吉安感知网项目-前端
罗广辉
2026-05-22 623e72af33f3715a4e7de650e5603e076a98ba33
feat: 算法下拉
3 files modified
127 ■■■■■ changed files
applications/task-work-order/src/api/zkxt/index.js 9 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/FormDiaLog.vue 52 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/ViewDiaLog.vue 66 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/api/zkxt/index.js
@@ -53,4 +53,13 @@
    })
}
// ai算法
export const algorithmGroupedApi = (params) => {
    return request({
        url: `/webservice/webservice/algorithm/grouped`,
        method: 'get',
        params,
    })
}
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/FormDiaLog.vue
@@ -5,7 +5,7 @@
        :title="titleEnum[dialogMode]"
        @closed="visible = false"
        destroy-on-close
        width="75%"
        width="90%"
        :close-on-click-modal="false"
    >
        <div>
@@ -161,7 +161,7 @@
                                <el-select
                                    no-data-text="暂无推荐飞手"
                                    class="gd-select"
                                    popper-class="gd-select-popper"
                                    popper-class="gd-select-popper"
                                    v-model="row.deviceFlyerId"
                                    placeholder="请选择"
                                    filterable
@@ -201,6 +201,30 @@
                                </el-select>
                            </template>
                        </el-table-column>
                        <el-table-column prop="algorithmIds" min-width="160">
                            <template #header>
                                算法
                            </template>
                            <template v-slot="{ row }">
                                <el-tree-select
                                    class="gd-select"
                                    popper-class="gd-tree-select-popper"
                                    v-model="row.algorithmIds"
                                    :data="algorithmTreeData"
                                    :props="{ label: 'name', children: 'children', value: 'id' }"
                                    node-key="id"
                                    multiple
                                    collapse-tags
                                    collapse-tags-tooltip
                                    check-strictly
                                    filterable
                                    placeholder="请选择"
                                    :disabled="dialogReadonly"
                                />
                            </template>
                        </el-table-column>
                        <el-table-column prop="taskDesc" label="巡查任务描述">
                            <template v-slot="{ row }">
                                <el-input class="gd-input" v-model="row.taskDesc" placeholder="请输入" :disabled="dialogReadonly" />
