detailsPage.vue 35 KB

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