张同海 2 years ago
parent 9b06cde0ff
commit 98630dcede

@ -42,20 +42,29 @@ export default {
},
methods: {
onEdit(targetKey, action) {
// let _that = this
// if (targetKey.split('?')[0] == '/BookingDetail') {
// this.$confirm({
// title: '',
// content: ' ',
// onOk() {
// _that[action](targetKey)
// },
// onCancel() {}
// })
// } else {
// this[action](targetKey)
// }
let _that = this
let data = Object.fromEntries(new URLSearchParams(targetKey.split('?')[1]))
console.log(targetKey.split('?')[0] == '/BookingDetail')
console.log(localStorage.getItem(data.id))
console.log(localStorage.getItem(data.id) == 'true')
console.log(data.id != null)
console.log(
targetKey.split('?')[0] == '/BookingDetail' && data.id != null && localStorage.getItem(data.id) == 'true'
)
if (targetKey.split('?')[0] == '/BookingDetail' && data.id != null && localStorage.getItem(data.id) == 'true') {
this.$confirm({
title: '请确认无未保存数据!',
content: '当点击确定按钮时,此页面 将会关闭。',
onOk() {
_that[action](targetKey)
localStorage.removeItem(data.id)
},
onCancel() {}
})
} else {
this[action](targetKey)
localStorage.removeItem(data.id)
}
console.log('关闭?', targetKey, action)
},
remove(targetKey) {

@ -158,7 +158,8 @@ export default {
watch: {
bookingDetails: {
handler(nval, oval) {
// console.log(' -- ', nval)
console.log('改了', nval, oval)
localStorage.setItem(`${this.id}`, true)
},
deep: true
}
@ -166,7 +167,11 @@ export default {
created() {
this.init()
},
updated() {
localStorage.setItem(`${this.id}`, false)
},
beforeRouteUpdate(to, from, next) {
console.log('beforeRouteUpdate')
if (!Object.keys(this.historyData).includes(this.$route.query.id)) {
const hisData = {
bookingDetails: this.bookingDetails,
@ -184,6 +189,7 @@ export default {
this.getRouterHis()
},
beforeRouteLeave(to, from, next) {
console.log('beforeRouteLeave')
if (!Object.keys(this.historyData).includes(this.id)) {
const hisData = {
bookingDetails: this.bookingDetails,
@ -210,6 +216,7 @@ export default {
},
methods: {
getRouterHis() {
console.log('getRouterHis')
const newId = this.$route.query.id
if (Object.keys(this.historyData).includes(newId)) {
// const newType = this.$route.query.type
@ -236,6 +243,7 @@ export default {
}
},
init() {
console.log('addSedList')
this.bookingDetails = {}
if (this.id) {
this.isAdd = false
@ -373,6 +381,7 @@ export default {
},
getDetail() {
console.log('getDetail')
if (this.inPageLoading) {
return false
}
@ -399,6 +408,7 @@ export default {
}
this.$set(this, 'bookingDetails', res.data)
this.$forceUpdate()
console.log('bookingDetails', this.bookingDetails)
})
.catch(err => {
console.log(err)
@ -406,6 +416,7 @@ export default {
},
changeDetailFun(data) {
console.log('changeDetailFun')
const { detail, type } = data
this.bookingDetails = detail
},
@ -521,6 +532,7 @@ export default {
})
},
addSedList() {
console.log('addSedList')
if (this.isAdd) {
this.$message.error('请先保存主单')
return false

@ -380,7 +380,6 @@ export default {
Object.keys(this.formRes).map((item, index) => {
this.formRes[item] = ''
})
debugger
this.init()
},
@ -551,7 +550,7 @@ export default {
this.moreNumVisible = false
},
resizableChange () {
resizableChange() {
console.log('==== 列宽拖动 =====')
}
}

Loading…
Cancel
Save