Эх сурвалжийг харах

feat: 优化可见光转红外两个细节

WANGKANG 3 сар өмнө
parent
commit
fdb92e4d25

+ 10 - 135
src/views/demo/toInfrared/index.vue

@@ -24,11 +24,8 @@
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
-        <el-button type="primary" link icon="View" v-if="scope.row.algorithmModelId != null" @click="openDialog_detail(scope.row, false)">
-          <!--@click="openStartDialog(scope.row)"  -->
-          详情
-        </el-button>
-        <el-button type="primary" link icon="EditPen" v-auth="['demo:toInfrared:edit']" @click="openDialog_detail(scope.row, true)"> 编辑 </el-button>
+        <el-button type="primary" link icon="View" @click="openDialog(3, '详情', scope.row)"> 详情 </el-button>
+        <el-button type="primary" link icon="EditPen" v-auth="['demo:toInfrared:edit']" @click="openDialog(2, '编辑', scope.row)"> 编辑 </el-button>
         <el-button
           type="primary"
           link
@@ -182,136 +179,7 @@ import PreviewCompareImages from '@/views/demo/components/PreviewCompareImages.v
 import ViewLog from '@/views/demo/components/ViewLog.vue'
 import useWebSocketStore from '@/stores/modules/websocket'
 import { resetHeart } from '@/utils/websocket'
-
-const openDialog_detail = async (row: any, edit: boolean = false) => {
-  let res = {}
-  if (row?.id) {
-    res = await getToInfraredApi(row.id || null)
-    const params = JSON.parse(res.data['algorithmParameters'])
-    if (params.otherParams) {
-      res.data = { ...res.data, ...params.otherParams }
-    }
-  }
-  // 重置表单
-  setItemsOptions_edit()
-  const itemsOptions = await updateItemsOptions(row.algorithmId)
-  const params = {
-    title: '编辑',
-    width: 600,
-    isEdit: edit,
-    itemsOptions: itemsOptions,
-    model: res.data,
-    api: updateToInfraredApi,
-    getTableList: proTable.value?.getTableList
-  }
-  formDialogRef.value?.openDialog(params)
-}
-
-const setItemsOptions_edit = () => {
-  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: getImageDataList,
-        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: {
-        disabled: true,
-        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,
-        clearable: true
-      }
-    },
-    {
-      label: '备注',
-      prop: 'remarks',
-      rules: [],
-      compOptions: {
-        elTagName: 'input',
-        placeholder: '请输入备注'
-      }
-    }
-  ]
-}
-
 import ShowStatisticResult from '@/views/demo/components/ShowStatisticResult.vue'
-
 const showStatisticResultRef = ref()
 
 onMounted(() => {
@@ -547,10 +415,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 getToInfraredApi(row?.id || null)
+    res = await getToInfraredApi(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: 600,