linqilong 3 주 전
부모
커밋
fc4a84671d
3개의 변경된 파일15개의 추가작업 그리고 8개의 파일을 삭제
  1. 3 3
      src/components/StationRightButtonGroup.vue
  2. 9 4
      src/utils/slopeCalculation.ts
  3. 3 1
      src/utils/tdInstruction/operate.ts

+ 3 - 3
src/components/StationRightButtonGroup.vue

@@ -317,9 +317,9 @@ watch(() => route.path, (path) => {
       <span v-if="appStore.currentLevel === 'TaiHuMain'" style="color: #fff;">风浪展示</span>
       <span v-else style="color: #fff;">返回</span>
     </div>
-    <div v-show="showBtnList.includes('home')" class="right-btn-item" @click="handleHome">
-      <img :src="homeSrc" alt="主页"/>
-    </div>
+    <!--    <div v-show="showBtnList.includes('home')" class="right-btn-item" @click="handleHome">-->
+    <!--      <img :src="homeSrc" alt="主页"/>-->
+    <!--    </div>-->
     <el-popover placement="left-start" trigger="hover" width="auto">
       <template #reference>
         <div v-show="showBtnList.includes('view')" class="right-btn-item">

+ 9 - 4
src/utils/slopeCalculation.ts

@@ -20,14 +20,19 @@ export function slopeCalculation(data: any[]) {
     console.log("坡度:", result.slope.toFixed(6), "米/经度纬度单位");
     console.log("倾斜方向:", result.direction.toFixed(2) + "°(0°为正东,逆时针方向)");
 
-    let max = data.map(a => a.value).reduce((acc, cur) => Math.max(acc, cur), Number.MIN_SAFE_INTEGER);
-    let min = data.map(a => a.value).reduce((acc, cur) => Math.min(acc, cur));
+    const {maxObj, minObj} = data.reduce((acc, cur) => ({
+      maxObj: acc.maxObj.value > cur.value ? acc.maxObj : cur,
+      minObj: acc.minObj.value < cur.value ? acc.minObj : cur
+    }), {
+      maxObj: data[0],
+      minObj: data[0]
+    });
 
     return {
       slope: result.slope.toFixed(6),
       direction: result.direction.toFixed(2),
-      max: max,
-      min: min,
+      max: `${maxObj.name},${maxObj.value}`,
+      min: `${minObj.name},${minObj.value}`,
     }
   } catch (error: any) {
     console.error("计算失败:", error.message);

+ 3 - 1
src/utils/tdInstruction/operate.ts

@@ -190,7 +190,7 @@ export async function addTyphoonTrack(tfid: string) {
     const date = new Date(timeList[value])
     const list = yuyanData.filter(y => y.YMDHM.getTime() === date.getTime())
     const data = list.map(d => {
-      let station = stationList.find(s => s.id === d.STCD)
+      let station: any = stationList.find(s => s.id === d.STCD)
 
       if (!station) {
         console.log(`未找到${d.STCD}`)
@@ -198,6 +198,7 @@ export async function addTyphoonTrack(tfid: string) {
 
       return {
         value: `${(d.DATA).toFixed(2)}`,
+        name: station.name,
         x: station.lgtd,
         y: station.lttd
       }
@@ -205,6 +206,7 @@ export async function addTyphoonTrack(tfid: string) {
 
     if (data && data.length > 0) {
       const res: any = slopeCalculation(data);
+      debugger
       taihuUI(res.direction, res.slope, res.max, res.min);
     }