菜单国际化

This commit is contained in:
shiziyuan9527 2020-03-03 17:05:22 +08:00
parent 5a9d52a1b0
commit a1ba010375
9 changed files with 165 additions and 125 deletions

View File

@ -29,6 +29,8 @@ export default {
'email': 'Email', 'email': 'Email',
'phone': 'Phone', 'phone': 'Phone',
'role': 'Role', 'role': 'Role',
'personal_info': 'Personal Info',
'status': 'Enable/Disable',
}, },
workspace: { workspace: {
'create': 'Create Workspace', 'create': 'Create Workspace',
@ -62,6 +64,23 @@ export default {
'modify': 'Modify', 'modify': 'Modify',
'delete_confirm': 'Are you sure you want to delete this Member?', 'delete_confirm': 'Are you sure you want to delete this Member?',
'please_choose_member': 'Please Choose Member', 'please_choose_member': 'Please Choose Member',
'search_by_name': 'Search by name',
'modify_personal_info': 'Modify Personal Information',
'input_name': 'Please enter a user name',
'special_characters_are_not_supported': 'Special characters are not supported',
'mobile_number_format_is_incorrect': 'Mobile number format is incorrect',
'email_format_is_incorrect': 'Email format is incorrect',
},
user: {
'create': 'Create',
'modify': 'Modify',
'input_name': 'Please enter a user name',
'input_id': 'Please enter a ID',
'input_email': 'Please enter a email',
'special_characters_are_not_supported': 'Special characters are not supported',
'mobile_number_format_is_incorrect': 'Mobile number format is incorrect',
'email_format_is_incorrect': 'Email format is incorrect',
'delete_confirm': 'Are you sure you want to delete this User?',
}, },
role: { role: {
'please_choose_role': 'Please Choose Role', 'please_choose_role': 'Please Choose Role',

View File

@ -29,6 +29,8 @@ export default {
'email': '邮箱', 'email': '邮箱',
'phone': '电话', 'phone': '电话',
'role': '角色', 'role': '角色',
'personal_info': '个人信息',
'status': '启用/禁用',
}, },
workspace: { workspace: {
'create': '创建工作空间', 'create': '创建工作空间',
@ -62,6 +64,24 @@ export default {
'modify': '修改成员', 'modify': '修改成员',
'delete_confirm': '这个用户确定要删除吗?', 'delete_confirm': '这个用户确定要删除吗?',
'please_choose_member': '请选择成员', 'please_choose_member': '请选择成员',
'search_by_name': '根据名称搜索',
'modify_personal_info': '修改个人信息',
'input_name': '请输入名称',
'input_email': '请输入邮箱',
'special_characters_are_not_supported': '不支持特殊字符',
'mobile_number_format_is_incorrect': '手机号码格式不正确',
'email_format_is_incorrect': '邮箱格式不正确',
},
user: {
'create': '创建用户',
'modify': '修改用户',
'input_name': '请输入用户名',
'input_id': '请输入ID',
'input_email': '请输入邮箱',
'special_characters_are_not_supported': '不支持特殊字符',
'mobile_number_format_is_incorrect': '手机号码格式不正确',
'email_format_is_incorrect': '邮箱格式不正确',
'delete_confirm': '这个用户确定要删除吗?',
}, },
role: { role: {
'please_choose_role': '请选择角色', 'please_choose_role': '请选择角色',

View File

@ -3,20 +3,21 @@
<el-card> <el-card>
<div slot="header"> <div slot="header">
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">成员 <span class="title">{{$t('commons.member')}}
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
</span> </span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据用户名搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" :placeholder="$t('member.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60" v-model="condition" @change="search" clearable/> maxlength="60" v-model="condition" @change="search" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column prop="name" label="用户名"/> <el-table-column prop="name" :label="$t('commons.username')"/>
<el-table-column prop="email" label="邮箱"/> <el-table-column prop="email" :label="$t('commons.email')"/>
<el-table-column prop="phone" label="电话"/> <el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column prop="roles" label="角色" width="140"> <el-table-column prop="roles" :label="$t('commons.role')" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark"> <el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark">
{{ role.name }} {{ role.name }}
@ -49,10 +50,10 @@
</div> </div>
</el-card> </el-card>
<el-dialog title="添加成员" :visible.sync="createVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <el-dialog :title="$t('member.create')" :visible.sync="createVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small"> <el-form :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small">
<el-form-item label="成员" prop="userIds"> <el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="form.userIds" multiple placeholder="请选择成员" class="select-width"> <el-select v-model="form.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option <el-option
v-for="item in form.userList" v-for="item in form.userList"
:key="item.id" :key="item.id"
@ -63,8 +64,8 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="角色" prop="roleIds"> <el-form-item :label="$t('commons.role')" prop="roleIds">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色" class="select-width"> <el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option <el-option
v-for="item in form.roles" v-for="item in form.roles"
:key="item.id" :key="item.id"
@ -75,26 +76,26 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('form')" size="medium">保存</el-button> <el-button type="primary" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="修改成员" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <el-dialog :title="$t('member.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" ref="updateUserForm"> <el-form :model="form" label-position="left" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/> <el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="用户名" prop="name"> <el-form-item :label="$t('commons.username')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item :label="$t('commons.email')" prop="email">
<el-input v-model="form.email" autocomplete="off"/> <el-input v-model="form.email" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="角色" prop="roleIds"> <el-form-item :label="$t('commons.role')" prop="roleIds">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色" class="select-width"> <el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option <el-option
v-for="item in form.allroles" v-for="item in form.allroles"
:key="item.id" :key="item.id"
@ -105,7 +106,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateOrgMember('updateUserForm')" size="medium">保存</el-button> <el-button type="primary" @click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
@ -124,7 +125,7 @@
data() { data() {
return { return {
result: {}, result: {},
btnTips: "添加组织成员", btnTips: this.$t('member.create'),
createVisible: false, createVisible: false,
updateVisible: false, updateVisible: false,
form: {}, form: {},
@ -133,10 +134,10 @@
tableData: [], tableData: [],
rules: { rules: {
userIds: [ userIds: [
{required: true, message: '请选择成员', trigger: ['blur']} {required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
], ],
roleIds: [ roleIds: [
{required: true, message: '请选择角色', trigger: ['blur']} {required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
] ]
}, },
multipleSelection: [], multipleSelection: [],
@ -208,29 +209,29 @@
this.result = this.$post("/organization/member/update", param,() => { this.result = this.$post("/organization/member/update", param,() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '修改成功!' message: this.$t('commons.modify_success')
}); });
this.updateVisible = false; this.updateVisible = false;
this.initTableData(); this.initTableData();
}); });
}, },
del(row) { del(row) {
this.$confirm('是否删除用户 ' + row.name + ' ?', '', { this.$confirm(this.$t('member.delete_confirm'), '', {
confirmButtonText: '确定', confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.result = this.$get('/user/orgmember/delete/' + this.currentUser().lastOrganizationId + '/' + row.id, () => { this.result = this.$get('/user/orgmember/delete/' + this.currentUser().lastOrganizationId + '/' + row.id, () => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: this.$t('commons.delete_success')
}); });
this.initTableData(); this.initTableData();
}); });
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: this.$t('commons.delete_cancel')
}); });
}); });
}, },

