代码调整
This commit is contained in:
parent
6fcba825f2
commit
595747be2a
@ -42,7 +42,7 @@ export default {
|
||||
{
|
||||
name: 'global.scan',
|
||||
handle: this.qcodeEntry,
|
||||
hidden: process.env.NODE_ENV != 'development' || getSessionStorage('project') === 'design'
|
||||
hidden: process.env.NODE_ENV != 'development' || getSessionStorage('project').startsWith('design')
|
||||
},
|
||||
{
|
||||
name: 'global.quickEntry',
|
||||
@ -50,7 +50,7 @@ export default {
|
||||
hidden: getSessionStorage('project').startsWith('design')
|
||||
},
|
||||
{
|
||||
name: LangStorage.getLang('zh')==='zh'?'English':'中文',
|
||||
name: LangStorage.getLang('zh') === 'zh' ? 'English' : '中文',
|
||||
handle: this.switchLanguage,
|
||||
tip: true
|
||||
}
|
||||
@ -106,13 +106,13 @@ export default {
|
||||
path = '/design/login';
|
||||
break;
|
||||
case 'xty':
|
||||
path='/designxty/login';
|
||||
path = '/designxty/login';
|
||||
break;
|
||||
case 'design':
|
||||
path = '/login';
|
||||
break;
|
||||
case 'designxty':
|
||||
path= '/xty/login';
|
||||
path = '/xty/login';
|
||||
break;
|
||||
}
|
||||
return path;
|
||||
|
@ -68,9 +68,6 @@ function handleRoute(to, from, next, routeInfo) {
|
||||
store.dispatch('GetInfo', routeInfo.getTokenInfo).then(res => {
|
||||
// 根据roles权限生成可访问的路由表
|
||||
const roles = res.roles;
|
||||
if (getSessionStorage('project').startsWith('design')) {
|
||||
roles.push(userDesign);
|
||||
}
|
||||
store.dispatch('GenerateRoutes', { roles, clientId: routeInfo.clientId }).then(() => {
|
||||
// 动态添加可访问路由表
|
||||
router.addRoutes(store.getters.addRouters);
|
||||
|
@ -28,37 +28,15 @@ function hasPermission(roles, route, parentsRoles) {
|
||||
setHonePagePath(route, roles);
|
||||
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 = 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('project').startsWith('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 ));
|
||||
const result = roles.filter(role => route.meta.roles.indexOf(role) >= 0) || [];
|
||||
return result.length;
|
||||
} else {
|
||||
roles= roles.filter(function (role) {
|
||||
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) && route.meta.roles.indexOf(userDesign) < 0;
|
||||
}
|
||||
} else if (parentsRoles) {
|
||||
// 如果没有本级路由,有父级路由,则使用父级路由过滤
|
||||
@ -95,7 +73,7 @@ function convertRouterRoles({ roles, permissionType }) {
|
||||
*/
|
||||
function filterAsyncRouter(asyncRouter, roles, parentsRoles) {
|
||||
return asyncRouter.filter(route => {
|
||||
if (route.name === '大屏系统' && roles.indexOf(admin)===-1 && roles.indexOf(userScreen) ===-1) {
|
||||
if (route.name === '大屏系统' && roles.indexOf(admin) === -1 && roles.indexOf(userScreen) === -1) {
|
||||
route.hidden = true;
|
||||
}
|
||||
if (hasPermission(roles, route, parentsRoles)) {
|
||||
|
@ -407,7 +407,7 @@ export default {
|
||||
name: 'systermOut',
|
||||
params: {
|
||||
width: 600,
|
||||
contextList: resp.data
|
||||
contextList: resp.data.length > 0 ? resp.data : ['检查成功']
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
|
@ -12,7 +12,7 @@
|
||||
<div v-if="isNotUser" class="li_plan" @click="handleModifyingTask">{{ $t('planMonitor.modifyTask') }}</div>
|
||||
</ul>
|
||||
<ul class="ul-box tool">
|
||||
<div v-if="isNotUser" class="li_plan" @click="handlePlanEffectiveCheck">{{ $t('planMonitor.validityCheck') }}</div>
|
||||
<div class="li_plan" @click="handlePlanEffectiveCheck">{{ $t('planMonitor.validityCheck') }}</div>
|
||||
<div class="li_plan" @click="handleTestRunPlan">{{ $t('planMonitor.testRunning') }}</div>
|
||||
</ul>
|
||||
</div>
|
||||
@ -117,11 +117,11 @@ export default {
|
||||
name: 'systermOut',
|
||||
params: {
|
||||
width: 600,
|
||||
contextList: resp.data
|
||||
contextList: resp.data.length > 0 ? resp.data : ['检查成功']
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.runGraphVerificationFailed'));
|
||||
}).catch(error => {
|
||||
this.$messageBox(error.message + ' ' + this.$t('tip.runGraphVerificationFailed'));
|
||||
});
|
||||
} else {
|
||||
this.$messageBox(this.$t('tip.selectARunGraphFirst'));
|
||||
|
Loading…
Reference in New Issue
Block a user