[fix 83085] 消息弹框跳转当前页,带入参数

This commit is contained in:
danshihao
2024-03-26 18:04:05 +08:00
parent 7199a4a9a9
commit f028b5b2b3
5 changed files with 69 additions and 24 deletions
@@ -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()
@@ -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
@@ -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()
@@ -16,7 +16,6 @@
<component
:is="comp"
ref="compModel"
:useRouteQuery="useRouteQuery"
v-if="comp">
</component>
</keep-alive>
@@ -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)
}
}
</script>
@@ -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 () {