refactor(用户组和权限): 权限显示优化
This commit is contained in:
parent
f5092b9cdd
commit
8a87431476
|
@ -858,11 +858,11 @@
|
|||
},
|
||||
{
|
||||
"id": "PROJECT_PERFORMANCE_TEST",
|
||||
"name": "性能测试"
|
||||
"name": "测试"
|
||||
},
|
||||
{
|
||||
"id": "PROJECT_PERFORMANCE_REPORT",
|
||||
"name": "性能测试报告"
|
||||
"name": "报告"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -16,7 +16,8 @@
|
|||
label="功能菜单"
|
||||
width="180">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ userGroupType[scope.row.type] ? userGroupType[scope.row.type] : scope.row.type }}</span>
|
||||
<span v-if="scope.row.type !== 'PROJECT'">{{ userGroupType[scope.row.type] ? userGroupType[scope.row.type] : scope.row.type }}</span>
|
||||
<span v-else>{{_computedMenuName(scope.row.resource)}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
@ -44,7 +45,7 @@
|
|||
<script>
|
||||
import GroupOperator from "@/business/components/settings/system/group/GroupOperator";
|
||||
import GroupPermission from "@/business/components/settings/system/group/GroupPermission";
|
||||
import {USER_GROUP_SCOPE} from "@/common/js/table-constants";
|
||||
import {PROJECT_GROUP_SCOPE, USER_GROUP_SCOPE} from "@/common/js/table-constants";
|
||||
|
||||
export default {
|
||||
name: "EditPermission",
|
||||
|
@ -83,13 +84,26 @@ export default {
|
|||
let data = result.data;
|
||||
if (data) {
|
||||
this.tableData = data.permissions;
|
||||
this._getUniteMenu();
|
||||
}
|
||||
})
|
||||
},
|
||||
_getUniteMenu() {
|
||||
let menu = ['TRACK', 'API', 'PERFORMANCE'];
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
if (i === 0) {
|
||||
this.spanArr.push(1);
|
||||
this.pos = 0
|
||||
} else {
|
||||
// 判断当前元素与上一个元素是否相同
|
||||
if (this.tableData[i].type === this.tableData[i - 1].type) {
|
||||
let sign = false;
|
||||
if (this.tableData[i].type !== 'PROJECT') {
|
||||
sign = this.tableData[i].type === this.tableData[i - 1].type;
|
||||
} else {
|
||||
sign = !menu.includes(this.tableData[i].resource.id.split('_')[1]) ?
|
||||
true : this.tableData[i].resource.id.split('_')[1] === this.tableData[i - 1].resource.id.split('_')[1]
|
||||
}
|
||||
if (sign) {
|
||||
this.spanArr[this.pos] += 1;
|
||||
this.spanArr.push(0);
|
||||
} else {
|
||||
|
@ -98,8 +112,9 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
_computedMenuName(resource) {
|
||||
return PROJECT_GROUP_SCOPE[resource.id.split('_')[1]] ? PROJECT_GROUP_SCOPE[resource.id.split('_')[1]] : '项目';
|
||||
},
|
||||
onSubmit() {
|
||||
let param = {};
|
||||
|
|
|
@ -97,3 +97,9 @@ export const USER_GROUP_SCOPE = {
|
|||
'WORKSPACE': '工作空间',
|
||||
'PROJECT': '项目'
|
||||
}
|
||||
|
||||
export const PROJECT_GROUP_SCOPE = {
|
||||
'TRACK': '测试跟踪',
|
||||
'API': '接口测试',
|
||||
'PERFORMANCE': '性能测试'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue