diff --git a/public/index.html b/public/index.html index 2283547..82948c1 100644 --- a/public/index.html +++ b/public/index.html @@ -95,7 +95,7 @@ <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %> <% } %> - + diff --git a/src/components/MultiTab/MultiTab.vue b/src/components/MultiTab/MultiTab.vue index 7a62064..e0af107 100644 --- a/src/components/MultiTab/MultiTab.vue +++ b/src/components/MultiTab/MultiTab.vue @@ -39,7 +39,7 @@ export default { this.$forceUpdate() } catch (e) {} }) - + console.log('== 路由新增 ==', this.$route, this.$route.fullPath, this.fullPathList) this.pages.push(this.$route) this.fullPathList.push(this.$route.fullPath) this.selectedLastPath() @@ -48,9 +48,10 @@ export default { ...mapActions(['setNeedSavePages']), onEdit(targetKey, action) { const _that = this - console.log(this.needSavePages[targetKey], targetKey) + console.log('== 路由编辑 start ==', this.fullPathList, this.page) if (targetKey.includes('BookingDetail')) { - if (this.needSavePages[targetKey].details || this.needSavePages[targetKey].hbList) { + if (Object.keys(this.needSavePages).includes(targetKey) && (this.needSavePages[targetKey].details || this.needSavePages[targetKey].hbList)) { + console.log('== 理由编辑 - 有未保存数据 biu 弹窗出现 ==', this.fullPathList, this.page) this.$confirm({ title: '请确认无未保存数据!', content: '当点击确定按钮时,此页面 将会关闭。', @@ -74,12 +75,12 @@ export default { } else { this[action](targetKey) } - // console.log('关闭?', targetKey, action) + console.log(' === 路由编辑 end ==', this.fullPathList, this.page) }, remove(targetKey) { this.pages = this.pages.filter(page => page.fullPath !== targetKey) this.fullPathList = this.fullPathList.filter(path => path !== targetKey) - console.log('== 关闭 ==') + console.log('== 关闭 ==', this.pages, this.fullPathList) // 判断当前标签是否关闭,若关闭则跳转到最后一个还存在的标签页 if (!this.fullPathList.includes(this.activeKey)) { console.log('=== 最后一个标签页 ===') @@ -92,6 +93,7 @@ export default { // content menu closeThat(e) { + console.log('=== 测试点4 ===', this.fullPathList) // 判断是否为最后一个标签页,如果是最后一个,则无法被关闭 if (this.fullPathList.length > 1) { this.remove(e) @@ -100,7 +102,7 @@ export default { } }, closeLeft(e) { - console.log('=== 测试点1 ===') + console.log('=== 测试点1 ===', this.fullPathList) const currentIndex = this.fullPathList.indexOf(e) if (currentIndex > 0) { this.fullPathList.forEach((item, index) => { @@ -181,6 +183,7 @@ export default { }, watch: { $route: function(newVal) { + console.log('=== 路由切换 === - fullPath: ', newVal.fullPath) if (!newVal.query.noOpenTab) { this.activeKey = newVal.fullPath if (this.fullPathList.indexOf(newVal.fullPath) < 0) { @@ -195,6 +198,7 @@ export default { }) this.activeKey = newVal.fullPath } + console.log('=== 路由切换 === - pages: ', this.pages, ', fullPathList: ', this.fullPathList) }, activeKey: function(newPathKey) { this.$router.push({ path: newPathKey }) diff --git a/src/views/main/BookingLedger/detail/components/ediMore.vue b/src/views/main/BookingLedger/detail/components/ediMore.vue index 06db5af..4e12ec7 100644 --- a/src/views/main/BookingLedger/detail/components/ediMore.vue +++ b/src/views/main/BookingLedger/detail/components/ediMore.vue @@ -277,6 +277,12 @@ export default { }, iscontainersoc(nval, oval) { this.details.iscontainersoc = nval !== '0' + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, created() {}, diff --git a/src/views/main/BookingLedger/detail/components/sedOrder.vue b/src/views/main/BookingLedger/detail/components/sedOrder.vue index fe6fcbc..9af85e7 100644 --- a/src/views/main/BookingLedger/detail/components/sedOrder.vue +++ b/src/views/main/BookingLedger/detail/components/sedOrder.vue @@ -138,6 +138,12 @@ export default { } }, deep: true + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, created() { diff --git a/src/views/main/BookingLedger/detail/index.vue b/src/views/main/BookingLedger/detail/index.vue index 54dd3c4..1d8cffc 100644 --- a/src/views/main/BookingLedger/detail/index.vue +++ b/src/views/main/BookingLedger/detail/index.vue @@ -244,11 +244,12 @@ export default { moreStr: '', tabActiveKey: '1', historyData: {}, - Showtabs: false + Showtabs: false, + inChildLoading: false } }, computed: { - ...mapGetters(['bookingList', 'needSavePages']), + ...mapGetters(['bookingList', 'needSavePages']) // Showtabs() { // let Rdata = true // if (this.bookingDetails.hbList && this.bookingDetails.hbList.length) { @@ -262,7 +263,7 @@ export default { watch: { bookingDetails: { handler(nval, oval) { - this.checkSaveFun({ type: 'details', hasChange: true }) + // this.checkSaveFun({ type: 'details', hasChange: true }) }, deep: true } @@ -272,7 +273,7 @@ export default { }, beforeRouteUpdate(to, from, next) { // console.log('fromId:', from.query.id, '| toId:', to.query.id) - // console.log('2.2 === beforeRouteUpdate ===', this.$route.query.id, this.isCopy) + console.log('Router 2.2 === beforeRouteUpdate ===', this.$route.query.id, this.isCopy) // if (!Object.keys(this.historyData).includes(this.$route.query.id)) { // const hisData = { // bookingDetails: this.bookingDetails, @@ -286,6 +287,7 @@ export default { // } // this.$set(this.historyData, this.$route.query.id, hisData) // } + // this.inChildLoading = true if (this.isCopy) { const hisData = { bookingDetails: this.bookingDetails, @@ -312,10 +314,11 @@ export default { this.$set(this.historyData, this.id, hisData) } next() + // this.inChildLoading = false this.getRouterHis() }, beforeRouteLeave(to, from, next) { - // console.log('2.1 === beforeRouteLeave ===', this.id, this.isCopy) + console.log('Router 2.1 === beforeRouteLeave ===', this.id, this.isCopy) // if (!Object.keys(this.historyData).includes(this.id)) { // const hisData = { // bookingDetails: this.bookingDetails, @@ -329,6 +332,7 @@ export default { // } // this.$set(this.historyData, this.id, hisData) // } + this.inChildLoading = true if (this.isCopy) { const hisData = { bookingDetails: this.bookingDetails, @@ -355,6 +359,9 @@ export default { this.$set(this.historyData, this.id, hisData) } next() + setTimeout(() => { + this.inChildLoading = false + }, 2000); }, beforeRouteEnter(to, from, next) { next(vm => { @@ -364,7 +371,8 @@ export default { methods: { ...mapActions(['setNeedSavePages']), getRouterHis() { - // console.log('2.3 === beforeRouteEnter - getRouterHis ===', Object.keys(this.historyData), this.$route.query.id) + console.log('Router 2.3 === beforeRouteEnter - getRouterHis ===', Object.keys(this.historyData), this.$route.query.id) + this.inChildLoading = true const newId = this.$route.query.id if (Object.keys(this.historyData).includes(`copy-${newId}`) && this.$route.query.isCopy === 'true') { this.id = this.$route.query.id @@ -376,6 +384,12 @@ export default { this.tabActiveKey = $data.tabActiveKey this.isCopy = this.$route.query.isCopy this.inPageLoading = false + setTimeout(() => { + this.inChildLoading = false + if (!Object.keys(this.needSavePages).includes(this.$route.fullPath)) { + this.checkSaveFun({ type: 'details', hasChange: false }) + } + }, 1500) // console.log('== 复制参数 ==', $data.isCopy, this.$route.query.isCopy, this.isCopy) this.$forceUpdate() } else if (Object.keys(this.historyData).includes(newId)) { @@ -393,6 +407,12 @@ export default { // console.log('== 新增复制, 这里置空了提单号 ==') this.bookingDetails.mblno = '' } + setTimeout(() => { + this.inChildLoading = false + if (!Object.keys(this.needSavePages).includes(this.$route.fullPath)) { + this.checkSaveFun({ type: 'details', hasChange: false }) + } + }, 1500) this.$forceUpdate() } else { this.id = this.$route.query.id @@ -448,6 +468,7 @@ export default { return false } this.inPageLoading = true + this.inChildLoading = true this.$message.loading({ content: '加载中...' }); // console.log('4.1 == 获取详情 ==', this.id) BookingOrderGet({ @@ -475,8 +496,10 @@ export default { } this.$set(this, 'bookingDetails', res.data) setTimeout(() => { + // console.log(' 1. === 主单获取信息更新 ===') + this.inChildLoading = false this.checkSaveFun({ type: 'details', hasChange: false }) - }, 600) + }, 1500) this.$forceUpdate() }) .catch(err => { @@ -486,9 +509,27 @@ export default { changeDetailFun(data) { const { detail, type } = data + // console.log('对比更新内容', this.ifCompare(this.bookingDetails, detail), !this.inChildLoading, this.ifCompare(this.bookingDetails, detail) && !this.inChildLoading) + if (this.ifCompare(this.bookingDetails, detail) && !this.inChildLoading) { + // console.log('2. == 这里子组件进行了更新 == ', type) + this.checkSaveFun({ type: 'details', hasChange: true }) + } this.bookingDetails = detail }, + ifCompare(object1, object2) { + var o1keys = Object.keys(object1); + var o2keys = Object.keys(object2); + if (o2keys.length !== o1keys.length) return false; + for (let i = 0; i <= o1keys.length - 1; i++) { + let key = o1keys[i]; + if (!o2keys.includes(key)) return false; + if (object2[key] !== object1[key]) return false; + } + return true; + }, + + bookingOrderUpdate() { if (!this.bookingDetails.mblno) { this.$message.error('请输入提单号') @@ -578,11 +619,12 @@ export default { const _this = this const key = this.$route.fullPath if (this.needSavePages[key].details || this.needSavePages[key].hbList) { + // console.log('== 切换上一票下一票 - biu 弹窗出现 ==') this.$confirm({ title: '请确认无未保存数据!', content: '当点击确定按钮时,此页面 将会关闭。', onOk() { - _this.changePage() + _this.changePage(type) const $data = _this.needSavePages delete $data[key] _this.setNeedSavePages($data) @@ -590,7 +632,7 @@ export default { onCancel() {} }) } else { - this.changePage() + this.changePage(type) } }, changePage (type) { @@ -604,6 +646,10 @@ export default { } const prevId = arr[index - 1] const prevType = this.bookingList[prevId].carrierid + + const $data = this.needSavePages + delete $data[this.$route.fullPath] + this.setNeedSavePages($data) this.$router.replace({ name: 'BookingDetail', query: { id: prevId, type: prevType, mblno: this.bookingList[prevId].mblno, noOpenTab: true } @@ -616,6 +662,9 @@ export default { } const nextId = arr[index + 1] const nextType = this.bookingList[nextId].carrierid + const $data = this.needSavePages + delete $data[this.$route.fullPath] + this.setNeedSavePages($data) this.$router.replace({ name: 'BookingDetail', query: { id: nextId, type: nextType, mblno: this.bookingList[nextId].mblno, noOpenTab: true } @@ -651,6 +700,7 @@ export default { const arr = data.map((item, index) => { return item.isNoSave }) + // console.log('3. === 分单更新 ===') if (arr.includes(true)) { this.checkSaveFun({ type: 'hbList', hasChange: true }) } else { @@ -658,6 +708,9 @@ export default { } }, checkSaveFun (data) { + // if (this.inPageLoading) { + // return false + // } const lastPages = this.needSavePages const $data = this.needSavePages[this.id] || {} if (data.type === 'details') { @@ -669,6 +722,7 @@ export default { const key = this.$route.fullPath this.$set(lastPages, key, $data) this.setNeedSavePages(lastPages) + // console.log('== vuex 配置更新信息 ==', this.needSavePages) } } } diff --git a/src/views/main/BookingLedger/detail/modules/basicInfo.vue b/src/views/main/BookingLedger/detail/modules/basicInfo.vue index 69caafd..2db8d57 100644 --- a/src/views/main/BookingLedger/detail/modules/basicInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/basicInfo.vue @@ -759,6 +759,12 @@ export default { }) }, deep: true + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, created() { @@ -854,7 +860,7 @@ export default { this.etdWeek = this.getWeek(this.details.etd) } this.ContactType = this.$options.filters['dictData']('booking_contact_type') - console.log(this.ContactType, 'this.ContactType') + // console.log(this.ContactType, 'this.ContactType') }, // 客户 - start getDjyCustomerpage(name = '', type, key) { diff --git a/src/views/main/BookingLedger/detail/modules/billInfo.vue b/src/views/main/BookingLedger/detail/modules/billInfo.vue index 21b342a..d7e1a23 100644 --- a/src/views/main/BookingLedger/detail/modules/billInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/billInfo.vue @@ -388,6 +388,12 @@ export default { }) }, deep: true + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, computed: { diff --git a/src/views/main/BookingLedger/detail/modules/cargoInfo.vue b/src/views/main/BookingLedger/detail/modules/cargoInfo.vue index a02761c..e13ed33 100644 --- a/src/views/main/BookingLedger/detail/modules/cargoInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/cargoInfo.vue @@ -85,6 +85,12 @@ export default { } this.details.description = str + nval } + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, created() {}, diff --git a/src/views/main/BookingLedger/detail/modules/goodsTable.vue b/src/views/main/BookingLedger/detail/modules/goodsTable.vue index d5e787e..4b40965 100644 --- a/src/views/main/BookingLedger/detail/modules/goodsTable.vue +++ b/src/views/main/BookingLedger/detail/modules/goodsTable.vue @@ -657,6 +657,7 @@ export default { '$route.query': { immediate: true, handler(nD, oD) { + this.id = this.$route.query.id this.init() } } diff --git a/src/views/main/BookingLedger/detail/modules/mailingInfo.vue b/src/views/main/BookingLedger/detail/modules/mailingInfo.vue index 6e1eac2..98a16a3 100644 --- a/src/views/main/BookingLedger/detail/modules/mailingInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/mailingInfo.vue @@ -61,9 +61,7 @@ @change="consigneeChange" @focus="consigneeChange" /> - 保存 + 保存
* 35 @@ -99,9 +97,7 @@ @change="notifyChange" @focus="notifyChange" /> - 保存 + 保存
* 35 @@ -144,7 +140,6 @@ v-model="details.yard" class="customer-input" :data-source="yardDataArr" - @select="yardSelect" @change="yardChange" /> --> @@ -712,6 +707,12 @@ export default { }) }, deep: true + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, computed: { diff --git a/src/views/main/BookingLedger/detail/modules/operationArea.vue b/src/views/main/BookingLedger/detail/modules/operationArea.vue index f730830..cfbe08a 100644 --- a/src/views/main/BookingLedger/detail/modules/operationArea.vue +++ b/src/views/main/BookingLedger/detail/modules/operationArea.vue @@ -616,6 +616,12 @@ export default { this.imgSrc = window.URL.createObjectURL(new Blob([res])) }) } + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, methods: { diff --git a/src/views/main/BookingLedger/detail/modules/remarksInfo.vue b/src/views/main/BookingLedger/detail/modules/remarksInfo.vue index 5820c6b..91b1ba2 100644 --- a/src/views/main/BookingLedger/detail/modules/remarksInfo.vue +++ b/src/views/main/BookingLedger/detail/modules/remarksInfo.vue @@ -38,6 +38,12 @@ export default { }) }, deep: true + }, + '$route.query': { + immediate: true, + handler(nD, oD) { + this.id = this.$route.query.id + } } }, created() {}, diff --git a/src/views/main/BookingLedger/detail/modules/rightContent.vue b/src/views/main/BookingLedger/detail/modules/rightContent.vue index 606f6be..a4ab219 100644 --- a/src/views/main/BookingLedger/detail/modules/rightContent.vue +++ b/src/views/main/BookingLedger/detail/modules/rightContent.vue @@ -290,6 +290,7 @@ export default { '$route.query': { immediate: true, handler(nD, oD) { + this.id = this.$route.query.id if (!nD.id) { this.BookingDetail = [] this.bookingLogList = [] diff --git a/src/views/main/BookingLedger/list/index.vue b/src/views/main/BookingLedger/list/index.vue index 5fc59c5..dd54b4a 100644 --- a/src/views/main/BookingLedger/list/index.vue +++ b/src/views/main/BookingLedger/list/index.vue @@ -100,7 +100,7 @@ {{ enmuBookingBtn(btn.staCode) }} {{ enmuBookingBtn(btn.staCode) }} - +