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(() => {
// 排除当前正在编辑的部门及其子部门