|
|
|
@ -271,7 +271,22 @@ export default {
|
|
|
|
|
this.init()
|
|
|
|
|
},
|
|
|
|
|
beforeRouteUpdate(to, from, next) {
|
|
|
|
|
if (!Object.keys(this.historyData).includes(this.$route.query.id)) {
|
|
|
|
|
// console.log('fromId:', from.query.id, '| toId:', to.query.id)
|
|
|
|
|
// console.log('2.2 === beforeRouteUpdate ===', this.$route.query.id, this.isCopy)
|
|
|
|
|
// if (!Object.keys(this.historyData).includes(this.$route.query.id)) {
|
|
|
|
|
// const hisData = {
|
|
|
|
|
// bookingDetails: this.bookingDetails,
|
|
|
|
|
// excuteRules: this.excuteRules,
|
|
|
|
|
// excuteRulesType: this.excuteRulesType,
|
|
|
|
|
// isAdd: this.isAdd,
|
|
|
|
|
// tabActiveKey: this.tabActiveKey,
|
|
|
|
|
// type: this.type,
|
|
|
|
|
// isCopy: this.isCopy,
|
|
|
|
|
// id: this.$route.query.id
|
|
|
|
|
// }
|
|
|
|
|
// this.$set(this.historyData, this.$route.query.id, hisData)
|
|
|
|
|
// }
|
|
|
|
|
if (this.isCopy) {
|
|
|
|
|
const hisData = {
|
|
|
|
|
bookingDetails: this.bookingDetails,
|
|
|
|
|
excuteRules: this.excuteRules,
|
|
|
|
@ -280,15 +295,53 @@ export default {
|
|
|
|
|
tabActiveKey: this.tabActiveKey,
|
|
|
|
|
type: this.type,
|
|
|
|
|
isCopy: this.isCopy,
|
|
|
|
|
id: this.$route.query.id
|
|
|
|
|
id: this.id
|
|
|
|
|
}
|
|
|
|
|
this.$set(this.historyData, this.$route.query.id, hisData)
|
|
|
|
|
this.$set(this.historyData, `copy-${this.id}`, hisData)
|
|
|
|
|
} else {
|
|
|
|
|
const hisData = {
|
|
|
|
|
bookingDetails: this.bookingDetails,
|
|
|
|
|
excuteRules: this.excuteRules,
|
|
|
|
|
excuteRulesType: this.excuteRulesType,
|
|
|
|
|
isAdd: this.isAdd,
|
|
|
|
|
tabActiveKey: this.tabActiveKey,
|
|
|
|
|
type: this.type,
|
|
|
|
|
isCopy: this.isCopy,
|
|
|
|
|
id: this.id
|
|
|
|
|
}
|
|
|
|
|
this.$set(this.historyData, this.id, hisData)
|
|
|
|
|
}
|
|
|
|
|
next()
|
|
|
|
|
this.getRouterHis()
|
|
|
|
|
},
|
|
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
|
|
if (!Object.keys(this.historyData).includes(this.id)) {
|
|
|
|
|
// console.log('2.1 === beforeRouteLeave ===', this.id, this.isCopy)
|
|
|
|
|
// if (!Object.keys(this.historyData).includes(this.id)) {
|
|
|
|
|
// const hisData = {
|
|
|
|
|
// bookingDetails: this.bookingDetails,
|
|
|
|
|
// excuteRules: this.excuteRules,
|
|
|
|
|
// excuteRulesType: this.excuteRulesType,
|
|
|
|
|
// isAdd: this.isAdd,
|
|
|
|
|
// tabActiveKey: this.tabActiveKey,
|
|
|
|
|
// type: this.type,
|
|
|
|
|
// isCopy: this.isCopy,
|
|
|
|
|
// id: this.id
|
|
|
|
|
// }
|
|
|
|
|
// this.$set(this.historyData, this.id, hisData)
|
|
|
|
|
// }
|
|
|
|
|
if (this.isCopy) {
|
|
|
|
|
const hisData = {
|
|
|
|
|
bookingDetails: this.bookingDetails,
|
|
|
|
|
excuteRules: this.excuteRules,
|
|
|
|
|
excuteRulesType: this.excuteRulesType,
|
|
|
|
|
isAdd: this.isAdd,
|
|
|
|
|
tabActiveKey: this.tabActiveKey,
|
|
|
|
|
type: this.type,
|
|
|
|
|
isCopy: this.isCopy,
|
|
|
|
|
id: this.id
|
|
|
|
|
}
|
|
|
|
|
this.$set(this.historyData, `copy-${this.id}`, hisData)
|
|
|
|
|
} else {
|
|
|
|
|
const hisData = {
|
|
|
|
|
bookingDetails: this.bookingDetails,
|
|
|
|
|
excuteRules: this.excuteRules,
|
|
|
|
@ -311,16 +364,35 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
...mapActions(['setNeedSavePages']),
|
|
|
|
|
getRouterHis() {
|
|
|
|
|
// console.log('2.3 === beforeRouteEnter - getRouterHis ===', Object.keys(this.historyData), this.$route.query.id)
|
|
|
|
|
const newId = this.$route.query.id
|
|
|
|
|
if (Object.keys(this.historyData).includes(newId)) {
|
|
|
|
|
const $data = this.historyData[newId]
|
|
|
|
|
if (Object.keys(this.historyData).includes(`copy-${newId}`) && this.$route.query.isCopy === 'true') {
|
|
|
|
|
this.id = this.$route.query.id
|
|
|
|
|
const $data = JSON.parse(JSON.stringify(this.historyData[`copy-${newId}`]))
|
|
|
|
|
this.bookingDetails = $data.bookingDetails
|
|
|
|
|
this.excuteRules = $data.excuteRules
|
|
|
|
|
this.excuteRulesType = $data.excuteRulesType
|
|
|
|
|
this.isAdd = $data.isAdd
|
|
|
|
|
this.tabActiveKey = $data.tabActiveKey
|
|
|
|
|
this.isCopy = $data.isCopy
|
|
|
|
|
this.isCopy = this.$route.query.isCopy
|
|
|
|
|
this.inPageLoading = false
|
|
|
|
|
// console.log('== 复制参数 ==', $data.isCopy, this.$route.query.isCopy, this.isCopy)
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else if (Object.keys(this.historyData).includes(newId)) {
|
|
|
|
|
this.id = this.$route.query.id
|
|
|
|
|
const $data = JSON.parse(JSON.stringify(this.historyData[newId]))
|
|
|
|
|
this.bookingDetails = $data.bookingDetails
|
|
|
|
|
this.excuteRules = $data.excuteRules
|
|
|
|
|
this.excuteRulesType = $data.excuteRulesType
|
|
|
|
|
this.isAdd = $data.isAdd
|
|
|
|
|
this.tabActiveKey = $data.tabActiveKey
|
|
|
|
|
this.isCopy = this.$route.query.isCopy
|
|
|
|
|
this.inPageLoading = false
|
|
|
|
|
// console.log('== 复制参数 ==', $data.isCopy, this.$route.query.isCopy, this.isCopy)
|
|
|
|
|
if (this.isCopy && !$data.isCopy) {
|
|
|
|
|
// console.log('== 新增复制, 这里置空了提单号 ==')
|
|
|
|
|
this.bookingDetails.mblno = ''
|
|
|
|
|
}
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|
this.id = this.$route.query.id
|
|
|
|
@ -332,11 +404,11 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
init() {
|
|
|
|
|
// this.bookingDetails = {}
|
|
|
|
|
this.bookingDetails = initDetail
|
|
|
|
|
this.excuteRules = []
|
|
|
|
|
this.excuteRulesType = ''
|
|
|
|
|
this.Showtabs = false
|
|
|
|
|
// console.log('3.1 == init ==', this.id)
|
|
|
|
|
if (this.id) {
|
|
|
|
|
this.isAdd = false
|
|
|
|
|
this.getDetail()
|
|
|
|
@ -377,6 +449,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
this.inPageLoading = true
|
|
|
|
|
this.$message.loading({ content: '加载中...' });
|
|
|
|
|
// console.log('4.1 == 获取详情 ==', this.id)
|
|
|
|
|
BookingOrderGet({
|
|
|
|
|
id: this.id
|
|
|
|
|
})
|
|
|
|
@ -384,7 +457,8 @@ export default {
|
|
|
|
|
this.inPageLoading = false
|
|
|
|
|
this.$message.destroy()
|
|
|
|
|
this.$message.success({ content: '加载完成' })
|
|
|
|
|
if (this.isCopy) {
|
|
|
|
|
// console.log('isCopy', this.$route.query.isCopy)
|
|
|
|
|
if (this.$route.query.isCopy) {
|
|
|
|
|
res.data.mblno = ''
|
|
|
|
|
this.isAdd = true
|
|
|
|
|
}
|
|
|
|
@ -429,8 +503,10 @@ export default {
|
|
|
|
|
this.isAdd = false
|
|
|
|
|
this.$message.success('保存成功')
|
|
|
|
|
if (this.$route.query.mblno === this.bookingDetails.mblno) {
|
|
|
|
|
// console.log('1.1 == 保存成功 - 不切换路由 ==', this.id)
|
|
|
|
|
this.init()
|
|
|
|
|
} else {
|
|
|
|
|
// console.log('1.2 == 保存成功 - 刷新路由 ==', this.id)
|
|
|
|
|
this.$router.replace({
|
|
|
|
|
name: 'BookingDetail',
|
|
|
|
|
query: { id: this.id, type: this.bookingDetails.carrierid, noOpenTab: true, mblno: this.bookingDetails.mblno }
|
|
|
|
|