From 105119f987e6e16d3a152649394f6052e5936b8f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 24 十二月 2024 11:17:53 +0800
Subject: [PATCH] 调整动画速率

---
 src/stores/satellite-grid.js    |   39 ++++++++++++++++---
 src/utils/map/grid.js           |   20 ++++++++++
 src/components.d.ts             |    1 
 src/utils/map/grid-animation.js |    3 +
 4 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/src/components.d.ts b/src/components.d.ts
index cdfa990..f0ccb89 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -40,6 +40,7 @@
     ElTable: typeof import('element-plus/es')['ElTable']
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     ElText: typeof import('element-plus/es')['ElText']
+    ElUpload: typeof import('element-plus/es')['ElUpload']
     FactorCheckbox: typeof import('./components/monitor/FactorCheckbox.vue')['default']
     FactorLegend: typeof import('./components/monitor/FactorLegend.vue')['default']
     FactorRadio: typeof import('./components/monitor/FactorRadio.vue')['default']
diff --git a/src/stores/satellite-grid.js b/src/stores/satellite-grid.js
index 2b83df2..02e0494 100644
--- a/src/stores/satellite-grid.js
+++ b/src/stores/satellite-grid.js
@@ -5,14 +5,39 @@
 
 // 鍗槦閬ユ祴缃戞牸
 export const usesatelliteGridStore = defineStore('satelliteGrid', () => {
-  const gridGropiList = ref([]);
-  const { loading, fetchData } = useFetchData();
+  // 缃戞牸淇℃伅
+  const gridInfo = ref([]);
+  // 缃戞牸鏁版嵁缁�
+  const gridDataList = ref([]);
 
-  function fetchGridGroup(area) {
-    return fetchData((page, pageSize) => {
-      return gridApi.fetchGridGroup(area, page, pageSize).then((res) => {
-        return res;
-      });
+  // 鑾峰彇缃戞牸淇℃伅
+  function fetchGridCell(groupId) {
+    return gridApi.fetchGridCell(groupId).then((res) => {
+      gridInfo.value = res.data;
     });
   }
+
+  // 鑾峰彇閬ユ祴鍗曟棩鏁版嵁淇℃伅
+  function fetchGridData(groupId) {
+    return gridApi.fetchGridData(groupId).then((res) => {
+      gridDataList.value = res.data;
+    });
+  }
+
+  // 鑾峰彇閬ユ祴鍗曟棩鍏蜂綋缃戞牸鐩戞祴鏁版嵁
+  function fetchGridDataDetail(gridData) {
+    return gridApi
+      .fetchGridDataDetail(gridData.id, gridData.groupId)
+      .then((res) => {
+        gridData.dataDetail = res.data;
+      });
+  }
+
+  return {
+    gridInfo,
+    gridDataList,
+    fetchGridCell,
+    fetchGridData,
+    fetchGridDataDetail
+  };
 });
diff --git a/src/utils/map/grid-animation.js b/src/utils/map/grid-animation.js
index ac1b208..2dd806f 100644
--- a/src/utils/map/grid-animation.js
+++ b/src/utils/map/grid-animation.js
@@ -6,7 +6,8 @@
 function GridAnimation() {
   // 甯у姩鐢绘帶鍒跺伐鍏�
   this.frameAnimation = new FrameAnimation();
-  this.frameAnimation.fps = 6;
+  this.frameAnimation.fps = 4;
+  this.frameAnimation.timeout = 1000;
   // 鍦板浘缁樺埗鍥惧舰缂撳瓨
   this.mapViews = {};
   // 涓ゅぉ涔嬮棿鐨勫崼鏄熼仴娴嬪姩鐢绘挱鏀炬椂闂�
diff --git a/src/utils/map/grid.js b/src/utils/map/grid.js
index e5d5273..bb3807f 100644
--- a/src/utils/map/grid.js
+++ b/src/utils/map/grid.js
@@ -185,6 +185,26 @@
   },
 
   drawGridColor(gridViews, texts, factorName) {
+    // new Promise((resolve, reject) => {
+    //   gridViews.forEach((g, i) => {
+    //     const data = parseFloat(texts[i]);
+    //     const { color, nextColor, range, nextRange } =
+    //       Legend.getStandardColorAndNext(factorName, data);
+    //     const ratio = (data - range) / (nextRange - range);
+    //     const _color = getColorBetweenTwoColors(
+    //       color.map((v) => v * 255),
+    //       nextColor.map((v) => v * 255),
+    //       ratio
+    //     );
+    //     resolve({ g, _color, color });
+    //   });
+    // }).then((res) => {
+    //   const { g, _color, color } = res;
+    //   g.setOptions({
+    //     fillColor: _color,
+    //     fillOpacity: color[3]
+    //   });
+    // });
     gridViews.forEach((g, i) => {
       const data = parseFloat(texts[i]);
       const { color, nextColor, range, nextRange } =

--
Gitblit v1.9.3