View File

@ -3,19 +3,19 @@
<el-card v-loading="result.loading"> <el-card v-loading="result.loading">
<div slot="header"> <div slot="header">
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title"> <span class="title">{{$t('commons.workspace')}}
工作空间
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
</span> </span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" :placeholder="$t('workspace.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60" v-model="condition" clearable/> maxlength="60" v-model="condition" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
<el-table :data="items" style="width: 100%"> <el-table :data="items" style="width: 100%">
<el-table-column prop="name" label="名称"/> <el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" label="描述"/> <el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column :label="$t('commons.member')"> <el-table-column :label="$t('commons.member')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}</el-button> <el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}</el-button>
@ -47,17 +47,17 @@
</div> </div>
</el-card> </el-card>
<el-dialog title="创建工作空间" :visible.sync="createVisible" width="30%"> <el-dialog :title="$t('workspace.create')" :visible.sync="createVisible" width="30%">
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small"> <el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
<el-form-item label="名称" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="描述"> <el-form-item :label="$t('commons.description')">
<el-input type="textarea" v-model="form.description"></el-input> <el-input type="textarea" v-model="form.description"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit('form')" size="medium">创建</el-button> <el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -209,7 +209,7 @@
this.$post("/workspace/" + saveType, this.form, () => { this.$post("/workspace/" + saveType, this.form, () => {
this.createVisible = false; this.createVisible = false;
this.list(); this.list();
Message.success('保存成功'); Message.success(this.$t('commons.save_success'));
}); });
} else { } else {
return false; return false;
@ -229,13 +229,13 @@
// }); // });
}, },
del(row) { del(row) {
this.$confirm('这个工作空间确定要删除吗?', '提示', { this.$confirm(this.$t('workspace.delete_confirm'), '', {
confirmButtonText: '确定', confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$get('/workspace/delete/' + row.id, () => { this.$get('/workspace/delete/' + row.id, () => {
Message.success('删除成功'); Message.success(this.$t('commons.delete_success'));
this.list(); this.list();
}); });
}).catch(() => { }).catch(() => {
@ -423,8 +423,8 @@
}, },
rules: { rules: {
name: [ name: [
{required: true, message: '请输入工作空间名称', trigger: 'blur'}, {required: true, message: this.$t('workspace.input_name'), trigger: 'blur'},
{min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur'} {min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
] ]
}, },
wsMemberRule: { wsMemberRule: {

View File

@ -4,44 +4,44 @@
<div slot="header"> <div slot="header">
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">个人信息</span> <span class="title">{{$t('commons.personal_info')}}</span>
</el-row> </el-row>
</div> </div>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID"/> <el-table-column prop="id" label="ID"/>
<el-table-column prop="name" label="用户名" width="120"/> <el-table-column prop="name" :label="$t('commons.username')" width="120"/>
<el-table-column prop="email" label="邮箱"/> <el-table-column prop="email" :label="$t('commons.email')"/>
<el-table-column prop="phone" label="电话"/> <el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column prop="createTime" label="创建时间" width="180"> <el-table-column prop="createTime" :label="$t('commons.create_time')" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column :label="$t('commons.operating')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/> <el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog title="修改个人信息" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <el-dialog :title="$t('member.modify_personal_info')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateUserForm"> <el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/> <el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="用户名" prop="name"> <el-form-item :label="$t('commons.username')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item :label="$t('commons.email')" prop="email">
<el-input v-model="form.email" autocomplete="off"/> <el-input v-model="form.email" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateUser('updateUserForm')" size="medium">修改</el-button> <el-button type="primary" @click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -62,12 +62,12 @@
form: {}, form: {},
rule: { rule: {
name: [ name: [
{required: true, message: '请输入姓名', trigger: 'blur'}, {required: true, message: this.$t('member.input_name'), trigger: 'blur'},
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }, { min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur' },
{ {
required: true, required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/, pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
message: '姓名不支持特殊字符', message: this.$t('member.special_characters_are_not_supported'),
trigger: 'blur' trigger: 'blur'
} }
], ],
@ -75,16 +75,16 @@
{ {
required: false, required: false,
pattern: '^1(3|4|5|7|8)\\d{9}$', pattern: '^1(3|4|5|7|8)\\d{9}$',
message: '手机号码格式不正确!', message: this.$t('member.mobile_number_format_is_incorrect'),
trigger: 'blur' trigger: 'blur'
} }
], ],
email: [ email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' }, { required: true, message: this.$t('member.input_email'), trigger: 'blur' },
{ {
required: true, required: true,
pattern: /^([A-Za-z0-9_\-.])+@([A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/, pattern: /^([A-Za-z0-9_\-.])+@([A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/,
message: '邮箱格式不正确!', message: this.$t('member.email_format_is_incorrect'),
trigger: 'blur' trigger: 'blur'
} }
] ]
@ -110,7 +110,7 @@
this.result = this.$post(this.updatePath, this.form,response => { this.result = this.$post(this.updatePath, this.form,response => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '修改成功!' message: this.$t('commons.modify_success')
}); });
localStorage.setItem(TokenKey, JSON.stringify(response.data)); localStorage.setItem(TokenKey, JSON.stringify(response.data));
this.updateVisible = false; this.updateVisible = false;

View File

@ -243,10 +243,10 @@
}, },
orgMemberRule: { orgMemberRule: {
userIds: [ userIds: [
{required: true, message: '请选择成员', trigger: ['blur']} {required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
], ],
roleIds: [ roleIds: [
{required: true, message: '请选择角色', trigger: ['blur']} {required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
] ]
} }
} }

View File

@ -89,8 +89,8 @@
del(row) { del(row) {
window.console.log(row); window.console.log(row);
this.$confirm('此操作将永久删除该资源池, 是否继续?', '提示', { this.$confirm('此操作将永久删除该资源池, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$get(`/testresourcepool/delete/${row.id}`).then(() => { this.$get(`/testresourcepool/delete/${row.id}`).then(() => {
@ -98,12 +98,12 @@
}); });
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: this.$t('commons.delete_success')
}); });
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: this.$t('commons.delete_cancel')
}); });
}); });
}, },
@ -131,7 +131,7 @@
.then(() => { .then(() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '修改成功!' message: this.$t('commons.modify_success')
}, },
this.updateVisible = false, this.updateVisible = false,
this.getOrganizationList(), this.getOrganizationList(),
@ -171,7 +171,7 @@
rule: { rule: {
name: [ name: [
{required: true, message: '请输入资源池名称', trigger: 'blur'}, {required: true, message: '请输入资源池名称', trigger: 'blur'},
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }, { min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur' },
{ {
required: true, required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/, pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,

View File

@ -4,21 +4,21 @@
<el-card> <el-card>
<div slot="header"> <div slot="header">
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">用户 <span class="title">{{$t('commons.member')}}
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
</span> </span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据ID名称搜索" prefix-icon="el-icon-search" maxlength="60" v-model="condition" clearable/> <el-input type="text" size="small" :placeholder="$t('member.search_by_name')" prefix-icon="el-icon-search" maxlength="60" v-model="condition" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column type="selection" width="55"/> <el-table-column type="selection" width="55"/>
<el-table-column prop="id" label="ID"/> <el-table-column prop="id" label="ID"/>
<el-table-column prop="name" label="用户名" width="120"/> <el-table-column prop="name" :label="$t('commons.username')" width="120"/>
<el-table-column prop="email" label="邮箱"/> <el-table-column prop="email" :label="$t('commons.email')"/>
<el-table-column prop="phone" label="电话"/> <el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column prop="status" label="启用/禁用" width="100"> <el-table-column prop="status" :label="$t('commons.status')" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.status" <el-switch v-model="scope.row.status"
active-color="#13ce66" active-color="#13ce66"
@ -29,12 +29,12 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="创建时间" width="180"> <el-table-column prop="createTime" :label="$t('commons.create_time')" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column :label="$t('commons.operating')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/> <el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/> <el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
@ -62,18 +62,18 @@
</el-card> </el-card>
<el-dialog title="创建用户" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true"> <el-dialog :title="$t('user.create')" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createUserForm"> <el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off"/> <el-input v-model="form.id" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="用户名" prop="name"> <el-form-item :label="$t('commons.username')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item :label="$t('commons.email')" prop="email">
<el-input v-model="form.email" autocomplete="off"/> <el-input v-model="form.email" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -82,23 +82,23 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="修改用户" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <el-dialog :title="$t('user.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateUserForm"> <el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/> <el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="用户名" prop="name"> <el-form-item :label="$t('commons.username')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item :label="$t('commons.email')" prop="email">
<el-input v-model="form.email" autocomplete="off"/> <el-input v-model="form.email" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateUser('updateUserForm')" size="medium">修改</el-button> <el-button type="primary" @click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -122,22 +122,22 @@
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
btnTips: "添加用户", btnTips: this.$t('user.create'),
condition: "", condition: "",
tableData: [], tableData: [],
form: {}, form: {},
rule: { rule: {
id: [ id: [
{ required: true, message: '请输入ID', trigger: 'blur'}, { required: true, message: this.$t('user.input_id'), trigger: 'blur'},
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' } { min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur' }
], ],
name: [ name: [
{required: true, message: '请输入姓名', trigger: 'blur'}, {required: true, message: this.$t('user.input_name'), trigger: 'blur'},
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }, { min: 2, max: 10, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur' },
{ {
required: true, required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/, pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
message: '姓名不支持特殊字符', message: this.$t('user.special_characters_are_not_supported'),
trigger: 'blur' trigger: 'blur'
} }
], ],
@ -145,16 +145,16 @@
{ {
required: false, required: false,
pattern: '^1(3|4|5|7|8)\\d{9}$', pattern: '^1(3|4|5|7|8)\\d{9}$',
message: '手机号码格式不正确!', message: this.$t('user.mobile_number_format_is_incorrect'),
trigger: 'blur' trigger: 'blur'
} }
], ],
email: [ email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' }, { required: true, message: this.$t('user.input_email'), trigger: 'blur' },
{ {
required: true, required: true,
pattern: /^([A-Za-z0-9_\-.])+@([A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/, pattern: /^([A-Za-z0-9_\-.])+@([A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/,
message: '邮箱格式不正确!', message: this.$t('user.email_format_is_incorrect'),
trigger: 'blur' trigger: 'blur'
} }
] ]
@ -175,22 +175,22 @@
this.form = row; this.form = row;
}, },
del(row) { del(row) {
this.$confirm('是否删除用户 ' + row.name + ' ?', '', { this.$confirm(this.$t('user.delete_confirm'), '', {
confirmButtonText: '确定', confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.result = this.$get(this.deletePath + row.id, () => { this.result = this.$get(this.deletePath + row.id, () => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: this.$t('commons.delete_success')
}); });
this.initTableData(); this.initTableData();
}); });
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: this.$t('commons.delete_cancel')
}); });
}); });
}, },
@ -200,7 +200,7 @@
this.result = this.$post(this.createPath, this.form, () => { this.result = this.$post(this.createPath, this.form, () => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '添加成功!' message: this.$t('commons.save_success')
}); });
this.initTableData(); this.initTableData();
this.createVisible = false; this.createVisible = false;
@ -216,7 +216,7 @@
this.result = this.$post(this.updatePath, this.form,() => { this.result = this.$post(this.updatePath, this.form,() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '修改成功!' message: this.$t('commons.modify_success')
}); });
this.updateVisible = false; this.updateVisible = false;
this.initTableData(); this.initTableData();
@ -240,7 +240,7 @@
this.$post(this.updatePath, row,() =>{ this.$post(this.updatePath, row,() =>{
this.$message({ this.$message({
type: 'success', type: 'success',
message: '状态修改成功!' message: this.$t('commons.modify_success')
}); });
}) })
}, },

