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