diff --git a/src/views/main/BookingLedger/detail/components/selectView.vue b/src/views/main/BookingLedger/detail/components/selectView.vue index c85f7c1..4539c93 100644 --- a/src/views/main/BookingLedger/detail/components/selectView.vue +++ b/src/views/main/BookingLedger/detail/components/selectView.vue @@ -127,7 +127,7 @@ export default { }, isCopy: { type: Boolean, - default: false + default: true } }, data() { diff --git a/src/views/main/BookingLedger/detail/index.vue b/src/views/main/BookingLedger/detail/index.vue index b17b0b5..ef2b5de 100644 --- a/src/views/main/BookingLedger/detail/index.vue +++ b/src/views/main/BookingLedger/detail/index.vue @@ -582,7 +582,7 @@ export default { } }, 200) setTimeout(() => { - const key = this.$route.fullPath + const key = this.$route.fullPath const detailsChange = Object.keys(this.needSavePages).includes(key) ? !!this.needSavePages[key].details : false this.checkSaveFun({ type: 'details', hasChange: detailsChange }) @@ -637,14 +637,32 @@ export default { } else if (Object.keys(this.historyData).includes(newId)) { this.id = !this.$route.query.isCopy ? this.$route.query.id : 0 const $data = JSON.parse(JSON.stringify(this.historyData[newId])) - this.bookingDetails = $data.bookingDetails + console.log('== 复制内容 ==', $data.bookingDetails.hbList) + this.isCopy = this.$route.query.isCopy this.excuteRules = $data.excuteRules this.excuteRulesType = $data.excuteRulesType this.isAdd = $data.isAdd this.tabActiveKey = $data.tabActiveKey this.mainOrderActiveKey = $data.mainOrderActiveKey - this.isCopy = this.$route.query.isCopy this.inPageLoading = false + if (this.isCopy && !$data.isCopy) { + const copyData = { + customername: $data.bookingDetails.customername, + portloadid: $data.bookingDetails.portloadid, + portload: $data.bookingDetails.portload, + issueplace: $data.bookingDetails.issueplace, + prepardat: $data.bookingDetails.prepardat, + route: $data.bookingDetails.route, + shippingMethod: $data.bookingDetails.shippingMethod, + shipper: $data.bookingDetails.shipper, + consignee: $data.bookingDetails.consignee, + notifyparty: $data.bookingDetails.notifyparty + } + this.bookingDetails = { ...JSON.parse(JSON.stringify(initDetail)), ...copyData } + } else { + this.bookingDetails = $data.bookingDetails + } + console.log('== 复制内容 ==', this.bookingDetails.hbList) setTimeout(() => { if (this.bookingDetails.hbList && this.bookingDetails.hbList.length > 0) { this.Showtabs = true @@ -661,10 +679,10 @@ export default { this.$refs.goodsTable.init() } }, 200) - if (this.isCopy && !$data.isCopy) { - this.bookingDetails.mblno = '' - this.bookingDetails.id = 0 - } + // if (this.isCopy && !$data.isCopy) { + // this.bookingDetails.mblno = '' + // this.bookingDetails.id = 0 + // } setTimeout(() => { const key = this.$route.fullPath @@ -907,14 +925,6 @@ export default { }, setDeatilsFun(res, overSet = false) { - if (this.$route.query.isCopy && !overSet) { - res.data.mblno = '' - delete res.data.id - this.isAdd = true - res.data.ctnInputs.map((item, index) => { - delete item.id - }) - } if (!res.data.bookingEDIExt) { res.data.bookingEDIExt = bookingEDIExt } @@ -951,8 +961,30 @@ export default { }) } res.data.feeself = !!res.data.feeself + let newData = res.data + if (this.$route.query.isCopy && !overSet) { + delete res.data.id + // res.data.mblno = '' + // this.isAdd = true + // res.data.ctnInputs.map((item, index) => { + // delete item.id + // }) + const copyData = { + customername: res.data.customername, + portloadid: res.data.portloadid, + portload: res.data.portload, + issueplace: res.data.issueplace, + prepardat: res.data.prepardat, + route: res.data.route, + shippingMethod: res.data.shippingMethod, + shipper: res.data.shipper, + consignee: res.data.consignee, + notifyparty: res.data.notifyparty + } + newData = { ...JSON.parse(JSON.stringify(initDetail)), ...copyData } + } const $BookingEDIExt = { ...JSON.parse(JSON.stringify(bookingEDIExt)), ...res.data.bookingEDIExt } - this.$set(this, 'bookingDetails', { ...this.bookingDetails, ...res.data, ...{ bookingEDIExt: $BookingEDIExt } }) + this.$set(this, 'bookingDetails', { ...this.bookingDetails, ...newData, ...{ bookingEDIExt: $BookingEDIExt } }) this.inPageLoading = false this.getDefaultVal() setTimeout(() => { diff --git a/src/views/main/BookingLedger/list/modules/formLabel.vue b/src/views/main/BookingLedger/list/modules/formLabel.vue index b60e7b7..2b0cfd3 100644 --- a/src/views/main/BookingLedger/list/modules/formLabel.vue +++ b/src/views/main/BookingLedger/list/modules/formLabel.vue @@ -163,7 +163,7 @@ export default { } }, computed: { - ...mapGetters(['carrierList', 'yardList', 'packageList', 'issuetypeList', 'blfrtList', 'lineList', 'bookingInitData']) + ...mapGetters(['carrierList', 'ctnallList', 'yardList', 'packageList', 'issuetypeList', 'blfrtList', 'lineList', 'bookingInitData']) }, mounted() { }, methods: { @@ -252,8 +252,8 @@ export default { }, getSelectFirst (e) { if (!e) { - if (['LINENAME'].includes(this.labelData.label)) { - this.dataList = this.lineList + if (['LINENAME', 'CNTRTOTAL', 'KINDPKGS', 'ISSUETYPE', 'YARDID', 'CARRIER', 'NOBILL', 'CARGOID'].includes(this.labelData.label)) { + this.dataList = this.emnuData(this.labelData.label) } else { this.$emit('selectFirst', { form: this.labelData, @@ -263,6 +263,26 @@ export default { } } }, + emnuData (type) { + switch (type) { + case 'LINENAME': + return this.lineList + case 'CNTRTOTAL': + return this.ctnallList + case 'KINDPKGS': + return this.packageList + case 'ISSUETYPE': + return this.issuetypeList + case 'YARDID': + return this.yardList + case 'CARRIER': + return this.carrierList + case 'NOBILL': + return this.labelData.data + case 'CARGOID': + return this.labelData.data + } + }, completeSelect (value) { const val = value.split('-')[1] this.$emit('change', {