From e3b992a03e6259b44649d63b66cfcad785942880 Mon Sep 17 00:00:00 2001 From: anbbukn Date: Wed, 1 Jul 2020 14:18:00 +0800 Subject: [PATCH] [FIX] nbs router --- src/components/ebiz/nbs/InternalList.vue | 2 + src/views/ebiz/nbs/InternalServiceItem.vue | 69 +++++++++++++++------- 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/src/components/ebiz/nbs/InternalList.vue b/src/components/ebiz/nbs/InternalList.vue index 338667f49..6e5f697fb 100644 --- a/src/components/ebiz/nbs/InternalList.vue +++ b/src/components/ebiz/nbs/InternalList.vue @@ -56,6 +56,8 @@ export default { }, routerInfo: { path: `${this.url}?name=${name}` } }) + console.log(this.$parent) + if (this.$parent.watchUrlChange) this.$parent.watchUrlChange(String(parseInt(this.level) + 1)) } } } diff --git a/src/views/ebiz/nbs/InternalServiceItem.vue b/src/views/ebiz/nbs/InternalServiceItem.vue index 0455763dc..dd8179d2b 100644 --- a/src/views/ebiz/nbs/InternalServiceItem.vue +++ b/src/views/ebiz/nbs/InternalServiceItem.vue @@ -26,26 +26,26 @@ export default { [InternalList.name]: InternalList }, watch: { - $route: { - deep: true, - handler(n) { - console.log(n) - if (n.path.indexOf('/nbs/internalItem_2') !== -1) { - console.log(33333333) - this.level = '3' - this.titleArr.push(this.$route.query.name) - } else { - this.level = '2' - if (this.titleArr.length === 2) this.titleArr.pop() - console.log(222) - } - this.tableData = {} - this.searchVal = '' - this.searchList = [] - this.getDataList() - this.changeKey = this.changeKey === 1 ? 2 : 1 - } - }, + // $route: { + // deep: true, + // handler(n) { + // console.log(n) + // if (n.path.indexOf('/nbs/internalItem_2') !== -1) { + // console.log(33333333) + // this.level = '3' + // this.titleArr.push(this.$route.query.name) + // } else { + // this.level = '2' + // if (this.titleArr.length === 2) this.titleArr.pop() + // console.log(222) + // } + // this.tableData = {} + // this.searchVal = '' + // this.searchList = [] + // this.getDataList() + // this.changeKey = this.changeKey === 1 ? 2 : 1 + // } + // }, searchVal(n) { if (this.tableData.list) this.searchList = this.tableData.list.filter(item => { @@ -66,6 +66,34 @@ export default { } }, methods: { + appCallBack(data) { + if (data.trigger == 'left_button_click') { + this.level = '2' + if (this.titleArr.length === 2) this.titleArr.pop() + + this.tableData = {} + this.searchVal = '' + this.searchList = [] + this.getDataList() + this.changeKey = this.changeKey === 1 ? 2 : 1 + } + }, + watchUrlChange(level) { + console.log(level) + this.level = level + console.log(33333333) + if (this.level === '3') { + this.titleArr.push(this.$route.query.name) + } else { + if (this.titleArr.length === 2) this.titleArr.pop() + console.log(222) + } + this.tableData = {} + this.searchVal = '' + this.searchList = [] + this.getDataList() + this.changeKey = this.changeKey === 1 ? 2 : 1 + }, async getDataList() { const data = { pageSize: 0, @@ -94,6 +122,7 @@ export default { created() { this.getDataList() this.titleArr = [decodeURIComponent(this.$route.query.name)] + window.appCallback = this.appCallBack } }