diff --git a/src/views/main/BookingLedger/detail/components/selectView.vue b/src/views/main/BookingLedger/detail/components/selectView.vue index d6c5d2a..d9c73b4 100644 --- a/src/views/main/BookingLedger/detail/components/selectView.vue +++ b/src/views/main/BookingLedger/detail/components/selectView.vue @@ -481,7 +481,7 @@ export default { this.setLineList() return false } - if (this.searchApi === 'DjyCustomerSuggest') { + if (this.type === 'forwarder') { this.selectList = [] } if (!e) { @@ -541,7 +541,7 @@ export default { this.inLoading = true this.getFromSelectData(this.emnuSelectApi(this.searchApi), this.searchQuery).then(data => { if (data.rows) { - if (this.searchApi === 'DjyCustomerSuggest') { + if (this.type === 'forwarder') { if (this.agentFilter.length === 0) { this.selectList = data.rows } else { @@ -588,7 +588,7 @@ export default { this.inLoading = true this.getFromSelectData(this.emnuSelectApi(this.searchApi), this.searchQuery).then(data => { if (data.rows) { - if (this.searchApi === 'DjyCustomerSuggest') { + if (this.type === 'forwarder') { if (this.agentFilter.length === 0) { this.selectList = data.rows } else { diff --git a/src/views/main/BookingLedger/detail/index.vue b/src/views/main/BookingLedger/detail/index.vue index fbbefa8..f6bfcab 100644 --- a/src/views/main/BookingLedger/detail/index.vue +++ b/src/views/main/BookingLedger/detail/index.vue @@ -854,7 +854,6 @@ export default { }, handleComplete() { this.checkSaveFun({ type: 'details', hasChange: false }) - console.log(111) }, getDefaultVal() { getDjyTenantConfig({ @@ -1047,7 +1046,6 @@ export default { this.hasTableRules = true } }) - console.log(this.tableRules, this.checkFrom) this.$forceUpdate() }) .catch(err => { @@ -1056,11 +1054,11 @@ export default { }, getFilter() { ListAgentByCarrier({ carrierCode: this.bookingDetails.carrierid }).then(res => { - this.$store.commit('SET_AgentFilter', res.data) - }) + this.$store.commit('SET_AgentFilter', res.data) + }) listYardBwCarrier({ carrierCode: this.bookingDetails.carrierid }).then(res => { - this.$store.commit('SET_YardFilter', res.data) - }) + this.$store.commit('SET_YardFilter', res.data) + }) }, enmuCarrier(type) { switch (type) { @@ -1115,7 +1113,6 @@ export default { this.$store.commit('SET_SAVETOPDOWN', false) }) .catch(err => { - console.log(err) this.$store.commit('SET_SAVETOPDOWN', false) }) }, @@ -1196,6 +1193,7 @@ export default { } const $BookingEDIExt = { ...JSON.parse(JSON.stringify(bookingEDIExt)), ...res.data.bookingEDIExt } this.$set(this, 'bookingDetails', { ...this.bookingDetails, ...newData, ...{ bookingEDIExt: $BookingEDIExt } }) + this.oldBookingDetails = JSON.parse(JSON.stringify(this.bookingDetails)) if (this.$route.query.isCopy && this.$route.query.copyId) { const hisData = { bookingDetails: this.bookingDetails, @@ -1220,7 +1218,6 @@ export default { setTimeout(() => { setTimeout(() => { this.checkSaveFun({ type: 'details', hasChange: false }) - this.oldBookingDetails = JSON.parse(JSON.stringify(this.bookingDetails)) }, 600) this.detailsLoadOver = true this.inChildLoading = false @@ -1414,24 +1411,27 @@ export default { delete _data.goodsStatus } const changedFields = this.diffObj(this.oldBookingDetails, _data) - if (changedFields.new_val.bookingEDIExt) { - delete changedFields.new_val.bookingEDIExt - } - if (changedFields.new_val.ctnInputs) { - delete changedFields.new_val.ctnInputs - } - if (changedFields.new_val.extendState) { - delete changedFields.new_val.extendState - } - if (changedFields.new_val.item) { - delete changedFields.new_val.item - } - if (changedFields.new_val.hbList) { - delete changedFields.new_val.hbList + if (changedFields) { + if (changedFields.new_val.bookingEDIExt) { + delete changedFields.new_val.bookingEDIExt + } + if (changedFields.new_val.ctnInputs) { + delete changedFields.new_val.ctnInputs + } + if (changedFields.new_val.extendState) { + delete changedFields.new_val.extendState + } + if (changedFields.new_val.item) { + delete changedFields.new_val.item + } + if (changedFields.new_val.hbList) { + delete changedFields.new_val.hbList + } } if (changedFields) { _data.changedFields = Object.keys(changedFields.new_val) } + console.log(changedFields, this.oldBookingDetails, 'changedFields') BookingOrderSave(_data) .then(res => { if (res.success) { diff --git a/src/views/main/BookingLedger/detail/modules/sedOrder.vue b/src/views/main/BookingLedger/detail/modules/sedOrder.vue index 2fe5d17..15819a5 100644 --- a/src/views/main/BookingLedger/detail/modules/sedOrder.vue +++ b/src/views/main/BookingLedger/detail/modules/sedOrder.vue @@ -5,16 +5,16 @@
- 分提单列表收起 + 分提单列表收起
+ :class="{ active: editIndex === sindex }">
分单{{ sindex + 1 }}: {{ sedDetail.hblno || '请填写分单号' }}
@@ -24,8 +24,7 @@ ok-text="是" cancel-text="否" @confirm.stop="removeSedOrderFun(sedDetail, sindex)" - @cancel="cancelRemove" - > + @cancel="cancelRemove">
@@ -44,8 +43,8 @@ :class="scrollTop < 100 ? 'normal-nav' : 'fixed-nav'" @save="saveFun" @copy="copyFun" - @remove="removeFun" - > + @remove="removeFun"> +
  • @@ -69,8 +68,7 @@ :ishd="true" :inSave="inSave" isParent="child" - @changeDetail="changeDetailFun" - > + @changeDetail="changeDetailFun"> + @changeDetail="changeDetailFun"> + @changeDetail="changeDetailFun"> + v-if="!inPageLoading">
@@ -379,6 +374,7 @@ export default { editDetails: null, editIndex: 0, showSecNav: true, + oldBookingDetails: {}, inSecLoad: false, mainOrderActiveKey: '1', basicRules: rules.basicRules, @@ -396,11 +392,11 @@ export default { }, watch: { parSedOrderList: { - handler(nval, oval) {}, + handler(nval, oval) { }, deep: true }, editDetails: { - handler(nval, oval) {}, + handler(nval, oval) { }, deep: true }, '$route.query': { @@ -424,7 +420,7 @@ export default { this.checkFromInit() } }, - created() {}, + created() { }, mounted() { this.checkFromInit() }, @@ -446,6 +442,7 @@ export default { $data.bookingEDIExt = bookingEDIExt } this.editDetails = $data + this.oldBookingDetails = JSON.parse(JSON.stringify($data)) setTimeout(() => { this.$refs.goodsTable.init() }, 1000) @@ -454,6 +451,7 @@ export default { }, 2000) } else { this.editDetails = JSON.parse(JSON.stringify(sedDetail)) + this.oldBookingDetails = JSON.parse(JSON.stringify(sedDetail)) setTimeout(() => { this.inSecLoad = false }, 2000) @@ -465,6 +463,52 @@ export default { pkgsEnCapitalFun(data) { this.bookingDetails.totalno = data }, + diffObj(obj1, obj2) { + function getTypeByObj(obj) { + return Object.prototype.toString.call(obj).match(/^\[object ([a-zA-Z]*)\]$/)[1]; + } + function isEmptyObject(obj) { + for (const key in obj) { + return false; + }; + return true; + } + if (!obj1 || isEmptyObject(obj1) || !obj2 || isEmptyObject(obj2)) { + return null; + } + const diffRes = { + old_val: {}, + new_val: {} + }; + for (const k in obj2) { + // 判断数据类型是否一致 + if (getTypeByObj(obj2[k]) === getTypeByObj(obj1[k])) { + // 比较 “Array”和“Object”类型 + if (getTypeByObj(obj2[k]) === 'Array' || getTypeByObj(obj2[k]) === 'Object') { + const diffData = this.diffObj(obj1[k], obj2[k]); + if (!isEmptyObject(diffData)) { + diffRes.old_val[k] = diffData.old_val; + diffRes.new_val[k] = diffData.new_val; + } + } else if (obj1[k] !== obj2[k]) { // 比较其他类型数据 + diffRes.old_val[k] = obj1[k]; + diffRes.new_val[k] = obj2[k]; + } + } else { + if ([undefined, null, ''].includes(obj1[k]) && [undefined, null, ''].includes(obj2[k])) { + // 这三类数据可视为相等,不做处理 + } else { + diffRes.old_val[k] = obj1[k]; + diffRes.new_val[k] = obj2[k]; + } + } + } + // 若没有变化,返回null + if (isEmptyObject(diffRes.old_val) || isEmptyObject(diffRes.new_val)) { + return null; + } + return diffRes; + }, checkFromInit() { Object.keys(this.basicRules).map((item, index) => { @@ -696,6 +740,22 @@ export default { item.id = 0 }) } + const changedFields = this.diffObj(this.oldBookingDetails, data) + if (changedFields) { + if (changedFields.new_val.bookingEDIExt) { + delete changedFields.new_val.bookingEDIExt + } + if (changedFields.new_val.ctnInputs) { + delete changedFields.new_val.ctnInputs + } + if (changedFields.new_val.extendState) { + delete changedFields.new_val.extendState + } + } + if (changedFields) { + data.changedFields = Object.keys(changedFields.new_val) + } + console.log(changedFields, this.oldBookingDetails, 'changedFields') BookingOrderSave(data) .then(res => { if (res.success) { diff --git a/src/views/main/ViewDeletedList/ViewDeletedList.vue b/src/views/main/ViewDeletedList/ViewDeletedList.vue index 9714671..3e12ff0 100644 --- a/src/views/main/ViewDeletedList/ViewDeletedList.vue +++ b/src/views/main/ViewDeletedList/ViewDeletedList.vue @@ -11,6 +11,11 @@ + + + + +