From 1c4e042c4bc78cf18fe5eff26a9df7c5de796731 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 7 Jan 2026 10:50:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E9=97=A8=E4=BD=BF=E7=94=A8=E6=A0=91?= =?UTF-8?q?=E5=BD=A2=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/Settings.vue | 52 ++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/frontend/src/views/Settings.vue b/frontend/src/views/Settings.vue index b5f3cf2..c024276 100644 --- a/frontend/src/views/Settings.vue +++ b/frontend/src/views/Settings.vue @@ -1695,20 +1695,18 @@

- - 未分配部门 - - {{ dept.deptName }} - - + :tree-data="departmentTreeSelectData" + :field-names="{ children: 'children', label: 'title', value: 'value' }" + tree-default-expand-all + allow-clear + show-search + :filter-tree-node="filterDeptTreeNode" + tree-node-filter-prop="title" + /> @@ -2499,6 +2497,38 @@ const getDepartmentLevel = (record: DepartmentOverview): number => { return 3 } +// 部门树形选择器数据 - 用于调整用户部门 +const departmentTreeSelectData = computed(() => { + // 构建树形结构 + const buildTree = (parentId: number | null): any[] => { + return departments.value + .filter(d => (d.parentId || null) === parentId) + .map(d => { + const children = buildTree(d.id!) + const node: any = { + title: `${d.deptName} (${d.deptType === 'demand' ? '需求' : '接单'})`, + value: d.id, + key: d.id + } + if (children.length > 0) { + node.children = children + } + return node + }) + } + + // 添加"未分配部门"选项 + return [ + { title: '未分配部门', value: 0, key: 0 }, + ...buildTree(null) + ] +}) + +// 过滤部门树节点 +const filterDeptTreeNode = (inputValue: string, treeNode: any) => { + return treeNode.title.toLowerCase().includes(inputValue.toLowerCase()) +} + // 上级部门选项(分层级)- 用于部门编辑弹窗 const parentDepartmentOptions = computed(() => { // 排除当前正在编辑的部门及其子部门