Procházet zdrojové kódy

feat: 目标检测添加终止接口

WANGKANG před 9 měsíci
rodič
revize
59ea39a46b

+ 8 - 5
src/api/modules/demo/TargetDetection.ts

@@ -1,5 +1,5 @@
 import http from '@/api'
-import {TargetDetectionVO, TargetDetectionForm, TargetDetectionQuery} from '@/api/interface/demo/TargetDetection'
+import { TargetDetectionVO, TargetDetectionForm, TargetDetectionQuery } from '@/api/interface/demo/TargetDetection'
 
 /**
  * @name 查询目标检测列表
@@ -7,7 +7,7 @@ import {TargetDetectionVO, TargetDetectionForm, TargetDetectionQuery} from '@/ap
  * @returns 返回列表
  */
 export const listTargetDetectionApi = (query: TargetDetectionQuery) => {
-  return http.get<TargetDetectionVO[]>('/demo/TargetDetection/list', query, {loading: true})
+  return http.get<TargetDetectionVO[]>('/demo/TargetDetection/list', query, { loading: true })
 }
 
 /**
@@ -25,7 +25,7 @@ export const getTargetDetectionApi = (id: string | number) => {
  * @returns returns
  */
 export const addTargetDetectionApi = (data: TargetDetectionForm) => {
-  return http.post<any>('/demo/TargetDetection', data, {loading: false})
+  return http.post<any>('/demo/TargetDetection', data, { loading: false })
 }
 
 /**
@@ -34,7 +34,7 @@ export const addTargetDetectionApi = (data: TargetDetectionForm) => {
  * @returns returns
  */
 export const updateTargetDetectionApi = (data: TargetDetectionForm) => {
-  return http.put<any>('/demo/TargetDetection', data, {loading: false})
+  return http.put<any>('/demo/TargetDetection', data, { loading: false })
 }
 
 /**
@@ -70,11 +70,14 @@ export const exportTargetDetectionApi = (data: any) => {
   return http.downloadPost('/demo/TargetDetection/export', data)
 }
 
-
 export const startTargetDetectionApi = (id: string | number) => {
   return http.get<any>(`/demo/TargetDetection/start/${id}`)
 }
 
+export const stopTargetDetectionApi = (id: string | number) => {
+  return http.get('/demo/TargetDetection/stop/' + id)
+}
+
 /**
  * @name 下载压缩包
  * @returns returns

+ 14 - 4
src/views/demo/TargetDetection/index.vue

@@ -37,9 +37,9 @@
         >
           开始
         </el-button>
-        <el-popconfirm title="确定终止此任务吗?" v-if="scope.row.status == '1'" @confirm="stopTrackSequence(scope.row)">
+        <el-popconfirm title="确定终止此任务吗?" v-if="scope.row.status == '1'" @confirm="stopTargetDetect(scope.row)">
           <template #reference>
-            <el-button type="primary" link icon="Delete"> 终止</el-button>
+            <el-button type="primary" link icon="Delete">终止</el-button>
           </template>
         </el-popconfirm>
         <el-button
@@ -99,7 +99,8 @@ import {
   exportTargetDetectionApi,
   getTargetDetectionApi,
   startTargetDetectionApi,
-  dowloadTargetDetectionApi
+  dowloadTargetDetectionApi,
+  stopTargetDetectionApi
 } from '@/api/modules/demo/TargetDetection'
 
 import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
@@ -107,7 +108,16 @@ import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
 import { enumAlgorithmModelTrackApi, getAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
 import { enumAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
 import { updateTrackSequenceApi } from '@/api/modules/demo/trackSequence'
-import { startToInfraredApi } from '@/api/modules/demo/toInfrared'
+
+const stopTargetDetect = async (params: any) => {
+  const res: any = await stopTargetDetectionApi(params.id)
+  if (res.code === 200) {
+    ElMessage.success('终止任务成功!')
+  } else {
+    ElMessage.error('终止任务失败,请检查!')
+  }
+  proTable.value?.getTableList()
+}
 
 import statusEnums from '@/utils/status'
 import { AlgorithmType, SubSystem, SubSystem__, enumsAlgorithmType, enumsSubSystem } from '@/views/demo/utils'