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

feat: 多源信息融合、异源图像匹配、电子稳相的暂停、继续、停止功能

Eagle 5 сар өмнө
parent
commit
e84e772cff

+ 8 - 0
src/api/modules/demo/match.ts

@@ -35,6 +35,14 @@ export const execute = data => {
   return http.get<any>('/demo/match/execute', data, { loading: false })
 }
 
+export const stopApi = data => {
+  return http.get<any>('/demo/match/stop', data, { loading: false })
+}
+
+export const hangupApi = data => {
+  return http.get<any>('/demo/match/hangup', data, { loading: false })
+}
+
 export const getResult = data => {
   return http.get<any>('/demo/match/result', data, { loading: false })
 }

+ 8 - 0
src/api/modules/demo/traceMerge.ts

@@ -31,6 +31,14 @@ export const executeApi = data => {
   return http.post<any>('/demo/traceMerge/execute', data, { loading: false })
 }
 
+export const stopApi = data => {
+  return http.post<any>('/demo/traceMerge/stop', data, { loading: false })
+}
+
+export const hangupApi = data => {
+  return http.post<any>('/demo/traceMerge/hangup', data, { loading: false })
+}
+
 export const getResApi = data => {
   return http.get<any>('/demo/traceMerge/result', data, { loading: false })
 }

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

@@ -83,6 +83,10 @@ export const stopVideoStableApi = (id: String | Number) => {
   return http.get('/demo/videoStable/stop/' + id)
 }
 
+export const hangupVideoStableApi = (id: String | Number) => {
+  return http.get('/demo/videoStable/hangup/' + id)
+}
+
 export const getCompareImageApi = (taskId: String, idx: String | Number) => {
   return http.get('/demo/videoStable/compare/' + taskId + '/' + idx)
 }

+ 19 - 3
src/views/demo/match/index.vue

@@ -28,7 +28,9 @@
       <!-- 表格操作 -->
       <template #operation="scope">
         <el-button type="primary" icon="View" link @click="doExecute(scope.row)">开始任务</el-button>
-
+        <el-button type="primary" link icon="View" @click="hangupTask(scope.row)"> 暂停任务 </el-button>
+        <el-button type="primary" link icon="View" @click="doExecute(scope.row)"> 继续任务 </el-button>
+        <el-button type="primary" link icon="View" @click="stopTask(scope.row)"> 停止任务 </el-button>
         <el-button type="primary" icon="View" link @click="showData(scope.row)">执行结果</el-button>
 
         <el-button type="primary" icon="View" link @click="showLog(scope.row)">查看日志</el-button>
@@ -68,7 +70,7 @@
         <file @update:model-value="updateFile" :file-size="2048" :file-type="['zip']"></file>
       </el-container>
 
-      <el-container v-for="(item, index) in jsonParams" :key="index" style=" align-items: center;margin-top: 5px">
+      <el-container v-for="(item, index) in jsonParams" :key="index" style="align-items: center; margin-top: 5px">
         <span style="min-width: 80px; max-width: 150px">{{ item.name }}</span>
         <el-tooltip :content="item.prompt" placement="top">
           <el-icon><InfoFilled /></el-icon>
@@ -155,7 +157,9 @@ import {
   getMatchApi,
   createTask,
   execute,
-  getResult
+  getResult,
+  hangupApi,
+  stopApi
 } from '@/api/modules/demo/match'
 import File from '@/components/Upload/File.vue'
 import { getDictsApi } from '@/api/modules/system/dictData'
@@ -229,6 +233,18 @@ const doExecute = function (row) {
   })
 }
 
