Sfoglia il codice sorgente

feat: 电子稳像日志 + 自动刷新 + 转图片自动刷新

WANGKANG 7 mesi fa
parent
commit
8587751213

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

@@ -94,3 +94,7 @@ export const getCompareImageCountApi = (taskId: String | Number) => {
 export const getImagesApi = (ossid: String | Number) => {
   return http.get('/demo/videoStable/images/' + ossid)
 }
+
+export const getLogVideoStableApi = (id: string | number) => {
+  return http.get('/demo/videoStable/log/' + id, {}, { loading: false })
+}

+ 17 - 0
src/views/demo/video2image/index.vue

@@ -93,6 +93,23 @@ import {
   downloadVideo2imageApi
 } from '@/api/modules/demo/video2image'
 
+import useWebSocketStore from '@/stores/modules/websocket'
+import { resetHeart } from '@/utils/websocket'
+
+onMounted(() => {
+  const websocketStore = useWebSocketStore()
+  websocketStore.websocket.onmessage = (e: any) => {
+    if (e.data.indexOf('heartbeat') > 0) {
+      resetHeart()
+    }
+    if (e.data.indexOf('ping') > 0) {
+      return
+    }
+    // console.log(e)
+    proTable.value?.getTableList(true)
+  }
+})
+
 const startVideo2image = async (params: any) => {
   const res = await startVideo2imageApi(params.id)
   if (res.code === 200) {

+ 16 - 1
src/views/demo/videoStable/index.vue

@@ -40,6 +40,16 @@
           </template>
         </el-popconfirm>
         <el-button type="primary" link icon="View" @click="compareVideoStable(scope.row)" v-if="scope.row.status == '2'"> 预览 </el-button>
+        <el-button
+          type="primary"
+          link
+          icon="View"
+          v-auth="['demo:toInfrared:query']"
+          @click="viewLogRef.handleOpen(scope.row.id)"
+          v-if="scope.row.status != '0'"
+        >
+          日志
+        </el-button>
         <el-button type="primary" link icon="View" v-auth="['demo:videoStable:query']" @click="openDialog(3, '视频去抖动查看', scope.row)">
           查看
         </el-button>
@@ -50,6 +60,7 @@
       </template>
     </ProTable>
     <FormDialog ref="formDialogRef" />
+    <ViewLog ref="viewLogRef" :get-log-api="getLogVideoStableApi" />
     <ImportExcel ref="dialogRef" />
     <el-dialog v-model="dialogVisible" :title="dialogTitle" width="80%" :before-close="handleClose">
       <el-form :inline="true">
@@ -100,11 +111,15 @@ import {
   stopVideoStableApi,
   // getCompareImageApi,
   // getCompareImageCountApi,
-  getImagesApi
+  getImagesApi,
+  getLogVideoStableApi
 } from '@/api/modules/demo/videoStable'
 
 import useWebSocketStore from '@/stores/modules/websocket'
 import { resetHeart } from '@/utils/websocket'
+import ViewLog from '@/views/demo/components/ViewLog.vue'
+
+const viewLogRef = ref()
 
 onMounted(() => {
   const websocketStore = useWebSocketStore()