|
@@ -200,8 +200,8 @@
|
|
|
<el-table-column prop="remarks" label="备注" width="120" />
|
|
|
<el-table-column prop="operation" label="操作" width="230" fixed="right">
|
|
|
<template #default="scope">
|
|
|
- <el-button type="primary" size="mini" @click="openViewDialog(scope.row)"> 查看</el-button>
|
|
|
- <el-button type="primary" size="mini" @click="openDialog(2, '可辨识性分析总任务编辑', scope.row)"> 编辑</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="openSubTaskViewDialog(3, '子任务查看', scope.row)"> 查看</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="openSubTaskViewDialog(2, '子任务编辑', scope.row)"> 编辑</el-button>
|
|
|
<el-button type="danger" size="mini" @click="deleteAlgorithmTaskTrack(scope.row)"> 删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -238,19 +238,233 @@ import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
|
|
|
import File from '@/components/Upload/File.vue'
|
|
|
import { enumAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
|
|
|
import statusEnums from '@/utils/status'
|
|
|
+import { addTrackSequenceApi, getTrackSequenceApi, updateTrackSequenceApi } from '@/api/modules/demo/trackSequence'
|
|
|
+import { getToInfraredApi, updateToInfraredApi } from '@/api/modules/demo/toInfrared'
|
|
|
+import { getTargetDetectionApi, updateTargetDetectionApi } from '@/api/modules/demo/TargetDetection'
|
|
|
+
|
|
|
+const loadSomeData = async (row?: any) => {
|
|
|
+ datasetList.value = await getDatasetList()
|
|
|
+ if (row.subsystem === SubSystem__['可见光转红外']) {
|
|
|
+ enumsAlgorithmConfigTrack_toInfrared.value = await getEnumsAlgorithmConfigTrack('可见光转红外', ['预测/推理'])
|
|
|
+ await getToInfraredModelList()
|
|
|
+ } else if (row.subsystem === SubSystem__['目标检测']) {
|
|
|
+ } else if (row.subsystem === SubSystem__['注释轨迹序列']) {
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const openSubTaskViewDialog = async (type: number, title: string, row?: any) => {
|
|
|
+ let res = { data: {} }
|
|
|
+ let api: any = null
|
|
|
+ if (row?.id) {
|
|
|
+ console.log(row)
|
|
|
+ if (row.subsystem === SubSystem__['可见光转红外']) {
|
|
|
+ console.log('可见光转红外')
|
|
|
+ res = await getToInfraredApi(row.id || null)
|
|
|
+ api = updateToInfraredApi
|
|
|
+
|
|
|
+ // 重置表单
|
|
|
+ setItemsOptions_ToInfrared()
|
|
|
+ } else if (row.subsystem === SubSystem__['目标检测']) {
|
|
|
+ console.log('目标检测')
|
|
|
+ res = await getTargetDetectionApi(row.id || null)
|
|
|
+ api = updateTargetDetectionApi
|
|
|
+ } else if (row.subsystem === SubSystem__['注释轨迹序列']) {
|
|
|
+ console.log('注释轨迹序列')
|
|
|
+ res = await getTrackSequenceApi(row.id || null)
|
|
|
+ api = updateTrackSequenceApi
|
|
|
+ } else {
|
|
|
+ console.log('其他')
|
|
|
+ ElMessage.error('暂不支持该子任务类型')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const params = JSON.parse(res.data['algorithmParameters'])
|
|
|
+ if (params.otherParams) {
|
|
|
+ res.data = { ...res.data, ...params.otherParams }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (row?.id) {
|
|
|
+ itemsOptions = await updateItemsOptions(row.algorithmId)
|
|
|
+ }
|
|
|
+ await loadSomeData(row)
|
|
|
+ const params = {
|
|
|
+ title: title,
|
|
|
+ width: 600,
|
|
|
+ isEdit: type !== 3,
|
|
|
+ itemsOptions: itemsOptions,
|
|
|
+ model: res.data,
|
|
|
+ api: api,
|
|
|
+ getTableList: handleOpenView
|
|
|
+ }
|
|
|
+ formDialogRef.value?.openDialog(params)
|
|
|
+}
|
|
|
+
|
|
|
+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
|
|
|
+ } else {
|
|
|
+ return itemsOptions // 返回原始选项,避免进一步的问题
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err)
|
|
|
+ ElMessage.error('获取算法配置失败,请检查!')
|
|
|
+ return itemsOptions // 返回原始选项,避免进一步的问题
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const setItemsOptions_ToInfrared = () => {
|
|
|
+ itemsOptions = [
|
|
|
+ {
|
|
|
+ label: '任务名称',
|
|
|
+ prop: 'name',
|
|
|
+ rules: [{ required: true, message: '任务名称不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
+ placeholder: '请输入任务名称'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '选择数据集',
|
|
|
+ prop: 'inputOssId',
|
|
|
+ rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'select',
|
|
|
+ placeholder: '请选择或者上传数据集',
|
|
|
+ enum: datasetList,
|
|
|
+ clearable: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '上传数据集',
|
|
|
+ prop: 'inputOssId',
|
|
|
+ rules: [{ required: false, message: '数据集不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'file-upload',
|
|
|
+ fileSize: 4096,
|
|
|
+ fileType: ['zip'],
|
|
|
+ placeholder: '请上传数据集'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '选择算法',
|
|
|
+ prop: 'algorithmId',
|
|
|
+ rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'select',
|
|
|
+ placeholder: '请选择算法',
|
|
|
+ enum: enumsAlgorithmConfigTrack_toInfrared,
|
|
|
+ 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_toInfrared.value.length; i++) {
|
|
|
+ if (enumsAlgorithmConfigTrack_toInfrared.value[i]['value'] === params.value.algorithmId) {
|
|
|
+ params.value.type = enumsAlgorithmConfigTrack_toInfrared.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: toInfraredModelList,
|
|
|
+ clearable: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '备注',
|
|
|
+ prop: 'remarks',
|
|
|
+ rules: [],
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'input',
|
|
|
+ placeholder: '请输入备注'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+}
|
|
|
|
|
|
const dialogVisibleView = ref(false)
|
|
|
const viewData = ref<any[]>([])
|
|
|
+const subTaskAlgorithmTaskTrack_id = ref<any>(null)
|
|
|
const openViewDialog = async (row: any) => {
|
|
|
dialogVisibleView.value = true
|
|
|
- const res = await listSubTaskAlgorithmTaskTrackApi(row.id)
|
|
|
+ subTaskAlgorithmTaskTrack_id.value = row.id
|
|
|
+}
|
|
|
+const handleOpenView = async () => {
|
|
|
+ const res = await listSubTaskAlgorithmTaskTrackApi(subTaskAlgorithmTaskTrack_id.value)
|
|
|
if (res.code === 200) {
|
|
|
viewData.value = res.data
|
|
|
} else {
|
|
|
ElMessage.error('获取子任务失败')
|
|
|
}
|
|
|
}
|
|
|
-const handleOpenView = () => {}
|
|
|
|
|
|
const fileUploadRef = ref()
|
|
|
const fileUploadDatasetChange = (value: any) => {
|