fix(权限设置): 修复组织成员可以修改工作空间成员的bug
This commit is contained in:
parent
03fe07833e
commit
9279cb6751
|
@ -2,7 +2,8 @@
|
||||||
<div>
|
<div>
|
||||||
<el-card class="table-card" v-loading="result.loading">
|
<el-card class="table-card" v-loading="result.loading">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<ms-table-header :create-permission="['ORGANIZATION_WORKSPACE:READ+CREATE']" :condition.sync="condition" @search="list" @create="create"
|
<ms-table-header :create-permission="['ORGANIZATION_WORKSPACE:READ+CREATE']" :condition.sync="condition"
|
||||||
|
@search="list" @create="create"
|
||||||
:create-tip="$t('workspace.create')" :title="$t('commons.workspace')"/>
|
:create-tip="$t('workspace.create')" :title="$t('commons.workspace')"/>
|
||||||
</template>
|
</template>
|
||||||
<el-table border class="adjust-table" :data="items" style="width: 100%"
|
<el-table border class="adjust-table" :data="items" style="width: 100%"
|
||||||
|
@ -31,7 +32,8 @@
|
||||||
:total="total"/>
|
:total="total"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible" width="30%" @close="close">
|
<el-dialog :close-on-click-modal="false" :title="$t('workspace.create')" :visible.sync="dialogWsAddVisible"
|
||||||
|
width="30%" @close="close">
|
||||||
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
|
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
|
||||||
<el-form-item :label="$t('commons.name')" prop="name">
|
<el-form-item :label="$t('commons.name')" prop="name">
|
||||||
<el-input v-model="form.name" autocomplete="off"/>
|
<el-input v-model="form.name" autocomplete="off"/>
|
||||||
|
@ -46,7 +48,8 @@
|
||||||
@confirm="submit('form')"/>
|
@confirm="submit('form')"/>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible" width="30%">
|
<el-dialog :close-on-click-modal="false" :title="$t('workspace.update')" :visible.sync="dialogWsUpdateVisible"
|
||||||
|
width="30%">
|
||||||
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
|
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="100px" size="small">
|
||||||
<el-form-item :label="$t('commons.name')" prop="name">
|
<el-form-item :label="$t('commons.name')" prop="name">
|
||||||
<el-input v-model="form.name" autocomplete="off"/>
|
<el-input v-model="form.name" autocomplete="off"/>
|
||||||
|
@ -63,9 +66,11 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- dialog of workspace member -->
|
<!-- dialog of workspace member -->
|
||||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true" @close="close"
|
<el-dialog :close-on-click-modal="false" :visible.sync="dialogWsMemberVisible" width="70%" :destroy-on-close="true"
|
||||||
|
@close="close"
|
||||||
class="dialog-css">
|
class="dialog-css">
|
||||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
||||||
|
:create-permission="['ORGANIZATION_WORKSPACE:READ+CREATE', 'ORGANIZATION_WORKSPACE:READ+EDIT']"
|
||||||
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
||||||
<!-- organization member table -->
|
<!-- organization member table -->
|
||||||
<el-table :data="memberLineData" style="width: 100%;margin-top: 5px;">
|
<el-table :data="memberLineData" style="width: 100%;margin-top: 5px;">
|
||||||
|
@ -80,7 +85,10 @@
|
||||||
<el-table-column :label="$t('commons.operating')">
|
<el-table-column :label="$t('commons.operating')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<div>
|
<div>
|
||||||
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)"
|
<ms-table-operator :tip2="$t('commons.remove')"
|
||||||
|
:edit-permission="['ORGANIZATION_WORKSPACE:READ+CREATE', 'ORGANIZATION_WORKSPACE:READ+EDIT']"
|
||||||
|
:delete-permission="['ORGANIZATION_WORKSPACE:READ+CREATE', 'ORGANIZATION_WORKSPACE:READ+EDIT']"
|
||||||
|
@editClick="editMember(scope.row)"
|
||||||
@deleteClick="delMember(scope.row)"/>
|
@deleteClick="delMember(scope.row)"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -92,12 +100,14 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- add workspace member dialog -->
|
<!-- add workspace member dialog -->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible" width="30%"
|
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogWsMemberAddVisible"
|
||||||
|
width="30%"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@close="closeFunc">
|
@close="closeFunc">
|
||||||
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
|
<el-form :model="memberForm" ref="form" :rules="wsMemberRule" label-position="right" label-width="100px"
|
||||||
size="small">
|
size="small">
|
||||||
<el-form-item :label="$t('commons.member')" prop="memberSign" :rules="{required: true, message: $t('member.input_id_or_email'), trigger: 'change'}">
|
<el-form-item :label="$t('commons.member')" prop="memberSign"
|
||||||
|
:rules="{required: true, message: $t('member.input_id_or_email'), trigger: 'change'}">
|
||||||
<el-autocomplete
|
<el-autocomplete
|
||||||
class="input-with-autocomplete"
|
class="input-with-autocomplete"
|
||||||
v-model="memberForm.memberSign"
|
v-model="memberForm.memberSign"
|
||||||
|
@ -110,8 +120,8 @@
|
||||||
@select="handleSelect"
|
@select="handleSelect"
|
||||||
>
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span class="ws-member-name">{{scope.item.id}}</span>
|
<span class="ws-member-name">{{ scope.item.id }}</span>
|
||||||
<span class="ws-member-email">{{scope.item.email}}</span>
|
<span class="ws-member-email">{{ scope.item.email }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-autocomplete>
|
</el-autocomplete>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -135,7 +145,8 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- update workspace member dialog -->
|
<!-- update workspace member dialog -->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible" width="30%"
|
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogWsMemberUpdateVisible"
|
||||||
|
width="30%"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@close="closeFunc">
|
@close="closeFunc">
|
||||||
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
|
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
|
||||||
|
@ -151,7 +162,8 @@
|
||||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||||
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
|
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用户组" prop="groupIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
<el-form-item label="用户组" prop="groupIds"
|
||||||
|
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
||||||
<el-select v-model="memberForm.groupIds" multiple placeholder="请选择用户组"
|
<el-select v-model="memberForm.groupIds" multiple placeholder="请选择用户组"
|
||||||
class="select-width">
|
class="select-width">
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -176,395 +188,396 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsCreateBox from "../CreateBox";
|
import MsCreateBox from "../CreateBox";
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
import {DEFAULT, GROUP_ORGANIZATION, GROUP_WORKSPACE} from "../../../../common/js/constants";
|
import {DEFAULT, GROUP_WORKSPACE} from "../../../../common/js/constants";
|
||||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||||
import MsRolesTag from "../../common/components/MsRolesTag";
|
import MsRolesTag from "../../common/components/MsRolesTag";
|
||||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||||
import {
|
import {
|
||||||
getCurrentOrganizationId,
|
getCurrentUser,
|
||||||
getCurrentUser,
|
getCurrentWorkspaceId,
|
||||||
getCurrentWorkspaceId, listenGoBack,
|
listenGoBack,
|
||||||
refreshSessionAndCookies, removeGoBackListener
|
refreshSessionAndCookies,
|
||||||
} from "../../../../common/js/utils";
|
removeGoBackListener
|
||||||
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
|
} from "../../../../common/js/utils";
|
||||||
|
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsOrganizationWorkspace",
|
name: "MsOrganizationWorkspace",
|
||||||
components: {
|
components: {
|
||||||
MsDeleteConfirm,
|
MsDeleteConfirm,
|
||||||
MsCreateBox,
|
MsCreateBox,
|
||||||
MsTablePagination,
|
MsTablePagination,
|
||||||
MsTableHeader,
|
MsTableHeader,
|
||||||
MsRolesTag,
|
MsRolesTag,
|
||||||
MsTableOperator,
|
MsTableOperator,
|
||||||
MsDialogFooter,
|
MsDialogFooter,
|
||||||
MsTableOperatorButton
|
MsTableOperatorButton
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
this.list();
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
currentUser: () => {
|
||||||
|
return getCurrentUser();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
create() {
|
||||||
|
this.dialogWsAddVisible = true;
|
||||||
|
this.form = {};
|
||||||
},
|
},
|
||||||
activated() {
|
submit(formName) {
|
||||||
this.list();
|
this.$refs[formName].validate((valid) => {
|
||||||
},
|
if (valid) {
|
||||||
computed: {
|
let saveType = 'add';
|
||||||
currentUser: () => {
|
if (this.form.id) {
|
||||||
return getCurrentUser();
|
saveType = 'update';
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
create() {
|
|
||||||
this.dialogWsAddVisible = 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.dialogWsAddVisible = false;
|
|
||||||
this.dialogWsUpdateVisible = false;
|
|
||||||
this.list();
|
|
||||||
if (saveType == 'add') {
|
|
||||||
Message.success(this.$t('commons.save_success'));
|
|
||||||
} else if (saveType == 'update') {
|
|
||||||
Message.success(this.$t('commons.modify_success'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
this.$post("/workspace/" + saveType, this.form, () => {
|
||||||
},
|
this.dialogWsAddVisible = false;
|
||||||
edit(row) {
|
this.dialogWsUpdateVisible = false;
|
||||||
this.dialogWsUpdateVisible = true;
|
|
||||||
this.form = Object.assign({}, row);
|
|
||||||
},
|
|
||||||
handleDelete(workspace) {
|
|
||||||
this.$refs.deleteConfirm.open(workspace);
|
|
||||||
},
|
|
||||||
_handleDelete(workspace) {
|
|
||||||
this.$confirm(this.$t('organization.delete_confirm'), '', {
|
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
this.$get('/workspace/delete/' + workspace.id, () => {
|
|
||||||
let lastWorkspaceId = getCurrentWorkspaceId();
|
|
||||||
let sourceId = workspace.id;
|
|
||||||
if (lastWorkspaceId === sourceId) {
|
|
||||||
let sign = DEFAULT;
|
|
||||||
refreshSessionAndCookies(sign, sourceId);
|
|
||||||
}
|
|
||||||
this.$success(this.$t('commons.delete_success'));
|
|
||||||
this.list();
|
this.list();
|
||||||
});
|
if (saveType == 'add') {
|
||||||
}).catch(() => {
|
Message.success(this.$t('commons.save_success'));
|
||||||
this.$message({
|
} else if (saveType == 'update') {
|
||||||
type: 'info',
|
Message.success(this.$t('commons.modify_success'));
|
||||||
message: this.$t('commons.delete_cancelled')
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
list() {
|
|
||||||
let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize;
|
|
||||||
let lastOrganizationId = this.currentUser.lastOrganizationId;
|
|
||||||
// let userRole = this.currentUser.userRoles.filter(r => r.sourceId === lastOrganizationId);
|
|
||||||
// if (userRole.length > 0) {
|
|
||||||
// let isOrg_admin = false;
|
|
||||||
// userRole.forEach(row=>{
|
|
||||||
// if(row.roleId === "org_admin" ){
|
|
||||||
// isOrg_admin = true;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// if (isOrg_admin) {
|
|
||||||
// this.result = this.$post(url, this.condition, response => {
|
|
||||||
// let data = response.data;
|
|
||||||
// this.items = data.listObject;
|
|
||||||
// for (let i = 0; i < this.items.length; i++) {
|
|
||||||
// let param = {
|
|
||||||
// name: '',
|
|
||||||
// workspaceId: this.items[i].id
|
|
||||||
// }
|
|
||||||
// let path = "user/ws/member/list/all";
|
|
||||||
// this.$post(path, param, res => {
|
|
||||||
// let member = res.data;
|
|
||||||
// this.$set(this.items[i], "memberSize", member.length);
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// this.total = data.itemCount;
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// this.items = [];
|
|
||||||
// this.total = 0;
|
|
||||||
// }
|
|
||||||
this.result = this.$post(url, this.condition, response => {
|
|
||||||
let data = response.data;
|
|
||||||
this.items = data.listObject;
|
|
||||||
for (let i = 0; i < this.items.length; i++) {
|
|
||||||
let param = {
|
|
||||||
name: '',
|
|
||||||
workspaceId: this.items[i].id
|
|
||||||
}
|
}
|
||||||
let path = "user/ws/member/list/all";
|
});
|
||||||
this.$post(path, param, res => {
|
} else {
|
||||||
let member = res.data;
|
return false;
|
||||||
this.$set(this.items[i], "memberSize", member.length);
|
}
|
||||||
})
|
});
|
||||||
|
},
|
||||||
|
edit(row) {
|
||||||
|
this.dialogWsUpdateVisible = true;
|
||||||
|
this.form = Object.assign({}, row);
|
||||||
|
},
|
||||||
|
handleDelete(workspace) {
|
||||||
|
this.$refs.deleteConfirm.open(workspace);
|
||||||
|
},
|
||||||
|
_handleDelete(workspace) {
|
||||||
|
this.$confirm(this.$t('organization.delete_confirm'), '', {
|
||||||
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$get('/workspace/delete/' + workspace.id, () => {
|
||||||
|
let lastWorkspaceId = getCurrentWorkspaceId();
|
||||||
|
let sourceId = workspace.id;
|
||||||
|
if (lastWorkspaceId === sourceId) {
|
||||||
|
let sign = DEFAULT;
|
||||||
|
refreshSessionAndCookies(sign, sourceId);
|
||||||
}
|
}
|
||||||
this.total = data.itemCount;
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
this.list();
|
||||||
});
|
});
|
||||||
// }
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: this.$t('commons.delete_cancelled')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
addMember() {
|
list() {
|
||||||
this.dialogWsMemberAddVisible = true;
|
let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize;
|
||||||
this.memberForm = {};
|
let lastOrganizationId = this.currentUser.lastOrganizationId;
|
||||||
this.result = this.$get('/user/list/', response => {
|
// let userRole = this.currentUser.userRoles.filter(r => r.sourceId === lastOrganizationId);
|
||||||
this.userList = response.data;
|
// if (userRole.length > 0) {
|
||||||
});
|
// let isOrg_admin = false;
|
||||||
this.result = this.$post('/user/group/list', {type: GROUP_WORKSPACE, resourceId: this.wsId}, response => {
|
// userRole.forEach(row=>{
|
||||||
this.$set(this.memberForm, "groups", response.data);
|
// if(row.roleId === "org_admin" ){
|
||||||
})
|
// isOrg_admin = true;
|
||||||
listenGoBack(this.close);
|
// return;
|
||||||
},
|
// }
|
||||||
cellClick(row) {
|
// });
|
||||||
// 保存当前点击的组织信息到currentRow
|
// if (isOrg_admin) {
|
||||||
this.currentWorkspaceRow = row;
|
// this.result = this.$post(url, this.condition, response => {
|
||||||
this.dialogWsMemberVisible = true;
|
// let data = response.data;
|
||||||
let param = {
|
// this.items = data.listObject;
|
||||||
name: '',
|
// for (let i = 0; i < this.items.length; i++) {
|
||||||
workspaceId: row.id
|
// let param = {
|
||||||
};
|
// name: '',
|
||||||
this.wsId = row.id;
|
// workspaceId: this.items[i].id
|
||||||
let path = "/user/ws/member/list";
|
// }
|
||||||
this.result = this.$post(this.buildPagePath(path), param, res => {
|
// let path = "user/ws/member/list/all";
|
||||||
let data = res.data;
|
// this.$post(path, param, res => {
|
||||||
this.memberLineData = data.listObject;
|
// let member = res.data;
|
||||||
let url = "/user/group/list/ws/" + row.id;
|
// this.$set(this.items[i], "memberSize", member.length);
|
||||||
// 填充角色信息
|
// })
|
||||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
// }
|
||||||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
// this.total = data.itemCount;
|
||||||
let groups = response.data;
|
// });
|
||||||
this.$set(this.memberLineData[i], "groups", groups);
|
// } else {
|
||||||
})
|
// this.items = [];
|
||||||
}
|
// this.total = 0;
|
||||||
this.dialogTotal = data.itemCount;
|
// }
|
||||||
});
|
this.result = this.$post(url, this.condition, response => {
|
||||||
},
|
let data = response.data;
|
||||||
dialogSearch() {
|
this.items = data.listObject;
|
||||||
let row = this.currentWorkspaceRow;
|
for (let i = 0; i < this.items.length; i++) {
|
||||||
this.dialogWsMemberVisible = true;
|
let param = {
|
||||||
let param = this.dialogCondition;
|
name: '',
|
||||||
this.$set(param, 'workspaceId', row.id);
|
workspaceId: this.items[i].id
|
||||||
let path = "/user/ws/member/list";
|
};
|
||||||
this.result = this.$post(this.buildPagePath(path), param, res => {
|
let path = "user/ws/member/list/all";
|
||||||
let data = res.data;
|
this.$post(path, param, res => {
|
||||||
this.memberLineData = data.listObject;
|
let member = res.data;
|
||||||
let url = "/user/group/list/ws/" + row.id;
|
this.$set(this.items[i], "memberSize", member.length);
|
||||||
// 填充角色信息
|
});
|
||||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
}
|
||||||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
this.total = data.itemCount;
|
||||||
let groups = response.data;
|
});
|
||||||
this.$set(this.memberLineData[i], "groups", groups);
|
// }
|
||||||
})
|
|
||||||
}
|
},
|
||||||
this.dialogTotal = data.itemCount;
|
addMember() {
|
||||||
});
|
this.dialogWsMemberAddVisible = true;
|
||||||
},
|
this.memberForm = {};
|
||||||
closeFunc() {
|
this.result = this.$get('/user/list/', response => {
|
||||||
this.form = {};
|
this.userList = response.data;
|
||||||
},
|
});
|
||||||
submitForm(formName) {
|
this.result = this.$post('/user/group/list', {type: GROUP_WORKSPACE, resourceId: this.wsId}, response => {
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$set(this.memberForm, "groups", response.data);
|
||||||
if (valid) {
|
});
|
||||||
let userIds = [];
|
listenGoBack(this.close);
|
||||||
let userId = this.memberForm.userId;
|
},
|
||||||
let email = this.memberForm.memberSign;
|
cellClick(row) {
|
||||||
let member = this.userList.find(user => user.id === email || user.email === email);
|
// 保存当前点击的组织信息到currentRow
|
||||||
if (!member) {
|
this.currentWorkspaceRow = row;
|
||||||
this.$warning(this.$t('member.no_such_user'));
|
this.dialogWsMemberVisible = true;
|
||||||
return false;
|
let param = {
|
||||||
} else {
|
name: '',
|
||||||
userId = member.id;
|
workspaceId: row.id
|
||||||
}
|
};
|
||||||
userIds.push(userId);
|
this.wsId = row.id;
|
||||||
let param = {
|
let path = "/user/ws/member/list";
|
||||||
userIds: userIds,
|
this.result = this.$post(this.buildPagePath(path), param, res => {
|
||||||
groupIds: this.memberForm.groupIds,
|
let data = res.data;
|
||||||
workspaceId: this.currentWorkspaceRow.id
|
this.memberLineData = data.listObject;
|
||||||
};
|
let url = "/user/group/list/ws/" + row.id;
|
||||||
this.result = this.$post("user/ws/member/add", param, () => {
|
// 填充角色信息
|
||||||
this.$success(this.$t('commons.save_success'));
|
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||||
this.cellClick(this.currentWorkspaceRow);
|
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||||
this.dialogWsMemberAddVisible = false;
|
let groups = response.data;
|
||||||
})
|
this.$set(this.memberLineData[i], "groups", groups);
|
||||||
} else {
|
});
|
||||||
|
}
|
||||||
|
this.dialogTotal = data.itemCount;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dialogSearch() {
|
||||||
|
let row = this.currentWorkspaceRow;
|
||||||
|
this.dialogWsMemberVisible = true;
|
||||||
|
let param = this.dialogCondition;
|
||||||
|
this.$set(param, 'workspaceId', row.id);
|
||||||
|
let path = "/user/ws/member/list";
|
||||||
|
this.result = this.$post(this.buildPagePath(path), param, res => {
|
||||||
|
let data = res.data;
|
||||||
|
this.memberLineData = data.listObject;
|
||||||
|
let url = "/user/group/list/ws/" + row.id;
|
||||||
|
// 填充角色信息
|
||||||
|
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||||
|
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||||
|
let groups = response.data;
|
||||||
|
this.$set(this.memberLineData[i], "groups", groups);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.dialogTotal = data.itemCount;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closeFunc() {
|
||||||
|
this.form = {};
|
||||||
|
},
|
||||||
|
submitForm(formName) {
|
||||||
|
this.$refs[formName].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let userIds = [];
|
||||||
|
let userId = this.memberForm.userId;
|
||||||
|
let email = this.memberForm.memberSign;
|
||||||
|
let member = this.userList.find(user => user.id === email || user.email === email);
|
||||||
|
if (!member) {
|
||||||
|
this.$warning(this.$t('member.no_such_user'));
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
userId = member.id;
|
||||||
}
|
}
|
||||||
|
userIds.push(userId);
|
||||||
|
let param = {
|
||||||
|
userIds: userIds,
|
||||||
|
groupIds: this.memberForm.groupIds,
|
||||||
|
workspaceId: this.currentWorkspaceRow.id
|
||||||
|
};
|
||||||
|
this.result = this.$post("user/ws/member/add", param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.cellClick(this.currentWorkspaceRow);
|
||||||
|
this.dialogWsMemberAddVisible = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
editMember(row) {
|
||||||
|
this.dialogWsMemberUpdateVisible = true;
|
||||||
|
this.memberForm = Object.assign({}, row);
|
||||||
|
let groupIds = this.memberForm.groups.map(r => r.id);
|
||||||
|
this.result = this.$post('/user/group/list', {type: GROUP_WORKSPACE, resourceId: this.wsId}, response => {
|
||||||
|
this.$set(this.memberForm, "allgroups", response.data);
|
||||||
|
});
|
||||||
|
// 编辑时填充角色信息
|
||||||
|
this.$set(this.memberForm, 'groupIds', groupIds);
|
||||||
|
listenGoBack(this.close);
|
||||||
|
},
|
||||||
|
delMember(row) {
|
||||||
|
this.$confirm(this.$t('member.remove_member'), '', {
|
||||||
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.result = this.$get('/user/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + encodeURIComponent(row.id), () => {
|
||||||
|
this.$success(this.$t('commons.remove_success'));
|
||||||
|
this.cellClick(this.currentWorkspaceRow);
|
||||||
});
|
});
|
||||||
},
|
}).catch(() => {
|
||||||
editMember(row) {
|
this.$info(this.$t('commons.remove_cancel'));
|
||||||
this.dialogWsMemberUpdateVisible = true;
|
});
|
||||||
this.memberForm = Object.assign({}, row);
|
},
|
||||||
let groupIds = this.memberForm.groups.map(r => r.id);
|
updateOrgMember(formName) {
|
||||||
this.result = this.$post('/user/group/list', {type: GROUP_WORKSPACE, resourceId: this.wsId}, response => {
|
let param = {
|
||||||
this.$set(this.memberForm, "allgroups", response.data);
|
id: this.memberForm.id,
|
||||||
})
|
name: this.memberForm.name,
|
||||||
// 编辑时填充角色信息
|
email: this.memberForm.email,
|
||||||
this.$set(this.memberForm, 'groupIds', groupIds);
|
phone: this.memberForm.phone,
|
||||||
listenGoBack(this.close);
|
groupIds: this.memberForm.groupIds,
|
||||||
},
|
workspaceId: this.currentWorkspaceRow.id
|
||||||
delMember(row) {
|
};
|
||||||
this.$confirm(this.$t('member.remove_member'), '', {
|
this.$refs[formName].validate((valid) => {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
if (valid) {
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
this.result = this.$post("/workspace/member/update", param, () => {
|
||||||
type: 'warning'
|
this.$success(this.$t('commons.modify_success'));
|
||||||
}).then(() => {
|
this.dialogWsMemberUpdateVisible = false;
|
||||||
this.result = this.$get('/user/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + encodeURIComponent(row.id), () => {
|
|
||||||
this.$success(this.$t('commons.remove_success'));
|
|
||||||
this.cellClick(this.currentWorkspaceRow);
|
this.cellClick(this.currentWorkspaceRow);
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
|
||||||
this.$info(this.$t('commons.remove_cancel'));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateOrgMember(formName) {
|
|
||||||
let param = {
|
|
||||||
id: this.memberForm.id,
|
|
||||||
name: this.memberForm.name,
|
|
||||||
email: this.memberForm.email,
|
|
||||||
phone: this.memberForm.phone,
|
|
||||||
groupIds: this.memberForm.groupIds,
|
|
||||||
workspaceId: this.currentWorkspaceRow.id
|
|
||||||
}
|
}
|
||||||
this.$refs[formName].validate((valid) => {
|
});
|
||||||
if (valid) {
|
|
||||||
this.result = this.$post("/workspace/member/update", param, () => {
|
|
||||||
this.$success(this.$t('commons.modify_success'));
|
|
||||||
this.dialogWsMemberUpdateVisible = false;
|
|
||||||
this.cellClick(this.currentWorkspaceRow);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
close: function () {
|
|
||||||
removeGoBackListener(this.close);
|
|
||||||
this.dialogWsMemberUpdateVisible = false;
|
|
||||||
this.dialogWsMemberAddVisible = false;
|
|
||||||
this.memberLineData = [];
|
|
||||||
this.list();
|
|
||||||
},
|
|
||||||
buildPagePath(path) {
|
|
||||||
return path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize;
|
|
||||||
},
|
|
||||||
querySearch(queryString, cb) {
|
|
||||||
var userList = this.userList;
|
|
||||||
var results = queryString ? userList.filter(this.createFilter(queryString)) : userList;
|
|
||||||
// 调用 callback 返回建议列表的数据
|
|
||||||
cb(results);
|
|
||||||
},
|
|
||||||
createFilter(queryString) {
|
|
||||||
return (user) => {
|
|
||||||
return (user.email.indexOf(queryString.toLowerCase()) === 0 || user.id.indexOf(queryString.toLowerCase()) === 0);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
handleSelect(item) {
|
|
||||||
this.$set(this.form, "userId", item.id);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
close: function () {
|
||||||
return {
|
removeGoBackListener(this.close);
|
||||||
result: {},
|
this.dialogWsMemberUpdateVisible = false;
|
||||||
dialogWsAddVisible: false,
|
this.dialogWsMemberAddVisible = false;
|
||||||
dialogWsUpdateVisible: false,
|
this.memberLineData = [];
|
||||||
dialogWsMemberVisible: false,
|
this.list();
|
||||||
dialogWsMemberAddVisible: false,
|
},
|
||||||
dialogWsMemberUpdateVisible: false,
|
buildPagePath(path) {
|
||||||
condition: {},
|
return path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize;
|
||||||
dialogCondition: {},
|
},
|
||||||
items: [],
|
querySearch(queryString, cb) {
|
||||||
userList: [],
|
var userList = this.userList;
|
||||||
currentPage: 1,
|
var results = queryString ? userList.filter(this.createFilter(queryString)) : userList;
|
||||||
pageSize: 10,
|
// 调用 callback 返回建议列表的数据
|
||||||
total: 0,
|
cb(results);
|
||||||
dialogCurrentPage: 1,
|
},
|
||||||
dialogPageSize: 10,
|
createFilter(queryString) {
|
||||||
dialogTotal: 0,
|
return (user) => {
|
||||||
memberLineData: [],
|
return (user.email.indexOf(queryString.toLowerCase()) === 0 || user.id.indexOf(queryString.toLowerCase()) === 0);
|
||||||
memberForm: {},
|
};
|
||||||
screenHeight: 'calc(100vh - 255px)',
|
},
|
||||||
form: {
|
handleSelect(item) {
|
||||||
// name: "",
|
this.$set(this.form, "userId", item.id);
|
||||||
// description: ""
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
name: [
|
|
||||||
{required: true, message: this.$t('workspace.input_name'), trigger: 'blur'},
|
|
||||||
{min: 2, max: 20, message: this.$t('commons.input_limit', [2, 20]), trigger: 'blur'},
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
pattern: /^(?!-)(?!.*?-$)[a-zA-Z0-9\u4e00-\u9fa5-]+$/,
|
|
||||||
message: this.$t('workspace.special_characters_are_not_supported'),
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
description: [
|
|
||||||
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
wsMemberRule: {
|
|
||||||
userIds: [
|
|
||||||
{required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
|
|
||||||
],
|
|
||||||
groupIds: [
|
|
||||||
{required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
currentWorkspaceRow: {},
|
|
||||||
wsId: ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: {},
|
||||||
|
dialogWsAddVisible: false,
|
||||||
|
dialogWsUpdateVisible: false,
|
||||||
|
dialogWsMemberVisible: false,
|
||||||
|
dialogWsMemberAddVisible: false,
|
||||||
|
dialogWsMemberUpdateVisible: false,
|
||||||
|
condition: {},
|
||||||
|
dialogCondition: {},
|
||||||
|
items: [],
|
||||||
|
userList: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
dialogCurrentPage: 1,
|
||||||
|
dialogPageSize: 10,
|
||||||
|
dialogTotal: 0,
|
||||||
|
memberLineData: [],
|
||||||
|
memberForm: {},
|
||||||
|
screenHeight: 'calc(100vh - 255px)',
|
||||||
|
form: {
|
||||||
|
// name: "",
|
||||||
|
// description: ""
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: this.$t('workspace.input_name'), trigger: 'blur'},
|
||||||
|
{min: 2, max: 20, message: this.$t('commons.input_limit', [2, 20]), trigger: 'blur'},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
pattern: /^(?!-)(?!.*?-$)[a-zA-Z0-9\u4e00-\u9fa5-]+$/,
|
||||||
|
message: this.$t('workspace.special_characters_are_not_supported'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
description: [
|
||||||
|
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
wsMemberRule: {
|
||||||
|
userIds: [
|
||||||
|
{required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
|
||||||
|
],
|
||||||
|
groupIds: [
|
||||||
|
{required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
currentWorkspaceRow: {},
|
||||||
|
wsId: ""
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.el-table__row:hover .edit {
|
.el-table__row:hover .edit {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.member-size {
|
.member-size {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-width {
|
.select-width {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ws-member-name {
|
.ws-member-name {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ws-member-email {
|
.ws-member-email {
|
||||||
float: right;
|
float: right;
|
||||||
color: #8492a6;
|
color: #8492a6;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-css >>> .el-dialog__header {
|
.dialog-css >>> .el-dialog__header {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-with-autocomplete {
|
.input-with-autocomplete {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue