refactor: i18n
This commit is contained in:
parent
00e1d00668
commit
10e3fbecac
|
@ -99,7 +99,7 @@
|
|||
</el-dialog>
|
||||
<user-import ref="userImportDialog" @refreshAll="search"></user-import>
|
||||
<project-cascader :title="batchAddTitle" @confirm="cascaderConfirm" ref="cascaderDialog"></project-cascader>
|
||||
<group-cascader :title="'批量添加用户组'" @confirm="cascaderConfirm" ref="groupCascaderDialog"></group-cascader>
|
||||
<group-cascader :title="$t('user.add_user_group_batch')" @confirm="cascaderConfirm" ref="groupCascaderDialog"></group-cascader>
|
||||
<edit-user ref="editUser" @refresh="search"/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -168,9 +168,7 @@ export default {
|
|||
createPath: '/user/special/add',
|
||||
updatePath: '/user/special/update',
|
||||
editPasswordPath: '/user/special/password',
|
||||
batchAddTitle: "批量选择项目",
|
||||
batchAddProjectOptions:[],
|
||||
batchAddUserRoleOptions:[],
|
||||
batchAddTitle: this.$t('user.add_project_batch'),
|
||||
result: {},
|
||||
currentUserId: '',
|
||||
createVisible: false,
|
||||
|
@ -196,10 +194,10 @@ export default {
|
|||
ruleForm: {},
|
||||
buttons: [
|
||||
{
|
||||
name: "批量添加到项目", handleClick: this.addToProjectBatch
|
||||
name: this.$t('user.add_project_batch'), handleClick: this.addToProjectBatch
|
||||
},
|
||||
{
|
||||
name: "批量添加用户组", handleClick: this.addUserGroupBatch
|
||||
name: this.$t('user.add_user_group_batch'), handleClick: this.addUserGroupBatch
|
||||
}
|
||||
],
|
||||
rule: {
|
||||
|
@ -276,10 +274,10 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
create() {
|
||||
this.$refs.editUser.open("Add", "创建用户");
|
||||
this.$refs.editUser.open("Add", this.$t('user.create'));
|
||||
},
|
||||
edit(row) {
|
||||
this.$refs.editUser.open("Edit", "修改用户", row);
|
||||
this.$refs.editUser.open("Edit", this.$t('user.modify'), row);
|
||||
},
|
||||
editPassword(row) {
|
||||
this.editPasswordVisible = true;
|
||||
|
@ -442,10 +440,10 @@ export default {
|
|||
toggleAllSelection(this.$refs.userTable, this.tableData, this.selectRows);
|
||||
},
|
||||
addToProjectBatch(){
|
||||
this.$refs.cascaderDialog.open('ADD_PROJECT',this.batchAddProjectOptions);
|
||||
this.$refs.cascaderDialog.open();
|
||||
},
|
||||
addUserGroupBatch(){
|
||||
this.$refs.groupCascaderDialog.open('ADD_USER_GROUP',this.batchAddUserRoleOptions);
|
||||
this.$refs.groupCascaderDialog.open();
|
||||
},
|
||||
cascaderConfirm(batchProcessTypeParam, selectValueArr){
|
||||
if(selectValueArr.length === 0){
|
||||
|
@ -458,10 +456,19 @@ export default {
|
|||
this.$post('/user/special/batchProcessUserInfo', params, () => {
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.search();
|
||||
batchProcessTypeParam === "ADD_PROJECT" ? this.$refs.cascaderDialog.close() :
|
||||
this.$refs.groupCascaderDialog.close();
|
||||
this.cascaderClose(batchProcessTypeParam);
|
||||
}, () => {
|
||||
this.cascaderRequestError(batchProcessTypeParam);
|
||||
});
|
||||
},
|
||||
cascaderRequestError(type) {
|
||||
type === "ADD_PROJECT" ? this.$refs.cascaderDialog.loading = false :
|
||||
this.$refs.groupCascaderDialog.loading = false;
|
||||
},
|
||||
cascaderClose(type) {
|
||||
type === "ADD_PROJECT" ? this.$refs.cascaderDialog.close() :
|
||||
this.$refs.groupCascaderDialog.close();
|
||||
},
|
||||
buildBatchParam(param) {
|
||||
param.ids = Array.from(this.selectRows).map(row => row.id);
|
||||
param.projectId = getCurrentProjectID();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-dialog class="user-cascade" :title="title" :visible.sync="dialogVisible"
|
||||
@close="close">
|
||||
@close="close" v-loading="loading">
|
||||
<div class="block">
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm">
|
||||
<el-form-item prop="project" label-width="0px">
|
||||
|
@ -37,7 +37,7 @@ export default {
|
|||
let validateSelect = (rule, value, callback) => {
|
||||
let checkNodes = this.$refs.cascadeSelector.getCheckedNodes(true);
|
||||
if (checkNodes.length === 0) {
|
||||
callback(new Error("请选择项目"));
|
||||
callback(new Error(this.$t('user.select_group')));
|
||||
}
|
||||
callback();
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ export default {
|
|||
},
|
||||
rules: {
|
||||
project: [
|
||||
{validator: validateSelect, message: "请选择项目", trigger: 'change'}
|
||||
{validator: validateSelect, message: this.$t('user.select_group'), trigger: 'change'}
|
||||
],
|
||||
},
|
||||
selectedIds: [],
|
||||
|
@ -70,9 +70,7 @@ export default {
|
|||
}
|
||||
},
|
||||
dialogVisible: false,
|
||||
isLoading: false,
|
||||
batchProcessType: '',
|
||||
options: [],
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -84,22 +82,16 @@ export default {
|
|||
methods: {
|
||||
close() {
|
||||
removeGoBackListener(this.close);
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
this.selectedIds = [];
|
||||
++this.isResourceShow;
|
||||
this.options = [];
|
||||
this.$refs['ruleForm'].resetFields();
|
||||
},
|
||||
open(batchProcessType, optionsParam) {
|
||||
open() {
|
||||
listenGoBack(this.close);
|
||||
this.dialogVisible = true;
|
||||
this.batchProcessType = batchProcessType;
|
||||
this.options = optionsParam;
|
||||
if (this.batchProcessType === 'ADD_PROJECT') {
|
||||
this.rules.project[0].message = "请选择项目";
|
||||
} else {
|
||||
this.rules.project[0].message = "请选择用户组";
|
||||
}
|
||||
this.rules.project[0].message = this.$t('user.select_group');
|
||||
},
|
||||
confirm() {
|
||||
this.$refs.ruleForm.validate((valid) => {
|
||||
|
@ -115,7 +107,8 @@ export default {
|
|||
}
|
||||
selectValueArr.push(idString);
|
||||
}
|
||||
this.$emit('confirm', this.batchProcessType, selectValueArr)
|
||||
this.$emit('confirm', 'ADD_USER_GROUP', selectValueArr);
|
||||
this.loading = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<el-dialog class="user-cascade" :title="title" :visible.sync="dialogVisible"
|
||||
@close="close">
|
||||
@close="close" v-loading="loading">
|
||||
<div class="block">
|
||||
<el-alert
|
||||
title="默认为成员添加只读用户组(系统)"
|
||||
:title="$t('user.add_project_batch_tip')"
|
||||
type="info"
|
||||
show-icon
|
||||
:closable="false"
|
||||
|
@ -43,7 +43,7 @@ export default {
|
|||
let validateSelect = (rule, value, callback) => {
|
||||
let checkNodes = this.$refs.cascadeSelector.getCheckedNodes(true);
|
||||
if (checkNodes.length === 0) {
|
||||
callback(new Error("请选择项目"));
|
||||
callback(new Error(this.$t('user.select_project')));
|
||||
}
|
||||
callback();
|
||||
};
|
||||
|
@ -54,7 +54,7 @@ export default {
|
|||
},
|
||||
rules: {
|
||||
project: [
|
||||
{validator: validateSelect, message: "请选择项目", trigger: 'change'}
|
||||
{validator: validateSelect, message: this.$t('user.select_project'), trigger: 'change'}
|
||||
],
|
||||
},
|
||||
selectedIds: [],
|
||||
|
@ -78,9 +78,7 @@ export default {
|
|||
}
|
||||
},
|
||||
dialogVisible: false,
|
||||
isLoading: false,
|
||||
batchProcessType: '',
|
||||
options: [],
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -92,22 +90,16 @@ export default {
|
|||
methods: {
|
||||
close() {
|
||||
removeGoBackListener(this.close);
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
this.selectedIds = [];
|
||||
++this.isResourceShow;
|
||||
this.options = [];
|
||||
this.$refs['ruleForm'].resetFields();
|
||||
},
|
||||
open(batchProcessType, optionsParam) {
|
||||
open() {
|
||||
listenGoBack(this.close);
|
||||
this.dialogVisible = true;
|
||||
this.batchProcessType = batchProcessType;
|
||||
this.options = optionsParam;
|
||||
if (this.batchProcessType === 'ADD_PROJECT') {
|
||||
this.rules.project[0].message = "请选择项目";
|
||||
} else {
|
||||
this.rules.project[0].message = "请选择用户组";
|
||||
}
|
||||
this.rules.project[0].message = this.$t('user.select_project');
|
||||
},
|
||||
confirm() {
|
||||
this.$refs.ruleForm.validate((valid) => {
|
||||
|
@ -117,7 +109,8 @@ export default {
|
|||
for (let i = 0; i < checkNodes.length; i++) {
|
||||
selectValueArr.push(checkNodes[i].value);
|
||||
}
|
||||
this.$emit('confirm', this.batchProcessType, selectValueArr)
|
||||
this.$emit('confirm', 'ADD_PROJECT', selectValueArr);
|
||||
this.loading = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -472,7 +472,12 @@ export default {
|
|||
button: {
|
||||
add_workspace_batch: 'Batch add user to workspace',
|
||||
add_user_role_batch: 'Batch add user role',
|
||||
}
|
||||
},
|
||||
select_project: 'please select project',
|
||||
select_group: 'please select group',
|
||||
add_user_group_batch: 'Batch Add User Group',
|
||||
add_project_batch : 'Batch Add User To Project',
|
||||
add_project_batch_tip: 'Add a read-only user group for members by default (system)',
|
||||
},
|
||||
group: {
|
||||
add: 'Add User Group',
|
||||
|
|
|
@ -470,7 +470,12 @@ export default {
|
|||
button: {
|
||||
add_workspace_batch: '批量添加到工作空间',
|
||||
add_user_role_batch: '批量添加角色',
|
||||
}
|
||||
},
|
||||
select_project: '请选择项目',
|
||||
select_group: '请选择用户组',
|
||||
add_user_group_batch: '批量添加用户组',
|
||||
add_project_batch : '批量添加到项目',
|
||||
add_project_batch_tip: '默认为成员添加只读用户组(系统)',
|
||||
},
|
||||
group: {
|
||||
add: '添加用户组',
|
||||
|
|
|
@ -470,7 +470,12 @@ export default {
|
|||
button: {
|
||||
add_workspace_batch: '批量添加到工作空間',
|
||||
add_user_role_batch: '批量添加角色',
|
||||
}
|
||||
},
|
||||
select_project: '請選擇項目',
|
||||
select_group: '請選擇用戶組',
|
||||
add_user_group_batch: '批量添加用戶組',
|
||||
add_project_batch : '批量添加到項目',
|
||||
add_project_batch_tip: '默認為成員添加只讀用戶組(系統)',
|
||||
},
|
||||
group: {
|
||||
add: '添加用戶組',
|
||||
|
|
Loading…
Reference in New Issue