From c7a16ca1b6fbcb0b82a4a09c2e75014624082e37 Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期四, 27 三月 2025 22:45:48 +0800
Subject: [PATCH] 修复走航融合功能bug

---
 src/views/historymode/HistoryMode.vue             |    4 
 src/model/SatelliteGrid.js                        |   11 ++
 src/api/index.js                                  |    3 
 src/views/underwaymix/UnderwayMixMode.vue         |  164 +++++++++++++++++++++++++++++++++++------
 src/views/underwaymix/component/GridStyleTool.vue |   35 +++++++-
 5 files changed, 181 insertions(+), 36 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 9a0aa30..2f00044 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -10,7 +10,8 @@
 }
 
 if (debug) {
-  ip1 = 'http://192.168.0.110:8084/';
+  // ip1 = 'http://192.168.0.110:8084/';
+  ip1 = 'http://locahost:8084/';
 }
 
 const $http = axios.create({
diff --git a/src/model/SatelliteGrid.js b/src/model/SatelliteGrid.js
index ad01ca9..d6f3c8c 100644
--- a/src/model/SatelliteGrid.js
+++ b/src/model/SatelliteGrid.js
@@ -300,6 +300,14 @@
     });
   }
 
+  deleteTagGrid(tags) {
+    this.changeVisibility({ tags, showGridViews: false });
+    tags.forEach((t) => {
+      this.mapViewsMap.delete(t);
+      this.gridDataDetailMap.delete(t);
+    });
+  }
+
   // 璋冩暣鍚勭被鍦板浘瑕嗙洊鐗╃殑鍙鎬�
   changeVisibility({ tags = [], showGridViews, showDataTxt, showRankTxt }) {
     let { _mapViewsList } = this._getMapViews(...tags);
@@ -568,9 +576,8 @@
           eachheight,
           searchLength
         );