+const hangupTask = function (row) {
+  hangupApi({ taskId: row.id }).then(res => {
+    console.log(res)
+  })
+}
+
+const stopTask = function (row) {
+  stopApi({ taskId: row.id }).then(res => {
+    console.log(res)
+  })
+}
+
 const jsonParams = ref([])
 const dialogVisible = ref(false)
 const openCreateDialog = async function () {

+ 29 - 4
src/views/demo/traceMerge/index.vue

@@ -26,7 +26,10 @@
         <!--          编辑-->
         <!--        </el-button>-->
         <!--        <el-button type="primary" link icon="Delete" v-auth="['demo:traceMerge:remove']" @click="deleteTraceMerge(scope.row)"> 删除 </el-button>-->
-        <el-button type="primary" link icon="View" @click="execute(scope.row)"> 执行任务 </el-button>
+        <el-button type="primary" link icon="View" @click="execute(scope.row)"> 开始任务 </el-button>
+        <el-button type="primary" link icon="View" @click="hangupTask(scope.row)"> 暂停任务 </el-button>
+        <el-button type="primary" link icon="View" @click="execute(scope.row)"> 继续任务 </el-button>
+        <el-button type="primary" link icon="View" @click="stopTask(scope.row)"> 停止任务 </el-button>
         <el-button type="primary" link icon="View" @click="display(scope.row)"> 展示结果 </el-button>
         <el-button type="primary" link icon="View" @click="showLog(scope.row)"> 查看日志 </el-button>
         <el-button type="primary" link icon="View" @click="showResult(scope.row)"> 查看指标 </el-button>
@@ -43,9 +46,9 @@
         </el-container>
         <el-container style="margin-top: 20px">
           <span style="min-width: 80px">任务文件</span>
-          <file @update:model-value="updateFiles" :file-size="20" :file-type="['mat']"></file>
+          <file @update:model-value="updateFiles" :file-size="20" :file-type="['mat', 'json', 'txt']"></file>
         </el-container>
-        <el-container v-for="(item, index) in jsonParams" :key="index" style=" align-items: center;margin-top: 5px">
+        <el-container v-for="(item, index) in jsonParams" :key="index" style="align-items: center; margin-top: 5px">
           <span style="min-width: 80px; max-width: 150px">{{ item.name }}</span>
           <el-tooltip :content="item.prompt" placement="top">
             <el-icon><InfoFilled /></el-icon>
@@ -100,9 +103,11 @@ import {
   exportTraceMergeApi,
   getResApi,
   getTraceMergeApi,
+  hangupApi,
   importTemplateApi,
   importTraceMergeDataApi,
   listTraceMergeApi,
+  stopApi,
   updateTraceMergeApi
 } from '@/api/modules/demo/traceMerge'
 import File from '@/components/Upload/File.vue'
@@ -184,6 +189,26 @@ const execute = function (row) {
   })
 }
 
+const hangupTask = function (row) {
+  hangupApi({ taskId: row.id }).then(res => {
+    if (res.code == 200) {
+      ElMessage.success('暂停成功!')
+    } else {
+      ElMessage.error('暂停失败: ' + res.msg)
+    }
+  })
+}
+
+const stopTask = function (row) {
+  stopApi({ taskId: row.id }).then(res => {
+    if (res.code == 200) {
+      ElMessage.success('停止成功!')
+    } else {
+      ElMessage.error('停止失败: ' + res.msg)
+    }
+  })
+}
+
 const jsonParams = ref([])
 const createTask = async function () {
   const res = await getOneAlgorithmConfigApi({ algorithmName: '多源信息融合' })
@@ -198,7 +223,7 @@ const createTask = async function () {
 
 const submitCreateTask = function () {
   if (params.value.preprocessPath == null || params.value.preprocessPath === '') {
-    ElMessage.error('请上传mat文件!')
+    ElMessage.error('请上传源数据文件!')
     return
   } else if (params.value.name == null || params.value.name === '') {
     ElMessage.error('请输入任务名称!')

+ 20 - 2
src/views/demo/videoStable/index.vue

@@ -30,10 +30,17 @@
           link
           icon="View"
           @click="startVideoStable(scope.row)"
-          v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '4'"
+          v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '2'"
         >
           开始
         </el-button>
+
+        <el-button type="primary" link icon="View" @click="startVideoStable(scope.row)" v-if="scope.row.status == '4'"> 继续 </el-button>
+        <el-popconfirm title="确定暂停此任务吗?" @confirm="hangupVideoStable(scope.row)" v-if="scope.row.status == '1'">
+          <template #reference>
+            <el-button type="primary" link icon="View"> 暂停 </el-button>
+          </template>
+        </el-popconfirm>
         <el-popconfirm title="确定终止此任务吗?" @confirm="stopVideoStable(scope.row)" v-if="scope.row.status == '1'">
           <template #reference>
             <el-button type="primary" link icon="View"> 终止 </el-button>
@@ -89,7 +96,8 @@ import {
   // getCompareImageApi,
   // getCompareImageCountApi,
   getImagesApi,
-  getLogVideoStableApi
+  getLogVideoStableApi,
+  hangupVideoStableApi
 } from '@/api/modules/demo/videoStable'
 
 import useWebSocketStore from '@/stores/modules/websocket'
@@ -139,6 +147,16 @@ const stopVideoStable = async (params: any) => {
   proTable.value?.getTableList()
 }
 
+const hangupVideoStable = async (params: any) => {
+  const res = await hangupVideoStableApi(params.id)
+  if (res.code === 200) {
+    ElMessage.success('任务暂停成功')
+  } else {
+    ElMessage.error('任务暂停失败!')
+  }
+  proTable.value?.getTableList()
+}
+
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
 

+ 2 - 0
src/views/task/bizProcess/index.vue

@@ -412,10 +412,12 @@ const loadVerifyResult = async (name, filepath) => {
   }
 }
 
+import { xywh2fourNodes } from '../../demo/data/reformat'
 const setDetail = obj => {
   http.get<any>(obj.labelUrl).then(res => {
     obj.jsonData = []
     // console.log('result', res)
+    res = xywh2fourNodes(res)
     let arr = res.replace('\r', '').split('\n')
     // console.log(arr)
     for (let i = 0; i < arr.length; i++) {