Hwf 7 месяцев назад
Родитель
Сommit
17abb4e743

+ 27 - 0
src/api/duty/eventing.ts

@@ -8,3 +8,30 @@ export function getEvent(params) {
     params: params
   });
 }
+
+//已登记事件
+export function registeredEvent(data) {
+  return request({
+    url: '/api/event_management/event/list_registered',
+    method: 'post',
+    data
+  });
+}
+
+// 编辑事件
+export function editEvent(params) {
+  return request({
+    url: '/api/event_management/event/edit',
+    method: 'get',
+    params: params
+  });
+}
+
+// 关闭事件
+export function closeEvent(data) {
+  return request({
+    url: '/api/event_management/event/close',
+    method: 'post',
+    data: data
+  });
+}

BIN
src/assets/images/inputIcon1.png


+ 0 - 19
src/components/Map/map.scss

@@ -117,23 +117,4 @@
     justify-content: flex-end;
     margin-top: -20px;
   }
-  .btn {
-    width: 300px;
-    height: 120px;
-    background: url('@/assets/images/map/rightMenu/potentialFloodHazard/btn2.png') no-repeat;
-    background-size: 100% 100%;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    cursor: pointer;
-    margin-left: 20px;
-    color: #edfaff;
-    .video-icon {
-      width: 41px;
-      height: 38px;
-      background: url('@/assets/images/map/rightMenu/potentialFloodHazard/video.png') no-repeat;
-      background-size: 100% 100%;
-      display: flex;
-    }
-  }
 }

+ 6 - 1
src/views/mobileControl/PositionSelect.vue

@@ -266,7 +266,12 @@ function submit() {
     showFailToast('纬度不能为空');
   } else {
     addEvent(form).then((res) => {
-      emits('confirm', res);
+      emits('confirm', {
+        event_id: res.data,
+        address: form.address,
+        latitude: form.latitude,
+        longitude: form.longitude
+      });
       handleClose();
     });
   }

+ 60 - 23
src/views/mobileControl/index.vue

@@ -43,12 +43,12 @@
     <!--地点选择-->
     <PositionSelect v-model:visible="showPositionSelect" @confirm="handleEnterCommand" />
     <!--临时结束指挥-->
-    <van-dialog v-model:show="endEventState.show" title="结束指挥" confirm-button-text="结束指挥" show-cancel-button @close="handleClose" @confirm="submit">
+    <van-dialog v-model:show="endEventState.show" title="结束指挥" confirm-button-text="结束指挥" show-cancel-button @close="closeDialog" @confirm="endProcess">
       <div class="form">
         <div class="form-item">
           <i class="icon" />
           <div class="form-label">灾害事件:</div>
-          <div class="form-select" @click="endEventState.showPicker = true">{{ endEventState.eventId }}</div>
+          <div class="form-select" @click="endEventState.showPicker = true">{{ endEventState.name }}</div>
         </div>
         <div class="form-text">注意:本次指挥未关联事件,指挥记录将不会保留。若要保留记录,请关联事件。</div>
       </div>
@@ -58,7 +58,7 @@
           :columns="endEventState.columns"
           :columns-field-names="{ text: 'event_title', value: 'event_id' }"
           @cancel="endEventState.showPicker = false"
-          @confirm="onConfirm"
+          @confirm="onPickerConfirm"
       />
     </van-popup>
   </div>
@@ -72,12 +72,14 @@ import SearchBtn from "./SearchBtn.vue";
 import {deepClone} from "@/utils";
 import {iconList} from "@/components/Map/mapData";
 import PositionSelect from "@/views/mobileControl/PositionSelect.vue";
-import {getEvent} from "@/api/duty/eventing";
+import {editEvent, registeredEvent} from "@/api/duty/eventing";
+import {showFailToast, showSuccessToast} from "vant";
+import {closeEvent} from "@/api/event";
 
 const router = useRouter();
 const route = useRoute();
 const eventId = ref('');
-const temp = ref(true);
+const temp = ref(false);
 let fullscreen = ref(false);
 let showMenu = ref(true);
 let mapRef = ref(null);
@@ -86,14 +88,14 @@ let map2Ref = ref(null);
 let activeMap = ref('vectorgraph');
 let pointType = ref([]);
 let endEventState = reactive({
-  show: true,
+  show: false,
   showPicker: false,
-  queryParams: {
-    page: 1,
-    page_size: 100
-  },
   columns: [],
-  eventId: ''
+  name: '',
+  address: '',
+  latitude: '',
+  longitude: '',
+  event_id: ''
 });
 
 
@@ -157,18 +159,53 @@ const handleShowPosition = () => {
 }
 const handleEnterCommand = (res) => {
   temp.value = true;
-  eventId.value = res.data;
+  eventId.value = res.event_id;
+  endEventState.address = res.address;
+  endEventState.latitude = res.latitude;
+  endEventState.longitude = res.longitude;
+}
+const onPickerConfirm = (data, a, b) => {
+  endEventState.event_id = data.selectedValues[0];
+  endEventState.name = data.selectedOptions[0].event_title;
+  endEventState.showPicker = false;
+};
+const closeDialog = () => {
+  endEventState.show = false;
+  endEventState.event_id = '';
+  endEventState.name = '';
+}
+const endProcess = () => {
+  if (!endEventState.event_id) {
+    showFailToast('请先选择一个事件')
+    return;
+  }
+  // 更新事件信息
+  const updateParams = {
+    event_id: endEventState.event_id,
+    address: endEventState.address,
+    latitude: endEventState.latitude,
+    longitude: endEventState.longitude
+  };
+  const params = {
+    eventId: endEventState.event_id,
+    address: endEventState.address,
+    latitude: endEventState.latitude,
+    longitude: endEventState.longitude
+  };
+  // 提交选择的事件信息
+  editEvent(updateParams).then(() => {
+    // 调用 closeEvent 接口关闭事件
+    closeEvent(params).then(() => {
+      closeDialog();
+      showSuccessToast('结束成功');
+      router.push('/leader/index');
+    })
+  })
 }
 onMounted(() => {
   eventId.value = route.query.event_id as string;
-  getEvent(endEventState.queryParams).then((res) => {
-    const data = [];
-    res.data.forEach((item) => {
-      if (!!item.event_title) {
-        data.push(item);
-      }
-    })
-    endEventState.columns = data;
+  registeredEvent({}).then((res) => {
+    endEventState.columns = res.data;
   });
 })
 </script>
@@ -317,13 +354,13 @@ onMounted(() => {
     }
     .form-select {
       flex: 1;
-      height: 30px;
+      height: 35px;
       background: #FFFFFF;
       border: 1px solid #DCE0EE;
       border-radius: 2px;
       margin-left: 6px;
-      padding-right: 40px;
-      position: relative;
+      padding: 5px 40px 5px 8px;
+      position: relative;;
       &::before {
         content: '';
       }