From 405d511a449051c6468f2b366e401d5ad89d892e Mon Sep 17 00:00:00 2001 From: jscyl13849007907 <13849007907@163.com> Date: Wed, 24 Jun 2026 18:40:49 +0800 Subject: [PATCH] no message --- components/panel/formSlot.vue | 73 ++++++++++++++++++++++++++++++++++--------- utils/ajax.js | 4 +++ 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/components/panel/formSlot.vue b/components/panel/formSlot.vue index 871f820..5811865 100644 --- a/components/panel/formSlot.vue +++ b/components/panel/formSlot.vue @@ -266,7 +266,7 @@
{{ dept.teamName }}
-
+
-1) { + // 找到了选中的节点,返回包含该节点的路径 + return [item.id]; + } + if (item.childs && item.childs.length > 0) { + let childPath = this.buildExpandedPath(item.childs, selectedIds); + if (childPath.length > 0) { + return [item.id].concat(childPath); + } + } + } + return []; + }, + // 根据展开路径构建级联列 + buildCascadingColumns(list) { if (!list || list.length === 0) return []; let columns = [list]; - // 找到所有有子级的节点,合并子级作为下一列 - let nextColumn = []; - list.forEach(item => { - if (item.childs && item.childs.length > 0) { - nextColumn = nextColumn.concat(item.childs); + let currentList = list; + for (let i = 0; i < this.expandedDeptIds.length; i++) { + let expandedId = this.expandedDeptIds[i]; + let found = currentList.find(item => item.id === expandedId); + if (found && found.childs && found.childs.length > 0) { + columns.push(found.childs); + currentList = found.childs; + } else { + break; } - }); - if (nextColumn.length > 0) { - columns = columns.concat(this.buildAllDeptColumns(nextColumn)); } return columns; }, - // 点击部门项:切换选中 + 展开下一级 + // 判断某节点是否在当前展开路径上 + isParentExpanded(dept, colIndex) { + return this.expandedDeptIds[colIndex] === dept.id; + }, + // 点击部门项:切换选中 + 展开/收起下一级 handleDeptClick(dept, colIndex) { + // 切换选中状态 let idx = this.selectedDeptIds.indexOf(dept.id); if (idx > -1) { this.selectedDeptIds.splice(idx, 1); @@ -848,6 +874,18 @@ export default { this.selectedDeptIds.push(dept.id); this.selectedDeptNames.push(dept.teamName); } + // 处理展开/收起:点击有子级的节点时,展开或收起其子级 + if (dept.childs && dept.childs.length > 0) { + if (this.expandedDeptIds[colIndex] === dept.id) { + // 已展开,则收起该节点及其后续展开 + this.expandedDeptIds = this.expandedDeptIds.slice(0, colIndex); + } else { + // 未展开或展开了其他节点,则设置当前节点为展开,并截断后续 + this.expandedDeptIds = this.expandedDeptIds.slice(0, colIndex); + this.expandedDeptIds.push(dept.id); + } + this.deptColumns = this.buildCascadingColumns(this.deptList || []); + } }, // 提交部门选择 submitDept() { @@ -990,11 +1028,16 @@ export default { .dept-columns-scroll { white-space: nowrap; overflow-x: auto; + overflow-y: hidden; -webkit-overflow-scrolling: touch; flex: 1; width: 100%; padding-bottom: calc(constant(safe-area-inset-bottom) + 80rpx); padding-bottom: calc(env(safe-area-inset-bottom) + 80rpx); + scrollbar-width: none; +} +.dept-columns-scroll::-webkit-scrollbar { + display: none; } .dept-columns { display: flex; @@ -1006,7 +1049,7 @@ export default { } .dept-column { width: 30vw; - min-width: 30vw; + min-width: 180px; max-width: 30vw; height: 100%; border-right: 1px solid #ddd; diff --git a/utils/ajax.js b/utils/ajax.js index 421c9d1..a142070 100644 --- a/utils/ajax.js +++ b/utils/ajax.js @@ -137,9 +137,13 @@ let data = { } if (uni.getStorageSync("AGENCY_ID")) { $header.AgencyId4A = uni.getStorageSync("AGENCY_ID"); + console.log("---------------$url", $url); if (!$parmas.agencyId) { $parmas.agencyId = uni.getStorageSync("AGENCY_ID") } + if($url == '/yishoudan/user/updateAgencyCorpUser'){ + $parmas.agencyId = uni.getStorageSync("apply-userinfo").agencyId + } } if ($parmas.formdata || $method == "POST" || $method == "PUT") {