Browse Source

Merge remote-tracking branch 'origin/dev' into dev

Hwf 7 tháng trước cách đây
mục cha
commit
d740d7bbef

+ 0 - 1
src/components/NearbyVideos/index.vue

@@ -21,7 +21,6 @@
       />
     </div>
   </Dialog>
-
 </template>
 
 <script lang="ts" setup name="NearbyVideos">

+ 60 - 3
src/views/emergencyCommandMap/LeftSection/CloseCommand.vue

@@ -23,7 +23,9 @@
           <el-option v-for="item in events" :key="item.event_id" :label="item.event_title" :value="item.event_title"></el-option>
         </el-select>
       </el-form-item>
-      <span style="color: red; display: block; margin-top: 10px;margin-left: 10px">注意:本次指挥未关联事件,指挥记录将不会保留,若需要保留指挥记录,请关联事件</span>
+      <span style="color: red; display: block; margin-top: 10px; margin-left: 10px"
+        >注意:本次指挥未关联事件,指挥记录将不会保留,若需要保留指挥记录,请关联事件</span
+      >
     </el-form>
     <div v-else>{{ form.event_title }}</div>
   </Dialog>
@@ -33,6 +35,8 @@
 import { ref, reactive, toRefs, watch, onMounted } from 'vue';
 import { editEvent, registeredEvent, closeEvent, getEventDetail } from '@/api/duty/eventing';
 import { useRouter, useRoute } from 'vue-router';
+import { ElMessage } from 'element-plus'; // 确保已正确导入 ElMessage
+
 const proxy = getCurrentInstance()?.proxy;
 const router = useRouter();
 const buttonLoading = ref(false);
@@ -87,6 +91,7 @@ const fetchEventDetail = async (id: string) => {
     if (response && response.data) {
       form.value = response.data;
     }
+    console.log('Event detail:', form.value);
   } catch (error) {
     console.error('Failed to fetch event detail:', error);
   }
@@ -126,6 +131,7 @@ watch(
   }
 );
 
