修改问题

master
sunzehua 12 months ago
parent 5ed454b48d
commit 9fab9f4b6a

@ -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 {

@ -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) {

@ -5,16 +5,16 @@
<a-col :span="showSecNav ? 5 : 0" v-if="showSecNav">
<div class="sed-order-list">
<div class="sed-order-title">
<i class="iconfont icon-liebiao"></i><span class="tit">分提单列表</span
><span class="right" @click="openNav"></span>
<i class="iconfont icon-liebiao"></i><span class="tit">分提单列表</span><span
class="right"
@click="openNav">收起</span>
</div>
<div class="sec-order">
<div
class="sed-order-label"
v-for="(sedDetail, sindex) in sedOrderList"
:key="sindex"
:class="{ active: editIndex === sindex }"
>
:class="{ active: editIndex === sindex }">
<div class="left" @click.stop="changeOrder(sindex)">
<i class="iconfont icon-dingdan"></i>分单{{ sindex + 1 }}: {{ sedDetail.hblno || '请填写分单号' }}
</div>
@ -24,8 +24,7 @@
ok-text="是"
cancel-text="否"
@confirm.stop="removeSedOrderFun(sedDetail, sindex)"
@cancel="cancelRemove"
>
@cancel="cancelRemove">
<span class="remove-btn iconfont icon-shanchu1"></span>
</a-popconfirm>
</div>
@ -44,8 +43,8 @@
:class="scrollTop < 100 ? 'normal-nav' : 'fixed-nav'"
@save="saveFun"
@copy="copyFun"
@remove="removeFun"
></sedOperationArea>
@remove="removeFun">
</sedOperationArea>
<ul class="sec-parent-tabs-box">
<div class="parents-tabs-top">
<li @click="changeParentTabs('1')" :class="{ active: mainOrderActiveKey === '1' }">
@ -69,8 +68,7 @@
:ishd="true"
:inSave="inSave"
isParent="child"
@changeDetail="changeDetailFun"
></basicInfo>
@changeDetail="changeDetailFun"></basicInfo>
<!-- 收发通信息 -->
<mailingInfo
ref="mailingInfo"
@ -79,8 +77,7 @@
:inSave="inSave"
:ishd="true"
isParent="child"
@changeDetail="changeDetailFun"
></mailingInfo>
@changeDetail="changeDetailFun"></mailingInfo>
<!-- 货物信息 -->
<cargoInfo
ref="cargoInfo"
@ -89,8 +86,7 @@
:inSave="inSave"
isParent="child"
@pkgsEnCapital="pkgsEnCapitalFun"
@changeDetail="changeDetailFun"
></cargoInfo>
@changeDetail="changeDetailFun"></cargoInfo>
<!-- 箱型 -->
<goodsTable
ref="goodsTable"
@ -113,8 +109,7 @@
:inSave="inSave"
isParent="child"
@changeDetail="changeDetailFun"
v-if="!inPageLoading"
></ediMore>
v-if="!inPageLoading"></ediMore>
</div>
</div>
</ul>
@ -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])) {
// ArrayObject
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) {

@ -11,6 +11,11 @@
<a-input allow-clear v-model="SearchContent" />
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-form-item :label="`创建人`">
<a-input allow-clear v-model="createdUserName" />
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-form-item label="删除时间">
<a-range-picker
@ -268,6 +273,7 @@ export default {
formRes: {},
searchData: {},
formAllData: null,
createdUserName:'',
formMoreData: null,
formBtnCol: 8,
delDate: [],
@ -917,6 +923,7 @@ export default {
},
tableRefresh() {
this.formRes.MBLNO = this.SearchContent
this.formRes.createdUserName = this.createdUserName
const data = { ...this.formRes }
this.searchData = JSON.parse(JSON.stringify(data))
if (this.delDate) {
@ -964,6 +971,7 @@ export default {
tableReset() {
this.SearchContent = ''
this.createdUserName = ''
this.delDate = []
},

Loading…
Cancel
Save