diff --git a/src/router/index.js b/src/router/index.js index 6fa5031..468c4ec 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -124,9 +124,9 @@ function fnAddDynamicMenuRoutes (menuList = [], routes = []) { } else if (menuList[i].url && /\S/.test(menuList[i].url)) { menuList[i].url = menuList[i].url.replace(/^\//, '') var route = { - path: menuList[i].url.replace('/', '-'), + path: menuList[i].url.replace(/\//g, '-'), component: null, - name: menuList[i].url.replace('/', '-'), + name: menuList[i].url.replace(/\//g, '-'), meta: { menuId: menuList[i].menuId, title: menuList[i].name, diff --git a/src/views/common/login-token.vue b/src/views/common/login-token.vue index b02d359..727ad82 100644 --- a/src/views/common/login-token.vue +++ b/src/views/common/login-token.vue @@ -70,12 +70,24 @@ for(let i = 0,len = paramsArr.length;i < len;i++){ // 再通过 = 将每一个参数分割为 key:value 的形式 let arr = paramsArr[i].split('=') - obj[arr[0]] = arr[1]; + obj[arr[0]] = arr[1] ? decodeURIComponent(arr[1]) : arr[1]; } this.urlParam = obj this.dataFormSubmit() }, + // 动态路由 name 会把菜单 url 中全部 '/' 换成 '-' + // 项目信息旧 OA 链接仍可能带 project-projectInfo/projectInfo + normalizeRouteName (path) { + if (!path) { + return path + } + if (path === 'project-projectInfo/projectInfo') { + return 'project-projectInfo-projectInfo' + } + return path + }, + getSiteData () { let data = {} getSiteData(data).then(({data}) => { @@ -105,7 +117,7 @@ if (data && data.code === 0) { this.$cookie.set('token_plm', data.token) this.$router.replace({ - name: this.urlParam.path, + name: this.normalizeRouteName(this.urlParam.path), params: { site: data.site, docNo: this.urlParam.docNo, diff --git a/src/views/modules/customer/customerInformationManagement.vue b/src/views/modules/customer/customerInformationManagement.vue index a2ee2e5..ba7ac92 100644 --- a/src/views/modules/customer/customerInformationManagement.vue +++ b/src/views/modules/customer/customerInformationManagement.vue @@ -3251,10 +3251,10 @@ export default { return s }, clickProjectId(projectId) { - if (this.$router.resolve('project-projectInfo/projectInfo').resolved.name === '404') { + if (this.$router.resolve('project-projectInfo-projectInfo').resolved.name === '404') { this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',}); } else { - this.$router.push({name: "project-projectInfo/projectInfo", params: {projectId: projectId},}) + this.$router.push({name: "project-projectInfo-projectInfo", params: {projectId: projectId},}) } }, rowStyle({row}) { diff --git a/src/views/modules/project/projectInfo/projectInfo.vue b/src/views/modules/project/projectInfo/projectInfo.vue index 8657cf2..bcbe545 100644 --- a/src/views/modules/project/projectInfo/projectInfo.vue +++ b/src/views/modules/project/projectInfo/projectInfo.vue @@ -1424,6 +1424,7 @@ this.authIssue = this.isAuth(this.menuId + ':issue') this.checkSuperAdmin() this.fetchNodeOptions() + this.handleRouteQuery() this.$nextTick(() => { //this.height = window.innerHeight - 520; this.height = window.innerHeight / 2 - 50 @@ -2308,13 +2309,55 @@ return true }, + handleRouteQuery () { + const routeParams = this.$route.params || {} + const isTokenLogin = routeParams.type === 'tokenLogin' + const projectId = String(routeParams.docNo || routeParams.projectId || '').trim() + if (isTokenLogin) { + if (!projectId) { + return + } + if (this.addOrUpdateVisible && this.currentRow && String(this.currentRow.projectId || '').trim() === projectId) { + return + } + this.searchData.projectId = projectId + this.searchData.limit = this.pageSize + this.searchData.page = this.pageIndex + this.searchData.userId = this.$store.state.user.id + this.searchData.menuId = this.menuId + projectInfoSearch(this.searchData).then(({data}) => { + if (data.code == 0) { + this.dataList1 = data.page.list + this.pageIndex = data.page.currPage + this.pageSize = data.page.pageSize + this.totalPage = data.page.totalCount + if (this.dataList1 && this.dataList1.length > 0) { + this.$nextTick(() => { + if (this.$refs.mainTable) { + this.$refs.mainTable.setCurrentRow(this.dataList1[0]) + } + this.changeData(this.dataList1[0]) + this.addOrUpdateVisible = true + this.addOrUpdate = 'update' + this.$nextTick(() => { + this.$refs.addOrUpdate.init(this.dataList1[0].id) + }) + }) + } + } + this.dataListLoading = false + }) + return + } + if (projectId) { + this.searchData.projectId = projectId + this.search() + } + }, + }, activated() { - if (this.$route.params.projectId){ - this.searchData.projectId = this.$route.params.projectId - this.search(); - } - // this.getTableUserColumn(this.$route.meta.menuId+'table1',1) + this.handleRouteQuery() }, }