系统菜单下组织页国际化

This commit is contained in:
shiziyuan9527 2020-03-03 10:48:15 +08:00
parent 2a1ac00ac8
commit f5e102d9f1
3 changed files with 67 additions and 35 deletions

View File

@ -25,7 +25,10 @@ export default {
'create_time': 'Created Time', 'create_time': 'Created Time',
'update_time': 'Updated Time', 'update_time': 'Updated Time',
'add': 'Add', 'add': 'Add',
'member': 'Member' 'member': 'Member',
'email': 'Email',
'phone': 'Phone',
'role': 'Role',
}, },
workspace: { workspace: {
'create': 'Create Workspace', 'create': 'Create Workspace',
@ -55,7 +58,13 @@ export default {
'input_name': 'Please enter a workspace name', 'input_name': 'Please enter a workspace name',
}, },
member: { member: {
'create': 'Create' 'create': 'Create',
'modify': 'Modify',
'delete_confirm': 'Are you sure you want to delete this Member?',
'please_choose_member': 'Please Choose Member',
},
role: {
'please_choose_role': 'Please Choose Role',
}, },
load_test: { load_test: {
'recent': 'Recent Tests', 'recent': 'Recent Tests',

View File

@ -25,7 +25,10 @@ export default {
'create_time': '创建时间', 'create_time': '创建时间',
'update_time': '更新时间', 'update_time': '更新时间',
'add': '添加', 'add': '添加',
'member': '成员' 'member': '成员',
'email': '邮箱',
'phone': '电话',
'role': '角色',
}, },
workspace: { workspace: {
'create': '创建工作空间', 'create': '创建工作空间',
@ -55,7 +58,13 @@ export default {
'input_name': '请输入项目名称', 'input_name': '请输入项目名称',
}, },
member: { member: {
'create': '添加成员' 'create': '添加成员',
'modify': '修改成员',
'delete_confirm': '这个用户确定要删除吗?',
'please_choose_member': '请选择成员',
},
role: {
'please_choose_role': '请选择角色',
}, },
load_test: { load_test: {
'recent': '最近的测试', 'recent': '最近的测试',

View File

@ -13,6 +13,7 @@
</span> </span>
</el-row> </el-row>
</div> </div>
<!-- system menu organization table-->
<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="name" :label="$t('commons.name')"/> <el-table-column prop="name" :label="$t('commons.name')"/>
@ -29,7 +30,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div> <div>
<el-row> <el-row>
<el-col :span="22" :offset="1"> <el-col :span="22" :offset="1">
@ -48,21 +48,24 @@
</el-row> </el-row>
</div> </div>
</el-card> </el-card>
<!-- dialog of organization member -->
<el-dialog :visible.sync="memberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc"> <el-dialog :visible.sync="memberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc">
<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="addMember"/> <ms-create-box :tips="btnTips" :exec="addMember"/>
</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('organization.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>
<!-- organization member table -->
<el-table :data="memberLineData" style="width: 100%"> <el-table :data="memberLineData" 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 label="角色" width="140"> <el-table-column label="角色" 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">
@ -96,6 +99,7 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- add organization form -->
<el-dialog :title="$t('organization.create')" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true"> <el-dialog :title="$t('organization.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="createOrganization"> <el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createOrganization">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
@ -110,6 +114,7 @@
</span> </span>
</el-dialog> </el-dialog>
<!-- update organization form -->
<el-dialog :title="$t('organization.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <el-dialog :title="$t('organization.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="updateOrganizationForm"> <el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateOrganizationForm">
<el-form-item :label="$t('commons.name')" prop="name"> <el-form-item :label="$t('commons.name')" prop="name">
@ -124,10 +129,11 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="添加成员" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <!-- add organization member form -->
<el-form :model="memberForm" ref="form" :rules="rule" label-position="left" label-width="100px" size="small"> <el-dialog :title="$t('member.create')" :visible.sync="addMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form-item label="成员" prop="userIds"> <el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="left" label-width="100px" size="small">
<el-select v-model="memberForm.userIds" multiple placeholder="请选择成员" class="select-width"> <el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')" class="select-width">
<el-option <el-option
v-for="item in memberForm.userList" v-for="item in memberForm.userList"
:key="item.id" :key="item.id"
@ -138,8 +144,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="memberForm.roleIds" multiple placeholder="请选择角色" class="select-width"> <el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option <el-option
v-for="item in memberForm.roles" v-for="item in memberForm.roles"
:key="item.id" :key="item.id"
@ -150,26 +156,27 @@
</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="updateMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc"> <!-- update organization member form -->
<el-dialog :title="$t('member.modify')" :visible.sync="updateMemberVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="memberForm" label-position="left" label-width="100px" size="small" ref="updateUserForm"> <el-form :model="memberForm" 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="memberForm.id" autocomplete="off" :disabled="true"/> <el-input v-model="memberForm.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="memberForm.name" autocomplete="off"/> <el-input v-model="memberForm.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="memberForm.email" autocomplete="off"/> <el-input v-model="memberForm.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="memberForm.phone" autocomplete="off"/> <el-input v-model="memberForm.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="memberForm.roleIds" multiple placeholder="请选择角色" class="select-width"> <el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')" class="select-width">
<el-option <el-option
v-for="item in memberForm.allroles" v-for="item in memberForm.allroles"
:key="item.id" :key="item.id"
@ -180,7 +187,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>
@ -233,6 +240,14 @@
description: [ description: [
{ max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'} { max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
] ]
},
orgMemberRule: {
userIds: [
{required: true, message: '请选择成员', trigger: ['blur']}
],
roleIds: [
{required: true, message: '请选择角色', trigger: ['blur']}
]
} }
} }
}, },
@ -254,7 +269,6 @@
}) })
}, },
edit(row) { edit(row) {
// this.loading = true;
this.updateVisible = true; this.updateVisible = true;
this.form = row; this.form = row;
}, },
@ -269,6 +283,7 @@
this.$set(this.memberForm, 'roleIds', roleIds); this.$set(this.memberForm, 'roleIds', roleIds);
}, },
cellClick(row){ cellClick(row){
// currentRow
this.currentRow = row; this.currentRow = row;
this.memberVisible = true; this.memberVisible = true;
let param = { let param = {
@ -310,22 +325,22 @@
}); });
}, },
delMember(row) { delMember(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.currentRow.id + '/' + row.id, () => { this.result = this.$get('/user/orgmember/delete/' + this.currentRow.id + '/' + row.id, () => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: this.$t('commons.delete_success')
}); });
this.cellClick(this.currentRow); this.cellClick(this.currentRow);
}); });
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: this.$t('commons.delete_cancel')
}); });
}); });
}, },
@ -397,7 +412,6 @@
this.currentPage = current; this.currentPage = current;
this.initTableData(); this.initTableData();
}, },
//
handleMemberSizeChange(size) { handleMemberSizeChange(size) {
this.pageMemberSize = size; this.pageMemberSize = size;
this.cellClick(this.currentRow); this.cellClick(this.currentRow);
@ -438,7 +452,7 @@
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.updateMemberVisible = false; this.updateMemberVisible = false;
this.cellClick(this.currentRow); this.cellClick(this.currentRow);