|
|
|
@ -244,11 +244,12 @@ export default {
|
|
|
|
|
moreStr: '',
|
|
|
|
|
tabActiveKey: '1',
|
|
|
|
|
historyData: {},
|
|
|
|
|
Showtabs: false
|
|
|
|
|
Showtabs: false,
|
|
|
|
|
inChildLoading: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters(['bookingList', 'needSavePages']),
|
|
|
|
|
...mapGetters(['bookingList', 'needSavePages'])
|
|
|
|
|
// Showtabs() {
|
|
|
|
|
// let Rdata = true
|
|
|
|
|
// if (this.bookingDetails.hbList && this.bookingDetails.hbList.length) {
|
|
|
|
@ -262,7 +263,7 @@ export default {
|
|
|
|
|
watch: {
|
|
|
|
|
bookingDetails: {
|
|
|
|
|
handler(nval, oval) {
|
|
|
|
|
this.checkSaveFun({ type: 'details', hasChange: true })
|
|
|
|
|
// this.checkSaveFun({ type: 'details', hasChange: true })
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
|
|
|
|
}
|
|
|
|
@ -272,7 +273,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
beforeRouteUpdate(to, from, next) {
|
|
|
|
|
// console.log('fromId:', from.query.id, '| toId:', to.query.id)
|
|
|
|
|
// console.log('2.2 === beforeRouteUpdate ===', this.$route.query.id, this.isCopy)
|
|
|
|
|
console.log('Router 2.2 === beforeRouteUpdate ===', this.$route.query.id, this.isCopy)
|
|
|
|
|
// if (!Object.keys(this.historyData).includes(this.$route.query.id)) {
|
|
|
|
|
// const hisData = {
|
|
|
|
|
// bookingDetails: this.bookingDetails,
|
|
|
|
@ -286,6 +287,7 @@ export default {
|
|
|
|
|
// }
|
|
|
|
|
// this.$set(this.historyData, this.$route.query.id, hisData)
|
|
|
|
|
// }
|
|
|
|
|
// this.inChildLoading = true
|
|
|
|
|
if (this.isCopy) {
|
|
|
|
|
const hisData = {
|
|
|
|
|
bookingDetails: this.bookingDetails,
|
|
|
|
@ -312,10 +314,11 @@ export default {
|
|
|
|
|
this.$set(this.historyData, this.id, hisData)
|
|
|
|
|
}
|
|
|
|
|
next()
|
|
|
|
|
// this.inChildLoading = false
|
|
|
|
|
this.getRouterHis()
|
|
|
|
|
},
|
|
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
|
|
// console.log('2.1 === beforeRouteLeave ===', this.id, this.isCopy)
|
|
|
|
|
console.log('Router 2.1 === beforeRouteLeave ===', this.id, this.isCopy)
|
|
|
|
|
// if (!Object.keys(this.historyData).includes(this.id)) {
|
|
|
|
|
// const hisData = {
|
|
|
|
|
// bookingDetails: this.bookingDetails,
|
|
|
|
@ -329,6 +332,7 @@ export default {
|
|
|
|
|
// }
|
|
|
|
|
// this.$set(this.historyData, this.id, hisData)
|
|
|
|
|
// }
|
|
|
|
|
this.inChildLoading = true
|
|
|
|
|
if (this.isCopy) {
|
|
|
|
|
const hisData = {
|
|
|
|
|
bookingDetails: this.bookingDetails,
|
|
|
|
@ -355,6 +359,9 @@ export default {
|
|
|
|
|
this.$set(this.historyData, this.id, hisData)
|
|
|
|
|
}
|
|
|
|
|
next()
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.inChildLoading = false
|
|
|
|
|
}, 2000);
|
|
|
|
|
},
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
|
next(vm => {
|
|
|
|
@ -364,7 +371,8 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
...mapActions(['setNeedSavePages']),
|
|
|
|
|
getRouterHis() {
|
|
|
|
|
// console.log('2.3 === beforeRouteEnter - getRouterHis ===', Object.keys(this.historyData), this.$route.query.id)
|
|
|
|
|
console.log('Router 2.3 === beforeRouteEnter - getRouterHis ===', Object.keys(this.historyData), this.$route.query.id)
|
|
|
|
|
this.inChildLoading = true
|
|
|
|
|
const newId = this.$route.query.id
|
|
|
|
|
if (Object.keys(this.historyData).includes(`copy-${newId}`) && this.$route.query.isCopy === 'true') {
|
|
|
|
|
this.id = this.$route.query.id
|
|
|
|
@ -376,6 +384,12 @@ export default {
|
|
|
|
|
this.tabActiveKey = $data.tabActiveKey
|
|
|
|
|
this.isCopy = this.$route.query.isCopy
|
|
|
|
|
this.inPageLoading = false
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.inChildLoading = false
|
|
|
|
|
if (!Object.keys(this.needSavePages).includes(this.$route.fullPath)) {
|
|
|
|
|
this.checkSaveFun({ type: 'details', hasChange: false })
|
|
|
|
|
}
|
|
|
|
|
}, 1500)
|
|
|
|
|
// console.log('== 复制参数 ==', $data.isCopy, this.$route.query.isCopy, this.isCopy)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else if (Object.keys(this.historyData).includes(newId)) {
|
|
|
|
@ -393,6 +407,12 @@ export default {
|
|
|
|
|
// console.log('== 新增复制, 这里置空了提单号 ==')
|
|
|
|
|
this.bookingDetails.mblno = ''
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.inChildLoading = false
|
|
|
|
|
if (!Object.keys(this.needSavePages).includes(this.$route.fullPath)) {
|
|
|
|
|
this.checkSaveFun({ type: 'details', hasChange: false })
|
|
|
|
|
}
|
|
|
|
|
}, 1500)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.id = this.$route.query.id
|
|
|
|
@ -448,6 +468,7 @@ export default {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
this.inPageLoading = true
|
|
|
|
|
this.inChildLoading = true
|
|
|
|
|
this.$message.loading({ content: '加载中...' });
|
|
|
|
|
// console.log('4.1 == 获取详情 ==', this.id)
|
|
|
|
|
BookingOrderGet({
|
|
|
|
@ -475,8 +496,10 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
this.$set(this, 'bookingDetails', res.data)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// console.log(' 1. === 主单获取信息更新 ===')
|
|
|
|
|
this.inChildLoading = false
|
|
|
|
|
this.checkSaveFun({ type: 'details', hasChange: false })
|
|
|
|
|
}, 600)
|
|
|
|
|
}, 1500)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
@ -486,9 +509,27 @@ export default {
|
|
|
|
|
|
|
|
|
|
changeDetailFun(data) {
|
|
|
|
|
const { detail, type } = data
|
|
|
|
|
// console.log('对比更新内容', this.ifCompare(this.bookingDetails, detail), !this.inChildLoading, this.ifCompare(this.bookingDetails, detail) && !this.inChildLoading)
|
|
|
|
|
if (this.ifCompare(this.bookingDetails, detail) && !this.inChildLoading) {
|
|
|
|
|
// console.log('2. == 这里子组件进行了更新 == ', type)
|
|
|
|
|
this.checkSaveFun({ type: 'details', hasChange: true })
|
|
|
|
|
}
|
|
|
|
|
this.bookingDetails = detail
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
ifCompare(object1, object2) {
|
|
|
|
|
var o1keys = Object.keys(object1);
|
|
|
|
|
var o2keys = Object.keys(object2);
|
|
|
|
|
if (o2keys.length !== o1keys.length) return false;
|
|
|
|
|
for (let i = 0; i <= o1keys.length - 1; i++) {
|
|
|
|
|
let key = o1keys[i];
|
|
|
|
|
if (!o2keys.includes(key)) return false;
|
|
|
|
|
if (object2[key] !== object1[key]) return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bookingOrderUpdate() {
|
|
|
|
|
if (!this.bookingDetails.mblno) {
|
|
|
|
|
this.$message.error('请输入提单号')
|
|
|
|
@ -578,11 +619,12 @@ export default {
|
|
|
|
|
const _this = this
|
|
|
|
|
const key = this.$route.fullPath
|
|
|
|
|
if (this.needSavePages[key].details || this.needSavePages[key].hbList) {
|
|
|
|
|
// console.log('== 切换上一票下一票 - biu 弹窗出现 ==')
|
|
|
|
|
this.$confirm({
|
|
|
|
|
title: '请确认无未保存数据!',
|
|
|
|
|
content: '当点击确定按钮时,此页面 将会关闭。',
|
|
|
|
|
onOk() {
|
|
|
|
|
_this.changePage()
|
|
|
|
|
_this.changePage(type)
|
|
|
|
|
const $data = _this.needSavePages
|
|
|
|
|
delete $data[key]
|
|
|
|
|
_this.setNeedSavePages($data)
|
|
|
|
@ -590,7 +632,7 @@ export default {
|
|
|
|
|
onCancel() {}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.changePage()
|
|
|
|
|
this.changePage(type)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
changePage (type) {
|
|
|
|
@ -604,6 +646,10 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
const prevId = arr[index - 1]
|
|
|
|
|
const prevType = this.bookingList[prevId].carrierid
|
|
|
|
|
|
|
|
|
|
const $data = this.needSavePages
|
|
|
|
|
delete $data[this.$route.fullPath]
|
|
|
|
|
this.setNeedSavePages($data)
|
|
|
|
|
this.$router.replace({
|
|
|
|
|
name: 'BookingDetail',
|
|
|
|
|
query: { id: prevId, type: prevType, mblno: this.bookingList[prevId].mblno, noOpenTab: true }
|
|
|
|
@ -616,6 +662,9 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
const nextId = arr[index + 1]
|
|
|
|
|
const nextType = this.bookingList[nextId].carrierid
|
|
|
|
|
const $data = this.needSavePages
|
|
|
|
|
delete $data[this.$route.fullPath]
|
|
|
|
|
this.setNeedSavePages($data)
|
|
|
|
|
this.$router.replace({
|
|
|
|
|
name: 'BookingDetail',
|
|
|
|
|
query: { id: nextId, type: nextType, mblno: this.bookingList[nextId].mblno, noOpenTab: true }
|
|
|
|
@ -651,6 +700,7 @@ export default {
|
|
|
|
|
const arr = data.map((item, index) => {
|
|
|
|
|
return item.isNoSave
|
|
|
|
|
})
|
|
|
|
|
// console.log('3. === 分单更新 ===')
|
|
|
|
|
if (arr.includes(true)) {
|
|
|
|
|
this.checkSaveFun({ type: 'hbList', hasChange: true })
|
|
|
|
|
} else {
|
|
|
|
@ -658,6 +708,9 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
checkSaveFun (data) {
|
|
|
|
|
// if (this.inPageLoading) {
|
|
|
|
|
// return false
|
|
|
|
|
// }
|
|
|
|
|
const lastPages = this.needSavePages
|
|
|
|
|
const $data = this.needSavePages[this.id] || {}
|
|
|
|
|
if (data.type === 'details') {
|
|
|
|
@ -669,6 +722,7 @@ export default {
|
|
|
|
|
const key = this.$route.fullPath
|
|
|
|
|
this.$set(lastPages, key, $data)
|
|
|
|
|
this.setNeedSavePages(lastPages)
|
|
|
|
|
// console.log('== vuex 配置更新信息 ==', this.needSavePages)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|