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

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

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

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

Loading…
Cancel
Save