无人机管理后台前端(已迁走)
罗广辉
2025-08-16 a35e1a8d806e7e9323665652c3ecc5ed22eddead
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);