detailsPage.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList(0)">返回列表
  7. </el-button>
  8. <el-button v-if="detailData.id" type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  9. @click="backToList(1)">返回审核列表
  10. </el-button>
  11. </div>
  12. <div class="add-customer-btn">
  13. <el-button class="el-button--small-yh" style="margin-right: 10px" type="primary" size="small" :disabled="form.status>0"
  14. @click="confirmEdit" v-if="optionForm.disabled === true">编辑
  15. </el-button>
  16. <el-dropdown style="margin-right: 10px">
  17. <el-button type="primary" size="small">
  18. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  19. </el-button>
  20. <el-dropdown-menu slot="dropdown">
  21. <el-dropdown-item @click.native="pleaseCheck" :disabled="form.status>0">请核数据</el-dropdown-item>
  22. <el-dropdown-item @click.native="checkScheduleDialog = true,checkId = form.id">审核进度</el-dropdown-item>
  23. <el-dropdown-item @click.native="repealCancel" :disabled="form.status === 0 || !form.status" v-if="!detailData.id">撤销请核</el-dropdown-item>
  24. <!-- <el-dropdown-item @click.native="changeApproveOpen">特殊审批</el-dropdown-item>-->
  25. </el-dropdown-menu>
  26. </el-dropdown>
  27. <el-button class="el-button--small-yh" type="primary" size="small" :disabled="form.status>0"
  28. @click="editCustomer">
  29. 保存数据
  30. </el-button>
  31. </div>
  32. </div>
  33. <trade-card title="基础资料" style="margin-top: 50px">
  34. <avue-form :option="optionForm" v-model="form" ref="form">
  35. <template slot="purchaseCompanyId" slot-scope="scope">
  36. <crop-select v-model="form.purchaseCompanyId" @getCorpData="(row)=>{getGSData(row,['form','purchaseCompanyName'])}" :disabled="scope.disabled"
  37. corpType="KH"/>
  38. </template>
  39. </avue-form>
  40. </trade-card>
  41. <trade-card title="箱信息">
  42. <avue-crud
  43. :option="option"
  44. :data="dataList"
  45. v-model="formTwo"
  46. ref="crud"
  47. :key="key"
  48. :before-open="beforeOpen"
  49. :upload-delete="uploadDelete"
  50. @row-save="rowSave"
  51. @row-update="rowUpdate"
  52. @resetColumn="resetColumnTwo('crud','option','optionBack',235.1)"
  53. @saveColumn="saveColumnTwo('crud','option','optionBack',235.1)">
  54. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  55. <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
  56. @click="$refs.crud.rowEdit(row,index)">编辑
  57. </el-button>
  58. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  59. @click="rowDel(row,index,'MX')">删除
  60. </el-button>
  61. </template>
  62. <template slot="addressForm" slot-scope="scope">
  63. <port-info v-model="formTwo.addressId" type="id" :disabled="scope.disabled" @balabalaTow="balabala"/>
  64. </template>
  65. <!-- <template slot="boxMakingCompanyForm" slot-scope="scope">-->
  66. <!-- <crop-select v-model="formTwo.boxMakingCompanyId" :disabled="scope.disabled" :refresh="false"-->
  67. <!-- @getCorpData="(row)=>{getGSData(row,['formTwo','boxMakingCompany'])}" corpType="GS"/>-->
  68. <!-- </template>-->
  69. <template slot="menuLeft" slot-scope="scope">
  70. <el-button :disabled="option.disabled" type="success" size="small" icon="el-icon-bottom" @click="importBox">
  71. 导入
  72. </el-button>
  73. <el-button class="el-icon-download" type="info" size="small" :disabled="!form.id" @click="openReport">报表打印</el-button>
  74. </template>
  75. </avue-crud>
  76. </trade-card>
  77. <!-- 报表-->
  78. <report-dialog
  79. :switchDialog="switchDialog"
  80. :reportId="form.id"
  81. reportName="买箱"
  82. @onClose="onClose()"
  83. />
  84. <!-- 费用信息组件-->
  85. <box-cost v-model="dataListTwo" activeName="second" ref="boxCost" @resetTrigger="resetTrigger"></box-cost>
  86. <trade-card title="附件明细">
  87. <c-upload
  88. basic
  89. :data="tradingBoxFilesList"
  90. :disabled="disabled"
  91. deleteUrl="/api/blade-box-tube/tradingBoxFiles/remove"
  92. :enumerationValue="235.3"
  93. display
  94. />
  95. </trade-card>
  96. <el-dialog title="导入箱档案" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
  97. v-dialog-drag>
  98. <avue-form v-if="excelBox" :option="excelOption" v-model="excelForm" table-loading="excelLoading"
  99. :upload-before="uploadBefore" :upload-after="uploadAfter">
  100. <template slot="excelTemplate">
  101. <el-button type="primary" @click="derivation">
  102. 点击下载<i class="el-icon-download el-icon--right"></i>
  103. </el-button>
  104. </template>
  105. </avue-form>
  106. <p style="text-align: center;color: #DC0505">
  107. 温馨提示 第一次导入时请先下载模板
  108. </p>
  109. </el-dialog>
  110. <el-dialog
  111. append-to-body
  112. title="审批进度"
  113. class="el-dialogDeep"
  114. :visible.sync="checkScheduleDialog"
  115. width="40%"
  116. :close-on-click-modal="false"
  117. :destroy-on-close="true"
  118. :close-on-press-escape="false"
  119. v-dialog-drag
  120. >
  121. <check-schedule
  122. :checkId="checkId"
  123. :batchNo="batchNo"
  124. @choceScheduleFun="choceScheduleFun"
  125. ></check-schedule>
  126. </el-dialog>
  127. </div>
  128. </template>
  129. <script>
  130. import {
  131. detail,
  132. submit,
  133. tradingBoxFiles,
  134. selectArchivesList,
  135. tradingBoxItem,
  136. tradingBoxFees,
  137. pleaseCheck,
  138. repealCancel
  139. } from "@/api/boxManagement/buyContainer";
  140. import reportDialog from "@/components/report-dialog/main";
  141. import checkSchedule from "@/components/check/checkSchedule";
  142. import {selectByName} from "@/api/boxManagement";
  143. import {getToken} from "@/util/auth";
  144. export default {
  145. name: "detailsPage",
  146. props: {
  147. onLoad: Object,
  148. detailData: Object
  149. },
  150. components:{checkSchedule,reportDialog},
  151. data() {
  152. return {
  153. key: 0,
  154. switchDialog: false,
  155. excelBox: false,
  156. excelOption: {
  157. submitBtn: false,
  158. emptyBtn: false,
  159. column: [
  160. {
  161. label: "模板下载",
  162. prop: "excelTemplate",
  163. formslot: true,
  164. span: 24
  165. },
  166. {
  167. label: "模板上传",
  168. prop: "excelFile",
  169. type: "upload",
  170. drag: true,
  171. loadText: "模板上传中,请稍等",
  172. span: 24,
  173. propsHttp: {
  174. res: "data"
  175. },
  176. tip: "请上传 .xls,.xlsx 标准格式文件",
  177. action: "/api/blade-box-tube/tradingBoxRent/import-tradingBox-info"
  178. }
  179. ]
  180. },
  181. excelForm: {},
  182. checkScheduleDialog: false,
  183. checkId: '',
  184. batchNo: '',
  185. breakConfiguration: {
  186. multipleChoices: false,
  187. multiple: false,
  188. disabled: false,
  189. searchShow: true,
  190. collapseTags: false,
  191. clearable: true,
  192. placeholder: "请点击右边按钮选择",
  193. dicData: []
  194. },
  195. form: {},
  196. formTwo: {},
  197. optionForm: {
  198. menuBtn: false,
  199. span: 6,
  200. column: [{
  201. label: '系统号',
  202. prop: 'sysNo',
  203. disabled: true
  204. }, {
  205. label: '合同号',
  206. prop: 'contractNo',
  207. rules: [{
  208. required: true,
  209. message: " ",
  210. trigger: "blur"
  211. }]
  212. }, {
  213. label: '买入公司',
  214. prop: 'purchaseCompanyId',
  215. rules: [{
  216. required: true,
  217. message: " ",
  218. trigger: "blur"
  219. }]
  220. }, {
  221. label: '买入日期',
  222. prop: 'purchaseDate',
  223. type: "date",
  224. format: "yyyy-MM-dd",
  225. valueFormat: "yyyy-MM-dd HH:mm:ss",
  226. rules: [{
  227. required: true,
  228. message: " ",
  229. trigger: "blur"
  230. }]
  231. }, {
  232. label: '备注',
  233. prop: 'remarks',
  234. type: 'textarea',
  235. minRows: 3,
  236. span: 24
  237. }]
  238. },
  239. option: {},
  240. optionBack: {
  241. align: 'center',
  242. index: true,
  243. addBtnText: "录入明细",
  244. refreshBtn: false,
  245. addBtn: true,
  246. span: 8,
  247. addRowBtn: false,
  248. cellBtn: false,
  249. editBtn: false,
  250. delBtn: false,
  251. menuWidth: 140,
  252. dialogTop: 25,
  253. dialogWidth: "80%",
  254. showSummary: true,
  255. sumColumnList: [{
  256. name: 'amount',
  257. type: 'sum',
  258. decimals: 2
  259. },{
  260. name: 'emptyWeight',
  261. type: 'sum',
  262. decimals: 2
  263. },{
  264. name: 'grossWeight',
  265. type: 'sum',
  266. decimals: 2
  267. },{
  268. name: 'tare',
  269. type: 'sum',
  270. decimals: 2
  271. },{
  272. name: 'loadingWeight',
  273. type: 'sum',
  274. decimals: 2
  275. },{
  276. name: 'volume',
  277. type: 'sum',
  278. decimals: 2
  279. }],
  280. column: [{
  281. label: '箱号',
  282. prop: 'code',
  283. width: 100,
  284. overHidden: true,
  285. // filterable: true,
  286. // remote: true,
  287. // allowCreate: true,
  288. // type: "select",
  289. // dicUrl: "/api/blade-box-tube/archives/selectArchivesList?size=10&current=1&code={{key}}",
  290. // props: {
  291. // label: "code",
  292. // value: "code"
  293. // },
  294. rules: [{
  295. required: true,
  296. message: " ",
  297. trigger: "blur"
  298. }]
  299. }, {
  300. label: '币别',
  301. prop: 'currency',
  302. width: 100,
  303. overHidden: true,
  304. filterable: true,
  305. type: "select",
  306. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  307. props: {
  308. label: "dictValue",
  309. value: "dictKey"
  310. },
  311. rules: [{
  312. required: true,
  313. message: " ",
  314. trigger: "blur"
  315. }]
  316. }, {
  317. label: '金额',
  318. prop: 'amount',
  319. type: 'number',
  320. controls: false,
  321. overHidden: true,
  322. width: 100,
  323. rules: [{
  324. required: true,
  325. message: " ",
  326. trigger: "blur"
  327. }]
  328. }, {
  329. label: '箱类型',
  330. prop: 'boxTypeId',
  331. width: 100,
  332. overHidden: true,
  333. filterable: true,
  334. type: 'select',
  335. props: {
  336. label: 'name',
  337. value: 'id'
  338. },
  339. dicUrl: '/api/blade-client/container/listMessage'
  340. }, {
  341. label: '最新地点',
  342. prop: 'address',
  343. overHidden: true,
  344. formProp: 'addressId',
  345. width: 100,
  346. rules: [{
  347. required: true,
  348. message: " ",
  349. trigger: "blur"
  350. }]
  351. }, {
  352. label: '最新日期',
  353. prop: 'newDate',
  354. overHidden: true,
  355. width: 100,
  356. type: "date",
  357. format: "yyyy-MM-dd",
  358. valueFormat: "yyyy-MM-dd HH:mm:ss",
  359. rules: [{
  360. required: true,
  361. message: " ",
  362. trigger: "blur"
  363. }]
  364. }, {
  365. label: '箱来源',
  366. prop: 'boxSource',
  367. width: 100,
  368. overHidden: true,
  369. filterable: true,
  370. type: 'select',
  371. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
  372. props: {
  373. label: "dictValue",
  374. value: "dictKey"
  375. },
  376. rules: [{
  377. required: true,
  378. message: " ",
  379. trigger: "blur"
  380. }]
  381. }, {
  382. label: '箱状态',
  383. prop: 'boxStatus',
  384. width: 100,
  385. overHidden: true,
  386. filterable: true,
  387. type: 'select',
  388. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  389. props: {
  390. label: "dictValue",
  391. value: "dictKey"
  392. },
  393. rules: [{
  394. required: true,
  395. message: " ",
  396. trigger: "blur"
  397. }]
  398. }, {
  399. label: '空重(kg)',
  400. prop: 'emptyWeight',
  401. type: 'number',
  402. overHidden: true,
  403. controls: false,
  404. width: 100,
  405. rules: [{
  406. required: true,
  407. message: " ",
  408. trigger: "blur"
  409. }]
  410. }, {
  411. label: '毛重(kg)',
  412. prop: 'grossWeight',
  413. type: 'number',
  414. overHidden: true,
  415. controls: false,
  416. width: 100,
  417. rules: [{
  418. required: true,
  419. message: " ",
  420. trigger: "blur"
  421. }]
  422. }, {
  423. label: '皮重(kg)',
  424. prop: 'tare',
  425. overHidden: true,
  426. type: 'number',
  427. controls: false,
  428. width: 100
  429. }, {
  430. label: '装载重量(kg)',
  431. prop: 'loadingWeight',
  432. type: 'number',
  433. overHidden: true,
  434. controls: false,
  435. width: 100
  436. }, {
  437. label: '容积(m³)',
  438. prop: 'volume',
  439. type: 'number',
  440. overHidden: true,
  441. controls: false,
  442. width: 100
  443. }, {
  444. label: '状态',
  445. prop: 'status',
  446. width: 100,
  447. overHidden: true,
  448. filterable: true,
  449. type: 'select',
  450. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
  451. props: {
  452. label: "dictValue",
  453. value: "dictKey"
  454. }
  455. }, {
  456. label: '造箱公司',
  457. prop: 'boxMakingCompany',
  458. overHidden: true,
  459. width: 100,
  460. rules: [{
  461. required: true,
  462. message: " ",
  463. trigger: "blur"
  464. }]
  465. }, {
  466. label: '造箱日期',
  467. prop: 'boxMakingDate',
  468. width: 100,
  469. overHidden: true,
  470. type: "date",
  471. format: "yyyy-MM-dd",
  472. valueFormat: "yyyy-MM-dd HH:mm:ss",
  473. rules: [{
  474. required: true,
  475. message: " ",
  476. trigger: "blur"
  477. }]
  478. }, {
  479. label: '箱来源日期',
  480. prop: 'leaseCommencementDate',
  481. width: 100,
  482. overHidden: true,
  483. type: "date",
  484. format: "yyyy-MM-dd",
  485. valueFormat: "yyyy-MM-dd HH:mm:ss",
  486. rules: [{
  487. required: true,
  488. message: " ",
  489. trigger: "blur"
  490. }]
  491. }, {
  492. label: '箱龄',
  493. prop: 'boxAge',
  494. type: 'number',
  495. controls: false,
  496. overHidden: true,
  497. width: 100,
  498. rules: [{
  499. required: true,
  500. message: " ",
  501. trigger: "blur"
  502. }]
  503. }, {
  504. label: '照片',
  505. prop: 'tradingBoxFilesList',
  506. width: 200,
  507. overHidden: true,
  508. type: 'upload',
  509. span: 24,
  510. listType: 'picture-card',
  511. tip: '只能上传jpg/png文件,且不超过500kb',
  512. propsHttp: {
  513. url: 'link',
  514. name: 'originalName',
  515. res: 'data'
  516. },
  517. action: '/api/blade-resource/oss/endpoint/put-file'
  518. }, {
  519. label: '备注',
  520. prop: 'remarks',
  521. overHidden: true,
  522. type: 'textarea',
  523. minRows: 3,
  524. span: 24,
  525. width: 200
  526. }]
  527. },
  528. dataList: [],
  529. dataListTwo:[],
  530. tradingBoxFilesList: [],
  531. disabled: false,
  532. costData:{}
  533. }
  534. },
  535. async created() {
  536. this.option = await this.getColumnData(this.getColumnName(235.1), this.optionBack);
  537. selectByName("买箱费").then(res => {
  538. this.costData = res.data.data
  539. })
  540. //下拉箱号带出对应信息
  541. // this.findObject(this.option.column, "code").change = ({value, column}) => {
  542. // selectArchivesList({code: value}).then(res => {
  543. // for (let item of res.data.data) {
  544. // if (value == item.code) {
  545. // this.formTwo = {
  546. // boxSource: item.boxSource,
  547. // boxStatus: item.boxStatus,
  548. // emptyWeight: item.emptyWeight,
  549. // grossWeight: item.gorssWeight,
  550. // tare: item.tare,
  551. // loadingWeight: item.loadingWeight,
  552. // volume: item.volume,
  553. // }
  554. // }
  555. // }
  556. // })
  557. // }
  558. this.key++
  559. if (this.onLoad.id && this.detailData.id) {
  560. this.refresh(this.onLoad.id,true)
  561. }else if (this.onLoad.id){
  562. this.refresh(this.onLoad.id,true)
  563. }
  564. },
  565. methods: {
  566. // 报表
  567. openReport() {
  568. this.switchDialog = !this.switchDialog;
  569. },
  570. // 报表关闭
  571. onClose(val) {
  572. this.switchDialog = val;
  573. },
  574. importBox() {
  575. this.findObject(this.excelOption.column, "excelFile").data = {
  576. corpId: this.form.purchaseCompanyId,
  577. corpName: this.form.purchaseCompanyName,
  578. billType: "BUY"
  579. }
  580. this.excelBox = true
  581. },
  582. uploadBefore(file, done, loading) {
  583. loading = true;
  584. done();
  585. },
  586. uploadAfter(res, done, loading, column) {
  587. this.excelBox = false;
  588. if (typeof res.message === "string") return
  589. for (let item of this.dataList) {
  590. for (let li of res.tradingBoxItemList) {
  591. if (item.code === li.code) {
  592. return this.$message.error(`箱号:${item.code}重复!`);
  593. }
  594. }
  595. }
  596. this.dataList = this.dataList.concat(res.tradingBoxItemList)
  597. this.dataListTwo = this.dataListTwo.concat(res.tradingBoxFeesList)
  598. this.$message.success("导入成功!");
  599. loading = false;
  600. done();
  601. },
  602. derivation() {
  603. window.open(`/api/blade-box-tube/tradingBoxRent/export-tradingBox-info?${this.website.tokenHeader}=${getToken()}`);
  604. },
  605. confirmEdit() {
  606. if (this.form.status > 0) {
  607. //基础资料
  608. this.$set(this.optionForm, "disabled", true)
  609. //箱信息
  610. this.$set(this.option, "disabled", true)
  611. this.$set(this.option, "addBtn", false)
  612. this.$set(this.option, "menu", false)
  613. //费用信息
  614. this.$set(this.$refs.boxCost.option, "disabled", true)
  615. this.$set(this.$refs.boxCost.option,"addBtn",false)
  616. this.$set(this.$refs.boxCost.option,"menu",false)
  617. //附件和顶部按钮
  618. this.disabled = true
  619. } else {
  620. //基础资料
  621. this.$set(this.optionForm, "disabled", false)
  622. //箱信息
  623. this.$set(this.option, "disabled", false)
  624. this.$set(this.option, "addBtn", true)
  625. this.$set(this.option, "menu", true)
  626. //费用信息
  627. this.$set(this.$refs.boxCost.option,"disabled",false)
  628. this.$set(this.$refs.boxCost.option,"addBtn",true)
  629. this.$set(this.$refs.boxCost.option,"menu",true)
  630. //附件和顶部按钮
  631. this.disabled = false
  632. }
  633. },
  634. // 明细删除
  635. rowDel(row, index, type) {
  636. this.$confirm("确定将选择数据删除?", {
  637. confirmButtonText: "确定",
  638. cancelButtonText: "取消",
  639. type: "warning"
  640. }).then(() => {
  641. if (row.id) {
  642. tradingBoxItem(row.id).then(res => {
  643. if (res.data.success) {
  644. this.$message.success("操作成功!");
  645. this.dataList.splice(index, 1);
  646. if (this.dataListTwo.length > 0) {
  647. for (let item in this.dataListTwo) {
  648. if (this.dataListTwo[item].code == row.code) {
  649. if (this.dataListTwo[item].autoGenerate == 1) {
  650. if (this.dataListTwo[item].id) {
  651. tradingBoxFees(this.dataListTwo[item].id).then(res => {
  652. if (res.data.success) {
  653. this.dataListTwo.splice(index, 1);
  654. }
  655. });
  656. } else {
  657. this.dataListTwo.splice(Number(item), 1);
  658. }
  659. }
  660. }
  661. }
  662. }
  663. }
  664. });
  665. } else {
  666. this.dataList.splice(index, 1);
  667. this.$message.success("操作成功!");
  668. if (this.dataListTwo.length > 0) {
  669. for (let item in this.dataListTwo) {
  670. if (this.dataListTwo[item].code == row.code) {
  671. if (this.dataListTwo[item].autoGenerate == 1) {
  672. this.dataListTwo.splice(Number(item), 1);
  673. }
  674. }
  675. }
  676. }
  677. }
  678. }
  679. )
  680. ;
  681. },
  682. balabala(val) {
  683. if (val === null) {
  684. this.formTwo.address = ''
  685. } else {
  686. this.formTwo.address = val.name
  687. }
  688. },
  689. //选择费用名称
  690. selectValue(value) {
  691. this.formThree.itemName = value.cname
  692. },
  693. //撤销
  694. repealCancel(){
  695. this.$confirm("您确定撤回此次申请吗?", {
  696. confirmButtonText: "确定",
  697. cancelButtonText: "取消",
  698. type: "warning"
  699. }).then(() => {
  700. const data = {
  701. id : this.form.id,
  702. pageLabel:"买箱",
  703. checkFlag: 1,
  704. }
  705. const loading = this.$loading({
  706. lock: true,
  707. text: '加载中',
  708. spinner: 'el-icon-loading',
  709. background: 'rgba(255,255,255,0.7)'
  710. });
  711. repealCancel(data).then(res => {
  712. loading.close();
  713. this.$message.success('撤回成功')
  714. this.refresh(this.form.id)
  715. }).catch(()=>{
  716. loading.close();
  717. })
  718. })
  719. },
  720. // 请核
  721. pleaseCheck() {
  722. this.$confirm("您确定提交请核申请吗?", {
  723. confirmButtonText: "确定",
  724. cancelButtonText: "取消",
  725. type: "warning"
  726. }).then(() => {
  727. this.$refs["form"].validate((valid,done) => {
  728. done()
  729. if (valid) {
  730. if (this.dataList.length === 0) {
  731. return this.$message.error("箱信息不能为空")
  732. }
  733. if (this.$refs.boxCost.dataList.length === 0) {
  734. return this.$message.error("费用信息不能为空")
  735. }else {
  736. for (let item of this.$refs.boxCost.dataList){
  737. if (!item.id){
  738. return this.$message.error("费用信息未保存")
  739. }
  740. }
  741. }
  742. let data = {
  743. ...this.form,
  744. tradingBoxItemsList: this.dataList,
  745. tradingBoxFeesList: this.dataListTwo,
  746. tradingBoxFilesList: this.tradingBoxFilesList,
  747. type: "BUY"
  748. }
  749. const loading = this.$loading({
  750. lock: true,
  751. text: '加载中',
  752. spinner: 'el-icon-loading',
  753. background: 'rgba(255,255,255,0.7)'
  754. });
  755. submit(data).then(res => {
  756. const data = {
  757. id: res.data.data.id,
  758. url: '/boxManagement/buyContainer/index',
  759. pageStatus: "this.$store.getters.domSaleStatus",
  760. pageLabel: "买箱",
  761. checkFlag: 1,
  762. }
  763. pleaseCheck({
  764. ...data,
  765. type: "BUY"
  766. }).then(rest => {
  767. loading.close();
  768. this.$message.success('请核成功')
  769. this.refresh(res.data.data.id)
  770. }).catch(()=>{
  771. loading.close();
  772. })
  773. }).catch(()=>{
  774. loading.close();
  775. })
  776. }
  777. });
  778. })
  779. },
  780. //审核关闭
  781. choceScheduleFun(){
  782. this.checkScheduleDialog = false
  783. },
  784. refresh(id,type) {
  785. const loading = this.$loading({
  786. lock: true,
  787. text: '加载中',
  788. spinner: 'el-icon-loading',
  789. background: 'rgba(255,255,255,0.7)'
  790. });
  791. detail({id: id}).then(res => {
  792. this.form = res.data.data
  793. this.dataList = res.data.data.tradingBoxItemsList
  794. this.dataListTwo = res.data.data.tradingBoxFeesList
  795. this.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  796. delete this.form.tradingBoxItemsList
  797. delete this.form.tradingBoxFeesList
  798. delete this.form.tradingBoxFilesList
  799. loading.close();
  800. if (type) {
  801. //基础资料
  802. this.$set(this.optionForm, "disabled", true)
  803. //箱信息
  804. this.$set(this.option, "disabled", true)
  805. this.$set(this.option, "addBtn", false)
  806. this.$set(this.option, "menu", false)
  807. //费用信息
  808. this.$set(this.$refs.boxCost.option, "disabled", true)
  809. this.$set(this.$refs.boxCost.option, "addBtn", false)
  810. this.$set(this.$refs.boxCost.option, "menu", false)
  811. //附件和顶部按钮
  812. this.disabled = true
  813. }else {
  814. if (this.form.status > 0) {
  815. //基础资料
  816. this.$set(this.optionForm, "disabled", true)
  817. //箱信息
  818. this.$set(this.option, "disabled", true)
  819. this.$set(this.option, "addBtn", false)
  820. this.$set(this.option, "menu", false)
  821. //费用信息
  822. this.$set(this.$refs.boxCost.option, "disabled", true)
  823. this.$set(this.$refs.boxCost.option, "addBtn", false)
  824. this.$set(this.$refs.boxCost.option,"menu",false)
  825. //附件和顶部按钮
  826. this.disabled = true
  827. } else {
  828. //基础资料
  829. this.$set(this.optionForm, "disabled", false)
  830. //箱信息
  831. this.$set(this.option, "disabled", false)
  832. this.$set(this.option, "addBtn", true)
  833. this.$set(this.option, "menu", true)
  834. //费用信息
  835. this.$set(this.$refs.boxCost.option, "disabled", false)
  836. this.$set(this.$refs.boxCost.option, "addBtn", true)
  837. this.$set(this.$refs.boxCost.option, "menu", true)
  838. //附件和顶部按钮
  839. this.disabled = false
  840. }
  841. }
  842. })
  843. },
  844. //新增修改
  845. editCustomer() {
  846. this.$refs["form"].validate((valid,done) => {
  847. done()
  848. if (valid) {
  849. let data = {
  850. ...this.form,
  851. tradingBoxItemsList: this.dataList,
  852. tradingBoxFeesList: this.dataListTwo,
  853. tradingBoxFilesList: this.tradingBoxFilesList,
  854. type: "BUY"
  855. }
  856. const loading = this.$loading({
  857. lock: true,
  858. text: '加载中',
  859. spinner: 'el-icon-loading',
  860. background: 'rgba(255,255,255,0.7)'
  861. });
  862. submit(data).then(res => {
  863. if (this.form.id) {
  864. this.$message.success("修改成功")
  865. } else {
  866. this.$message.success("新增成功")
  867. }
  868. loading.close();
  869. this.refresh(res.data.data.id)
  870. }).catch(()=>{
  871. loading.close();
  872. })
  873. }
  874. });
  875. },
  876. rowSave(form,done,loading) {
  877. let result = this.dataList.some((item) => {
  878. if (item.code == form.code) {
  879. return true
  880. }
  881. })
  882. if (result === true) {
  883. this.$message.error("已存在此箱号");
  884. return loading();
  885. }
  886. done(form)
  887. this.getWorkDicts("currency").then(res => {
  888. for (let item of res.data.data){
  889. if (item.dictValue == form.currency){
  890. form.exchangeRate = item.remark
  891. }
  892. }
  893. this.dataListTwo.push({
  894. corpId: this.form.purchaseCompanyId,
  895. corpName: this.form.purchaseCompanyName,
  896. code: form.code,
  897. itemId: this.costData.id,
  898. itemName: this.costData.cname,
  899. currency: form.currency,
  900. price: form.amount,
  901. quantity: 1,
  902. autoGenerate: 1,
  903. exchangeRate:form.exchangeRate || 1,
  904. feesType:2,
  905. amount: form.amount,
  906. })
  907. });
  908. },
  909. rowUpdate(form, index, done, loading) {
  910. form.boxType = form.$boxTypeId
  911. done(form)
  912. this.getWorkDicts("currency").then(res => {
  913. for (let item of res.data.data){
  914. if (item.dictValue == form.currency){
  915. form.exchangeRate = item.remark
  916. }
  917. }
  918. if (this.dataListTwo.length > 0) {
  919. for (let item in this.dataListTwo) {
  920. if (this.dataListTwo[item].code == form.code) {
  921. if (this.dataListTwo[item].autoGenerate == 1) {
  922. this.dataListTwo.splice(Number(item), 1, {
  923. ...this.dataListTwo[item],
  924. corpId: this.form.purchaseCompanyId,
  925. corpName: this.form.purchaseCompanyName,
  926. code: form.code,
  927. currency: form.currency,
  928. price: form.amount,
  929. exchangeRate:form.exchangeRate || 1,
  930. amount: form.amount
  931. })
  932. this.key++
  933. }
  934. }
  935. }
  936. }
  937. });
  938. },
  939. //打开表单前
  940. beforeOpen(done,type){
  941. if (type === "add"){
  942. this.formTwo.boxSource = this.$refs.crud.DIC.boxSource.length === 0?"":this.$refs.crud.DIC.boxSource[0].dictKey
  943. this.formTwo.status = this.$refs.crud.DIC.status.length === 0?"":this.$refs.crud.DIC.status[0].dictKey
  944. }
  945. done();
  946. },
  947. //删除图片
  948. uploadDelete(file, column) {
  949. return new Promise((resolve, reject) => {
  950. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  951. confirmButtonText: '确定',
  952. cancelButtonText: '取消',
  953. type: 'warning'
  954. }).then(() => {
  955. if (this.formTwo.tradingBoxFilesList[file.uid].id) {
  956. tradingBoxFiles(this.formTwo.tradingBoxFilesList[file.uid].id).then(res => {
  957. this.$message({
  958. type: 'success',
  959. message: '删除成功!'
  960. });
  961. resolve();
  962. })
  963. } else {
  964. resolve();
  965. }
  966. }).catch(()=>{
  967. reject();
  968. this.$message({
  969. type: "info",
  970. message: "已取消删除"
  971. });
  972. })
  973. })
  974. },
  975. getGSData(row,type) {
  976. this[type[0]][type[1]] = row.cname
  977. },
  978. backToList(type) {
  979. if (type == 0){
  980. if (this.detailData.id){
  981. this.$router.push({
  982. path: '/boxManagement/buyContainer/index'
  983. });
  984. }
  985. this.$emit("backToList",type);
  986. }else if (type == 1){
  987. this.$router.push({
  988. path: '/approveData/index'
  989. });
  990. this.$emit("backToList",type);
  991. }
  992. },
  993. //自定义列保存
  994. async saveColumnTwo(ref, option, optionBack, code) {
  995. /**
  996. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  997. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  998. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  999. */
  1000. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1001. if (inSave) {
  1002. this.$message.success("保存成功");
  1003. //关闭窗口
  1004. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1005. }
  1006. },
  1007. resetTrigger(){
  1008. if (this.optionForm.disabled == true) {
  1009. if (this.form.status > 0) {
  1010. //基础资料
  1011. this.$set(this.optionForm, "disabled", true)
  1012. //箱信息
  1013. this.$set(this.option, "disabled", true)
  1014. this.$set(this.option, "addBtn", false)
  1015. this.$set(this.option, "menu", false)
  1016. //费用信息
  1017. this.$set(this.$refs.boxCost.option, "disabled", true)
  1018. this.$set(this.$refs.boxCost.option, "addBtn", false)
  1019. this.$set(this.$refs.boxCost.option,"menu",false)
  1020. //附件和顶部按钮
  1021. this.disabled = true
  1022. } else {
  1023. //基础资料
  1024. this.$set(this.optionForm, "disabled", false)
  1025. //箱信息
  1026. this.$set(this.option, "disabled", false)
  1027. this.$set(this.option, "addBtn", true)
  1028. this.$set(this.option, "menu", true)
  1029. //费用信息
  1030. this.$set(this.$refs.boxCost.option, "disabled", false)
  1031. this.$set(this.$refs.boxCost.option, "addBtn", true)
  1032. this.$set(this.$refs.boxCost.option, "menu", true)
  1033. //附件和顶部按钮
  1034. this.disabled = false
  1035. }
  1036. }else {
  1037. //基础资料
  1038. this.$set(this.optionForm, "disabled", false)
  1039. //箱信息
  1040. this.$set(this.option, "disabled", false)
  1041. this.$set(this.option, "addBtn", true)
  1042. this.$set(this.option, "menu", true)
  1043. //费用信息
  1044. this.$set(this.$refs.boxCost.option, "disabled", false)
  1045. this.$set(this.$refs.boxCost.option, "addBtn", true)
  1046. this.$set(this.$refs.boxCost.option, "menu", true)
  1047. //附件和顶部按钮
  1048. this.disabled = false
  1049. }
  1050. },
  1051. //自定义列重置
  1052. async resetColumnTwo(ref, option, optionBack, code) {
  1053. this[option] = this[optionBack];
  1054. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1055. if (inSave) {
  1056. this.resetTrigger()
  1057. this.$message.success("重置成功");
  1058. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1059. }
  1060. }
  1061. }
  1062. }
  1063. </script>
  1064. <style scoped>
  1065. ::v-deep .el-form-item {
  1066. margin-bottom: 8px;
  1067. }
  1068. </style>