菜单按照组织工作空间隔离
This commit is contained in:
parent
167c8cd675
commit
5371e09c23
|
@ -113,7 +113,9 @@ public class WorkspaceService {
|
||||||
userRoles.forEach(userRole -> {
|
userRoles.forEach(userRole -> {
|
||||||
workspaces.forEach(workspace -> {
|
workspaces.forEach(workspace -> {
|
||||||
if (StringUtils.equals(userRole.getSourceId(),workspace.getId())) {
|
if (StringUtils.equals(userRole.getSourceId(),workspace.getId())) {
|
||||||
resultWorkspaceList.add(workspace);
|
if (!resultWorkspaceList.contains(workspace)) {
|
||||||
|
resultWorkspaceList.add(workspace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,6 +102,9 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
|
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
|
||||||
|
if (this.currentUser.lastOrganizationId === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.$get("/workspace/list/orgworkspace/", response => {
|
this.$get("/workspace/list/orgworkspace/", response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
if (data.length == 0) {
|
if (data.length == 0) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import OrganizationMember from "../settings/OrganizationMember";
|
||||||
import Member from "../settings/Member";
|
import Member from "../settings/Member";
|
||||||
import TestResourcePool from "../settings/TestResourcePool";
|
import TestResourcePool from "../settings/TestResourcePool";
|
||||||
import MsProject from "../project/MsProject";
|
import MsProject from "../project/MsProject";
|
||||||
|
import OrganizationWorkspace from "../settings/OrganizationWorkspace";
|
||||||
|
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
|
@ -53,6 +54,10 @@ const router = new VueRouter({
|
||||||
path: 'organizationmember',
|
path: 'organizationmember',
|
||||||
component: OrganizationMember,
|
component: OrganizationMember,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'organizationworkspace',
|
||||||
|
component: OrganizationWorkspace,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'member',
|
path: 'member',
|
||||||
component: Member
|
component: Member
|
||||||
|
|
|
@ -63,6 +63,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsCreateBox from "./CreateBox";
|
import MsCreateBox from "./CreateBox";
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
import {TokenKey} from "../../../common/constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Member",
|
name: "Member",
|
||||||
|
@ -82,7 +84,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
currentWorkspaceId: "0a2430b1-a818-4b9b-bc04-c1229c472896",
|
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -92,11 +93,18 @@
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
currentUser: () => {
|
||||||
|
let user = Cookies.get(TokenKey);
|
||||||
|
return JSON.parse(user);
|
||||||
|
},
|
||||||
initTableData() {
|
initTableData() {
|
||||||
|
if (this.currentUser.lastWorkspaceId === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
let param = {
|
let param = {
|
||||||
name: this.condition,
|
name: this.condition,
|
||||||
workspaceId: this.currentWorkspaceId
|
workspaceId: this.currentUser().lastWorkspaceId
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$post(this.buildPagePath(this.queryPath), param).then(response => {
|
this.$post(this.buildPagePath(this.queryPath), param).then(response => {
|
||||||
|
@ -130,7 +138,7 @@
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.$get('/user/member/delete/' + this.currentWorkspaceId + '/' + row.id).then(() => {
|
this.$get('/user/member/delete/' + this.currentUser().lastWorkspaceId + '/' + row.id).then(() => {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
@ -170,7 +178,7 @@
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let param = {
|
let param = {
|
||||||
userIds: this.form.userIds,
|
userIds: this.form.userIds,
|
||||||
workspaceId: this.currentWorkspaceId
|
workspaceId: this.currentUser().lastWorkspaceId
|
||||||
};
|
};
|
||||||
this.$post("user/member/add", param).then(() => {
|
this.$post("user/member/add", param).then(() => {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
|
|
|
@ -86,7 +86,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
currentOrganizationId: JSON.parse(Cookies.get(TokenKey)).organizationId,
|
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -100,8 +99,7 @@
|
||||||
initTableData() {
|
initTableData() {
|
||||||
let param = {
|
let param = {
|
||||||
name: this.condition,
|
name: this.condition,
|
||||||
organizationId: this.currentUser().organizationId
|
organizationId: this.currentUser().lastOrganizationId
|
||||||
// organizationId: this.currentOrganizationId
|
|
||||||
};
|
};
|
||||||
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
|
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
|
@ -127,7 +125,7 @@
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.result = this.$get('/user/orgmember/delete/' + this.currentUser().organizationId + '/' + row.id, () => {
|
this.result = this.$get('/user/orgmember/delete/' + this.currentUser().lastOrganizationId + '/' + row.id, () => {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: '删除成功!'
|
message: '删除成功!'
|
||||||
|
@ -153,7 +151,7 @@
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let param = {
|
let param = {
|
||||||
userIds: this.form.userIds,
|
userIds: this.form.userIds,
|
||||||
organizationId: this.currentUser().organizationId
|
organizationId: this.currentUser().lastOrganizationId
|
||||||
};
|
};
|
||||||
this.result = this.$post("user/orgmember/add", param,() => {
|
this.result = this.$post("user/orgmember/add", param,() => {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
|
|
|
@ -0,0 +1,181 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card v-loading="result.loading">
|
||||||
|
<div slot="header">
|
||||||
|
<el-row type="flex" justify="space-between" align="middle">
|
||||||
|
<span class="title">
|
||||||
|
工作空间
|
||||||
|
<ms-create-box :tips="btnTips" :exec="create"/>
|
||||||
|
</span>
|
||||||
|
<span class="search">
|
||||||
|
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||||
|
maxlength="60" v-model="condition" clearable/>
|
||||||
|
</span>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<el-table :data="items" style="width: 100%">
|
||||||
|
<el-table-column prop="name" label="名称"/>
|
||||||
|
<el-table-column prop="description" label="描述"/>
|
||||||
|
<el-table-column>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<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/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="22" :offset="1">
|
||||||
|
<div class="table-page">
|
||||||
|
<el-pagination
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
:current-page.sync="currentPage"
|
||||||
|
:page-sizes="[5, 10, 20, 50, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total">
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog title="创建工作空间" :visible.sync="createVisible" width="30%">
|
||||||
|
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input v-model="form.name" autocomplete="off"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述">
|
||||||
|
<el-input type="textarea" v-model="form.description"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submit('form')" size="medium">创建</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import MsCreateBox from "./CreateBox";
|
||||||
|
import {Message} from "element-ui";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "OrganizationWorkspace",
|
||||||
|
components: {MsCreateBox},
|
||||||
|
mounted() {
|
||||||
|
this.list();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
create() {
|
||||||
|
this.createVisible = true;
|
||||||
|
this.form = {};
|
||||||
|
},
|
||||||
|
submit(formName) {
|
||||||
|
this.$refs[formName].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let saveType = 'add';
|
||||||
|
if (this.form.id) {
|
||||||
|
saveType = 'update'
|
||||||
|
}
|
||||||
|
this.$post("/workspace/" + saveType, this.form, () => {
|
||||||
|
this.createVisible = false;
|
||||||
|
this.list();
|
||||||
|
Message.success('保存成功');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
edit(row) {
|
||||||
|
this.createVisible = true;
|
||||||
|
this.form = row;
|
||||||
|
|
||||||
|
// let self = this;
|
||||||
|
// let getUser1 = this.$get("/test/user");
|
||||||
|
// let getUser2 = this.$get("/test/sleep");
|
||||||
|
// this.$all([getUser1, getUser2], function (r1, r2) {
|
||||||
|
// window.console.log(r1.data.data, r2.data.data);
|
||||||
|
// self.loading = false;
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
del(row) {
|
||||||
|
this.$confirm('这个工作空间确定要删除吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$get('/workspace/delete/' + row.id, () => {
|
||||||
|
Message.success('删除成功');
|
||||||
|
this.list();
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
list() {
|
||||||
|
let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize;
|
||||||
|
this.result = this.$post(url, {name: this.condition}, response => {
|
||||||
|
let data = response.data;
|
||||||
|
this.items = data.listObject;
|
||||||
|
this.total = data.itemCount;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleSizeChange(size) {
|
||||||
|
this.pageSize = size;
|
||||||
|
this.list();
|
||||||
|
},
|
||||||
|
handleCurrentChange(current) {
|
||||||
|
this.currentPage = current;
|
||||||
|
this.list();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: {},
|
||||||
|
loading: false,
|
||||||
|
createVisible: false,
|
||||||
|
btnTips: "添加工作空间",
|
||||||
|
condition: "",
|
||||||
|
items: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 5,
|
||||||
|
total: 0,
|
||||||
|
form: {
|
||||||
|
// name: "",
|
||||||
|
// description: ""
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: '请输入工作空间名称', trigger: 'blur'},
|
||||||
|
{min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.search {
|
||||||
|
width: 240px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table__row:hover .edit {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-page {
|
||||||
|
padding-top: 20px;
|
||||||
|
margin-right: -9px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<span>组织</span>
|
<span>组织</span>
|
||||||
</template>
|
</template>
|
||||||
<el-menu-item index="/setting/organizationmember" v-permission="['org_admin']">成员</el-menu-item>
|
<el-menu-item index="/setting/organizationmember" v-permission="['org_admin']">成员</el-menu-item>
|
||||||
<el-menu-item index="/setting/workspace" v-permission="['org_admin']">工作空间</el-menu-item>
|
<el-menu-item index="/setting/organizationworkspace" v-permission="['org_admin']">工作空间</el-menu-item>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
|
|
||||||
<el-submenu index="3" v-permission="['test_manager','test_user','test_viewer']">
|
<el-submenu index="3" v-permission="['test_manager','test_user','test_viewer']">
|
||||||
|
|
Loading…
Reference in New Issue