Explorar el Código

feat: 目标检测启动停止,下载改打开文件夹

Suuuuuukang hace 1 mes
padre
commit
b4e104a0d8
Se han modificado 1 ficheros con 30 adiciones y 7 borrados
  1. 30 7
      src/views/task/bizProcess/index.vue

+ 30 - 7
src/views/task/bizProcess/index.vue

@@ -47,11 +47,19 @@
         <!--          查看详情-->
         <!--        </el-button>-->
 
-        <el-button v-if="scope.row.name.indexOf('训练') === -1" type="primary" link icon="Refresh" @click="reRunTask(scope.row)">
-          执行任务
+        <el-button v-if="scope.row.name.indexOf('训练') === -1 && (scope.row.status === '0' || scope.row.status === '3')" type="primary" link icon="Refresh" @click="reRunTask(scope.row)">
+          开始任务
+        </el-button>
+        <el-button v-if="scope.row.name.indexOf('训练') !== -1 && (scope.row.status === '0' || scope.row.status === '3')" type="primary" link icon="Refresh" @click="startTask(scope.row)"> 开始任务 </el-button>
+        <el-button v-if="scope.row.status === '0'" type="primary" link icon="Refresh" @click="taskExecute('continue', scope.row)">
+          继续任务
+        </el-button>
+        <el-button v-if="scope.row.status === '1'" type="primary" link icon="Refresh" @click="taskExecute('pause', scope.row)">
+          暂停任务
+        </el-button>
+        <el-button v-if="scope.row.status === '1'" type="primary" link icon="Refresh" @click="taskExecute('stop', scope.row)">
+          停止任务
         </el-button>
-        <el-button v-else type="primary" link icon="Refresh" @click="startTask(scope.row)"> 开始任务 </el-button>
-
         <el-button v-if="!scope.row.name.includes('测试')" type="primary" link icon="finished" @click="showResult(scope.row)"> 结果图 </el-button>
 
         <el-button v-if="!scope.row.name.includes('训练')" type="primary" link icon="search" @click="showTimeResult(scope.row)"> 查看指标 </el-button>
@@ -60,8 +68,8 @@
           查看日志
         </el-button>
 
-        <el-button type="primary" link icon="Refresh" @click="openDir(scope.row)"> 打开文件夹 </el-button>
-        <el-button type="primary" link icon="Refresh" @click="exportData(scope.row)"> 导出结果 </el-button>
+        <el-button type="primary" link icon="document" @click="openDir(scope.row)"> 任务文件夹 </el-button>
+        <el-button type="primary" link icon="document" @click="exportData(scope.row)"> 结果文件夹 </el-button>
       </template>
     </ProTable>
     <FormDialog ref="formDialogRef" />
@@ -313,13 +321,28 @@ const startTask = row => {
     }
   })
 }
+
+const taskExecute = (type, row) => {
+  http.post<any>('/identification/identificationSubtaskDetails/' + (type === 'continue' ? 'continueTask' : type === 'pause' ? 'pauseTask' : 'stopTask'),
+    { bizId: row.id }, { loading: true }).then(res => {
+    if (res.code !== 200) {
+      ElMessage.error(res.msg)
+    } else {
+      ElMessage.success('操作成功')
+    }
+  })
+}
+
 const typeDefs = ref(reactive([]))
 
 const exportData = row => {
   http.get<any>('/identification/identificationSubtaskDetails/resultZip', { taskId: row.id }, { loading: true }).then(res => {
     console.log(res)
     if (res.code === 200) {
-      window.open(res.msg, '_blank')
+      // window.open(res.msg, '_blank')
+      http.get<any>('/identification/identificationSubtaskDetails/openDir', { directory: row.resultPath + "/weights" }, { loading: true }).then(res => {
+        console.log(res)
+      })
     }
   })
 }