refactor(用户组和权限): i18n

This commit is contained in:
shiziyuan9527 2021-06-04 18:03:23 +08:00 committed by 刘瑞斌
parent 87bd515c9d
commit cc24a21e48
7 changed files with 106 additions and 37 deletions

View File

@ -25,7 +25,7 @@ export default {
{
path: 'usergroup',
component: () => import('@/business/components/settings/system/group/UserGroup'),
meta: {system: true, title: '用户组与权限', permissions: ['SYSTEM_GROUP:READ', 'ORGANIZATION_GROUP:READ']}
meta: {system: true, title: 'group.group_permission', permissions: ['SYSTEM_GROUP:READ', 'ORGANIZATION_GROUP:READ']}
},
{
path: 'workspace/template/field',

View File

@ -1,6 +1,6 @@
<template>
<el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" width="65%"
title="设置权限"
:title="$t('group.set_permission')"
:destroy-on-close="true"
v-loading="result.loading"
top="5%"
@ -13,7 +13,7 @@
style="width: 100%">
<el-table-column
prop="type"
label="功能菜单"
:label="$t('group.functional_menu')"
width="180">
<template v-slot:default="scope">
<span v-if="scope.row.type !== 'PROJECT'">{{ userGroupType[scope.row.type] ? userGroupType[scope.row.type] : scope.row.type }}</span>
@ -22,7 +22,7 @@
</el-table-column>
<el-table-column
prop="resource"
label="操作对象"
:label="$t('group.operation_object')"
width="180">
<template v-slot:default="scope">
{{scope.row.resource.name}}
@ -30,14 +30,14 @@
</el-table-column>
<el-table-column
prop="permissions"
label="权限">
:label="$t('group.permission')">
<template v-slot:default="scope">
<group-permission :permissions="scope.row.permissions" :selected.sync="tableData"/>
</template>
</el-table-column>
<el-table-column
width="50px"
label="全选">
:label="$t('group.check_all')">
<template v-slot:default="scope">
<div style="text-align: center;">
<el-checkbox @change="handleSelectAll($event, scope.row.permissions)"/>
@ -46,8 +46,8 @@
</el-table-column>
</el-table>
</div>
<el-button type="primary" @click="onSubmit" size="small" style="margin-top: 10px;margin-left: 5px;">确定</el-button>
<el-button @click="cancel" size="small">取消</el-button>
<el-button type="primary" @click="onSubmit" size="small" style="margin-top: 10px;margin-left: 5px;">{{ $t('commons.confirm') }}</el-button>
<el-button @click="cancel" size="small">{{ $t('commons.cancel') }}</el-button>
</el-dialog>
</template>

View File

@ -5,36 +5,36 @@
<el-form ref="form" :model="form" label-width="auto" size="small" :rules="rules">
<el-row>
<el-col :span="11">
<el-form-item label="名称" prop="name">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
<el-form-item label="所属类型" prop="type">
<el-select v-model="form.type" placeholder="请选择所属类型" style="width: 100%" @change="changeGroup" :disabled="dialogType === 'edit'">
<el-option label="系统" value="SYSTEM"></el-option>
<el-option label="组织" value="ORGANIZATION"></el-option>
<el-option label="工作空间" value="WORKSPACE"></el-option>
<el-option label="项目" value="PROJECT"></el-option>
<el-form-item :label="$t('group.type')" prop="type">
<el-select v-model="form.type" :placeholder="$t('group.select_type')" style="width: 100%" @change="changeGroup" :disabled="dialogType === 'edit'">
<el-option :label="$t('group.system')" value="SYSTEM"></el-option>
<el-option :label="$t('group.organization')" value="ORGANIZATION"></el-option>
<el-option :label="$t('group.workspace')" value="WORKSPACE"></el-option>
<el-option :label="$t('group.project')" value="PROJECT"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="描述" prop="description">
<el-form-item :label="$t('group.description')" prop="description">
<el-input type="textarea" v-model="form.description"></el-input>
</el-form-item>
<el-form-item label="全局用户组">
<el-form-item :label="$t('group.global_group')">
<el-switch v-model="form.global" :disabled="dialogType === 'edit' || form.type === 'SYSTEM'" @change="change(form.global)"></el-switch>
</el-form-item>
<el-form-item label="所属组织" v-if="show" prop="scopeId">
<el-select v-model="form.scopeId" placeholder="请选择所属组织" style="width: 100%;" :disabled="dialogType === 'edit'" clearable>
<el-form-item :label="$t('group.belong_organization')" v-if="show" prop="scopeId">
<el-select v-model="form.scopeId" :placeholder="$t('group.select_belong_organization')" style="width: 100%;" :disabled="dialogType === 'edit'" clearable>
<el-option v-for="item in organizations" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">确定</el-button>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="onSubmit">{{ $t('commons.confirm') }}</el-button>
<el-button @click="cancel">{{ $t('commons.cancel') }}</el-button>
</el-form-item>
</el-form>
</el-dialog>
@ -54,31 +54,31 @@ export default {
},
rules: {
name: [
{required: true, message: '请输入名称', trigger: 'blur'},
{required: true, message: this.$t('commons.input_name'), trigger: 'blur'},
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'},
],
type: [
{required: true, message: '请选择所属类型', trigger: 'blur'},
{required: true, message: this.$t('group.select_type'), trigger: 'blur'},
],
description: [
{min: 2, max: 90, message: this.$t('commons.input_limit', [2, 90]), trigger: 'blur'},
],
scopeId: [
{required: true, message: '请选择所属组织', trigger: 'blur'},
{required: true, message: this.$t('group.select_belong_organization'), trigger: 'blur'},
]
},
dialogType: '',
isSystem: false,
show: true,
organizations: [],
title: '创建用户组'
title: this.$t('group.create')
}
},
props: {
dialogTitle: {
type: String,
default() {
return "创建用户组"
return this.$t('group.create')
}
}
},

