Prechádzať zdrojové kódy

feat: 优化可见光转红外添加模型流程

WANGKANG 8 mesiacov pred
rodič
commit
948427d842
1 zmenil súbory, kde vykonal 84 pridanie a 11 odobranie
  1. 84 11
      src/views/demo/toInfrared/index.vue

+ 84 - 11
src/views/demo/toInfrared/index.vue

@@ -115,7 +115,7 @@
                 <el-link :href="model.url" type="primary" icon="Download" :underline="false" target="_blank" style="margin-right: 20px"
                   >下载
                 </el-link>
-                <el-button type="success" link @click="1"
+                <el-button type="success" link @click="addToInfraredModel(model.path)"
                   ><el-icon><Plus /></el-icon>添加模型</el-button
                 >
               </el-form-item>
@@ -162,8 +162,91 @@ import { AlgorithmType, SubSystem, SubSystem__, enumsAlgorithmType, enumsSubSyst
 import PreviewImages from '@/views/demo/components/PreviewImages.vue'
 import { Row } from 'element-plus/es/components/table-v2/src/components'
 
+import { addAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
+
 import ViewLog from '@/views/demo/components/ViewLog.vue'
 
+const enumsAlgorithmConfigTrack = ref<any>([])
+onMounted(async () => {
+  const result = await enumAlgorithmConfigTrackApi()
+  enumsAlgorithmConfigTrack.value = []
+  const tmp_data: any = result['data']
+  for (const item of tmp_data) {
+    if (item.subsystem === SubSystem__['可见光转红外'] && item.type === AlgorithmType2['预测/推理']) {
+      item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
+      enumsAlgorithmConfigTrack.value.push(item)
+    }
+  }
+  return result['data']
+})
+
+const setItemsOptions222 = () => {
+  itemsOptions = [
+    {
+      label: '算法',
+      prop: 'algorithmId',
+      rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
+      compOptions: {
+        elTagName: 'select',
+        placeholder: '请输入算法',
+        enum: enumsAlgorithmConfigTrack
+      }
+    },
+    {
+      label: '子系统',
+      prop: 'subSystem',
+      rules: [{ required: true, message: '子系统不能为空', trigger: 'blur' }],
+      compOptions: {
+        disabled: true,
+        elTagName: 'select',
+        placeholder: '请输入子系统',
+        enum: enumsSubSystem
+      }
+    },
+    {
+      label: '模型名称',
+      prop: 'modelName',
+      rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入模型名称'
+      }
+    },
+    {
+      label: '模型路径',
+      prop: 'modelPath',
+      rules: [{ required: false, message: '模型文件不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入模型名称',
+        disabled: true
+      }
+    },
+    {
+      label: '备注',
+      prop: 'remarks',
+      rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入备注'
+      }
+    }
+  ]
+}
+
+const addToInfraredModel = async (modelPath: string) => {
+  let res = { data: { modelPath, subSystem: SubSystem__['可见光转红外'], type: AlgorithmType2['预测/推理'] } }
+  // 重置表单
+  setItemsOptions222()
+  const params = {
+    title: '添加模型',
+    width: 580,
+    isEdit: true,
+    itemsOptions: itemsOptions,
+    model: res.data,
+    api: addAlgorithmModelTrackApi,
+    getTableList: proTable.value?.getTableList
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
 const showModelDialogVisible = ref(false)
 const model_list: Ref<any> = ref([
   // {
@@ -539,16 +622,6 @@ const setItemsOptions2 = () => {
   ]
 }
 
-const enumsAlgorithmConfigTrack = ref<any>([])
-onMounted(async () => {
-  const result = await enumAlgorithmConfigTrackApi()
-  enumsAlgorithmConfigTrack.value = result['data']
-  for (const item of enumsAlgorithmConfigTrack.value) {
-    item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
-  }
-  return result['data']
-})
-
 const setItemsOptionsModel = () => {
   itemsOptions = [
     {