From b33517d527aff48ff30eb78d341bbce53d0ed3bb Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期六, 30 十一月 2024 06:42:42 +0800 Subject: [PATCH] 部门、人。回显bug --- src/components/Process/panel/taskPanel.vue | 67 +++++++++++++++++++++++---------- 1 files changed, 47 insertions(+), 20 deletions(-) diff --git a/src/components/Process/panel/taskPanel.vue b/src/components/Process/panel/taskPanel.vue index 59063a2..51fb63f 100644 --- a/src/components/Process/panel/taskPanel.vue +++ b/src/components/Process/panel/taskPanel.vue @@ -5,7 +5,7 @@ <el-switch v-model="bpmnFormData.async" active-text="鏄�" inactive-text="鍚�" @change="updateElementTask('async')"/> </el-form-item> <el-form-item label="鐢ㄦ埛绫诲瀷"> - <el-select v-model="bpmnFormData.userType" placeholder="閫夋嫨浜哄憳" @change="updateUserType"> + <el-select v-model="bpmnFormData.userType" placeholder="鐢ㄦ埛绫诲瀷" @change="updateUserType"> <el-option v-for="item in userTypeOption" :key="item.value" @@ -87,7 +87,7 @@ :close-on-press-escape="false" :show-close="false" > - <flow-user v-if="userVisible" :checkType="checkType" :selectValues="selectData.assignee || selectData.candidateUsers" @handleUserSelect="userSelect"></flow-user> + <flow-user v-show="userVisible" ref="user" :checkType="checkType" :num="num" :selectValues="selectData.assignee || selectData.candidateUsers" @handleUserSelect="userSelect"></flow-user> <div slot="footer" class="dialog-footer"> <el-button size="small" @click="userVisible = false">鍙� 娑�</el-button> <el-button size="small" type="primary" @click="checkUserComplete">纭� 瀹�</el-button> @@ -109,7 +109,8 @@ </div> </el-dialog> - <flow-dept :checkeds="selectData.candidateGroups" :show="deptVisible" @close="closeDept" @submit="submitDept"/> + <!-- 閫夋嫨閮ㄩ棬 --> + <flow-dept ref="dept" :checkeds="selectData.candidateGroups" :show="deptVisible" @close="closeDept" @submit="submitDept"/> <!--閫夋嫨琛ㄨ揪寮�--> <el-dialog @@ -119,7 +120,7 @@ :close-on-press-escape="false" :show-close="false" > - <flow-exp v-if="expVisible" :selectValues="selectData.exp" @handleSingleExpSelect="expSelect"></flow-exp> + <flow-exp :selectValues="selectData.exp" @handleSingleExpSelect="expSelect"></flow-exp> <div slot="footer" class="dialog-footer"> <el-button size="small" @click="expVisible = false">鍙� 娑�</el-button> <el-button size="small" type="primary" @click="checkExpComplete">纭� 瀹�</el-button> @@ -137,6 +138,8 @@ import ElInputTag from '@/components/flow/ElInputTag' import FlowDept from '@/components/flow/Dept' import {StrUtil} from '@/utils/StrUtil' + + export default { name: "TaskPanel", @@ -156,6 +159,7 @@ }, data() { return { + num: 0, // 鐢ㄤ簬瑙﹀彂鐢ㄦ埛閫夋嫨鏇存柊 userVisible: false, roleVisible: false, expVisible: false, @@ -171,7 +175,7 @@ ], checkAll: false, bpmnFormData: { - userType: "", + userType: "candidateDeptGroups", assignee: "", candidateUsers: "", candidateGroups: "", @@ -184,7 +188,7 @@ selectData: { assignee: null, candidateUsers: null, - candidateGroups: null, // 瑙掕壊 + candidateGroups: [], // 瑙掕壊 candidateDeptGroups: [], // 閮ㄩ棬 exp: null, }, @@ -209,14 +213,14 @@ methods: { closeDept() { this.deptVisible = false - this.selectData.candidateGroups = [] + this.selectData.candidateGroups = null }, // 鍒濆鍖栬〃鍗� resetTaskForm() { // 鍒濆鍖栬涓虹┖鍊� this.bpmnFormData = { - userType: "", + userType: "candidateDeptGroups", assignee: "", candidateUsers: "", candidateGroups: "", @@ -256,16 +260,19 @@ // 鏇存柊浜哄憳绫诲瀷 updateUserType(val) { + console.log("worinim", val) // 鍒犻櫎xml涓凡閫夋嫨鏁版嵁绫诲瀷鑺傜偣 this.deleteFlowAttar(); - delete this.modelerStore.element.businessObject[`userType`] // 娓呴櫎宸查�変汉鍛樻暟鎹� - this.bpmnFormData[val] = null; + if (val === "candidateDeptGroups") { + this.bpmnFormData["candidateGroups"] = null; + } else { + this.bpmnFormData[val] = null; + } this.selectData = { assignee: null, candidateUsers: null, candidateGroups: null, - candidateDeptGroups: null, exp: null, } // 鍐欏叆userType鑺傜偣淇℃伅鍒皒ml @@ -297,43 +304,54 @@ // 鑾峰彇浜哄憳淇℃伅 getUserList(val, key) { if (StrUtil.isNotBlank(val)) { - const newArr = this.modelerStore.userList?.filter(i => val.split(',').includes(i.userId.toString())) - this.bpmnFormData[key] = newArr.map(item => item.nickName).join(','); + + if ('assignee' === key) { - this.selectData[key] = newArr.find(item => item.userId.toString() === val).userId; + console.log("杩欓噷寮�濮嬫姤閿欙紝", this.modelerStore.userList) + const uList = this.modelerStore.userList.filter(item => item.userId == val); + this.bpmnFormData[key] = uList && uList.length > 0 ? uList[0].nickName : "浜哄憳涓嶅瓨鍦�"; + this.selectData[key] = val; } else { + const newArr = this.modelerStore.userList?.filter(i => val.split(',').includes(i.userId.toString())) + console.log("鎸囧畾浜哄憳", newArr) + this.bpmnFormData[key] = newArr.map(item => item.nickName).join(','); this.selectData[key] = newArr.map(item => item.userId); } + // if (this.$refs.user) { + // this.$refs.user.setChecked(this.selectData[key]) + // } + } }, // 鑾峰彇瑙掕壊淇℃伅 getRoleList(val, key) { if (StrUtil.isNotBlank(val)) { - // 鏍规嵁id绛涢�夊嚭鏄鑹茶繕鏄儴闂� const roleAndDeptIds = val.split(","); const deptIds = roleAndDeptIds.filter(item => item.includes("dept")); const roleIds = roleAndDeptIds.filter(item => !item.includes("dept")); // 璋佹湁鍊煎氨鏄皝 if (roleIds && roleIds.length > 0) { - console.log("鎴戝幓1", roleIds) const newArr = this.modelerStore.roleList?.filter(i => roleIds.includes(i.roleId.toString())) this.bpmnFormData[key] = newArr.map(item => item.roleName).join(','); if ('assignee' === key) { + console.log("涓嶄細鍚э紵") this.selectData[key] = newArr.find(item => item.roleId.toString() === val).roleId; } else { this.selectData[key] = newArr.map(item => item.roleId); } } else { - console.log("鎴戝幓2", deptIds) + console.log(deptIds, "閮ㄩ棬IDs") const newArr = this.modelerStore.deptList?.filter(i => deptIds.includes(i.id)) this.bpmnFormData[key] = newArr.map(item => item.label).join(','); if ('assignee' === key) { + console.log("涓嶄細鍚э紵锛燂紵") this.selectData[key] = newArr.find(item => item.id === val).id; } else { this.selectData[key] = newArr.map(item => item.id); } + // this.$refs.dept.setCheckList(this.selectData[key]) } @@ -344,12 +362,19 @@ /*鍗曢�変汉鍛�*/ singleUserCheck() { + this.num+=1 this.userVisible = true; this.checkType = "single"; + // this.$nextTick(() => { + // console.log(typeof this.selectData.assignee, "绫诲瀷") + // this.$refs.user.setChecked(this.selectData.assignee); + // }); + }, /*澶氶�変汉鍛�*/ multipleUserCheck() { + this.num = this.num + 1 this.userVisible = true; this.checkType = "multiple"; }, @@ -387,7 +412,7 @@ if (selection) { this.deleteFlowAttar(); this.updateCustomElement('dataType', 'fixed'); - if (selection instanceof Array) { + if (this.checkType === 'multiple') { const userIds = selection.map(item => item.userId); const nickName = selection.map(item => item.nickName); // userType = candidateUsers @@ -395,6 +420,7 @@ this.updateCustomElement(this.bpmnFormData.userType, userIds.join(',')); this.handleSelectData(this.bpmnFormData.userType, userIds); } else { + console.log(selection, "杩斿洖鍊�") // userType = assignee this.bpmnFormData[this.bpmnFormData.userType] = selection.nickName; this.updateCustomElement(this.bpmnFormData.userType, selection.userId); @@ -418,15 +444,16 @@ // 閮ㄩ棬閫変腑鏁版嵁 submitDept(checkList, names) { this.deptVisible = false - // this.selectData.candidateDeptGroups = checkList if (checkList && names) { this.deleteFlowAttar(); this.bpmnFormData["candidateGroups"] = names; this.updateCustomElement('dataType', 'fixed'); // userType = candidateGroups // 杩欓噷鍙兘鍐欐涓猴細candidateGroups锛屽洜涓篺lowable鐢ㄦ埛缁勭殑鍏抽敭瀛楀氨鏄畠 + // this.updateCustomElement("candidateGroups", null); // 鍏堟竻绌哄啀璧嬪�硷紝鍥犱负鏄竴娆℃�ф彁浜ょ殑閮ㄩ棬鏁版嵁锛屾墍浠ラ渶瑕佸幓閲嶏紝鐩存帴璧嬪�间负null this.updateCustomElement("candidateGroups", checkList); this.handleSelectData("candidateGroups", checkList); + console.log(checkList, "閮ㄩ棬鍊�") } }, @@ -444,7 +471,7 @@ /*鐢ㄦ埛閫変腑璧嬪��*/ checkUserComplete() { this.userVisible = false; - this.checkType = ""; + this.checkType = "single"; }, /*鍊欓�夎鑹查�変腑璧嬪��*/ -- Gitblit v1.8.0