|
@@ -28,10 +28,16 @@
|
|
|
</template>
|
|
|
<!-- 表格操作 -->
|
|
|
<template #operation="scope">
|
|
|
- <el-button type="primary" link icon="View" v-if="scope.row.algorithmModelId != null" @click="openModelDialog(scope.row)">
|
|
|
- <!--@click="openStartDialog(scope.row)" -->
|
|
|
+ <!-- <el-button type="primary" link icon="View" @click="openModelDialog(scope.row)">-->
|
|
|
+ <!-- <!–@click="openStartDialog(scope.row)" –>-->
|
|
|
+ <!-- 详情-->
|
|
|
+ <!-- </el-button>-->
|
|
|
+ <el-button type="primary" link icon="View" v-auth="['demo:TargetDetection:query']" @click="openDialog(3, '详情', scope.row)">
|
|
|
详情
|
|
|
</el-button>
|
|
|
+ <el-button type="primary" link icon="EditPen" v-auth="['demo:TargetDetection:edit']" @click="openDialog(2, '编辑', scope.row)">
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
link
|
|
@@ -77,24 +83,6 @@
|
|
|
>
|
|
|
模型
|
|
|
</el-button>
|
|
|
- <!-- <el-button-->
|
|
|
- <!-- type="primary"-->
|
|
|
- <!-- link-->
|
|
|
- <!-- icon="View"-->
|
|
|
- <!-- v-auth="['demo:TargetDetection:query']"-->
|
|
|
- <!-- @click="openDialog(3, '目标检测查看', scope.row)"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- 查看-->
|
|
|
- <!-- </el-button>-->
|
|
|
- <!-- <el-button-->
|
|
|
- <!-- type="primary"-->
|
|
|
- <!-- link-->
|
|
|
- <!-- icon="EditPen"-->
|
|
|
- <!-- v-auth="['demo:TargetDetection:edit']"-->
|
|
|
- <!-- @click="openDialog(2, '目标检测编辑', scope.row)"-->
|
|
|
- <!-- >-->
|
|
|
- <!-- 编辑-->
|
|
|
- <!-- </el-button>-->
|
|
|
<el-button type="primary" link icon="Delete" v-auth="['demo:TargetDetection:remove']" @click="deleteTargetDetection(scope.row)">
|
|
|
删除
|
|
|
</el-button>
|
|
@@ -162,14 +150,12 @@ import {
|
|
|
} from '@/api/modules/demo/TargetDetection'
|
|
|
|
|
|
import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
|
|
|
-
|
|
|
import { enumAlgorithmModelTrackApi, getAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
|
|
|
-import { enumAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
|
|
|
+import { enumAlgorithmConfigTrackApi, getAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
|
|
|
import { updateTrackSequenceApi } from '@/api/modules/demo/trackSequence'
|
|
|
import ViewLog from '@/views/demo/components/ViewLog.vue'
|
|
|
import { AlgorithmType2 } from '@/views/demo/utils'
|
|
|
import { addAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
|
|
|
-
|
|
|
import useWebSocketStore from '@/stores/modules/websocket'
|
|
|
import { resetHeart } from '@/utils/websocket'
|
|
|
|
|
@@ -192,7 +178,7 @@ onMounted(async () => {
|
|
|
enumsAlgorithmConfigTrack.value = []
|
|
|
const tmp_data: any = result['data']
|
|
|
for (const item of tmp_data) {
|
|
|
- if (item.subsystem === SubSystem__['目标检测'] && item.type === AlgorithmType2['预测/推理']) {
|
|
|
+ if (item.subsystem === SubSystem__['目标检测']) {
|
|
|
item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
|
|
|
enumsAlgorithmConfigTrack.value.push(item)
|
|
|
}
|
|
@@ -368,10 +354,17 @@ const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
|
|
|
const openDialog = async (type: number, title: string, row?: any) => {
|
|
|
let res = { data: {} }
|
|
|
if (row?.id) {
|
|
|
- res = await getTargetDetectionApi(row?.id || null)
|
|
|
+ res = await getTargetDetectionApi(row.id || null)
|
|
|
+ const params = JSON.parse(res.data['algorithmParameters'])
|
|
|
+ if (params.otherParams) {
|
|
|
+ res.data = { ...res.data, ...params.otherParams }
|
|
|
+ }
|
|
|
}
|
|
|
// 重置表单
|
|
|
setItemsOptions()
|
|
|
+ if (row?.id) {
|
|
|
+ itemsOptions = await updateItemsOptions(row.algorithmId)
|
|
|
+ }
|
|
|
const params = {
|
|
|
title,
|
|
|
width: 580,
|
|
@@ -430,6 +423,14 @@ const columns = reactive<ColumnProps<any>[]>([
|
|
|
label: '模型名称',
|
|
|
width: 200
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'algorithmParameters',
|
|
|
+ label: '算法参数',
|
|
|
+ search: {
|
|
|
+ el: 'input'
|
|
|
+ },
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
// {
|
|
|
// prop: 'algorithmModelId',
|
|
|
// label: '模型',
|
|
@@ -516,6 +517,52 @@ onMounted(async () => {
|
|
|
updateWnumsAlgorithmModelTrack()
|
|
|
})
|
|
|
|
|
|
+const remove_unnecessary_parameters = (itemsOptions: ProForm.ItemsOptions[]): ProForm.ItemsOptions[] => {
|
|
|
+ try {
|
|
|
+ const endIndex = itemsOptions.findIndex(option => option['label'] === '备注')
|
|
|
+ if (endIndex !== -1) {
|
|
|
+ itemsOptions = itemsOptions.slice(0, endIndex + 1)
|
|
|
+ }
|
|
|
+ return itemsOptions
|
|
|
+ } catch (error) {
|
|
|
+ console.error('移除不必要的参数时出错:', error)
|
|
|
+ // ElMessage.error('移除不必要的参数时出错,请检查!');
|
|
|
+ return itemsOptions // 返回原始选项,避免进一步的问题
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const updateItemsOptions = async (algorithmId: any) => {
|
|
|
+ try {
|
|
|
+ const result = await getAlgorithmConfigTrackApi(algorithmId)
|
|
|
+ if (result.code === 200) {
|
|
|
+ // 处理结果
|
|
|
+ const parameters = JSON.parse(result.data['parameters'])
|
|
|
+ // console.log('parameters: ', parameters)
|
|
|
+
|
|
|
+ const itemsOptions_new = remove_unnecessary_parameters(itemsOptions)
|
|
|
+ for (const item of parameters) {
|
|
|
+ // 添加新的表单项选项
|
|
|
+ itemsOptions_new.push({
|
|
|
+ label: item['name'],
|
|
|
+ prop: item['agName'],
|
|
|
+ rules: [{ required: item['required'], message: item['agName'] + '不能为空', trigger: 'blur' }],
|
|
|
+ tooltip: item['prompt'],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
+ placeholder: item['defaultValue']
|
|
|
+ // value: item['defaultValue']
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ formDialogRef.value?.updateItemOptions(itemsOptions_new)
|
|
|
+ return itemsOptions_new
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err)
|
|
|
+ ElMessage.error('获取算法配置失败,请检查!')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 表单配置项
|
|
|
let itemsOptions: ProForm.ItemsOptions[] = []
|
|
|
const setItemsOptions = () => {
|
|
@@ -550,14 +597,62 @@ const setItemsOptions = () => {
|
|
|
placeholder: '请上传数据集'
|
|
|
}
|
|
|
},
|
|
|
+ {
|
|
|
+ label: '选择算法',
|
|
|
+ prop: 'algorithmId',
|
|
|
+ rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'select',
|
|
|
+ placeholder: '请选择算法',
|
|
|
+ enum: enumsAlgorithmConfigTrack,
|
|
|
+ clearable: true,
|
|
|
+ onChange: async (value: any) => {
|
|
|
+ if (value != undefined && value != null && value != '') {
|
|
|
+ await updateItemsOptions(value)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '任务类型',
|
|
|
+ prop: 'type',
|
|
|
+ rules: [{ required: true, message: '任务类型不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ disabled: true,
|
|
|
+ elTagName: 'select',
|
|
|
+ placeholder: '请选择模任务类型',
|
|
|
+ enum: enumsAlgorithmType,
|
|
|
+ clearable: true,
|
|
|
+ value: ''
|
|
|
+ },
|
|
|
+ show: params => {
|
|
|
+ if (params.value.algorithmId != undefined) {
|
|
|
+ for (let i = 0; i < enumsAlgorithmConfigTrack.value.length; i++) {
|
|
|
+ if (enumsAlgorithmConfigTrack.value[i]['value'] === params.value.algorithmId) {
|
|
|
+ params.value.type = enumsAlgorithmConfigTrack.value[i]['type']
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
label: '选择模型',
|
|
|
prop: 'algorithmModelId',
|
|
|
rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
|
|
|
+ show: params => {
|
|
|
+ if (params.value.type == AlgorithmType2['预测/推理']) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ params.value.algorithmModelId = ''
|
|
|
+ return false
|
|
|
+ },
|
|
|
compOptions: {
|
|
|
elTagName: 'select',
|
|
|
placeholder: '请选择模型',
|
|
|
- enum: enumsAlgorithmModelTrack
|
|
|
+ enum: enumsAlgorithmModelTrack,
|
|
|
+ clearable: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -565,6 +660,7 @@ const setItemsOptions = () => {
|
|
|
prop: 'remarks',
|
|
|
rules: [],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入备注'
|
|
|
}
|
|
|
}
|