fix(用户组与权限): 权限编辑

This commit is contained in:
shiziyuan9527 2022-12-13 11:02:06 +08:00 committed by lyh
parent 0aac4ed341
commit d0cf2b0b33
2 changed files with 14 additions and 12 deletions

View File

@ -108,12 +108,14 @@
{ {
"id": "SYSTEM_QUOTA:READ", "id": "SYSTEM_QUOTA:READ",
"name": "permission.system_quota.read", "name": "permission.system_quota.read",
"resourceId": "SYSTEM_QUOTA" "resourceId": "SYSTEM_QUOTA",
"license": true
}, },
{ {
"id": "SYSTEM_QUOTA:READ+EDIT", "id": "SYSTEM_QUOTA:READ+EDIT",
"name": "permission.system_quota.edit", "name": "permission.system_quota.edit",
"resourceId": "SYSTEM_QUOTA" "resourceId": "SYSTEM_QUOTA",
"license": true
}, },
{ {
"id": "SYSTEM_AUTH:READ", "id": "SYSTEM_AUTH:READ",
@ -337,7 +339,8 @@
}, },
{ {
"id": "SYSTEM_QUOTA", "id": "SYSTEM_QUOTA",
"name": "permission.system_quota.name" "name": "permission.system_quota.name",
"license": true
}, },
{ {
"id": "SYSTEM_AUTH", "id": "SYSTEM_AUTH",

View File

@ -1,12 +1,11 @@
<template> <template>
<div> <div>
<span v-for="(permission, index) in permissions" :key="index"> <span v-for="(permission, index) in permissions" :key="index">
<el-checkbox v-if="permission.license" v-xpack class="permission-checkbox" <el-checkbox
v-model="permission['checked']" @change="change($event, permission)" :disabled="readOnly"> class="permission-checkbox"
{{ $t(permission.name) }} v-model="permission['checked']"
</el-checkbox> @change="change($event, permission)"
<el-checkbox v-else class="permission-checkbox" :disabled="isReadOnly(permission)">
v-model="permission['checked']" @change="change($event, permission)" :disabled="isReadOnly(permission)">
{{ $t(permission.name) }} {{ $t(permission.name) }}
</el-checkbox> </el-checkbox>
</span> </span>
@ -20,13 +19,13 @@ export default {
permissions: { permissions: {
type: Array, type: Array,
default() { default() {
return [] return [];
} }
}, },
selected: { selected: {
type: Array, type: Array,
default() { default() {
return [] return [];
} }
}, },
readOnly: { readOnly: {
@ -45,7 +44,7 @@ export default {
computed: { computed: {
isReadOnly() { isReadOnly() {
return function (permission) { return function (permission) {
// //
const isSystemGroupPermission = permission.id === 'SYSTEM_GROUP:READ' || permission.id === 'SYSTEM_GROUP:READ+SETTING_PERMISSION'; const isSystemGroupPermission = permission.id === 'SYSTEM_GROUP:READ' || permission.id === 'SYSTEM_GROUP:READ+SETTING_PERMISSION';
const isDefaultSystemGroup = (this.group.id === 'admin' || this.group.id === 'super_group') && isSystemGroupPermission; const isDefaultSystemGroup = (this.group.id === 'admin' || this.group.id === 'super_group') && isSystemGroupPermission;
return this.readOnly || isDefaultSystemGroup; return this.readOnly || isDefaultSystemGroup;