detailsPage.vue 28 KB

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