View File

@ -13,9 +13,9 @@
</el-row> </el-row>
</div> </div>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column prop="name" label="用户名"/> <el-table-column prop="name" :label="$t('commons.username')"/>
<el-table-column prop="email" label="邮箱"/> <el-table-column prop="email" :label="$t('commons.email')"/>
<el-table-column prop="phone" label="电话"/> <el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column prop="roles" label="角色" width="120"> <el-table-column prop="roles" label="角色" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark" type="success"> <el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark" type="success">
@ -52,7 +52,7 @@
<el-dialog title="添加成员" :visible.sync="createVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <el-dialog title="添加成员" :visible.sync="createVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small"> <el-form :model="form" ref="form" :rules="rules" label-position="left" label-width="100px" size="small">
<el-form-item label="成员" prop="userIds"> <el-form-item label="成员" prop="userIds">
<el-select v-model="form.userIds" multiple placeholder="请选择成员" class="select-width"> <el-select v-model="form.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option <el-option
v-for="item in form.userList" v-for="item in form.userList"
:key="item.id" :key="item.id"
@ -64,7 +64,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="角色" prop="roleIds"> <el-form-item label="角色" prop="roleIds">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色" class="select-width"> <el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option <el-option
v-for="item in form.roles" v-for="item in form.roles"
:key="item.id" :key="item.id"
@ -75,7 +75,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('form')" size="medium">保存</el-button> <el-button type="primary" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -84,17 +84,17 @@
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/> <el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="用户名" prop="name"> <el-form-item :label="$t('commons.username')" prop="name">
<el-input v-model="form.name" autocomplete="off"/> <el-input v-model="form.name" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item :label="$t('commons.email')" prop="email">
<el-input v-model="form.email" autocomplete="off"/> <el-input v-model="form.email" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="phone"> <el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/> <el-input v-model="form.phone" autocomplete="off"/>
</el-form-item> </el-form-item>
<el-form-item label="角色" prop="roleIds"> <el-form-item label="角色" prop="roleIds">
<el-select v-model="form.roleIds" multiple placeholder="请选择角色" class="select-width"> <el-select v-model="form.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option <el-option
v-for="item in form.allroles" v-for="item in form.allroles"
:key="item.id" :key="item.id"
@ -105,7 +105,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateWorkspaceMember('updateUserForm')" size="medium">保存</el-button> <el-button type="primary" @click="updateWorkspaceMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -131,10 +131,10 @@
tableData: [], tableData: [],
rules: { rules: {
userIds: [ userIds: [
{required: true, message: '请选择成员', trigger: ['blur']} {required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
], ],
roleIds: [ roleIds: [
{required: true, message: '请选择角色', trigger: ['blur']} {required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
] ]
}, },
multipleSelection: [], multipleSelection: [],
@ -193,8 +193,8 @@
}, },
del(row) { del(row) {
this.$confirm('移除该成员, 是否继续?', '提示', { this.$confirm('移除该成员, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.loading = true; this.loading = true;
@ -204,13 +204,13 @@
}); });
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: this.$t('commons.delete_success')
}); });
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: this.$t('commons.delete_cancel')
}); });
}); });
}, },
@ -236,7 +236,7 @@
this.result = this.$post("/workspace/member/update", param,() => { this.result = this.$post("/workspace/member/update", param,() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '修改成功!' message: this.$t('commons.modify_success')
}); });
this.updateVisible = false; this.updateVisible = false;
this.initTableData(); this.initTableData();