+
@@ -16,8 +16,16 @@
+
+
+
+ {{ role.name }}
+
+
+
+
@@ -41,7 +49,7 @@
-
+
@@ -50,6 +58,18 @@
:key="item.id"
:label="item.name"
:value="item.id">
+ {{ item.name }}
+ {{ item.email }}
+
+
+
+
+
+
@@ -58,6 +78,37 @@
保存
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -71,16 +122,20 @@
components: {MsCreateBox},
data() {
return {
- loading: false,
+ result: {},
form: {},
- btnTips: "添加成员",
+ btnTips: "添加工作空间成员",
createVisible: false,
+ updateVisible: false,
queryPath: "/user/member/list",
condition: "",
tableData: [],
rules: {
userIds: [
- {required: true, message: '请选择成员', trigger: ['blur', 'change']}
+ {required: true, message: '请选择成员', trigger: ['blur']}
+ ],
+ roleIds: [
+ {required: true, message: '请选择角色', trigger: ['blur']}
]
},
multipleSelection: [],
@@ -107,15 +162,17 @@
workspaceId: this.currentUser().lastWorkspaceId
};
- this.$post(this.buildPagePath(this.queryPath), param).then(response => {
- if (response.data.success) {
- let data = response.data.data;
- this.total = data.itemCount;
- this.tableData = data.listObject;
- } else {
- this.$message.error(response.message);
+ this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
+ let data = response.data;
+ this.tableData = data.listObject;
+ let url = "/userrole/list/ws/" + this.currentUser().lastWorkspaceId;
+ for (let i = 0; i < this.tableData.length; i++) {
+ this.$get(url + "/" + this.tableData[i].id, response => {
+ let roles = response.data;
+ this.$set(this.tableData[i], "roles", roles);
+ })
}
- this.loading = false;
+ this.total = data.itemCount;
})
},
@@ -131,6 +188,10 @@
handleCurrentChange(current) {
this.currentPage = current;
},
+ closeFunc() {
+ this.form = {};
+ this.initTableData();
+ },
del(row) {
this.$confirm('移除该成员, 是否继续?', '提示', {
confirmButtonText: '确定',
@@ -154,41 +215,69 @@
});
});
},
- create() {
- this.loading = true;
- this.$get('/user/list').then(response => {
- if (response.data.success) {
- this.createVisible = true;
- this.form = {userList: response.data.data};
- } else {
- this.$message.error(response.message);
- }
- this.loading = false;
- }).catch(() => {
- this.loading = false;
+ edit(row) {
+ this.updateVisible = true;
+ this.form = row;
+ let roleIds = this.form.roles.map(r => r.id);
+ this.result = this.$get('/role/list/test', response => {
+ this.$set(this.form, "allroles", response.data);
+ })
+ // 编辑使填充角色信息
+ this.$set(this.form, 'roleIds', roleIds);
+ },
+ updateWorkspaceMember() {
+ let param = {
+ id: this.form.id,
+ name: this.form.name,
+ email: this.form.email,
+ phone: this.form.phone,
+ roleIds: this.form.roleIds,
+ workspaceId: this.currentUser().lastWorkspaceId
+ }
+ this.result = this.$post("/workspace/member/update", param,() => {
this.$message({
- type: 'error',
- message: '获取用户列表失败'
+ type: 'success',
+ message: '修改成功!'
});
+ this.updateVisible = false;
+ this.initTableData();
});
},
+ create() {
+ this.form = {};
+ let param = {
+ name: this.condition,
+ organizationId: this.currentUser().lastOrganizationId
+ };
+ let wsId = this.currentUser().lastWorkspaceId;
+ if (typeof wsId == "undefined" || wsId == null || wsId == "") {
+ this.$message({
+ message:'请先选择工作空间!',
+ type: 'warning'
+ });
+ return false;
+ }
+ this.$post('/user/orgmember/list/all', param,response => {
+ this.createVisible = true;
+ this.$set(this.form, "userList", response.data);
+ })
+ this.result = this.$get('/role/list/test', response => {
+ this.$set(this.form, "roles", response.data);
+ })
+ },
submitForm(formName) {
this.loading = true;
this.$refs[formName].validate((valid) => {
if (valid) {
let param = {
userIds: this.form.userIds,
+ roleIds: this.form.roleIds,
workspaceId: this.currentUser().lastWorkspaceId
};
- this.$post("user/member/add", param).then(() => {
+ this.$post("user/member/add", param, () => {
this.initTableData();
this.createVisible = false;
- this.loading = false;
- }).catch(() => {
- this.loading = false;
})
- } else {
- return false;
}
});
}
@@ -214,4 +303,15 @@
.select-width {
width: 100%;
}
+
+ .workspace-member-name {
+ float: left;
+ }
+
+ .workspace-member-email {
+ float: right;
+ color: #8492a6;
+ font-size: 13px;
+ }
+
diff --git a/frontend/src/performance/components/settings/OrganizationMember.vue b/frontend/src/performance/components/settings/OrganizationMember.vue
index c55757a5c4..42a8d29058 100644
--- a/frontend/src/performance/components/settings/OrganizationMember.vue
+++ b/frontend/src/performance/components/settings/OrganizationMember.vue
@@ -22,7 +22,6 @@
{{ role.name }}
-
@@ -59,8 +58,8 @@
:key="item.id"
:label="item.name"
:value="item.id">
- {{ item.name }}
- {{ item.email }}
+ {{ item.name }}
+ {{ item.email }}
@@ -95,7 +94,7 @@
-
+
{
let data = response.data;
this.tableData = data.listObject;
- let url = "/userrole/list/" + this.currentUser().lastOrganizationId;
+ let url = "/userrole/list/org/" + this.currentUser().lastOrganizationId;
for (let i = 0; i < this.tableData.length; i++) {
this.$get(url + "/" + this.tableData[i].id, response => {
let roles = response.data;
@@ -215,9 +214,6 @@
this.initTableData();
});
},
- checkTag() {
- // todo 修改成员信息时必须保留一个组织级角色
- },
del(row) {
this.$confirm('是否删除用户 ' + row.name + ' ?', '', {
confirmButtonText: '确定',
@@ -276,4 +272,18 @@
margin-right: -9px;
float: right;
}
+
+ .org-member-name {
+ float: left;
+ }
+
+ .org-member-email {
+ float: right;
+ color: #8492a6;
+ font-size: 13px;
+ }
+
+ .select-width {
+ width: 100%;
+ }