|
@@ -175,13 +175,11 @@ import {
|
|
|
|
|
|
import { getImagesApi, listDataSeqApi } from '@/api/modules/demo/DataSeq'
|
|
|
|
|
|
-import { enumAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
|
|
|
-import { getAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
|
|
|
-import { enumAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
|
|
|
+import { enumAlgorithmModelTrackApi, addAlgorithmModelTrackApi, getAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
|
|
|
+import { enumAlgorithmConfigTrackApi, getAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
|
|
|
import statusEnums from '@/utils/status'
|
|
|
import { AlgorithmType, SubSystem, SubSystem__, enumsAlgorithmType, enumsSubSystem, AlgorithmType2 } from '@/views/demo/utils'
|
|
|
import PreviewCompareImages from '@/views/demo/components/PreviewCompareImages.vue'
|
|
|
-import { addAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
|
|
|
import ViewLog from '@/views/demo/components/ViewLog.vue'
|
|
|
import useWebSocketStore from '@/stores/modules/websocket'
|
|
|
import { resetHeart } from '@/utils/websocket'
|
|
@@ -217,7 +215,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)
|
|
|
}
|
|
@@ -252,6 +250,7 @@ const setItemsOptions222 = () => {
|
|
|
prop: 'modelName',
|
|
|
rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入模型名称'
|
|
|
}
|
|
|
},
|
|
@@ -260,6 +259,7 @@ const setItemsOptions222 = () => {
|
|
|
prop: 'modelPath',
|
|
|
rules: [{ required: false, message: '模型文件不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入模型名称',
|
|
|
disabled: true
|
|
|
}
|
|
@@ -269,6 +269,7 @@ const setItemsOptions222 = () => {
|
|
|
prop: 'remarks',
|
|
|
rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入备注'
|
|
|
}
|
|
|
}
|
|
@@ -444,7 +445,7 @@ const openDialog = async (type: number, title: string, row?: any) => {
|
|
|
setItemsOptions()
|
|
|
const params = {
|
|
|
title,
|
|
|
- width: 580,
|
|
|
+ width: 600,
|
|
|
isEdit: type !== 3,
|
|
|
itemsOptions: itemsOptions,
|
|
|
model: type == 1 ? {} : res.data,
|
|
@@ -501,6 +502,14 @@ const columns = reactive<ColumnProps<any>[]>([
|
|
|
label: '模型名称',
|
|
|
width: 200
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'algorithmParameters',
|
|
|
+ label: '算法参数',
|
|
|
+ search: {
|
|
|
+ el: 'input'
|
|
|
+ },
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
// {
|
|
|
// prop: 'algorithmModelId',
|
|
|
// label: '模型',
|
|
@@ -544,6 +553,51 @@ const columns = reactive<ColumnProps<any>[]>([
|
|
|
},
|
|
|
{ prop: 'operation', label: '操作', width: 230, fixed: 'right' }
|
|
|
])
|
|
|
+
|
|
|
+const remove_unnecessary_parameters = (itemsOptions: ProForm.ItemsOptions[]): ProForm.ItemsOptions[] => {
|
|
|
+ try {
|
|
|
+ const endIndex = itemsOptions.findIndex(option => option['label'] === 'end')
|
|
|
+ if (endIndex !== -1) {
|
|
|
+ itemsOptions = itemsOptions.slice(0, endIndex)
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err)
|
|
|
+ ElMessage.error('获取算法配置失败,请检查!')
|
|
|
+ }
|
|
|
+}
|
|
|
// 表单配置项
|
|
|
let itemsOptions: ProForm.ItemsOptions[] = []
|
|
|
const setItemsOptions = () => {
|
|
@@ -553,6 +607,7 @@ const setItemsOptions = () => {
|
|
|
prop: 'name',
|
|
|
rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入任务名称'
|
|
|
}
|
|
|
},
|
|
@@ -578,14 +633,61 @@ 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
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ },
|
|
|
compOptions: {
|
|
|
elTagName: 'select',
|
|
|
placeholder: '请选择模型',
|
|
|
- enum: enumsAlgorithmModelTrack
|
|
|
+ enum: enumsAlgorithmModelTrack,
|
|
|
+ clearable: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -593,8 +695,17 @@ const setItemsOptions = () => {
|
|
|
prop: 'remarks',
|
|
|
rules: [],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入备注'
|
|
|
}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: 'end',
|
|
|
+ prop: '----',
|
|
|
+ show: false,
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'input'
|
|
|
+ }
|
|
|
}
|
|
|
]
|
|
|
}
|
|
@@ -655,6 +766,7 @@ const setItemsOptions2 = () => {
|
|
|
prop: 'name',
|
|
|
rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
disabled: true,
|
|
|
placeholder: '请输入任务名称'
|
|
|
}
|
|
@@ -674,6 +786,7 @@ const setItemsOptions2 = () => {
|
|
|
prop: 'remarks',
|
|
|
rules: [],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入备注'
|
|
|
}
|
|
|
}
|
|
@@ -687,6 +800,7 @@ const setItemsOptionsModel = () => {
|
|
|
prop: 'algorithmId',
|
|
|
rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
disabled: true,
|
|
|
placeholder: '请输入算法'
|
|
|
}
|
|
@@ -707,6 +821,7 @@ const setItemsOptionsModel = () => {
|
|
|
prop: 'parameterConfig',
|
|
|
rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入模型名称'
|
|
|
}
|
|
|
},
|
|
@@ -715,6 +830,7 @@ const setItemsOptionsModel = () => {
|
|
|
prop: 'id',
|
|
|
rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入模型名称'
|
|
|
}
|
|
|
},
|
|
@@ -723,6 +839,7 @@ const setItemsOptionsModel = () => {
|
|
|
prop: 'modelName',
|
|
|
rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入模型名称'
|
|
|
}
|
|
|
},
|
|
@@ -731,6 +848,7 @@ const setItemsOptionsModel = () => {
|
|
|
prop: 'modelAddress',
|
|
|
rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入模型名称'
|
|
|
}
|
|
|
},
|
|
@@ -739,6 +857,7 @@ const setItemsOptionsModel = () => {
|
|
|
prop: 'remarks',
|
|
|
rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
|
|
|
compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
placeholder: '请输入备注'
|
|
|
}
|
|
|
}
|