Jelajahi Sumber

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

hmm 8 bulan lalu
induk
melakukan
2e821fd30e

+ 14 - 13
src/components/TimeAxis/index.vue

@@ -60,6 +60,7 @@ import img8 from './tempImg/img8.jfif';
 import img9 from './tempImg/img9.jfif';
 import img10 from './tempImg/img10.jfif';
 
+const containerScale = inject('containerScale');
 const timeAxisState = reactive({
   expand: false,
   format: 'YYYY-MM-DD HH:mm',
@@ -214,19 +215,19 @@ const onDrag = (event) => {
   if (!dragState.dragging) return;
   console.log(dragState.bottom + dragState.initialMouseY - event.clientY);
   console.log(dragState.bottom, dragState.initialMouseY, event.clientY);
-  let left = dragState.startX + event.clientX - dragState.initialMouseX;
-  let bottom = dragState.startY + dragState.initialMouseY - event.clientY;
-  // 检测是否溢出
-  if (left < 0) {
-    left = 0;
-  } else if (left > document.body.clientWidth - 1001) {
-    left = document.body.clientWidth - 1001;
-  }
-  if (bottom < 0) {
-    bottom = 0;
-  } else if (bottom > document.body.clientHeight - 70) {
-    bottom = document.body.clientHeight - 70;
-  }
+  let left = (dragState.startX + event.clientX - dragState.initialMouseX) / containerScale().scaleX - 134;
+  let bottom = (dragState.startY + dragState.initialMouseY - event.clientY) / containerScale().scaleY - 134;
+  // // 检测是否溢出
+  // if (left < 0) {
+  //   left = 0;
+  // } else if (left > document.body.clientWidth - 1001) {
+  //   left = document.body.clientWidth - 1001;
+  // }
+  // if (bottom < 0) {
+  //   bottom = 0;
+  // } else if (bottom > document.body.clientHeight - 70) {
+  //   bottom = document.body.clientHeight - 70;
+  // }
   dragState.left = left;
   dragState.bottom = bottom;
 };

+ 1 - 3
src/types/components.d.ts

@@ -48,8 +48,6 @@ declare module 'vue' {
     ElRow: typeof import('element-plus/es')['ElRow']
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
     ElSelect: typeof import('element-plus/es')['ElSelect']
-    ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
-    ElSkeletonItem: typeof import('element-plus/es')['ElSkeletonItem']
     ElSlider: typeof import('element-plus/es')['ElSlider']
     ElStep: typeof import('element-plus/es')['ElStep']
     ElSteps: typeof import('element-plus/es')['ElSteps']
@@ -62,7 +60,6 @@ declare module 'vue' {
     ElTimeline: typeof import('element-plus/es')['ElTimeline']
     ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
-    ElTree: typeof import('element-plus/es')['ElTree']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
     FooterSection: typeof import('./../components/FooterSection/index.vue')['default']
@@ -104,6 +101,7 @@ declare module 'vue' {
     VideoContainer: typeof import('./../components/HKVideo/video-container.vue')['default']
     VideoContainer2: typeof import('./../components/HKVideo/video-container2.vue')['default']
     YMap: typeof import('./../components/Map/YMap.vue')['default']
+    YMapold: typeof import('./../components/Map/YMapold.vue')['default']
     YztMap: typeof import('./../components/Map/YztMap/index.vue')['default']
   }
   export interface ComponentCustomProperties {

+ 34 - 6
src/views/globalMap/RightMenu/RainChart.vue → src/views/globalMap/RightMenu/RainMonitor/RainChart.vue

@@ -1,11 +1,14 @@
 <template>
   <div class="rain-chart-dialog">
     <div class="close-btn" @click="handleClose"></div>
-    <div class="gradient-text title">{{ rainData.address }}</div>
-    <div class="time-box">
-      <div class="text1">更新时间</div>
-      <div class="text2" style="margin-left: 30px">{{ parseTime(updateTime, '{m}-{d}') }}</div>
-      <div class="text2" style="margin-left: 10px">{{ parseTime(updateTime, '{h}:{i}') }}</div>
+    <div class="gradient-text title">24小时降水图</div>
+    <div class="line">
+      <div class="title-box"><div class="gradient-text">{{ rainData.address }}</div></div>
+      <div class="time-box">
+        <div class="text1">更新时间</div>
+        <div class="text2" style="margin-left: 30px">{{ parseTime(updateTime, '{m}-{d}') }}</div>
+        <div class="text2" style="margin-left: 10px">{{ parseTime(updateTime, '{h}:{i}') }}</div>
+      </div>
     </div>
     <Chart :option="chartOption" style="flex: 1" />
   </div>
@@ -143,12 +146,37 @@ const handleClose = () => {
   width: 2001px;
   height: 1000px;
   background: url('@/assets/images/map/rightMenu/rainMonitor/dialog3.png') no-repeat;
-  padding: 108px 30px 20px 40px;
+  padding: 150px 30px 20px 40px;
   display: flex;
   flex-direction: column;
   align-items: flex-end;
+  .line {
+    width: 100%;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+  }
+  .title-box {
+    background-image: url('@/assets/images/map/rightMenu/rainMonitor/titleBox.png');
+    background-repeat: no-repeat;
+    background-size: 370px 35px;
+    background-position: bottom left;
+    padding-left: 50px;
+    display: flex;
+    align-items: center;
+    flex: 1;
+    overflow: hidden;
+    margin-right: 50px;
+    .gradient-text {
+      font-size: 64px;
+      overflow: hidden;
+      white-space: nowrap;
+      text-overflow: ellipsis;
+    }
+  }
   .time-box {
     width: 482px;
+    min-width: 482px;
     height: 83px;
     background: url('@/assets/images/map/rightMenu/rainMonitor/dateBox.png') no-repeat;
     display: flex;

+ 1 - 1
src/views/globalMap/RightMenu/RainRank.vue → src/views/globalMap/RightMenu/RainMonitor/RainRank.vue

@@ -81,7 +81,7 @@
 <script lang="ts" setup name="RainRank">
 import { getRainfallRange2 } from '@/api/globalMap/rainMonitor';
 import { getNextAreaInfo } from '@/api/common';
-import RainChart from '@/views/globalMap/RightMenu/RainChart.vue';
+import RainChart from '@/views/globalMap/RightMenu/RainMonitor/RainChart.vue';
 
 interface Props {
   modelValue: boolean;

+ 48 - 14
src/views/globalMap/RightMenu/RainMonitor.vue → src/views/globalMap/RightMenu/RainMonitor/index.vue

@@ -100,7 +100,7 @@
           <div class="line-item">大暴雨</div>
           <div class="line-item">特大暴雨</div>
         </div>
-        <div ref="lineRef" class="line2" @mousemove="handleMouseMove" @mouseup="handleMouseUp">
+        <div ref="lineRef" class="line2" @mousemove="handleMouseMove" @mouseup="handleMouseUp" @mouseleave="handleMouseUp">
           <div class="line-item"></div>
           <div class="line-item"></div>
           <div class="line-item"></div>
@@ -140,7 +140,7 @@
       </div>
       <div class="box">
         <div class="text1">雨量范围</div>
-        <div class="text2">25-50</div>
+        <div class="text2">{{ rainRange[0] }}-{{ rainRange[1] }}</div>
       </div>
     </div>
     <div class="data-box2">
@@ -189,8 +189,8 @@
   <RainRank v-if="showMore" v-model="showMore" />
 </template>
 
-<script lang="ts" setup>
-import { option6 } from './echartOptions';
+<script lang="ts" setup name="RainMonitor">
+import { option6 } from '../echartOptions';
 import { graphic } from 'echarts';
 import {
   getRainfallRange1,
@@ -199,9 +199,11 @@ import {
   getRainfallTownDataExport,
   getRainfallTownNumCount
 } from '@/api/globalMap/rainMonitor';
-import RainRank from '@/views/globalMap/RightMenu/RainRank.vue';
+import RainRank from '@/views/globalMap/RightMenu/RainMonitor/RainRank.vue';
 import * as XLSX from 'xlsx';
 import { getNextAreaInfo } from '@/api/common';
+import BigNumber from 'bignumber.js';
+import { useDebounce } from '@vueuse/core';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { district_type } = toRefs<any>(proxy?.useDict('district_type'));
@@ -336,7 +338,7 @@ const handleShowMore = () => {
   showMore.value = true;
 };
 // 影响分析
-const rainRange = reactive([25, 50]);
+const rainRange = reactive(['25', '50']);
 const analyzeData = ref({
   GDP: 0,
   areaSize: 0,
@@ -344,8 +346,8 @@ const analyzeData = ref({
   town_num: 0
 });
 const lineRef = ref();
-const startLeft = ref(351.5);
-const endLeft = ref(543.5);
+const startLeft = ref(384);
+const endLeft = ref(576);
 const mouseStatus = reactive({
   move: false,
   type: '',
@@ -353,6 +355,7 @@ const mouseStatus = reactive({
   left: 0
 });
 const handleMouseDown = (event, type) => {
+  event.preventDefault();
   // 获取目标元素的边界框
   const rect = lineRef.value.getBoundingClientRect();
   // 获取鼠标位置
@@ -366,22 +369,22 @@ const handleMouseDown = (event, type) => {
   } else {
     mouseStatus.left = endLeft.value;
   }
-  console.log('按下', mouseStatus.downLeft);
 };
 const handleMouseMove = (event) => {
   if (!mouseStatus.move) return;
+  event.preventDefault();
   // 获取鼠标位置
   const mouseX = event.clientX;
-  console.log(mouseX);
   let distance = mouseX - mouseStatus.downLeft;
-  console.log(distance);
+  let value = mouseStatus.left + distance / containerScale().scaleX;
   if (mouseStatus.type === 'start') {
-    startLeft.value = mouseStatus.left + distance;
+    startLeft.value = value >= 0 ? value : 0;
   } else {
-    endLeft.value = mouseStatus.left + distance;
+    endLeft.value = value <= 1152 ? value : 1152;
   }
 };
-const handleMouseUp = () => {
+const handleMouseUp = (event) => {
+  event.preventDefault();
   mouseStatus.move = false;
   mouseStatus.type = '';
   mouseStatus.downLeft = 0;
@@ -398,6 +401,36 @@ const getRainRange = () => {
     analyzeData.value = res.rows[0];
   });
 };
+useDebounce(getRainRange, 1000);
+watch(startLeft, () => {
+  getNewRange(0, startLeft.value);
+  useDebounceFn(getRainRange, 1000);
+});
+watch(endLeft, () => {
+  getNewRange(1, endLeft.value);
+  useDebounceFn(getRainRange, 1000);
+});
+const getNewRange = (index, value) => {
+  if (value >= 0 && value < 192) {
+    const data = new BigNumber(value).dividedBy(new BigNumber(19.2)).toFixed(0);
+    rainRange[index] = data;
+  } else if (value >= 192 && value < 384) {
+    const data = new BigNumber(value).minus(new BigNumber(192)).dividedBy(new BigNumber(12.8)).plus(new BigNumber(10)).toFixed(0);
+    rainRange[index] = data;
+  } else if (value >= 384 && value < 576) {
+    const data = new BigNumber(value).minus(new BigNumber(384)).dividedBy(new BigNumber(7.68)).plus(new BigNumber(25)).toFixed(0);
+    rainRange[index] = data;
+  } else if (value >= 576 && value < 768) {
+    const data = new BigNumber(value).minus(new BigNumber(576)).dividedBy(new BigNumber(3.84)).plus(new BigNumber(50)).toFixed(0);
+    rainRange[index] = data;
+  } else if (value >= 768 && value < 960) {
+    const data = new BigNumber(value).minus(new BigNumber(768)).dividedBy(new BigNumber(1.28)).plus(new BigNumber(100)).toFixed(0);
+    rainRange[index] = data;
+  } else if (value >= 960 && value < 1152) {
+    const data = new BigNumber(value).minus(new BigNumber(960)).dividedBy(new BigNumber(1.28)).plus(new BigNumber(250)).toFixed(0);
+    rainRange[index] = data;
+  }
+};
 const initData = () => {
   handleGetRainfallStatisticsCount();
   handleGetRainfallRange();
@@ -661,6 +694,7 @@ initData();
       position: absolute;
       top: 50%;
       transform: translateY(-50%);
+      margin-left: -32.5px;
     }
     .line-item {
       width: 192px;

+ 1 - 1
src/views/globalMap/RightMenu/index.vue

@@ -64,7 +64,7 @@ import OnlinePlotting from './OnlinePlotting/index.vue';
 import UAV from './UAV.vue';
 import WarningInfo from './WarningInfo.vue';
 import { PointType } from '@/api/globalMap/type';
-import RainMonitor from './RainMonitor.vue';
+import RainMonitor from './RainMonitor/index.vue';
 import PreventDrowning from './PreventDrowning.vue';
 import Fireproofing from './Fireproofing.vue';
 import Mitigation from './Mitigation.vue';