Procházet zdrojové kódy

fix: 解耦预审与问题处理简单复杂的关系

sunhongyao341504 před 1 rokem
rodič
revize
38e8a7c6f4

+ 71 - 0
src/views/datamanager/alertformdata/components/common/Prequalification.vue

@@ -0,0 +1,71 @@
+<template>
+  <div style="margin-bottom: 10px; display: flex" v-if="hasDevModePermisson()">
+    <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>
+</template>
+
+<script setup lang="ts">
+  import { onMounted, ref } from 'vue';
+  import {
+    getDevMode,
+    switchDevMode as SDM,
+    getVideoLength,
+    updateVideoLength,
+  } from '@/api/datamanagement/getDevMode';
+  import { useUserStore } from '@/store/modules/user';
+  import { ElMessage } from 'element-plus';
+
+  const userStore = useUserStore();
+
+  const devMode = ref(true);
+  getDevMode().then((res) => {
+    devMode.value = res;
+  });
+
+  const switchDevMode = () => {
+    SDM();
+    devMode.value = !devMode.value;
+  };
+
+  const hasDevModePermisson = () => {
+    return userStore.checkPermission('control_activation');
+  };
+
+  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',
+      });
+    });
+  };
+
+  onMounted(() => {
+    getCurVideoLength();
+  });
+</script>
+
+<style scoped></style>

+ 2 - 0
src/views/datamanager/alertformdata/components/default-simple/Default.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="box">
+    <Prequalification />
     <div class="search-form">
       <QueryFormSimple
         :is-show-tab="false"
@@ -55,6 +56,7 @@
   import Pagination from '../common/Pagination.vue';
   import { useIssueType } from '../../hooks/useIssueType';
   import { useWorkLocation } from '../../hooks/useWorkLocation';
+  import Prequalification from '../common/Prequalification.vue';
   import { getDefaultTableData, deleteDefaultTableData } from '@/api/datamanagement/alert-default';
 
   const { aiOptions, manualOptions, getAIOptions, getManualOptions } = useIssueType();

+ 2 - 55
src/views/datamanager/alertformdata/components/default/Default.vue

@@ -1,22 +1,6 @@
 <template>
   <div class="box">
-    <div style="margin-bottom: 10px; display: flex" v-if="hasDevModePermisson()">
-      <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>
+    <Prequalification />
     <div class="search-form">
       <QueryForm
         :is-show-tab="false"
@@ -120,12 +104,7 @@
     updateDefaultPriority,
     updateDefaultPriorityAll,
   } from '@/api/datamanagement/alert-default';
-  import {
-    getDevMode,
-    switchDevMode as SDM,
-    getVideoLength,
-    updateVideoLength,
-  } from '@/api/datamanagement/getDevMode';
+  import Prequalification from '../common/Prequalification.vue';
 
   import { useUserStore } from '@/store/modules/user';
   import { useGlobSetting } from '@/hooks/setting';
@@ -495,46 +474,14 @@
     return userStore.checkPermission('question_mock_edit_admin');
   };
 
-  const hasDevModePermisson = () => {
-    return userStore.checkPermission('control_activation');
-  };
-
-  const devMode = ref(true);
-  getDevMode().then((res) => {
-    devMode.value = res;
-  });
-  const switchDevMode = () => {
-    SDM();
-    devMode.value = !devMode.value;
-  };
-
   onMounted(() => {
     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>