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

feat: cat模型列表搞定

WANGKANG 6 сар өмнө
parent
commit
dc658499d9

+ 4 - 0
src/api/modules/demo/trackSequence.ts

@@ -102,3 +102,7 @@ export const getLDetailTrackSequenceApi = (id: string | number) => {
 export const addEvaluateTrackSequenceApi = (data: any) => {
   return http.post('/demo/trackSequence/add_evaluate', data, { loading: true })
 }
+
+export const showCATModelApi = (id: string | number) => {
+  return http.get('/demo/trackSequence/model/' + id, { loading: true })
+}

+ 140 - 2
src/views/demo/trackSequence/index.vue

@@ -76,6 +76,16 @@
         >
           评估
         </el-button>
+        <el-button
+          type="primary"
+          link
+          icon="View"
+          v-auth="['demo:ToInfrared:download']"
+          v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['训练']"
+          @click="showModelDialog(scope.row.id)"
+        >
+          模型
+        </el-button>
         <!-- <el-button type="primary" link icon="View" v-auth="['demo:toInfrared:query']" @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
@@ -93,6 +103,33 @@
     <FormDialog ref="formDialogRef" />
     <ImportExcel ref="dialogRef" />
     <ViewLog ref="viewLogRef" :get-log-api="getLogTrackSequenceApi" />
+    <el-dialog v-model="showModelDialogVisible" title="模型列表" width="1000">
+      <el-scrollbar ref="scrollbarRef" id="scrollbarRef1" height="500px">
+        <template v-for="model in model_list" :key="model">
+          <el-card style="width: 100%; margin-bottom: 10px">
+            <el-form label-width="130px" label-position="left">
+              <el-form-item label="Model Name">
+                {{ model.name }}
+              </el-form-item>
+              <el-form-item label="Model Path">
+                {{ model.path }}
+              </el-form-item>
+              <el-form-item label="Model Size">
+                {{ model.size }}
+              </el-form-item>
+              <el-form-item label="操作">
+                <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="addModel(model.path, model.name)"
+                  ><el-icon><Plus /></el-icon>添加模型</el-button
+                >
+              </el-form-item>
+            </el-form>
+          </el-card>
+        </template>
+      </el-scrollbar>
+    </el-dialog>
   </div>
 </template>
 
@@ -119,7 +156,8 @@ import {
   dowloadTrackSequenceApi,
   getLogTrackSequenceApi,
   getLDetailTrackSequenceApi,
-  addEvaluateTrackSequenceApi
+  addEvaluateTrackSequenceApi,
+  showCATModelApi
 } from '@/api/modules/demo/trackSequence'
 import { enumAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
 import { getAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
@@ -129,6 +167,102 @@ import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
 import statusEnums from '@/utils/status'
 import { AlgorithmType, SubSystem, SubSystem__, enumsAlgorithmType, enumsSubSystem, AlgorithmType2 } from '@/views/demo/utils'
 import ViewLog from '@/views/demo/components/ViewLog.vue'
+import { addAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
+
+const enumsAlgorithmConfigTrack_addModel____ = ref<any>([])
+
+const setItemsOptions222 = async () => {
+  console.log('setItemsOptions222')
+  const result = await enumAlgorithmConfigTrackApi()
+  enumsAlgorithmConfigTrack_addModel____.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_addModel____.value.push(item)
+    }
+  }
+  console.log(enumsAlgorithmConfigTrack_addModel____.value)
+
+  itemsOptions = [
+    {
+      label: '算法',
+      prop: 'algorithmId',
+      rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
+      compOptions: {
+        elTagName: 'select',
+        placeholder: '请输入算法',
+        enum: enumsAlgorithmConfigTrack_addModel____
+      }
+    },
+    {
+      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: {
+        disabled: true,
+        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 addModel = async (modelPath: string, modelName: string) => {
+  console.log(modelPath, modelName)
+  let res = { data: { modelPath, subSystem: SubSystem__['目标检测'], type: AlgorithmType2['预测/推理'], modelName: modelName } }
+  // 重置表单
+  await setItemsOptions222()
+  const params = {
+    title: '添加模型',
+    width: 580,
+    isEdit: true,
+    itemsOptions: itemsOptions,
+    model: res.data,
+    api: addAlgorithmModelTrackApi,
+    getTableList: proTable.value?.getTableList,
+    closedEvent: async () => {
+      await updateEnumsAlgorithmModelTrack()
+    }
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+const showModelDialogVisible = ref(false)
+const model_list: Ref<any> = ref([])
+
+const showModelDialog = async (id: any) => {
+  const res: any = await showCATModelApi(id)
+  model_list.value = res.data
+  showModelDialogVisible.value = true
+}
 
 const setItemsOptionsAddCAT = () => {
   itemsOptions = [
@@ -621,7 +755,7 @@ onMounted(async () => {
 
 const enumsAlgorithmModelTrack = ref<any>([])
 
-onMounted(async () => {
+const updateEnumsAlgorithmModelTrack = async () => {
   const result: any = await enumAlgorithmModelTrackApi()
   // console.log(result.data);
   enumsAlgorithmModelTrack.value = []
@@ -635,5 +769,9 @@ onMounted(async () => {
       enumsAlgorithmModelTrack.value.push(item)
     }
   }
+}
+
+onMounted(async () => {
+  updateEnumsAlgorithmModelTrack()
 })
 </script>