fix: 流程部门、用户选择显示完善

main
wx-jincw 2 weeks ago
parent fca31bb136
commit 09ce747ead

@ -280,6 +280,13 @@ export default {
if (!val) return; if (!val) return;
this.checkedKeys = val; this.checkedKeys = val;
this.initCheckedData(); this.initCheckedData();
},
data() {
this.initCheckedData();
this.$nextTick(() => {
this.handleCheckChange();
});
} }
} }
}; };

@ -39,7 +39,7 @@
multiple multiple
clearable clearable
checkStrictly checkStrictly
nodeKey="id" node-key="deptId"
:checkedKeys="deptIds" :checkedKeys="deptIds"
@change="checkedDeptChange"> @change="checkedDeptChange">
</tree-select> </tree-select>
@ -90,6 +90,7 @@
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
ref="tree" ref="tree"
node-key="deptId"
default-expand-all default-expand-all
@node-click="handleNodeClick" @node-click="handleNodeClick"
/> />
@ -99,8 +100,12 @@
<el-col :span="17"> <el-col :span="17">
<el-table ref="multipleTable" height="600" :data="userTableList" border @selection-change="handleSelectionChange"> <el-table ref="multipleTable" height="600" :data="userTableList" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="用户名" align="center" prop="nickName" /> <el-table-column label="用户名" align="center" prop="realName" />
<el-table-column label="部门" align="center" prop="dept.deptName" /> <el-table-column label="部门" align="center" prop="deptNames" >
<template slot-scope="scope">
{{scope.row.deptNames ? scope.row.deptNames.join('、') : '-'}}
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
:total="userTotal" :total="userTotal"
@ -157,7 +162,7 @@ export default {
deptOptions: [], deptOptions: [],
deptProps: { deptProps: {
children: "children", children: "children",
label: "label" label: "deptName"
}, },
deptTempOptions: [], deptTempOptions: [],
userTableList: [], userTableList: [],
@ -268,7 +273,7 @@ export default {
getDeptTreeData() { getDeptTreeData() {
function refactorTree(data) { function refactorTree(data) {
return data.map(node => { return data.map(node => {
let treeData = { id: `DEPT${node.id}`, label: node.label, parentId: node.parentId, weight: node.weight }; let treeData = { deptId: `DEPT${node.deptId}`, deptName: node.deptName, parentId: node.parentId, weight: node.weight };
if (node.children && node.children.length > 0) { if (node.children && node.children.length > 0) {
treeData.children = refactorTree(node.children); treeData.children = refactorTree(node.children);
} }
@ -306,11 +311,11 @@ export default {
// //
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.label.indexOf(value) !== -1; return data.deptName.indexOf(value) !== -1;
}, },
// //
handleNodeClick(data) { handleNodeClick(data) {
this.queryParams.deptId = data.id; this.queryParams.deptId = data.deptId;
this.getUserList(); this.getUserList();
}, },
// //
@ -334,18 +339,18 @@ export default {
return; return;
} }
userTaskForm.dataType = 'USERS'; userTaskForm.dataType = 'USERS';
this.selectedUser.text = this.selectedUserDate.map(k => k.nickName) || []; this.selectedUser.text = this.selectedUserDate.map(k => k.realName) || [];
if (this.selectedUserDate.length === 1) { if (this.selectedUserDate.length === 1) {
let data = this.selectedUserDate[0]; let data = this.selectedUserDate[0];
userTaskForm.assignee = data.userId; userTaskForm.assignee = data.id;
userTaskForm.text = data.nickName; userTaskForm.text = data.realName;
userTaskForm.candidateUsers = null; userTaskForm.candidateUsers = null;
this.showMultiFlog = false; this.showMultiFlog = false;
this.multiLoopType = 'Null'; this.multiLoopType = 'Null';
this.changeMultiLoopType(); this.changeMultiLoopType();
} else { } else {
userTaskForm.candidateUsers = this.selectedUserDate.map(k => k.userId).join() || null; userTaskForm.candidateUsers = this.selectedUserDate.map(k => k.id).join() || null;
userTaskForm.text = this.selectedUserDate.map(k => k.nickName).join() || null; userTaskForm.text = this.selectedUserDate.map(k => k.realName).join() || null;
userTaskForm.assignee = null; userTaskForm.assignee = null;
this.showMultiFlog = true; this.showMultiFlog = true;
} }
@ -386,12 +391,12 @@ export default {
if(temp.children) { if(temp.children) {
stark = temp.children.concat(stark); stark = temp.children.concat(stark);
} }
if(id === temp.id) { if(id === temp.deptId) {
textArr.push(temp); textArr.push(temp);
} }
} }
}) })
text = textArr?.map(k => k.label).join() || null; text = textArr?.map(k => k.deptName).join() || null;
} else { } else {
userTaskForm.dataType = null; userTaskForm.dataType = null;
this.multiLoopType = 'Null'; this.multiLoopType = 'Null';
@ -442,12 +447,12 @@ export default {
if(temp.children) { if(temp.children) {
stark = temp.children.concat(stark); stark = temp.children.concat(stark);
} }
if(id === temp.id) { if(id === temp.deptId) {
textArr.push(temp); textArr.push(temp);
} }
} }
}) })
userTaskForm.text = textArr?.map(k => k.label).join() || null; userTaskForm.text = textArr?.map(k => k.deptName).join() || null;
} }
} else if (val === 'INITIATOR') { } else if (val === 'INITIATOR') {
userTaskForm.assignee = "${initiator}"; userTaskForm.assignee = "${initiator}";

@ -28,7 +28,7 @@
closable closable
:disable-transitions="false" :disable-transitions="false"
@close="handleClose('copy', item)"> @close="handleClose('copy', item)">
{{ item.nickName }} {{ item.realName }}
</el-tag> </el-tag>
<el-button class="button-new-tag" type="primary" icon="el-icon-plus" size="mini" circle @click="onSelectCopyUsers" /> <el-button class="button-new-tag" type="primary" icon="el-icon-plus" size="mini" circle @click="onSelectCopyUsers" />
</el-form-item> </el-form-item>
@ -39,7 +39,7 @@
closable closable
:disable-transitions="false" :disable-transitions="false"
@close="handleClose('next', item)"> @close="handleClose('next', item)">
{{ item.nickName }} {{ item.realName }}
</el-tag> </el-tag>
<el-button class="button-new-tag" type="primary" icon="el-icon-plus" size="mini" circle @click="onSelectNextUsers" /> <el-button class="button-new-tag" type="primary" icon="el-icon-plus" size="mini" circle @click="onSelectNextUsers" />
</el-form-item> </el-form-item>
@ -161,6 +161,7 @@
:props="deptProps" :props="deptProps"
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
node-key="deptId"
ref="tree" ref="tree"
default-expand-all default-expand-all
@node-click="handleNodeClick" @node-click="handleNodeClick"
@ -180,7 +181,7 @@
<el-table-column v-if="userData.type === 'copy' || userData.type === 'next'" width="55" type="selection" /> <el-table-column v-if="userData.type === 'copy' || userData.type === 'next'" width="55" type="selection" />
<el-table-column v-else width="30"> <el-table-column v-else width="30">
<template slot-scope="scope"> <template slot-scope="scope">
<el-radio :label="scope.row.userId" v-model="currentUserId">{{''}}</el-radio> <el-radio :label="scope.row.id" v-model="currentUserId">{{''}}</el-radio>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="用户名" align="center" prop="nickName" /> <el-table-column label="用户名" align="center" prop="nickName" />
@ -271,7 +272,7 @@ export default {
userList: null, userList: null,
deptProps: { deptProps: {
children: "children", children: "children",
label: "label" label: "deptName"
}, },
// //
queryParams: { queryParams: {
@ -352,7 +353,7 @@ export default {
}, },
// //
handleNodeClick(data) { handleNodeClick(data) {
this.queryParams.deptId = data.id; this.queryParams.deptId = data.deptId;
this.getList(); this.getList();
}, },
setIcon(val) { setIcon(val) {
@ -377,7 +378,7 @@ export default {
if (selection && selection.length > 0) { if (selection && selection.length > 0) {
this.$nextTick(()=> { this.$nextTick(()=> {
selection.forEach(item => { selection.forEach(item => {
let row = this.userList.find(k => k.userId === item.userId); let row = this.userList.find(k => k.id === item.id);
this.$refs.userTable.toggleRowSelection(row); this.$refs.userTable.toggleRowSelection(row);
}) })
}) })
@ -389,7 +390,7 @@ export default {
}, },
// //
handleClose(type, tag) { handleClose(type, tag) {
let userObj = this.userMultipleSelection.find(item => item.userId === tag.id); let userObj = this.userMultipleSelection.find(item => item.id === tag.id);
this.userMultipleSelection.splice(this.userMultipleSelection.indexOf(userObj), 1); this.userMultipleSelection.splice(this.userMultipleSelection.indexOf(userObj), 1);
if (type === 'copy') { if (type === 'copy') {
this.copyUser = this.userMultipleSelection; this.copyUser = this.userMultipleSelection;
@ -516,7 +517,7 @@ export default {
}); });
}, },
changeCurrentUser(val) { changeCurrentUser(val) {
this.currentUserId = val.userId this.currentUserId = val.id
}, },
/** 返回页面 */ /** 返回页面 */
goBack() { goBack() {
@ -553,7 +554,7 @@ export default {
this.$modal.msgError("请选择用户"); this.$modal.msgError("请选择用户");
return false; return false;
} }
let userIds = this.userMultipleSelection.map(k => k.userId); let userIds = this.userMultipleSelection.map(k => k.id);
if (type === 'copy') { if (type === 'copy') {
// ID // ID
this.copyUser = this.userMultipleSelection; this.copyUser = this.userMultipleSelection;
@ -573,7 +574,7 @@ export default {
this.$modal.msgError("请选择用户"); this.$modal.msgError("请选择用户");
return false; return false;
} }
this.taskForm.userId = this.currentUserId; this.taskForm.id = this.currentUserId;
if (type === 'delegate') { if (type === 'delegate') {
delegate(this.taskForm).then(res => { delegate(this.taskForm).then(res => {
this.$modal.msgSuccess('操作成功'); this.$modal.msgSuccess('操作成功');

Loading…
Cancel
Save