Parcourir la source

优化启动预案和预案通知列表

libushang il y a 10 mois
Parent
commit
1bd22fdb8f

+ 4 - 8
src/types/auto-imports.d.ts

@@ -78,6 +78,7 @@ declare global {
   const onStartTyping: typeof import('@vueuse/core')['onStartTyping']
   const onUnmounted: typeof import('vue')['onUnmounted']
   const onUpdated: typeof import('vue')['onUpdated']
+  const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
   const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
   const provide: typeof import('vue')['provide']
   const provideLocal: typeof import('@vueuse/core')['provideLocal']
@@ -189,6 +190,7 @@ declare global {
   const useFullscreen: typeof import('@vueuse/core')['useFullscreen']
   const useGamepad: typeof import('@vueuse/core')['useGamepad']
   const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
+  const useId: typeof import('vue')['useId']
   const useIdle: typeof import('@vueuse/core')['useIdle']
   const useImage: typeof import('@vueuse/core')['useImage']
   const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
@@ -205,6 +207,7 @@ declare global {
   const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
   const useMemoize: typeof import('@vueuse/core')['useMemoize']
   const useMemory: typeof import('@vueuse/core')['useMemory']
+  const useModel: typeof import('vue')['useModel']
   const useMounted: typeof import('@vueuse/core')['useMounted']
   const useMouse: typeof import('@vueuse/core')['useMouse']
   const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
@@ -252,6 +255,7 @@ declare global {
   const useStyleTag: typeof import('@vueuse/core')['useStyleTag']
   const useSupported: typeof import('@vueuse/core')['useSupported']
   const useSwipe: typeof import('@vueuse/core')['useSwipe']
+  const useTemplateRef: typeof import('vue')['useTemplateRef']
   const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
   const useTextDirection: typeof import('@vueuse/core')['useTextDirection']
   const useTextSelection: typeof import('@vueuse/core')['useTextSelection']
@@ -312,10 +316,6 @@ declare module 'vue' {
   interface GlobalComponents {}
   interface ComponentCustomProperties {
     readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
-    readonly ElLoading: UnwrapRef<typeof import('element-plus/es')['ElLoading']>
-    readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']>
-    readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']>
-    readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']>
     readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
     readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
     readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
@@ -611,10 +611,6 @@ declare module '@vue/runtime-core' {
   interface GlobalComponents {}
   interface ComponentCustomProperties {
     readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
-    readonly ElLoading: UnwrapRef<typeof import('element-plus/es')['ElLoading']>
-    readonly ElMessage: UnwrapRef<typeof import('element-plus/es')['ElMessage']>
-    readonly ElMessageBox: UnwrapRef<typeof import('element-plus/es')['ElMessageBox']>
-    readonly ElNotification: UnwrapRef<typeof import('element-plus/es')['ElNotification']>
     readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
     readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
     readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>

+ 4 - 0
src/types/components.d.ts

@@ -20,6 +20,7 @@ declare module 'vue' {
     ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
     ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
     ElButton: typeof import('element-plus/es')['ElButton']
+    ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElCol: typeof import('element-plus/es')['ElCol']
     ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
@@ -95,4 +96,7 @@ declare module 'vue' {
     YMap: typeof import('./../components/Map/YMap.vue')['default']
     YztMap: typeof import('./../components/Map/YztMap/index.vue')['default']
   }
+  export interface ComponentCustomProperties {
+    vLoading: typeof import('element-plus/es')['ElLoadingDirective']
+  }
 }

+ 2 - 2
src/views/emergencyCommandMap/RightSection/RenWuGenZong.vue

@@ -96,7 +96,7 @@ const toggleScroll = () => {
 };
 
 // 设置定时器
-const fetchInterval = 1000; // 每1秒刷新一次
+const fetchInterval = process.env.NODE_ENV === 'development' ? 60000 : 3000; // 每60秒刷新一次(刷新太频繁影响调试)
 let intervalId: number | null = null;
 
 const startFetchingData = () => {
@@ -231,7 +231,7 @@ watch(
 }
 .more {
   position: absolute;
-  bottom: 10px; /* 根据需要调整位置 */
+  bottom: 20px; /* 根据需要调整位置 */
   right: 50%; /* 根据需要调整位置 */
   transform: translateX(50%);
   color: #1890ff;

+ 6 - 3
src/views/emergencyCommandMap/RightSection/RightTop.vue

@@ -67,6 +67,9 @@ const activeTab = ref('任务跟踪');
 
 const setActiveTab = (id) => {
   activeTab.value = id;
+  if(id === '预案通知' && notifications.value.length === 0) {
+    fetchData();
+  }
 };
 
 // 定义 notifications
@@ -153,7 +156,7 @@ watch(
   width: 100%;
 
   .table-content {
-    height: 600px;
+    height: 550px;
     overflow-y: auto;
 
     .box1 {
@@ -243,7 +246,7 @@ watch(
 
         .box-content {
           color: #fff;
-          width: 80%;
+          width: 100%;
           font-size: 38px;
           line-height: 1.5;
           margin-top: 10px;
@@ -264,7 +267,7 @@ watch(
   .card-content {
     display: flex;
     flex-wrap: wrap;
-    padding: 0 80px;
+    padding: 0 0 0 80px;
     width: 100%;
   }
 }

+ 6 - 1
src/views/emergencyCommandMap/RightSection/TaskDelivery.vue

@@ -1,5 +1,5 @@
 <template>
-  <Dialog v-model="dialogVisible" type="xl" :title="props.title" @close="closeDialog">
+  <Dialog v-model="dialogVisible" type="xl" :title="props.title" @close="closeDialog" v-loading="sending">
     <div class="content">
       <el-skeleton :loading="loading" animated>
         <template #template>
@@ -43,6 +43,7 @@ const emit = defineEmits(['update:modelValue']);
 const dialogVisible = ref(props.modelValue);
 const tasks = ref([]);
 const loading = ref(false);
+const sending = ref(false);
 
 watch(
   () => props.modelValue,
@@ -80,6 +81,7 @@ const sendTasks = () => {
     ElMessage.error('事件ID未定义,无法发送任务!');
     return;
   }
+  sending.value = true;
   sendTask({ eventId: props.eventId })
     .then(() => {
       ElMessage.success('任务已成功发送!');
@@ -87,6 +89,9 @@ const sendTasks = () => {
     })
     .catch(() => {
       ElMessage.error('发送任务失败,请稍后再试!');
+    })
+    .finally(() => {
+      sending.value = false;
     });
 };
 </script>

+ 5 - 0
src/views/emergencyCommandMap/RightSection/index.vue

@@ -92,6 +92,11 @@ const getEventIdFromUrl = () => {
 const startPlan = async() => {
   const response = await getEventDetail({ event_id: eventId.value })
   const event_data = (response.data);
+  if(event_data.emergency_notify_count > 0) {
+    ElMessage.warning('预案已启动');
+    return;
+  }
+
   if (event_data.del_flag === '0') {
     // 正式事件
     startPlanState.title = '启动预案';