@@ -249,7 +273,7 @@
import { gdWorkOrderPageApi } from '../orderManage/orderManageApi'
import { gdManageDeviceListApi } from '../orderManage/gdManageDeviceApi'
import { pxToRem } from '@/utils/rem'
import { airlineListApi } from '@/api/zkxt'
import { airlineListApi, algorithmGroupedApi } from '@/api/zkxt'
// 初始化任务行
const initTaskRow = () => ({
@@ -259,6 +283,7 @@
    patrolRouteUrl: '',
    deviceFlyerId: '',
    deviceId: null,
    algorithmIds: [],
    taskDesc: '',
})
const dictObj = inject('dictObj')
@@ -279,6 +304,26 @@
const deviceList = ref([]) // 设备列表
const routeOptions = ref([]) // 航线选项(根据工单范围获取)
const routeLoading = ref(false) // 航线加载中
const algorithmTreeData = ref([]) // 算法树形数据
// 获取算法分组数据
async function getAlgorithmList() {
    try {
        const res = await algorithmGroupedApi()
        const list = res?.data?.data ?? []
        algorithmTreeData.value = list.map(group => ({
            id: 'group_' + group.type,
            name: group.type,
            disabled: true,
            children: (group.algorithms || []).map(alg => ({
                id: alg.id,
                name: alg.name,
            }))
        }))
    } catch (e) {
        console.error('获取算法列表失败', e)
    }
}
// 子任务列表
const taskList = ref([initTaskRow()])
@@ -488,6 +533,7 @@
async function open({ mode = 'add', row } = {}) {
    dialogMode.value = mode
    await getWorkOrderList()
    getAlgorithmList()
    if (dialogMode.value === 'add') {
        selectedWorkOrderId.value = null
        selectedWorkOrder.value = null
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/ViewDiaLog.vue
@@ -72,6 +72,10 @@
                            <div class="label">巡查任务描述</div>
                            <div class="val">{{ formData.taskDesc }}</div>
                        </el-col>
                        <el-col :span="12">
                            <div class="label">算法</div>
                            <div class="val">{{ getAlgorithmNames(formData.algorithmIds) }}</div>
                        </el-col>
                    </el-row>
                    <template v-if="['6', '7', '8'].includes(taskStatus)">
                        <div class="detail-title" :style="{ marginTop: pxToRem(10) }">
@@ -181,6 +185,26 @@
                                <span>{{ getWorkOrderName(formData.workOrderId) }}</span>
                            </el-form-item>
                        </el-col>
                        <!-- 算法下拉 -->
                        <el-col :span="12">
                            <el-form-item label="算法" prop="algorithmIds">
                                <el-tree-select
                                    class="gd-select"
                                    popper-class="gd-tree-select-popper"
                                    v-model="formData.algorithmIds"
                                    :data="algorithmTreeData"
                                    :props="{ label: 'name', children: 'children', value: 'id' }"
                                    node-key="id"
                                    multiple
                                    collapse-tags
                                    collapse-tags-tooltip
                                    check-strictly
                                    filterable
                                    clearable
                                    placeholder="请选择"
                                />
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="巡查任务描述" prop="taskDesc">
                                <el-input
@@ -276,7 +300,7 @@
import { gdTaskResultListApi } from '@/views/orderView/orderManage/clueEvents/achievementApi'
import RefuseOrderDialog1 from '@/views/orderView/orderManage/inspectionRequest/RefuseOrderDialog1.vue'
import { Check } from '@element-plus/icons-vue'
import { queryAirById, airlineListApi } from '@/api/zkxt'
import { queryAirById, airlineListApi, algorithmGroupedApi } from '@/api/zkxt'
import * as Cesium from 'cesium'
import { useStore } from 'vuex'
@@ -289,6 +313,7 @@
    patrolRouteUrl: '',
    deviceFlyerId: null,
    deviceId: null,
    algorithmIds: [],
    taskDesc: '',
    workOrderId: null,
})
@@ -317,6 +342,37 @@
const getAirName = id => {
    const item = routeOptions.value.find(item => item.id === id)
    return item ? item.name : id
}
const algorithmTreeData = ref([]) // 算法树形数据
// 获取算法分组数据
async function getAlgorithmList() {
    try {
        const res = await algorithmGroupedApi()
        const list = res?.data?.data ?? []
        algorithmTreeData.value = list.map(group => ({
            id: 'group_' + group.type,
            name: group.type,
            disabled: true,
            children: (group.algorithms || []).map(alg => ({
                id: alg.id,
                name: alg.name,
            }))
        }))
    } catch (e) {
        console.error('获取算法列表失败', e)
    }
}
// 根据 algorithmIds 数组获取算法名称,逗号分割回显
function getAlgorithmNames(algorithmIds) {
    if (!algorithmIds || !algorithmIds.length) return ''
    const allAlgorithms = algorithmTreeData.value.flatMap(group => group.children || [])
    return algorithmIds.map(id => {
        const item = allAlgorithms.find(alg => alg.id === id)
        return item ? item.name : id
    }).join(', ')
}
const gdStatusObj = {
@@ -526,7 +582,15 @@
    dialogMode.value = mode
    const res = await gdPatrolTaskDetailApi({ id: row.id })
    formData.value = { ...initForm(), ...res.data.data }
    // 确保 algorithmIds 是数组
    if (formData.value.algorithmIds && typeof formData.value.algorithmIds === 'string') {
        formData.value.algorithmIds = formData.value.algorithmIds.split(',').filter(Boolean)
    } else if (!formData.value.algorithmIds) {
        formData.value.algorithmIds = []
    }
    detailLoaded.value = true
    // 获取算法列表
    getAlgorithmList()
    // 获取工单详情并根据geom范围获取航线列表
    await getWorkOrderDetail(formData.value.workOrderId)
    ;['6', '7', '8'].includes(row.taskStatus) && await getTaskResultList()