fix -- 完善流程设计候选人操作

This commit is contained in:
konbai
2022-05-14 16:32:45 +08:00
parent ed355c4a81
commit 4e5ee8be65

View File

@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
<div v-if="dataType === 'ROLES'"> <div v-if="dataType === 'ROLES'">
<el-select v-model="roleIds" multiple size="mini" placeholder="请选择 角色"> <el-select v-model="roleIds" multiple size="mini" placeholder="请选择 角色" @change="changeSelectRoles">
<el-option <el-option
v-for="item in roleOptions" v-for="item in roleOptions"
:key="item.roleId" :key="item.roleId"
@@ -28,9 +28,6 @@
:disabled="item.status === 1"> :disabled="item.status === 1">
</el-option> </el-option>
</el-select> </el-select>
<div class="element-drawer__button">
<el-button size="mini" type="primary" icon="el-icon-plus" @click="handleSaveRoles()"> </el-button>
</div>
</div> </div>
<div v-if="dataType === 'DEPTS'"> <div v-if="dataType === 'DEPTS'">
<tree-select <tree-select
@@ -195,6 +192,7 @@ export default {
if (!bpmnElementObj) { if (!bpmnElementObj) {
return; return;
} }
this.clearOptionsData()
this.dataType = bpmnElementObj['dataType']; this.dataType = bpmnElementObj['dataType'];
if (this.dataType === 'USERS') { if (this.dataType === 'USERS') {
let userIdData = bpmnElementObj['assignee'] || bpmnElementObj['candidateUsers']; let userIdData = bpmnElementObj['assignee'] || bpmnElementObj['candidateUsers'];
@@ -202,9 +200,9 @@ export default {
if (userIdData && userIdData.length > 0 && userText && userText.length > 0) { if (userIdData && userIdData.length > 0 && userText && userText.length > 0) {
this.selectedUser.ids = userIdData?.toString().split(','); this.selectedUser.ids = userIdData?.toString().split(',');
this.selectedUser.text = userText?.split(','); this.selectedUser.text = userText?.split(',');
} else { }
this.selectedUser.ids = [] if (this.selectedUser.ids.length > 1) {
this.selectedUser.text = [] this.showMultiFlog = true;
} }
} else if (this.dataType === 'ROLES') { } else if (this.dataType === 'ROLES') {
this.getRoleOptions(); this.getRoleOptions();
@@ -212,6 +210,7 @@ export default {
if (roleIdData && roleIdData.length > 0) { if (roleIdData && roleIdData.length > 0) {
this.roleIds = roleIdData.split(',') this.roleIds = roleIdData.split(',')
} }
this.showMultiFlog = true;
} else if (this.dataType === 'DEPTS') { } else if (this.dataType === 'DEPTS') {
this.getDeptTreeData().then(() => { this.getDeptTreeData().then(() => {
let deptIdData = bpmnElementObj['candidateGroups'] || []; let deptIdData = bpmnElementObj['candidateGroups'] || [];
@@ -219,9 +218,22 @@ export default {
this.deptIds = deptIdData.split(','); this.deptIds = deptIdData.split(',');
} }
}); });
this.showMultiFlog = true;
} }
this.getElementLoop(bpmnElementObj); this.getElementLoop(bpmnElementObj);
}, },
/**
* 清空选项数据
*/
clearOptionsData() {
this.selectedUser.ids = [];
this.selectedUser.text = [];
this.roleIds = [];
this.deptIds = [];
},
/**
* 跟新节点数据
*/
updateElementTask() { updateElementTask() {
const taskAttr = Object.create(null); const taskAttr = Object.create(null);
for (let key in userTaskForm) { for (let key in userTaskForm) {
@@ -334,13 +346,9 @@ export default {
this.updateElementTask() this.updateElementTask()
this.userOpen = false; this.userOpen = false;
}, },
handleSaveRoles() { changeSelectRoles(val) {
if (!this.roleIds || this.roleIds.length <= 0) { userTaskForm.candidateGroups = val.join() || null;
this.$modal.msgError('请选择角色'); let textArr = this.roleOptions.filter(k => val.indexOf(`ROLE${k.roleId}`) >= 0);
return;
}
userTaskForm.candidateGroups = this.roleIds.join() || null;
let textArr = this.roleOptions.filter(k => this.roleIds.indexOf(`ROLE${k.roleId}`) >= 0);
userTaskForm.text = textArr?.map(k => k.roleName).join() || null; userTaskForm.text = textArr?.map(k => k.roleName).join() || null;
this.updateElementTask(); this.updateElementTask();
}, },
@@ -400,7 +408,7 @@ export default {
userTaskForm.text = "流程发起人"; userTaskForm.text = "流程发起人";
} }
this.updateElementTask(); this.updateElementTask();
if (val === 'ROLES' || val === 'DEPTS' || (val === 'USERS' && userTaskForm.text.indexOf(',') > 0)) { if (val === 'ROLES' || val === 'DEPTS' || (val === 'USERS' && this.selectedUser.ids.length > 1)) {
this.showMultiFlog = true; this.showMultiFlog = true;
} else { } else {
this.showMultiFlog = false; this.showMultiFlog = false;