refactor(项目设置): 用户组与权限列表增加查看权限按钮

This commit is contained in:
shiziyuan9527 2022-01-14 17:28:06 +08:00 committed by 刘瑞斌
parent db86c635f5
commit c80497c3c7
6 changed files with 25 additions and 8 deletions

View File

@ -57,6 +57,7 @@
icon="el-icon-s-tools"
@exec="setPermission(scope.row)"
:disabled="flagChange(scope.row.scopeId ==='global')"/>
<ms-table-operator-button :tip="$t('group.view_permission')" icon="el-icon-view" @exec="viewPermission(scope.row)"/>
</template>
</ms-table-operator>
</div>
@ -164,6 +165,9 @@ export default {
return false;
}
},
viewPermission(row) {
this.$refs.editPermission.open(row, true, this.$t('group.view_permission'));
},
create() {
this.$refs.editUserGroup.open({}, 'create', this.$t('group.create'));
},

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" width="65%"
:title="$t('group.set_permission')"
:title="title"
:destroy-on-close="true"
v-loading="result.loading"
top="5%"
@ -35,7 +35,7 @@
prop="permissions"
:label="$t('group.permission')">
<template v-slot:default="scope">
<group-permission :permissions="scope.row.permissions" :selected.sync="tableData"/>
<group-permission :permissions="scope.row.permissions" :selected.sync="tableData" :read-only="readOnly"/>
</template>
</el-table-column>
<el-table-column
@ -43,7 +43,7 @@
:label="$t('group.check_all')">
<template v-slot:default="scope">
<div style="text-align: center;">
<el-checkbox @change="handleSelectAll($event, scope.row.permissions)"/>
<el-checkbox @change="handleSelectAll($event, scope.row.permissions)" :disabled="readOnly"/>
</div>
</template>
</el-table-column>
@ -51,7 +51,7 @@
</div>
<template v-slot:footer>
<el-button @click="cancel" size="medium">{{ $t('commons.cancel') }}</el-button>
<el-button type="primary" @click="onSubmit" size="medium" style="margin-top: 10px;margin-left: 5px;">
<el-button type="primary" @click="onSubmit" size="medium" style="margin-top: 10px;margin-left: 5px;" :disabled="readOnly">
{{ $t('commons.confirm') }}
</el-button>
</template>
@ -72,7 +72,9 @@ export default {
selected: [],
group: {},
result: {},
spanArr: []
spanArr: [],
readOnly: false,
title: this.$t('group.set_permission')
}
},
components: {
@ -84,7 +86,9 @@ export default {
}
},
methods: {
open(row) {
open(row, readOnly, title) {
this.readOnly = readOnly ? readOnly : false;
this.title = title ? title : this.$t('group.set_permission');
this.tableData = [];
this.spanArr = [];
this.dialogVisible = true;

View File

@ -2,11 +2,11 @@
<div>
<span v-for="(permission, index) in permissions" :key="index">
<el-checkbox v-if="permission.license" v-xpack class="permission-checkbox"
v-model="permission['checked']" @change="change($event, permission)">
v-model="permission['checked']" @change="change($event, permission)" :disabled="readOnly">
{{ $t(permission.name) }}
</el-checkbox>
<el-checkbox v-else class="permission-checkbox"
v-model="permission['checked']" @change="change($event, permission)">
v-model="permission['checked']" @change="change($event, permission)" :disabled="readOnly">
{{ $t(permission.name) }}
</el-checkbox>
</span>
@ -28,6 +28,12 @@ export default {
default() {
return []
}
},
readOnly: {
type: Boolean,
default() {
return false;
}
}
},
data() {

View File

@ -850,6 +850,7 @@ export default {
admin_not_allow_edit: 'admin not allow edit!',
admin_not_allow_delete: 'admin not allow delete!',
select_type: 'please select type',
view_permission: 'view permission',
system: 'System',
organization: 'Organization',
workspace: 'Workspace',

View File

@ -849,6 +849,7 @@ export default {
operator: '操作人',
description: '描述',
set_permission: '设置权限',
view_permission: '查看权限',
delete: '删除用户组',
edit: '编辑用户组',
admin_not_allow_edit: '系统管理员不支持编辑!',

View File

@ -849,6 +849,7 @@ export default {
operator: '操作人',
description: '描述',
set_permission: '設置權限',
view_permission: '查看權限',
delete: '刪除用戶組',
edit: '編輯用戶組',
admin_not_allow_edit: '系統管理員不支持編輯!',