提交 8c121c39 编写于 作者: S shiziyuan9527

组织成员管理

上级 807135e7
...@@ -62,9 +62,10 @@ public class UserController { ...@@ -62,9 +62,10 @@ public class UserController {
} }
@PostMapping("/switch/source/{sourceId}") @PostMapping("/switch/source/{sourceId}")
public void switchUserRole(@PathVariable(value = "sourceId") String sourceId) { public UserDTO switchUserRole(@PathVariable(value = "sourceId") String sourceId) {
UserDTO user = SessionUtils.getUser(); UserDTO user = SessionUtils.getUser();
userService.switchUserRole(user, sourceId); userService.switchUserRole(user, sourceId);
return SessionUtils.getUser();
} }
@GetMapping("/info/{userId}") @GetMapping("/info/{userId}")
......
...@@ -32,7 +32,9 @@ ...@@ -32,7 +32,9 @@
} }
}, },
mounted() { mounted() {
this.activeIndex = this.$route.matched[0].path || '/' if (this.$route.matched.length > 0) {
this.activeIndex = this.$route.matched[0].path;
}
}, },
methods: { methods: {
handleSelect(index) { handleSelect(index) {
......
...@@ -124,8 +124,11 @@ ...@@ -124,8 +124,11 @@
let user = {}; let user = {};
user.id = this.currentUserInfo.id; user.id = this.currentUserInfo.id;
user.lastSourceId = data.id; user.lastSourceId = data.id;
this.$post("/user/switch/source/" + user.lastSourceId, {}); this.$post("/user/switch/source/" + user.lastSourceId, {},response => {
window.location.reload(); Cookies.set(TokenKey, response.data);
window.location.reload();
})
} }
} }
} }
......
...@@ -63,6 +63,8 @@ ...@@ -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: "OrganizationMember", name: "OrganizationMember",
components: {MsCreateBox}, components: {MsCreateBox},
...@@ -84,19 +86,24 @@ ...@@ -84,19 +86,24 @@
] ]
}, },
multipleSelection: [], multipleSelection: [],
currentOrganizationId: "d2f49498-3333-4872-ab98-59174d4a81da", currentOrganizationId: JSON.parse(Cookies.get(TokenKey)).organizationId,
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 5,
total: 0 total: 0,
} }
}, },
methods: { methods: {
currentUser: () => {
let user = Cookies.get(TokenKey);
window.console.log(user);
return JSON.parse(user);
},
initTableData() { initTableData() {
let param = { let param = {
name: this.condition, name: this.condition,
organizationId: this.currentOrganizationId organizationId: this.currentUser().organizationId
// 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;
this.total = data.itemCount; this.total = data.itemCount;
...@@ -116,22 +123,19 @@ ...@@ -116,22 +123,19 @@
this.currentPage = current; this.currentPage = current;
}, },
del(row) { del(row) {
this.$confirm('移除该成员, 是否继续?', '提示', { this.$confirm('是否删除用户 ' + row.name + ' ?', '', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.loading = true; this.result = this.$get('/user/orgmember/delete/' + this.currentOrganizationId + '/' + row.id, () => {
this.$get('/user/member/delete/' + this.currentWorkspaceId + '/' + row.id).then(() => { this.$message({
type: 'success',
message: '删除成功!'
});
this.initTableData(); this.initTableData();
this.loading = false;
});
this.$message({
type: 'success',
message: '删除成功!'
}); });
}).catch(() => { }).catch(() => {
this.loading = false;
this.$message({ this.$message({
type: 'info', type: 'info',
message: '已取消删除' message: '已取消删除'
...@@ -139,22 +143,10 @@ ...@@ -139,22 +143,10 @@
}); });
}, },
create() { create() {
this.loading = true; this.result = this.$get('/user/list', response => {
this.$get('/user/list').then(response => {
if (response.data.success) {
this.createVisible = true; this.createVisible = true;
this.form = {userList: response.data.data}; this.form = {userList: response.data};
} else { })
this.$message.error(response.message);
}
this.loading = false;
}).catch(() => {
this.loading = false;
this.$message({
type: 'error',
message: '获取用户列表失败'
});
});
}, },
submitForm(formName) { submitForm(formName) {
this.loading = true; this.loading = true;
...@@ -162,14 +154,11 @@ ...@@ -162,14 +154,11 @@
if (valid) { if (valid) {
let param = { let param = {
userIds: this.form.userIds, userIds: this.form.userIds,
workspaceId: this.currentWorkspaceId organizationId: this.currentOrganizationId
}; };
this.$post("user/member/add", param).then(() => { this.result = this.$post("user/orgmember/add", param,() => {
this.initTableData(); this.initTableData();
this.createVisible = false; this.createVisible = false;
this.loading = false;
}).catch(() => {
this.loading = false;
}) })
} else { } else {
return false; return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册