+// 关闭对话框
 const closeDialog = () => {
   emits('update:modelValue', false);
   if (eventFormRef.value) {
@@ -133,6 +139,8 @@ const closeDialog = () => {
   }
   // 不需要重置 form.value.event_id 和 form.value.event_title
 };
+
+// 结束指挥
 const endProcess = () => {
   // 如果 flag 为 false,则需要选择一个事件
   if (!props.flag) {
@@ -173,7 +181,8 @@ const endProcess = () => {
   }
 };
 
-const submitForm = async () => {
+// 提交表单
+/*const submitForm = async () => {
   return new Promise((resolve, reject) => {
     eventFormRef.value?.validate(async (valid) => {
       if (valid) {
@@ -186,7 +195,7 @@ const submitForm = async () => {
             latitude: form.value.latitude,
             longitude: form.value.longitude
           };
-          console.log('Sending request with params:', params); // 添加调试信息
+          console.log('使用参数发送请求:', params); // 添加调试信息
           // 提交关闭事件请求
           await closeEvent(params);
           proxy?.$modal.msgSuccess('已成功关闭');
@@ -205,8 +214,55 @@ const submitForm = async () => {
       }
     });
   });
+};*/
+
+// 提交选择的事件信息
+const submitForm = async () => {
+  // 仅在 props.flag 为 false 时进行表单验证
+  if (!props.flag) {
+    const valid = await eventFormRef.value?.validate();
+
+    if (!valid) {
+      ElMessage.error('表单验证失败,请检查您的输入');
+      throw new Error('Validation failed');
+    }
+  }
+
+  // 设置按钮加载状态
+  buttonLoading.value = true;
+
+  try {
+    // 构造请求参数
+    const params = {
+      eventId: form.value.event_id,
+      address: form.value.address,
+      latitude: form.value.latitude,
+      longitude: form.value.longitude
+    };
+    console.log('使用参数发送请求:', params); // 添加调试信息
+
+    // 提交关闭事件请求
+    await closeEvent(params);
+
+    // 显示成功消息
+    ElMessage.success('已成功关闭');
+
+    // 关闭对话框
+    closeDialog();
+
+    // 如果需要返回特定信息,可以在这里返回
+    return;
+  } catch (error) {
+    console.error('Failed to close event:', error);
+    ElMessage.error('关闭事件失败,请检查您的输入');
+    throw error; // 继续抛出错误以便上层处理
+  } finally {
+    // 重置按钮加载状态
+    buttonLoading.value = false;
+  }
 };
 
+// 提交选择的事件信息
 const submitSelectedEvent = async () => {
   // 提交选择的事件信息
   if (form.value.event_id) {
@@ -227,6 +283,7 @@ const submitSelectedEvent = async () => {
   }
 };
 
+// 选择事件
 const selectEvent = (eventTitle) => {
   const selectedItem = events.value.find((event) => event.event_title === eventTitle);
   if (selectedItem) {

+ 31 - 4
src/views/routineCommandMap/LeftSection/EventManage.vue

@@ -96,7 +96,7 @@
               </el-form-item>
             </el-col>
             <div class="flex">
-              <div class="common-btn-primary" @click="handleQuery" style="margin-top: -32px">搜索</div>
+              <div class="common-btn-primary" style="margin-top: -32px" @click="handleQuery">搜索</div>
               <div class="common-btn" @click="resetQuery">重置</div>
             </div>
           </el-row>
@@ -118,14 +118,41 @@
       <div v-for="(item, index) in eventList" :key="index" class="tr">
         <div class="td">{{ item.event_id }}</div>
         <div class="td">{{ item.event_title }}</div>
-        <div class="td">{{ item.event_type }}</div>
+<!--        <div class="td">{{ item.event_type }}</div>-->
+        <div v-if="item.event_type === '0' || item.event_type === '1' || item.event_type === '2' || item.event_type === '3'" class="flex">
+          <template v-if="item.event_type === '0'">
+            <div>自然灾害</div>
+          </template>
+          <template v-if="item.event_type === '1'">
+            <div>事故灾害</div>
+          </template>
+          <template v-if="item.event_type === '2'">
+            <div>公共卫生事件</div>
+          </template>
+          <template v-if="item.event_type === '3'">
+            <div>社会安全事件</div>
+          </template>
+        </div>
         <div class="td">{{ item.event_level }}</div>
         <div class="td">{{ item.address }}</div>
-        <div class="td">{{ item.event_status }}</div>
+        <div v-if="item.event_status === '0' || item.event_status === '1' || item.event_status === '2' || item.event_status === '3'" class="flex">
+          <template v-if="item.event_status === '0'">
+            <div>已登记</div>
+          </template>
+          <template v-if="item.event_status === '1'">
+            <div>指挥中</div>
+          </template>
+          <template v-if="item.event_status === '2'">
+            <div>指挥结束</div>
+          </template>
+          <template v-if="item.event_status === '3'">
+            <div>已关闭</div>
+          </template>
+        </div>
         <div class="td">{{ item.event_time }}</div>
         <div class="td">
           <div class="common-btn2" @click="enterCommand(item)">进入指挥</div>
-<!--          <div class="common-btn2" style="margin-left: 20px" @click="handleClose(item)">关闭事件</div>-->
+          <!--          <div class="common-btn2" style="margin-left: 20px" @click="handleClose(item)">关闭事件</div>-->
         </div>
       </div>
     </div>

+ 13 - 2
src/views/routineCommandMap/RightSection/planManageDialog.vue

@@ -1,5 +1,5 @@
 <template>
-  <Dialog v-model="localValue" customShow type="xl" title="预案管理列表" hide-footer @close="handleClose">
+  <Dialog v-model="localValue" custom-show type="xl" title="预案管理列表" hide-footer @close="handleClose">
     <transition name="fade">
       <div v-if="isFormVisible" class="mb-[20px]">
         <el-form ref="queryFormRef" :model="planForm" :inline="true">
@@ -79,7 +79,18 @@
       <div v-for="(item, index) in demoList" :key="index" class="tr">
         <div class="td">{{ item.planId }}</div>
         <div class="td">{{ item.planName }}</div>
-        <div class="td">{{ item.planType }}</div>
+        <!--        <div class="td">{{ item.planType }}</div>-->
+        <div v-if="item.planType === '1' || item.planType === '2' || item.planType === '3'" class="flex">
+          <template v-if="item.planType === '1'">
+            <div>总体应急预案</div>
+          </template>
+          <template v-if="item.planType === '2'">
+            <div>专项应急预案</div>
+          </template>
+          <template v-if="item.planType === '3'">
+            <div>部门应急预案</div>
+          </template>
+        </div>
         <div class="td">{{ item.document }}</div>
         <div class="td">{{ item.organizingUnit }}</div>
         <div class="td">{{ item.publishDate }}</div>