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

feat: 任务开始、终止、下载结果接口

WANGKANG 7 сар өмнө
parent
commit
424fed2509

+ 10 - 2
src/api/modules/demo/toInfrared.ts

@@ -70,9 +70,17 @@ export const exportToInfraredApi = (data: any) => {
 }
 
 export const startToInfraredApi = (id: string | number) => {
-  return http.downloadPost('/demo/toInfrared/start' + id)
+  return http.get('/demo/toInfrared/start/' + id)
 }
 
 export const stopToInfraredApi = (id: string | number) => {
-  return http.downloadPost('/demo/toInfrared/stop' + id)
+  return http.get('/demo/toInfrared/stop/' + id)
+}
+
+/**
+ * @name 下载压缩包
+ * @returns returns
+ */
+export const dowloadToInfraredApi = (id: string | number): Promise<any> => {
+  return http.downloadGet('/demo/toInfrared/zip/' + id)
 }

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

@@ -76,3 +76,11 @@ export const startTrackSequenceApi = (id: string | number) => {
 export const stopTrackSequenceApi = (id: string | number) => {
   return http.downloadPost('/demo/trackSequence/stop' + id)
 }
+
+/**
+ * @name 下载压缩包
+ * @returns returns
+ */
+export const dowloadTrackSequenceApi = (id: string | number): Promise<any> => {
+  return http.downloadGet('/demo/trackSequence/zip/' + id)
+}

+ 13 - 3
src/views/demo/toInfrared/index.vue

@@ -34,8 +34,14 @@
             <el-button type="primary" link icon="Delete"> 终止 </el-button>
           </template>
         </el-popconfirm>
-        <el-button type="primary" link icon="View" v-auth="['demo:ToInfrared:download']" v-if="scope.row.status == '2'">
-          <!-- @click="dowloadToInfrared(scope.row)" -->
+        <el-button
+          type="primary"
+          link
+          icon="View"
+          v-auth="['demo:ToInfrared:download']"
+          v-if="scope.row.status == '2'"
+          @click="dowloadToInfrared(scope.row)"
+        >
           下载
         </el-button>
         <!-- <el-button type="primary" link icon="View" v-auth="['demo:toInfrared:query']" @click="openDialog(3, '查看', scope.row)"> 查看 </el-button> -->
@@ -75,7 +81,8 @@ import {
   importToInfraredDataApi,
   exportToInfraredApi,
   startToInfraredApi,
-  stopToInfraredApi
+  stopToInfraredApi,
+  dowloadToInfraredApi
 } from '@/api/modules/demo/toInfrared'
 import statusEnums from '@/utils/status'
 
@@ -98,6 +105,9 @@ const stopToInfrared = async (params: any) => {
   }
   proTable.value?.getTableList()
 }
+const dowloadToInfrared = async (params: any) => {
+  await useDownload(dowloadToInfraredApi, params.name, params.id, true, '.zip')
+}
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()

+ 14 - 3
src/views/demo/trackSequence/index.vue

@@ -34,8 +34,14 @@
             <el-button type="primary" link icon="Delete"> 终止 </el-button>
           </template>
         </el-popconfirm>
-        <el-button type="primary" link icon="View" v-auth="['demo:trackSequence:download']" v-if="scope.row.status == '2'">
-          <!-- @click="dowloadtrackSequence(scope.row)" -->
+        <el-button
+          type="primary"
+          link
+          icon="View"
+          v-auth="['demo:trackSequence:download']"
+          v-if="scope.row.status == '2'"
+          @click="dowloadtrackSequence(scope.row)"
+        >
           下载
         </el-button>
         <!-- <el-button type="primary" link icon="View" v-auth="['demo:toInfrared:query']" @click="openDialog(3, '查看', scope.row)"> 查看 </el-button> -->
@@ -76,7 +82,8 @@ import {
   exportTrackSequenceApi,
   getTrackSequenceApi,
   startTrackSequenceApi,
-  stopTrackSequenceApi
+  stopTrackSequenceApi,
+  dowloadTrackSequenceApi
 } from '@/api/modules/demo/trackSequence'
 import statusEnums from '@/utils/status'
 
@@ -100,6 +107,10 @@ const stopTrackSequence = async (params: any) => {
   proTable.value?.getTableList()
 }
 
+const dowloadToInfrared = async (params: any) => {
+  await useDownload(dowloadTrackSequenceApi, params.name, params.id, true, '.zip')
+}
+
 // ProTable 实例
 const proTable = ref<ProTableInstance>()