From 1d760d5688a12af6f386b7530449d4a4e4b360cd Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 10 Oct 2019 13:45:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=88=86=E5=8C=96=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../menuDialog/stationControlConvert.vue | 8 ++-- .../fuzhou_01/menus/passiveDialog/alarm.vue | 2 +- src/store/modules/permission.js | 41 +++++++++++++------ 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/jmap/theme/fuzhou_01/menus/menuDialog/stationControlConvert.vue b/src/jmap/theme/fuzhou_01/menus/menuDialog/stationControlConvert.vue index adfc1e675..e4aa7958f 100644 --- a/src/jmap/theme/fuzhou_01/menus/menuDialog/stationControlConvert.vue +++ b/src/jmap/theme/fuzhou_01/menus/menuDialog/stationControlConvert.vue @@ -155,7 +155,7 @@ if (operate.selection && operate.selection.length) { operate.selection.forEach(elem => { if (operate.commit) { - this.updateTableValue(elem.code, { result: `${$t('menu.menuDialog.senedMessageOne')} ,${this.timeout} ${$t('menu.menuDialog.senedMessageTwo')}` }, false); + this.updateTableValue(elem.code, { result: `${this.$t('menu.menuDialog.senedMessageOne')} ,${this.timeout} ${this.$t('menu.menuDialog.senedMessageTwo')}` }, false); } else if (operate.cancel) { this.updateTableValue(elem.code, { result: '' }, false); } @@ -359,7 +359,7 @@ } this.selection.forEach((elem, index) => { - operate.messages.push(`${$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`); + operate.messages.push(`${this.$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`); }); this.disabledSure = true; @@ -384,7 +384,7 @@ } this.selection.forEach((elem, index) => { - operate.messages.push(`${$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`); + operate.messages.push(`${this.$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`); }); this.disabledSure = true; @@ -409,7 +409,7 @@ } this.selection.forEach((elem, index) => { - operate.messages.push(`${$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`); + operate.messages.push(`${this.$t('menu.menuDialog.operatingArea')} ${index + 1}:${elem.operate}`); }); this.disabledSure = true; diff --git a/src/jmap/theme/fuzhou_01/menus/passiveDialog/alarm.vue b/src/jmap/theme/fuzhou_01/menus/passiveDialog/alarm.vue index 57f11dab4..38346ed72 100644 --- a/src/jmap/theme/fuzhou_01/menus/passiveDialog/alarm.vue +++ b/src/jmap/theme/fuzhou_01/menus/passiveDialog/alarm.vue @@ -154,7 +154,7 @@ childType: this.$t('menu.passiveDialog.childTypeTips'), timeSummary: this.$t('menu.passiveDialog.controlModeSummary'), recommendedOperation: '', - alarmDetail: `${$t('menu.passiveDialog.controlModeTransfer')} ${this.operate.name}${$t('menu.passiveDialog.alarmDetailOne')}${operate.currentMode == '01' ? this.$t('menu.passiveDialog.stationToCentral') : this.$t('menu.passiveDialog.centralToStation') }!` + alarmDetail: `${this.$t('menu.passiveDialog.controlModeTransfer')} ${this.operate.name}${this.$t('menu.passiveDialog.alarmDetailOne')}${operate.currentMode == '01' ? this.$t('menu.passiveDialog.stationToCentral') : this.$t('menu.passiveDialog.centralToStation') }!` } this.dialogShow = true; this.$nextTick(function () { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index d7cb1b7a2..b5fef8ca6 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -29,21 +29,37 @@ function hasPermission(roles, route, parentsRoles) { if (route.meta && route.meta.roles) { // 如果存在本级路由,则使用自己的roles过滤 // debugger; - if (getSessionStorage('design')) { - if (route.meta.roles.indexOf(userDesign)===-1) { - route.hidden = true; - } else { - if (!(route.meta.roles.indexOf(admin)>=0 && roles.indexOf(admin)>=0)) { - route.hidden = true; - } - } + // if (getSessionStorage('design')) { + // if (route.meta.roles.indexOf(userDesign)===-1) { + // route.hidden = true; + // } else { + // if ((route.meta.roles.indexOf(admin)>=0 && roles.indexOf(admin)>=0)) { + // route.hidden = false; + // } else if (route.meta.roles.indexOf(user)>=0 && roles.indexOf(user)>=0) { + // route.hidden = false; + // } else { + // route.hidden = true; + // } + // } + // } else { + // if (route.meta.roles.indexOf(userDesign)>0) { + // route.hidden = true; + // } + // } + // return roles.some(role => route.meta.roles.indexOf(role) >= 0); + if (getSessionStorage('design')) { + roles= roles.filter(function (role) { + return route.meta.roles.indexOf(role) >= 0; + }); + const result=roles.every(role => route.meta.roles.indexOf(role) >= 0); + return result && ((roles.indexOf(admin)>=0 && route.meta.roles.indexOf(admin)>=0) || (roles.indexOf(user)>=0 && route.meta.roles.indexOf(user)>=0 )); } else { - if (route.meta.roles.indexOf(userDesign)>0) { - route.hidden = true; - } + roles= roles.filter(function (role) { + return route.meta.roles.indexOf(role) >= 0; + }); + return roles.some(role => route.meta.roles.indexOf(role) >= 0) && route.meta.roles.indexOf(userDesign)<0; } - return roles.some(role => route.meta.roles.indexOf(role) >= 0); } else if (parentsRoles) { // 如果没有本级路由,有父级路由,则使用父级路由过滤 return roles.some(role => parentsRoles.indexOf(role) >= 0); @@ -107,7 +123,6 @@ const permission = { // 生成其他权限路由 GenerateRoutes({ commit }, data) { return new Promise(resolve => { - // debugger; const { roles } = convertRouterRoles(data); let accessedRouters; // if (roles.indexOf(superAdmin) >= 0) {