From f028b5b2b31c6265a8064dd289e69ee51ac56c1a Mon Sep 17 00:00:00 2001 From: danshihao Date: Tue, 26 Mar 2024 18:04:05 +0800 Subject: [PATCH] =?UTF-8?q?[fix=2083085]=20=E6=B6=88=E6=81=AF=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E8=B7=B3=E8=BD=AC=E5=BD=93=E5=89=8D=E9=A1=B5=EF=BC=8C?= =?UTF-8?q?=E5=B8=A6=E5=85=A5=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../standard/EnterpriseStandardList.vue | 17 ++++++++-- .../inconformityItem/InconformityItemList.vue | 18 +++++++++++ .../SpecialProjectLibrary.vue | 13 ++++++++ .../processCenter/ProcessCenter.vue | 31 ++++++++++++++----- .../processCenter/table/TodoList.vue | 14 --------- 5 files changed, 69 insertions(+), 24 deletions(-) diff --git a/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue b/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue index e45b4f16..ee9876e6 100644 --- a/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue +++ b/src/views/enterpriseStandardLibrary/standard/EnterpriseStandardList.vue @@ -342,10 +342,23 @@ export default { return userRoleList.some(tt => adminRoleList.includes(tt)) } }, + watch: { + // 消息当前页跳转,需要带入参数 + $route: { + deep: true, + handler (to, from) { + // 如果有消息跳转参数就带入参数查询 + if (to.query.standard_number) { + this.$set(this.$refs.searchRef.queryParam, 'standard_number', to.query.standard_number) + this.searchParams = Object.assign({}, this.$refs.searchRef.queryParam) + this.loadData() + } + } + } + }, mounted () { // 从消息跳转进来带企业编号 - const { standard_number } = this.$route.query - this.$set(this.$refs.searchRef.queryParam, 'standard_number', standard_number) + this.$set(this.$refs.searchRef.queryParam, 'standard_number', this.$route.query.standard_number) this.searchParams = Object.assign({}, this.$refs.searchRef.queryParam) this.getTableHeader() this.loadData() diff --git a/src/views/projectLibrary/inconformityItem/InconformityItemList.vue b/src/views/projectLibrary/inconformityItem/InconformityItemList.vue index 5522af85..43433d58 100644 --- a/src/views/projectLibrary/inconformityItem/InconformityItemList.vue +++ b/src/views/projectLibrary/inconformityItem/InconformityItemList.vue @@ -263,6 +263,24 @@ export default { disableMixinCreated: true } }, + watch: { + // 消息当前页跳转,需要带入参数 + $route: { + deep: true, + handler (to, from) { + const { projectId, standardName, standardNumber, projectName } = to.query + // 如果有消息跳转参数就带入参数查询 + if (projectId || standardName || standardNumber || projectName) { + this.queryParam.projectId = projectId + // 我的消息跳转带入搜索条件 + this.$set(this.queryParam, 'standardName', standardName) + this.$set(this.queryParam, 'standardNumber', standardNumber) + this.$set(this.queryParam, 'projectName', projectName) + this.loadData() + } + } + } + }, created () { const { projectId, standardName, standardNumber, projectName } = this.$route.query this.queryParam.projectId = projectId diff --git a/src/views/projectLibrary/specialProjectLibrary/SpecialProjectLibrary.vue b/src/views/projectLibrary/specialProjectLibrary/SpecialProjectLibrary.vue index aeb33335..fbf3a249 100644 --- a/src/views/projectLibrary/specialProjectLibrary/SpecialProjectLibrary.vue +++ b/src/views/projectLibrary/specialProjectLibrary/SpecialProjectLibrary.vue @@ -278,6 +278,19 @@ export default { disableMixinCreated: true } }, + watch: { + // 消息当前页跳转,需要带入参数 + $route: { + deep: true, + handler (to, from) { + // 如果有消息跳转参数就带入参数查询 + if (to.query.standardId) { + this.queryParam.standardId = to.query.standardId + this.loadData() + } + } + } + }, created () { this.queryParam.standardId = this.$route.query.standardId this.loadData() diff --git a/src/views/workCenter/processCenter/ProcessCenter.vue b/src/views/workCenter/processCenter/ProcessCenter.vue index 8a6e2158..408ce58c 100644 --- a/src/views/workCenter/processCenter/ProcessCenter.vue +++ b/src/views/workCenter/processCenter/ProcessCenter.vue @@ -16,7 +16,6 @@ @@ -32,7 +31,6 @@ export default { return { comp: null, activeTab: '', - useRouteQuery: true, tabList: [ { // 待办流程 component: 'TodoList', @@ -62,9 +60,27 @@ export default { this.comp = resolve => require([`@views/workCenter/processCenter/table/${this.activeTab}.vue`], resolve) setTimeout(() => { this.$refs.compModel.loadData() - // 切换tab后就不使用路由参数,页面会有缓存 - this.useRouteQuery = false }, 100) + }, + // 消息弹框当前页跳转当前页,需要将参数带入查询条件 + $route: { + deep: true, + handler (to, from) { + // 如果有消息跳转参数就带入参数查询 + if (to.query.prcNum) { + // 如果有路由参数,则使用路由参数跳转对应页签 + if (this.$route.query.activeTab) { + this.activeTab = to.query.activeTab + this.comp = resolve => require([`@views/workCenter/processCenter/table/${this.activeTab}.vue`], resolve) + } + setTimeout(() => { + if (this.$refs.compModel && this.$refs.compModel.loadData) { + this.$refs.compModel.initQueryParam && this.$refs.compModel.initQueryParam() + this.$refs.compModel.loadData() + } + }, 100) + } + } } }, created () { @@ -80,19 +96,18 @@ export default { // } // }, activated () { - // 第一次进页面通过路由参数回显查询条件 - this.useRouteQuery = true console.log('---------activated') // 如果有路由参数,则使用路由参数跳转对应页签 if (this.$route.query.activeTab) { this.activeTab = this.$route.query.activeTab this.comp = resolve => require([`@views/workCenter/processCenter/table/${this.activeTab}.vue`], resolve) } - this.$nextTick(() => { + setTimeout(() => { if (this.$refs.compModel && this.$refs.compModel.loadData) { + this.$refs.compModel.initQueryParam && this.$refs.compModel.initQueryParam() this.$refs.compModel.loadData() } - }) + }, 100) } } diff --git a/src/views/workCenter/processCenter/table/TodoList.vue b/src/views/workCenter/processCenter/table/TodoList.vue index 19e3c83c..8fd5109d 100644 --- a/src/views/workCenter/processCenter/table/TodoList.vue +++ b/src/views/workCenter/processCenter/table/TodoList.vue @@ -121,14 +121,6 @@ export default { name: 'TodoList', components: { JTable, UserSelectModal }, mixins: [JeroListMixin], - props: { - // 从路由中读取参数 - useRouteQuery: { - type: Boolean, - required: false, - default: false - } - }, data () { return { labelCol: { @@ -280,12 +272,6 @@ export default { disableMixinCreated: true } }, - activated () { - // 初始化查询参数 - if (this.useRouteQuery) { - this.initQueryParam() - } - }, methods: { // 初始化查询参数 initQueryParam () {