Bläddra i källkod

平时态到应急态弹窗跳转

hmm 10 månader sedan
förälder
incheckning
28036346db

+ 9 - 1
src/api/emergencyCommandMap/JointDuty.ts

@@ -38,7 +38,7 @@ export function getCheckinList(eventId: string) {
   });
 }
 
-// 更新事发地点
+// 更新事发地点 (用于将表单数据发送到服务器以更新某个事件的位置信息)
 export function updateEventLocation(evevtId: string, address: string, longitude: string, latitude: string) {
   return request({
     url: '/api/event_management/event/save_address',
@@ -51,3 +51,11 @@ export function updateEventLocation(evevtId: string, address: string, longitude:
     }
   });
 }
+
+export function addEvent(data) {
+  return request({
+    url: '/api/event_management/event/create',
+    method: 'post',
+    data: data
+  });
+}

+ 4 - 4
src/views/routineCommandMap/MiddleSection.vue

@@ -18,8 +18,8 @@ import CompanyMap from './company-map.vue';
 const form = ref({
   eventId: '',
   address: '',
-  longitude: '',
-  latitude: ''
+  lon: '',
+  lat: ''
 });
 const mapDialogVisible = ref(false);
 const handleQuery1 = () => {
@@ -32,8 +32,8 @@ const handleQuery2 = () => {
 
 const handleMapChange = (data) => {
   form.value.address = data.address;
-  form.value.longitude = data.longitude[0];
-  form.value.latitude = data.latitude[1];
+  form.value.lon = data.lnglat[0];
+  form.value.lat = data.lat[1];
   mapDialogVisible.value = true;
 };
 </script>

+ 13 - 31
src/views/routineCommandMap/company-map.vue

@@ -77,6 +77,7 @@
 <script setup>
 import AMapLoader from '@amap/amap-jsapi-loader';
 import { useRouter } from 'vue-router';
+import { updateEventLocation,addEvent } from '@/api/emergencyCommandMap/JointDuty';
 
 const props = defineProps({
   visible: {
@@ -137,7 +138,6 @@ onUnmounted(() => {
   }
   window.removeEventListener('resize', handleResize);
 });
-
 function handleInput(flag) {
   if (!location.value) return;
 
@@ -178,13 +178,11 @@ function handleInput(flag) {
     }
   });
 }
-
 function handleChangePage(newNum) {
   if (!searchPop.value) return;
   pageNum.value = newNum;
   this.handleInput(1);
 }
-
 function closeSearchList() {
   searchPop.value = false;
   location.value = '';
@@ -192,18 +190,17 @@ function closeSearchList() {
   total.value = 0;
   pageNum.value = 1;
 }
-
 // 地图中心的平移至指定点位置
 function handlePanTo(index) {
   let lnglat = searchList.value[index].lnglat;
-  form.longitude = searchList.value[index].name + '(' + searchList.value[index] + ')';
-  form.latitude = lnglat[0];
+  form.address = searchList.value[index].name + '(' + searchList.value[index].address + ')';
+  form.longitude = lnglat[0];
   form.latitude = lnglat[1];
+
   map.panTo(lnglat);
   setMarks(lnglat);
   closeSearchList();
 }
-
 const initMap = async () => {
   let position = [110.93154257997, 21.669064031332];
   const AMap = await AMapLoader.load({
@@ -226,7 +223,6 @@ const initMap = async () => {
   map.on('rightclick', handleRightclick);
   handleResize();
 };
-
 function ContextMenu() {
   contextMenu = new AMap.ContextMenu();
   contextMenu.addItem(
@@ -246,14 +242,12 @@ function ContextMenu() {
     1
   );
 }
-
 // 右键事件
 function handleRightclick(e) {
   let lnglat = [e.lnglat.getLng(), e.lnglat.getLat()];
   contextMenu.open(map, e.lnglat);
   lnglatPosition.value = lnglat;
 }
-
 function setMarks(lnglat) {
   //添加标记
   if (marker) map.remove(marker);
@@ -269,14 +263,11 @@ function setMarks(lnglat) {
   });
   marker.setMap(map);
 }
-
 function handleClose() {
   emits('update:visible', false);
 }
-
 let queryFormRef = ref();
 let containerRef = ref();
-
 function handleResize() {
   const containerWidth = containerRef.value.clientWidth * (document.body.clientWidth / 8960);
   const containerHeight = containerRef.value.clientHeight * (document.body.clientHeight / 2520);
@@ -286,18 +277,24 @@ function handleResize() {
     map.resize();
   });
 }
-
 function submit() {
   queryFormRef.value.validate((valid) => {
     if (valid) {
       console.log('提交数据', form);
       router.push({
         path: '/emergencyCommandMap',
-        query: { id: '11111111' }
-      });
+        query: {
+          address:form.address,
+          longitude:form.longitude,
+          latitude:form.latitude
+          }
+        });
     }
   });
 }
+
+
+
 </script>
 
 <style lang="scss" scoped>
@@ -306,12 +303,10 @@ function submit() {
   background: rgba(0, 0, 0, 0.3);
   margin-bottom: 20px;
 }
-
 .map {
   width: 100%;
   height: 100%;
 }
-
 .search {
   width: 50%;
   position: absolute;
@@ -322,7 +317,6 @@ function submit() {
   border-radius: 3px;
   display: flex;
 }
-
 .btn {
   margin-left: 10px;
 }
@@ -337,7 +331,6 @@ function submit() {
   top: 70px;
   padding: 15px;
   border-radius: 3px;
-
   .close {
     position: absolute;
     right: 2%;
@@ -346,7 +339,6 @@ function submit() {
     font-size: 20px;
   }
 }
-
 .scroll {
   width: 100%;
   max-height: 250px;
@@ -388,7 +380,6 @@ function submit() {
     }
   }
 }
-
 ::v-deep {
   .el-scrollbar__wrap {
     overflow-x: hidden !important;
@@ -398,11 +389,9 @@ function submit() {
     display: none;
   }
 }
-
 .empty {
   margin: 20px 0;
 }
-
 .dialog-wrap {
   position: fixed;
   top: 50%;
@@ -413,7 +402,6 @@ function submit() {
   align-items: center;
   justify-content: center;
   font-size: 16px;
-
   .dialog {
     width: 4000px;
     height: 2000px;
@@ -422,29 +410,23 @@ function submit() {
     border-radius: 10px;
   }
 }
-
 .dialog {
   padding: 0 20px;
-
   .dialog-header {
     width: 100%;
     height: 70px;
     display: flex;
     justify-content: space-between;
     align-items: center;
-
     .dialog-title {
       font-size: 36px;
     }
-
     .icon-close {
       cursor: pointer;
     }
   }
-
   .dialog-content {
     padding: 10px 0;
-
     .map_box {
       width: calc(4000px - 50px) !important;
       height: calc(2000px - 200px) !important;