-        if (searchRes.find(v=> v.cellId == 1670)) {
+        if (searchRes.find((v) => v.cellId == 1670)) {
           console.log();
-          
         }
         searchRes.forEach((e) => {
           if (originCellIdList.indexOf(e.cellId) == -1) {
diff --git a/src/views/historymode/HistoryMode.vue b/src/views/historymode/HistoryMode.vue
index 97c9982..d2a780e 100644
--- a/src/views/historymode/HistoryMode.vue
+++ b/src/views/historymode/HistoryMode.vue
@@ -148,8 +148,8 @@
       // 鍒锋柊鍥句緥
       const factor = this.factorDatas.factor[this.factorType];
       sector.clearSector();
-      this.drawRoadLine(factor);
-      // this.drawRoadMap(factor);
+      // this.drawRoadLine(factor);
+      this.drawRoadMap(factor);
       this.drawMassMarks(factor);
     },
     // 缁樺埗3D璧拌璺嚎鍥�
diff --git a/src/views/underwaymix/UnderwayMixMode.vue b/src/views/underwaymix/UnderwayMixMode.vue
index 460355c..2ed90d6 100644
--- a/src/views/underwaymix/UnderwayMixMode.vue
+++ b/src/views/underwaymix/UnderwayMixMode.vue
@@ -42,7 +42,9 @@
                   </el-form-item> -->
                 </el-form>
               </el-row>
-              <div class="m-t-8">绛涢�夎緟鍔�</div>
+              <el-row class="m-t-8" justify="space-between">
+                <span>铻嶅悎鍒嗘瀽</span>
+              </el-row>
               <el-form :inline="false">
                 <el-form-item label="鏃舵绛涢��">
                   <el-select
@@ -96,11 +98,15 @@
                   </el-select>
                 </el-form-item>
               </el-form>
-
+              <div v-if="!gridCellList">
+                <el-icon class="is-loading"><Loading /></el-icon>
+                缃戞牸淇℃伅鍔犺浇涓�...
+              </div>
               <el-table
+                ref="tableRef"
                 :data="showFusionDataList"
                 table-layout="fixed"
-                size="small"
+                size="default"
                 :show-overflow-tooltip="true"
                 border
                 height="50vh"
@@ -112,7 +118,17 @@
                 @row-click="handleRowClick"
                 @selection-change="handleSelectionChange"
               >
-                <el-table-column type="selection" width="40" />
+                <el-table-column width="40" v-if="!gridCellList">
+                  <template #default>
+                    <el-icon class="is-loading"><Loading /></el-icon>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  v-else
+                  type="selection"
+                  :selectable="selectable"
+                  width="40"
+                />
                 <!-- <el-table-column
                   type="index"
                   label="搴忓彿"
@@ -123,7 +139,7 @@
                   label="鏃堕棿"
                   align="center"
                   :formatter="timeFormatter"
-                  width="100"
+                  width="120"
                 />
                 <el-table-column
                   prop="missionCode"
@@ -141,13 +157,13 @@
                   prop="pollutionDegree"
                   label="姹℃煋鑳屾櫙"
                   align="center"
-                  width="50"
+                  width="70"
                 />
               </el-table>
 
               <div class="m-t-8">鎿嶄綔</div>
               <el-space class="m-t-8 m-b-8">
-                <el-button
+                <!-- <el-button
                   type="primary"
                   class="el-button-custom"
                   size="small"
@@ -155,10 +171,9 @@
                   @click="handleFusionClick"
                 >
                   {{ '鍙犲姞璧拌埅' }}
-                </el-button>
+                </el-button> -->
                 <CheckButton
-                  active-text="寮�鍚瀺鍚�"
-                  inactive-text="闅愯棌铻嶅悎"
+                  active-text="铻嶅悎鍒嗘瀽"
                   :default-value="false"
                   @change="handleMixClick"
                 >
@@ -182,6 +197,7 @@
     <GridStyleTool
       :gridCtrls="gridCtrls"
       @show-underway="handleUnderwayClick"
+      @on-delete="handleFusionDelete"
     ></GridStyleTool>
   </el-row>
   <!-- </div> -->
@@ -217,6 +233,8 @@
 const fusionLoading = ref(false);
 const fusionDataList = ref([]);
 const selectedfusionData = ref([]);
+const tableRef = ref()
+const selectable = (row) => gridCellList.value;
 
 const gridDataDetailMap = new Map();
 
@@ -225,34 +243,86 @@
 const selectedPollutionDegree = ref([]);
 
 const timeSectionList = computed(() => {
-  const res = [];
+  let res = [];
   fusionDataList.value.forEach((e) => {
-    const t = moment(e.dataTime).format('YYYY-MM-DD');
-    if (res.indexOf(t) == -1) {
-      res.push(t);
+    const hour = moment(e.dayTimePeriodStart).hour();
+    const t = e.dayTimePeriod;
+    const option = {
+      value: t,
+      index: hour
+    };
+    if (res.indexOf(option) == -1) {
+      res.push(option);
     }
+  });
+  res.sort((a, b) => {
+    return a.index - b.index;
+  });
+
+  const rMap = new Map();
+  showFusionDataList.value.forEach((d) => {
+    if (!rMap.has(d.dayTimePeriod)) {
+      rMap.set(d.dayTimePeriod, 0);
+    }
+    rMap.set(d.dayTimePeriod, rMap.get(d.dayTimePeriod) + 1);
+  });
+
+  res = res.map((v) => {
+    const count = rMap.get(v.value);
+    return `${v.value} (${count})`;
   });
   return res;
 });
 
 const zoneList = computed(() => {
-  const res = [];
+  let res = [];
   fusionDataList.value.forEach((e) => {
     const t = e.zone;
     if (res.indexOf(t) == -1) {
       res.push(t);
     }
   });
+  const rMap = new Map();
+  showFusionDataList.value.forEach((d) => {
+    if (!rMap.has(d.zone)) {
+      rMap.set(d.zone, 0);
+    }
+    rMap.set(d.zone, rMap.get(d.zone) + 1);
+  });
+
+  res = res.map((v) => {
+    const count = rMap.get(v);
+    return `${v} (${count})`;
+  });
   return res;
 });
 
 const pollutionDegreeList = computed(() => {
-  const res = [];
+  let res = [];
   fusionDataList.value.forEach((e) => {
     const t = e.pollutionDegree;
-    if (res.indexOf(t) == -1) {
-      res.push(t);
+    const option = {
+      value: t,
+      index: e.pollutionDegreeIndex
+    };
+    if (res.indexOf(option) == -1) {
+      res.push(option);
     }
+  });
+  res.sort((a, b) => {
+    return a.index - b.index;
+  });
+  const rMap = new Map();
+  showFusionDataList.value.forEach((d) => {
+    if (!rMap.has(d.pollutionDegree)) {
+      rMap.set(d.pollutionDegree, 0);
+    }
+    rMap.set(d.pollutionDegree, rMap.get(d.pollutionDegree) + 1);
+  });
+
+  res = res.map((v) => {
+    const count = rMap.get(v.value);
+    return `${v.value} (${count})`;
   });
   return res;
 });
@@ -261,9 +331,7 @@
   return fusionDataList.value.filter((v) => {
     const b1 =
       selectedTimeSection.value.length == 0 ||
-      selectedTimeSection.value.indexOf(
-        moment(v.dataTime).format('YYYY-MM-DD')
-      ) != -1;
+      selectedTimeSection.value.indexOf(v.dayTimePeriod) != -1;
     const b2 =
       selectedZone.value.length == 0 ||
       selectedZone.value.indexOf(v.zone) != -1;
@@ -421,9 +489,7 @@
 let mixTag;
 function handleMixClick() {
   mixActive.value = !mixActive.value;
-  const tags = fusionDataList.value
-    .filter((v, i) => selectedfusionData.value.indexOf(i) != -1)
-    .map((v) => v.id);
+  const tags = selectedfusionData.value.map((v) => v.id);
   satelliteGrid.changeVisibility({
     showGridViews: false,
     showDataTxt: false,
@@ -525,8 +591,58 @@
     mapLine.hideLine(mission.missionCode);
   }
 }
+function handleFusionDelete(index, tag) {
+  const f = selectedfusionData.value.find((v) => v.id == tag);
+  if (f) {
+    // const i = selectedfusionData.value.indexOf(f);
+    // selectedfusionData.value.splice(i, 1);
+    tableRef.value.toggleRowSelection(f, false)
+  }
+}
 
 function handleSelectionChange(val) {
+  const deleted = selectedfusionData.value.filter((v) => {
+    return val.indexOf(v) == -1;
+  });
+  const deletedIdList = deleted.map((d) => d.id);
+  const added = val.filter((v) => {
+    return selectedfusionData.value.indexOf(v) == -1;
+  });
+  // const addedIdList = added.map(d=>d.id)
+
+  if (deletedIdList.length > 0) {
+    satelliteGrid.deleteTagGrid(deletedIdList);
+    gridCtrls.value = [satelliteGrid];
+    // satelliteGrid.changeVisibility({ tags: deletedIdList, showGridViews: false });
+  }
+
+  added.forEach((i) => {
+    const d = i;
+    gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => {
+      gridDataDetailMap.set(d.id, res.data);
+      const gdd = res.data;
+      satelliteGrid.drawTagGrid({
+        tag: d.id,
+        data: gdd,
+        extData: {
+          name: `璧拌埅缃戞牸 - ${d.mixDataId}`,
+          type: 0
+        }
+      });
+      satelliteGrid.setGridEvent(
+        [d.id],
+        'click',
+        (gridCell, gridDataDetail) => {
+          gridStore.selectedGridCellAndDataDetail = {
+            gridCell,
+            gridDataDetail
+          };
+        }
+      );
+      gridCtrls.value = [satelliteGrid];
+    });
+  });
+
   selectedfusionData.value = val;
 }
 
diff --git a/src/views/underwaymix/component/GridStyleTool.vue b/src/views/underwaymix/component/GridStyleTool.vue
index 35b61e7..6d16811 100644
--- a/src/views/underwaymix/component/GridStyleTool.vue
+++ b/src/views/underwaymix/component/GridStyleTool.vue
@@ -14,10 +14,25 @@
         <template #content>
           <el-scrollbar class="content-wrap">
             <div v-for="(g, i) in gridCtrlList" :key="i">
-              {{ g.name }}
+              <span>{{ g.name }}</span>
               <div v-for="(value, t) in g.views" :key="t">
-                <span v-if="value.extData.type == 0">{{ value.tag + '.' }}</span>
-                {{ value.extData.name }}
+                <el-row justify="space-between" align="middle">
+                  <div>
+                    <span v-if="value.extData.type == 0">{{
+                      value.tag + '.'
+                    }}</span>
+                    {{ value.extData.name }}
+                  </div>
+                  <el-button
+                    class="el-button-custom"
+                    type="primary"
+                    icon="Close"
+                    circle
+                    @click="handleCloseClick(i, t, value)"
+                  />
+                  <!-- <el-icon><Close /></el-icon> -->
+                </el-row>
+
                 <!-- {{ key }} -->
                 <!-- <el-text>{{ g.name }}</el-text> -->
                 <!-- <div class="m-t-8">缃戞牸瑕佺礌</div> -->
@@ -115,7 +130,7 @@
 import gridApi from '@/api/gridApi';
 import { useGridStore } from '@/stores/grid-info';
 
-const gridStore = useGridStore()
+const gridStore = useGridStore();
 
 const props = defineProps({
   // 缃戞牸绠$悊瀵硅薄[SatelliteGrid]鏁扮粍
@@ -125,7 +140,7 @@
   }
 });
 
-const emits = defineEmits(['showUnderway']);
+const emits = defineEmits(['showUnderway', 'onDelete']);
 
 const gridCtrlList = computed(() => {
   return props.gridCtrls.map((g) => {
@@ -157,6 +172,12 @@
 //   'changeColor',
 //   'changeOpacity'
 // ]);
+function handleCloseClick(index, t, value) {
+  const key = value.tag;
+  toRaw(props.gridCtrls[index]).deleteTagGrid([key]);
+  gridCtrlList.value[index].views.splice(t, 1)
+  emits('onDelete', index, key)
+}
 
 function handleGridClick(e, index, value) {
   const key = value.tag;
@@ -212,9 +233,9 @@
   toRaw(props.gridCtrls[index]).mixGrid(value.tag.split('-'), e);
 }
 
-let heatTag
+let heatTag;
 function handleHeatMapClick(e, index, value) {
-  const _satelliteGrid = toRaw(props.gridCtrls[index])
+  const _satelliteGrid = toRaw(props.gridCtrls[index]);
   _satelliteGrid.changeVisibility({
     showGridViews: false,
     showDataTxt: false,

--
Gitblit v1.9.3