From 2e3d761b358faece0483a2cb8bfe9018bd28c176 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 17 Nov 2025 11:41:35 +0800
Subject: [PATCH] feat:更新所属部门

---
 src/views/job/components/SearchBox.vue |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/src/views/job/components/SearchBox.vue b/src/views/job/components/SearchBox.vue
index d69206c..b3a443b 100644
--- a/src/views/job/components/SearchBox.vue
+++ b/src/views/job/components/SearchBox.vue
@@ -94,21 +94,18 @@
             @clear="handleClear"
           />
         </el-form-item>
-        <!-- <el-form-item label="所属部门:" v-if="isExpand">
-          <el-select
-            :teleported="false"
+        <el-form-item label="所属部门:" v-if="isExpand">
+          <el-tree-select
+            popper-class="custom-tree-select"
             v-model="searchForm.create_dept"
-            placeholder="请选择"
+            :data="deptData"
+            :default-expanded-keys="[searchForm.create_dept]"
+            check-strictly
+            node-key="id"
+            :props="treeDeptProps"
             clearable
-          >
-            <el-option
-              v-for="item in deptData"
-              :key="item.id"
-              :label="item.deptName"
-              :value="item.id"
-            />
-          </el-select>
-        </el-form-item> -->
+          />
+        </el-form-item>
         <el-form-item label="任务状态:" v-if="isExpand">
           <el-select
           style="z-index: 1000"
@@ -149,6 +146,7 @@
 import { pxToRem } from '@/utils/rem';
 import { ElMessage } from 'element-plus';
 import { deptsByAreaCode, getSFDictionaryTree  } from '@/api/job/task';
+import { getDeptLazyTree } from '@/api/system/dept'
 // import TaskAlgorithmBusiness from './TaskAlgorithmBusiness.vue';
 import dayjs from 'dayjs';
 import { useStore } from 'vuex';
@@ -213,10 +211,8 @@
 let deptData = ref([]);
 // 所属部门信息
 const getDeptsByAreaCode = () => {
-  deptsByAreaCode(searchForm.area_code).then(res => {
-    if (res.code !== 0) {
-      deptData.value = res.data.data;
-    }
+  getDeptLazyTree({ parentId: 0, level: 0 }).then(res => {
+    deptData.value = res.data.data;
   });
 };
 
@@ -239,6 +235,12 @@
     label: 'dictValue',
     value: 'id',
     children: 'children',
+}
+// 部门
+const treeDeptProps = {
+  label: 'title',
+  value: 'id',
+  children: 'children',
 }
 const dictKey = ref('')
 const dataList = ref([])
@@ -293,9 +295,9 @@
     searchForm.device_sn = signDevice_sn.value;
   }
   // 所属部门重新请求值
-  searchForm.create_dept = '';
-  deptData.value = [];
-  getDeptsByAreaCode();
+  // searchForm.create_dept = '';
+  // deptData.value = [];
+  // getDeptsByAreaCode();
   handleSearch();
 };
 
@@ -416,6 +418,7 @@
 
 onMounted(() => {
   requestDockInfo();
+  getDeptsByAreaCode()
   getAlgorithmList();
   // 日历传值
   const calendarday = ref(route.query.day);

--
Gitblit v1.9.3