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..bafab1a 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,29 @@ 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 + } + 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 +676,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 +922,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 +958,27 @@ 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 + } + 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(() => {