WANGKANG пре 3 месеци
родитељ
комит
bbd9b2df98
1 измењених фајлова са 91 додато и 9 уклоњено
  1. 91 9
      src/views/demo/algorithmTaskTrack/index.vue

+ 91 - 9
src/views/demo/algorithmTaskTrack/index.vue

@@ -198,11 +198,62 @@
             </template>
           </el-table-column>
           <el-table-column prop="remarks" label="备注" width="120" />
-          <el-table-column prop="operation" label="操作" width="230" fixed="right">
+          <el-table-column prop="operation" label="操作" width="300" fixed="right">
             <template #default="scope">
-              <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="deletSubTaskAlgorithmTaskTrack(scope.row)"> 删除</el-button>
+              <el-button
+                type="primary"
+                link
+                icon="View"
+                v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '4'"
+                @click="startSubTask(scope.row)"
+              >
+                开始
+              </el-button>
+              <el-popconfirm title="确定终止此任务吗?" @confirm="stopSubTask(scope.row)" v-if="scope.row.status == '1'">
+                <template #reference>
+                  <el-button type="primary" link icon="Delete"> 终止</el-button>
+                </template>
+              </el-popconfirm>
+              <el-button type="primary" link icon="View" @click="openLogSubTask(scope.row)" v-if="scope.row.status != '0'"> 日志 </el-button>
+              <el-button
+                type="primary"
+                link
+                icon="View"
+                v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['预测/推理']"
+                @click="previewSubTask(scope.row)"
+              >
+                预览
+              </el-button>
+              <el-button
+                type="primary"
+                link
+                icon="View"
+                v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['预测/推理']"
+                @click="showStatisticResultSubTask(scope.row)"
+              >
+                结果
+              </el-button>
+              <el-button
+                type="primary"
+                link
+                icon="View"
+                v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['测试']"
+                @click="showEvaluateResultSubTask(scope.row.id)"
+              >
+                结果
+              </el-button>
+              <el-button
+                type="primary"
+                link
+                icon="View"
+                v-if="scope.row.status == '2' && scope.row.type === AlgorithmType2['预测/推理']"
+                @click="showEvaluateSubTask(scope.row)"
+              >
+                评估
+              </el-button>
+              <el-button type="primary" link icon="View" @click="openSubTaskViewDialog(3, '子任务查看', scope.row)"> 查看 </el-button>
+              <el-button type="primary" link icon="EditPen" @click="openSubTaskViewDialog(2, '子任务编辑', scope.row)"> 编辑 </el-button>
+              <el-button type="danger" link icon="Delete" @click="deletSubTaskAlgorithmTaskTrack(scope.row)"> 删除</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -238,13 +289,44 @@ 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, delTrackSequenceApi, getTrackSequenceApi, updateTrackSequenceApi } from '@/api/modules/demo/trackSequence'
-import { delToInfraredApi, getToInfraredApi, updateToInfraredApi } from '@/api/modules/demo/toInfrared'
-import { getTargetDetectionApi, updateTargetDetectionApi } from '@/api/modules/demo/TargetDetection'
+import {
+  addTrackSequenceApi,
+  delTrackSequenceApi,
+  getTrackSequenceApi,
+  startTrackSequenceApi,
+  updateTrackSequenceApi
+} from '@/api/modules/demo/trackSequence'
+import { delToInfraredApi, getToInfraredApi, startToInfraredApi, updateToInfraredApi } from '@/api/modules/demo/toInfrared'
+import { getTargetDetectionApi, startTargetDetectionApi, updateTargetDetectionApi } from '@/api/modules/demo/TargetDetection'
 import { delDataAugmentationApi } from '@/api/modules/demo/dataAugmentation'
 
-const deletSubTaskAlgorithmTaskTrack = async (row: any) => {
-  console.log(row.subsystem)
+const startSubTask = async (row: any) => {
+  let res: any = null
+  if (row.subsystem === SubSystem__['可见光转红外']) {
+    res = await startToInfraredApi(row.id)
+  } else if (row.subsystem === SubSystem__['目标检测']) {
+    res = await startTargetDetectionApi(row.id)
+  } else if (row.subsystem === SubSystem__['注释轨迹序列']) {
+    res = await startTrackSequenceApi(row.id)
+  } else {
+    ElMessage.error('暂不支持该子任务类型')
+    return
+  }
+  if (res.code === 200) {
+    ElMessage.success('任务已开始,请等待完成!')
+  } else {
+    ElMessage.error('任务开始失败,请检查!')
+  }
+  handleOpenView()
+}
+const stopSubTask = async (row: any) => {}
+const openLogSubTask = async (row: any) => {}
+const previewSubTask = async (row: any) => {}
+const showStatisticResultSubTask = async (row: any) => {}
+const showEvaluateResultSubTask = async (row: any) => {}
+const showEvaluateSubTask = async (row: any) => {}
+
+const deletSubTask = async (row: any) => {
   if (row.subsystem === SubSystem__['可见光转红外']) {
     await useHandleData(delToInfraredApi, row.id, '删除【' + row.name + '】可见光转红外')
   } else if (row.subsystem === SubSystem__['目标检测']) {