From 5c8103de425c4ebaac699fe3286f9845c65ca9ec Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Sat, 31 Jan 2026 15:33:25 +0800
Subject: [PATCH] feat:不显示下拉按钮

---
 applications/task-work-order/src/views/orderView/organizational/agenciesManagement/FormDiaLog.vue |   17 +++++++++++------
 applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue      |   14 +++++++++++---
 applications/task-work-order/src/views/orderView/organizational/zoningManagement/FormDiaLog.vue   |   17 +++++++++++------
 3 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/FormDiaLog.vue b/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/FormDiaLog.vue
index 6a4411e..8bd33d4 100644
--- a/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/FormDiaLog.vue
+++ b/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/FormDiaLog.vue
@@ -49,11 +49,7 @@
               v-model="formData.areaCode"
               node-key="id"
               :default-expanded-keys="expandedKeys"
-              :props="{
-                value: 'id',
-                label: 'name',
-                children: 'children'
-              }"
+              :props="treeSelectProps"
               placeholder="请选择"
               clearable
               filterable
@@ -139,7 +135,16 @@
 const titleEnum = ref({ edit: '编辑', view: '查看', add: '新增' })
 const expandedKeys = ref([]) // 树形选择器展开的节点
 const regionNodeCache = ref(new Map()) // 缓存区域节点及其父节点关系
-
+const treeSelectProps = ref({
+  value: 'id',
+  label: 'name',
+  children: 'children',
+  // 判断叶子节点
+  isLeaf: (data, node) => {
+    // 如果是第二级节点,则认为是叶子节点
+    return node.level >= 2
+  }
+})
 const rules = {
   deptName: fieldRules(true),
   areaCode: fieldRules(true),
diff --git a/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue b/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
index 9bb277c..549eab1 100644
--- a/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
+++ b/applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
@@ -181,7 +181,11 @@
 const treeSelectProps = {
   value: 'id',
   label: 'name',
-  children: 'children'
+  children: 'children',
+  // 添加isLeaf配置,告诉组件如何判断叶子节点
+  isLeaf: (data, node) => {
+    return data.leaf === true
+  }
 }
 // 导入机构相关
 const isShowImportView = ref(false)
@@ -214,7 +218,6 @@
 
 // 懒加载获取区域节点数据
 async function loadRegionNode(node, resolve) {
-
   try {
     // 限制只加载两级,当前节点 level >= 1 时不加载子节点
     if (node.level >= 2) {
@@ -229,10 +232,15 @@
     
     // 处理返回的节点数据
     const processedNodes = nodes.map(item => {
+      // 判断是否为叶子节点:如果是第二级(node.level === 1)则为叶子节点
+      const isLeaf = node.level === 1
+      
       return {
         id: item.id || item.value,
         name: item.name || item.title || item.label,
-        hasChildren: item.hasChildren || false
+        hasChildren: item.hasChildren || false,
+        // 关键:设置leaf属性,告知Tree组件该节点是否为叶子节点
+        leaf: isLeaf
       }
     })
     
diff --git a/applications/task-work-order/src/views/orderView/organizational/zoningManagement/FormDiaLog.vue b/applications/task-work-order/src/views/orderView/organizational/zoningManagement/FormDiaLog.vue
index 2781012..a82015f 100644
--- a/applications/task-work-order/src/views/orderView/organizational/zoningManagement/FormDiaLog.vue
+++ b/applications/task-work-order/src/views/orderView/organizational/zoningManagement/FormDiaLog.vue
@@ -62,11 +62,7 @@
               v-model="formData.parentCode"
               node-key="id"
               :default-expanded-keys="expandedKeys"
-              :props="{
-                value: 'id',
-                label: 'name',
-                children: 'children'
-              }"
+              :props="treeSelectProps"
               placeholder="请选择"
               clearable
               filterable
@@ -139,7 +135,16 @@
   zoningDetailApi,
   regionLazyTreeApi
 } from './zoningApi'
-
+const treeSelectProps = ref({
+  value: 'id',
+  label: 'name',
+  children: 'children',
+  // 判断叶子节点
+  isLeaf: (data, node) => {
+    // 如果是第二级节点,则认为是叶子节点
+    return node.level >= 2
+  }
+})
 // 初始化表单数据
 const initForm = () => ({
   code: '',

--
Gitblit v1.9.3