View File

@ -3,18 +3,18 @@
<el-card>
<template v-slot:header>
<ms-table-header :create-permission="['SYSTEM_GROUP:READ+CREATE','ORGANIZATION_GROUP:READ+CREATE']" :condition.sync="condition" @search="initData" @create="create"
create-tip="创建用户组" title="用户组与权限" :have-search="false"/>
:create-tip="$t('group.create')" :title="$t('group.group_permission')" :have-search="false"/>
</template>
<el-table :data="groups" border class="adjust-table" style="width: 100%"
:height="screenHeight" @sort-change="sort">
<el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="type" label="所属类型">
<el-table-column prop="type" :label="$t('group.type')">
<template v-slot="scope">
<span>{{ userGroupType[scope.row.type] ? userGroupType[scope.row.type] : scope.row.type }}</span>
</template>
</el-table-column>
<el-table-column prop="scopeName" label="应用范围"/>
<el-table-column prop="scopeName" :label="$t('group.scope')"/>
<el-table-column prop="createTime" :label="$t('commons.create_time')" sortable>
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
@ -25,8 +25,8 @@
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="creator" label="操作人"/>
<el-table-column prop="description" label="描述"/>
<el-table-column prop="creator" :label="$t('group.operator')"/>
<el-table-column prop="description" :label="$t('group.description')"/>
<el-table-column :label="$t('commons.operating')" min-width="120">
<template v-slot:default="scope">
<div>
@ -37,7 +37,7 @@
<!-- <ms-table-operator-button tip="复制" icon="el-icon-document-copy" @exec="copy(scope.row)"/>-->
<ms-table-operator-button
v-permission="['SYSTEM_GROUP:READ+SETTING_PERMISSION', 'ORGANIZATION_GROUP:READ+SETTING_PERMISSION']"
tip="设置权限" icon="el-icon-s-tools" @exec="setPermission(scope.row)"/>
:tip="$t('group.set_permission')" icon="el-icon-s-tools" @exec="setPermission(scope.row)"/>
</template>
</ms-table-operator>
</div>
@ -51,7 +51,7 @@
<edit-user-group ref="editUserGroup" @refresh="initData"/>
<edit-permission ref="editPermission"/>
<ms-delete-confirm title="删除用户组" @delete="_handleDel" ref="deleteConfirm"/>
<ms-delete-confirm :title="$t('group.delete')" @delete="_handleDel" ref="deleteConfirm"/>
</div>
</template>
@ -107,14 +107,14 @@ export default {
});
},
create() {
this.$refs.editUserGroup.open({}, 'create', '创建用户组');
this.$refs.editUserGroup.open({}, 'create', this.$t('group.create'));
},
edit(row) {
if (row.id === "admin") {
this.$warning("系统管理员不支持编辑!");
this.$warning(this.$t('group.admin_not_allow_edit'));
return ;
}
this.$refs.editUserGroup.open(row, 'edit', '编辑用户组');
this.$refs.editUserGroup.open(row, 'edit', this.$t('group.edit'));
},
_handleDel(row) {
this.result = this.$get("/user/group/delete/" + row.id, () => {
@ -124,7 +124,7 @@ export default {
},
del(row) {
if (row.system) {
this.$warning("系统用户组不支持删除!");
this.$warning(this.$t('group.admin_not_allow_delete'));
return ;
}
this.$refs.deleteConfirm.open(row);

View File

@ -474,6 +474,29 @@ export default {
},
group: {
add: 'Add User Group',
group_permission: 'Group Permission',
create: 'Create',
type: 'Type',
scope: 'Scope',
operator: 'Operator',
description: 'Description',
set_permission: 'Set Permission',
delete: 'Delete',
edit: 'Edit',
admin_not_allow_edit: 'admin not allow edit!',
admin_not_allow_delete: 'admin not allow delete!',
select_type: 'please select type',
system: 'System',
organization: 'Organization',
workspace: 'Workspace',
project: 'Project',
global_group: 'Global Group',
belong_organization: 'Belong Organization',
select_belong_organization: 'please select belong organization',
functional_menu: 'Functional Menu',
operation_object: 'Operation Object',
check_all: 'ALL',
permission: 'Permission'
},
role: {
please_choose_role: 'Please Choose Role',

View File

@ -472,6 +472,29 @@ export default {
},
group: {
add: '添加用户组',
group_permission: '用户组与权限',
create: '创建用户组',
type: '所属类型',
scope: '应用范围',
operator: '操作人',
description: '描述',
set_permission: '设置权限',
delete: '删除用户组',
edit: '编辑用户组',
admin_not_allow_edit: '系统管理员不支持编辑!',
admin_not_allow_delete: '系统用户组不支持删除!',
select_type: '请选择所属类型',
system: '系统',
organization: '组织',
workspace: '工作空间',
project: '项目',
global_group: '全局用户组',
belong_organization: '所属组织',
select_belong_organization: '请选择所属组织',
functional_menu: '功能菜单',
operation_object: '操作对象',
check_all: '全选',
permission: '权限'
},
role: {
please_choose_role: '请选择角色',

View File

@ -472,6 +472,29 @@ export default {
},
group: {
add: '添加用戶組',
group_permission: '用戶組與權限',
create: '創建用戶組',
type: '所屬類型',
scope: '應用範圍',
operator: '操作人',
description: '描述',
set_permission: '設置權限',
delete: '刪除用戶組',
edit: '編輯用戶組',
admin_not_allow_edit: '系統管理員不支持編輯!',
admin_not_allow_delete: '系統用戶組不支持刪除!',
select_type: '請選擇所屬類型',
system: '系統',
organization: '組織',
workspace: '工作空間',
project: '項目',
global_group: '全局用戶組',
belong_organization: '所屬組織',
select_belong_organization: '請選擇所屬組織',
functional_menu: '功能菜單',
operation_object: '操作對象',
check_all: '全選',
permission: '權限'
},
role: {
please_choose_role: '請選擇角色',