|
|
|
@ -899,6 +899,12 @@ export default {
|
|
|
|
|
this.inAddSave = true
|
|
|
|
|
this.id = res.data.id
|
|
|
|
|
this.setDeatilsFun(res)
|
|
|
|
|
const newBookingList = JSON.parse(JSON.stringify(this.bookingList))
|
|
|
|
|
const newBookingGridOptions = JSON.parse(JSON.stringify(this.bookingGridOptions))
|
|
|
|
|
newBookingGridOptions.data = [...[res.data], ...newBookingGridOptions.data]
|
|
|
|
|
this.$set(newBookingList, res.data.id, res.data)
|
|
|
|
|
this.setBookingList(newBookingList)
|
|
|
|
|
this.setBookingGridOptions(newBookingGridOptions)
|
|
|
|
|
that.$router.replace({
|
|
|
|
|
name: 'BookingDetail',
|
|
|
|
|
query: {
|
|
|
|
@ -911,14 +917,6 @@ export default {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.inAddSave = false
|
|
|
|
|
}, 2000)
|
|
|
|
|
console.log('== 新增订舱内容 ==', this.bookingList, this.bookingGridOptions, res.data)
|
|
|
|
|
const newBookingList = JSON.parse(JSON.stringify(this.bookingList))
|
|
|
|
|
const newBookingGridOptions = JSON.parse(JSON.stringify(this.bookingGridOptions))
|
|
|
|
|
newBookingGridOptions.data.push(res.data)
|
|
|
|
|
this.$set(newBookingList, res.data.id, res.data)
|
|
|
|
|
this.setBookingList(newBookingList)
|
|
|
|
|
this.setBookingGridOptions(newBookingGridOptions)
|
|
|
|
|
console.log('== 新增订舱内容 ==', newBookingList, newBookingGridOptions, res.data)
|
|
|
|
|
} else if (that.$route.query.mblno === that.bookingDetails.mblno) {
|
|
|
|
|
that.isCopy = false
|
|
|
|
|
that.isAdd = false
|
|
|
|
@ -932,15 +930,25 @@ export default {
|
|
|
|
|
return item.id
|
|
|
|
|
})
|
|
|
|
|
const index = arr.indexOf(res.data.id)
|
|
|
|
|
newBookingGridOptions.data[index] = res.data
|
|
|
|
|
console.log(index)
|
|
|
|
|
console.log('== 修改订舱内容 ==', this.bookingList, this.bookingGridOptions)
|
|
|
|
|
newBookingGridOptions.data.splice(index, 1, res.data)
|
|
|
|
|
this.setBookingList(newBookingList)
|
|
|
|
|
this.setBookingGridOptions(newBookingGridOptions)
|
|
|
|
|
} else {
|
|
|
|
|
that.isCopy = false
|
|
|
|
|
that.isAdd = false
|
|
|
|
|
this.inAddSave = true
|
|
|
|
|
this.id = res.data.id
|
|
|
|
|
this.setDeatilsFun(res)
|
|
|
|
|
const newBookingList = JSON.parse(JSON.stringify(this.bookingList))
|
|
|
|
|
const newBookingGridOptions = JSON.parse(JSON.stringify(this.bookingGridOptions))
|
|
|
|
|
this.$set(newBookingList, res.data.id, res.data)
|
|
|
|
|
const arr = newBookingGridOptions.data.map((item, index) => {
|
|
|
|
|
return item.id
|
|
|
|
|
})
|
|
|
|
|
const index = arr.indexOf(res.data.id)
|
|
|
|
|
newBookingGridOptions.data.splice(index, 1, res.data)
|
|
|
|
|
this.setBookingList(newBookingList)
|
|
|
|
|
this.setBookingGridOptions(newBookingGridOptions)
|
|
|
|
|
that.$router.replace({
|
|
|
|
|
name: 'BookingDetail',
|
|
|
|
|
query: {
|
|
|
|
@ -950,14 +958,6 @@ export default {
|
|
|
|
|
mblno: res.data.mblno
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log('== 复制订舱内容 ==', this.bookingList, this.bookingGridOptions, res.data)
|
|
|
|
|
const newBookingList = JSON.parse(JSON.stringify(this.bookingList))
|
|
|
|
|
const newBookingGridOptions = JSON.parse(JSON.stringify(this.bookingGridOptions))
|
|
|
|
|
newBookingGridOptions.data.push(res.data)
|
|
|
|
|
this.$set(newBookingList, res.data.id, res.data)
|
|
|
|
|
this.setBookingList(newBookingList)
|
|
|
|
|
this.setBookingGridOptions(newBookingGridOptions)
|
|
|
|
|
console.log('== 复制订舱内容 ==', newBookingList, newBookingGridOptions, res.data)
|
|
|
|
|
}
|
|
|
|
|
that.$forceUpdate()
|
|
|
|
|
} else {
|
|
|
|
|