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