From a35e1a8d806e7e9323665652c3ecc5ed22eddead Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 16 Aug 2025 10:34:56 +0800
Subject: [PATCH] Merge branch 'feature/v5.0/5.0.2' into feature/v5.0/5.0.3

---
 src/views/job/components/SearchBox.vue |   66 +++++++++++++++++++++++++++++++-
 1 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/src/views/job/components/SearchBox.vue b/src/views/job/components/SearchBox.vue
index 89ac36e..f374b37 100644
--- a/src/views/job/components/SearchBox.vue
+++ b/src/views/job/components/SearchBox.vue
@@ -70,11 +70,24 @@
           <!-- <div class="btn add" @click="addTask"><img src="@/assets/images/task/add.png"/>新增</div> -->
         </div>
         <el-form-item label="任务算法:" v-if="isExpand" class="taskAlgorithm">
-          <TaskAlgorithmBusiness
+          <!-- <TaskAlgorithmBusiness
           ref="algorithmRef"
             :setWidth="160"
             :showAlgorithm="true"
             @algorithmChange="algorithmChange"
+          /> -->
+          <el-tree-select
+              popper-class="custom-tree-select"
+              :style="{ width: pxToRem(186) }"
+              v-model="dictKey"
+              :data="dataList"
+              :default-expanded-keys="[dictKey]"
+              check-strictly
+              node-key="id"
+              :props="treePropsSF"
+              @node-click="handleSFNodeClick"
+              clearable
+              @clear="handleClear"
           />
         </el-form-item>
         <!-- <el-form-item label="所属部门:" v-if="isExpand">
@@ -130,8 +143,8 @@
 <script setup>
 import { pxToRem } from '@/utils/rem';
 import { ElMessage } from 'element-plus';
-import { deptsByAreaCode } from '@/api/job/task';
-import TaskAlgorithmBusiness from './TaskAlgorithmBusiness.vue';
+import { deptsByAreaCode, getSFDictionaryTree  } from '@/api/job/task';
+// import TaskAlgorithmBusiness from './TaskAlgorithmBusiness.vue';
 import dayjs from 'dayjs';
 import { useStore } from 'vuex';
 import { getRegionTreeAll } from '@/api/job/task';
@@ -215,6 +228,52 @@
     handleNodeClick({ id: userAreaCode.value });
   });
 };
+
+// 算法
+const treePropsSF = {
+    label: 'dictValue',
+    value: 'id',
+    children: 'children',
+}
+const dictKey = ref('')
+const dataList = ref([])
+function getAlgorithmList() {
+  getSFDictionaryTree({code:'SF'}).then((res) => {
+      if (res.data.code === 200) {
+          const result = res.data.data[0].children
+          // 过滤第一层数据
+          const filteredData = result.map(item => {
+              // 过滤第二层数据
+              const children = item.children?.map(child => ({
+                  ...child,
+                  children: [] // 清空第三层数据
+              }))
+              return {
+                  ...item,
+                  children: children || []
+              }
+          })
+          dataList.value = filteredData
+      }
+  })
+}
+
+function handleSFNodeClick(data) {
+    if (data.children && data.children.length) {
+        // 获取子节点dictKey
+        const childDictKeys = data.children.map(child => child.dictKey)
+        searchForm.ai_types = childDictKeys
+    } else {
+        searchForm.ai_types = [data.dictKey]
+    }
+    // 更新列表
+    handleSearch()
+}
+function handleClear() {
+    dictKey.value = ''
+    searchForm.ai_types = []
+    handleSearch()
+}
 
 const handleNodeClick = async data => {
   // 处理机巢数据
@@ -340,6 +399,7 @@
 
 onMounted(() => {
   requestDockInfo();
+  getAlgorithmList();
   // 日历传值
   const calendarday = ref(route.query.day);
 

--
Gitblit v1.9.3