代码优化

This commit is contained in:
shiziyuan9527 2020-05-07 14:35:56 +08:00
parent 02ab2f230a
commit 74c8be756a
7 changed files with 65 additions and 29 deletions

View File

@ -27,7 +27,7 @@ public class UserRoleController {
@GetMapping("/list/ws/{workspaceId}/{userId}")
@RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR)
public List<Role> getWorkspaceMemberRole(@PathVariable String workspaceId, @PathVariable String userId) {
public List<Role> getWorkspaceMemberRoles(@PathVariable String workspaceId, @PathVariable String userId) {
return userRoleService.getWorkspaceMemberRoles(workspaceId, userId);
}
}

View File

@ -0,0 +1,35 @@
<template>
<div>
<ms-tag v-for="(role, index) in roles"
:key="index"
:effect="effect"
:type="type"
:content="role.name"/>
</div>
</template>
<script>
import MsTag from "./MsTag";
export default {
name: "MsRolesTag",
components: {MsTag},
props: {
type: {
type: String,
default: 'primary',
},
roles: {
type: Array
},
effect: {
type: String,
default: 'dark',
}
}
}
</script>
<style scoped>
</style>

View File

@ -11,9 +11,7 @@
<el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column prop="roles" :label="$t('commons.role')" width="140">
<template v-slot:default="scope">
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark">
{{ role.name }}
</el-tag>
<ms-roles-tag :roles="scope.row.roles"/>
</template>
</el-table-column>
<el-table-column>
@ -105,10 +103,11 @@
import {TokenKey} from "../../../../common/js/constants";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsRolesTag from "../../common/components/MsRolesTag";
export default {
name: "MsOrganizationMember",
components: {MsCreateBox, MsTablePagination, MsTableHeader},
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag},
created() {
this.initTableData();
},

View File

@ -55,9 +55,7 @@
<el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column :label="$t('commons.role')" width="120">
<template v-slot:default="scope">
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark" type="success">
{{ role.name }}
</el-tag>
<ms-roles-tag :roles="scope.row.roles" type="success"/>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')">
@ -69,12 +67,14 @@
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="dialogSearch" :current-page.sync="dialogCurrentPage" :page-size.sync="dialogPageSize"
<ms-table-pagination :change="dialogSearch" :current-page.sync="dialogCurrentPage"
:page-size.sync="dialogPageSize"
:total="dialogTotal"/>
</el-dialog>
<!-- add workspace member dialog -->
<el-dialog :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%" :destroy-on-close="true"
<el-dialog :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%"
:destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
size="small">
@ -112,7 +112,8 @@
</el-dialog>
<!-- update workspace member dialog -->
<el-dialog :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%" :destroy-on-close="true"
<el-dialog :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%"
:destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
@ -156,10 +157,11 @@
import {TokenKey} from "../../../../common/js/constants";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsRolesTag from "../../common/components/MsRolesTag";
export default {
name: "MsOrganizationWorkspace",
components: {MsCreateBox, MsTablePagination, MsTableHeader},
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag},
mounted() {
this.list();
},

View File

@ -41,9 +41,7 @@
<el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column :label="$t('commons.role')" width="140">
<template v-slot:default="scope">
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark">
{{ role.name }}
</el-tag>
<ms-roles-tag :roles="scope.row.roles"/>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')">
@ -185,10 +183,11 @@
import MsCreateBox from "../CreateBox";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsRolesTag from "../../common/components/MsRolesTag";
export default {
name: "MsOrganization",
components: {MsCreateBox, MsTablePagination, MsTableHeader},
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag},
data() {
return {
queryPath: '/organization/list',

View File

@ -96,9 +96,7 @@
<el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column :label="$t('commons.role')" width="120">
<template v-slot:default="scope">
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark" type="success">
{{ role.name }}
</el-tag>
<ms-roles-tag :roles="scope.row.roles" type="success"/>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')">
@ -116,7 +114,8 @@
</el-dialog>
<!-- add workspace member dialog -->
<el-dialog :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%" :destroy-on-close="true"
<el-dialog :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%"
:destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
size="small">
@ -153,7 +152,8 @@
</el-dialog>
<!-- update workspace member dialog -->
<el-dialog :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%" :destroy-on-close="true"
<el-dialog :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%"
:destroy-on-close="true"
@close="closeFunc">
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
@ -197,10 +197,11 @@
import {Message} from "element-ui";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsRolesTag from "../../common/components/MsRolesTag";
export default {
name: "MsSystemWorkspace",
components: {MsCreateBox, MsTablePagination, MsTableHeader},
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag},
mounted() {
this.list();
},

View File

@ -11,9 +11,7 @@
<el-table-column prop="phone" :label="$t('commons.phone')"/>
<el-table-column prop="roles" :label="$t('commons.role')" width="120">
<template v-slot:default="scope">
<el-tag v-for="(role, index) in scope.row.roles" :key="index" size="mini" effect="dark" type="success">
{{ role.name }}
</el-tag>
<ms-roles-tag :roles="scope.row.roles" type="success"/>
</template>
</el-table-column>
<el-table-column>
@ -29,7 +27,8 @@
:total="total"/>
</el-card>
<el-dialog :title="$t('member.create')" :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="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.member')" prop="userIds">
<el-select v-model="form.userIds" multiple :placeholder="$t('member.please_choose_member')"
@ -63,7 +62,8 @@
</template>
</el-dialog>
<el-dialog :title="$t('member.modify')" :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="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
@ -104,11 +104,11 @@
import {TokenKey} from "../../../../common/js/constants";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader";
import MsTag from "../../common/components/MsTag";
import MsRolesTag from "../../common/components/MsRolesTag";
export default {
name: "MsMember",
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsTag},
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag},
data() {
return {
result: {},