Bladeren bron

feat: 自定义报警视频截取长度

sunhongyao341504 1 jaar geleden
bovenliggende
commit
c7c1017ad9

+ 23 - 6
src/api/datamanagement/getDevMode.ts

@@ -4,14 +4,31 @@ import { http } from '@/utils/http/axios';
 export const getDevMode = () => {
   return http.request({
     url: '/issue/getDevMode',
-    method: 'get'
+    method: 'get',
   });
 };
 
 // 切换开发者模式开关状态
 export const switchDevMode = () => {
-    return http.request({
-      url: '/issue/switchDevMode',
-      method: 'post'
-    });
-  };
+  return http.request({
+    url: '/issue/switchDevMode',
+    method: 'post',
+  });
+};
+
+export const getVideoLength = () => {
+  return http.request({
+    url: '/sysconfig/getVideoLength',
+    method: 'get',
+  });
+};
+
+export const updateVideoLength = (len: number) => {
+  return http.request({
+    url: '/sysconfig/updateVideoLength',
+    method: 'post',
+    data: {
+      videoLength: len,
+    },
+  });
+};

+ 40 - 3
src/views/datamanager/alertformdata/components/default/Default.vue

@@ -1,8 +1,21 @@
 <template>
   <div class="box">
     <div style="margin-bottom: 10px; display: flex" v-if="hasDevModePermisson()">
-      <div style="line-height: 33px">预审后生效模式:</div>
-      <el-switch :model-value="devMode" @change="switchDevMode" />
+      <div style="display: flex">
+        <div style="line-height: 33px">预审后生效模式:</div>
+        <el-switch :model-value="devMode" @change="switchDevMode" />
+      </div>
+      <div style="display: flex; margin-left: 30px">
+        <div style="line-height: 33px; text-wrap: nowrap">报警视频截取时长:</div>
+        <el-select
+          v-model="videoLength"
+          style="width: 80px; margin: 0 10px"
+          @change="updateNewVideoLength"
+        >
+          <el-option v-for="item in videoLengthOptions" :key="item" :label="item" :value="item" />
+        </el-select>
+        <div style="line-height: 33px">s</div>
+      </div>
     </div>
     <div class="search-form">
       <QueryForm
@@ -107,7 +120,12 @@
     updateDefaultPriority,
     updateDefaultPriorityAll,
   } from '@/api/datamanagement/alert-default';
-  import { getDevMode, switchDevMode as SDM } from '@/api/datamanagement/getDevMode';
+  import {
+    getDevMode,
+    switchDevMode as SDM,
+    getVideoLength,
+    updateVideoLength,
+  } from '@/api/datamanagement/getDevMode';
 
   import { useUserStore } from '@/store/modules/user';
   import { useGlobSetting } from '@/hooks/setting';
@@ -494,10 +512,29 @@
     getTableData();
   });
 
+  const videoLength = ref(10);
+  const videoLengthOptions = [10, 20, 40, 60];
+
+  const getCurVideoLength = () => {
+    getVideoLength().then((res) => {
+      videoLength.value = res;
+    });
+  };
+
+  const updateNewVideoLength = () => {
+    updateVideoLength(videoLength.value).then(() => {
+      ElMessage({
+        message: '报警视频截取长度设置成功',
+        type: 'success',
+      });
+    });
+  };
+
   onBeforeMount(() => {
     getLocationOptions();
     getAIMainOptions();
     getManualMainOptions();
+    getCurVideoLength();
   });
 </script>