feiyu02
2025-01-03 4f1fb28dad6a4df83752dc9b60f504764f8e3dcb
src/stores/satellite-grid.js
@@ -1,4 +1,4 @@
import { ref } from 'vue';
import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
import gridApi from '@/api/gridApi';
import { useFetchData } from '@/composables/fetchData';
@@ -7,8 +7,20 @@
export const useSatelliteGridStore = defineStore('satelliteGrid', () => {
  // 网格信息
  const gridInfo = ref([]);
  // 网格数据组
  const gridDataList = ref([]);
  // 所有网格数据组
  const allGridDataList = ref([]);
  // 原始网格数据组
  const gridDataList = computed(() => {
    return allGridDataList.value.filter((v) => {
      return v.type == 0;
    });
  });
  // 融合网格数据组
  const mixGridDataList = computed(() => {
    return allGridDataList.value.filter((v) => {
      return v.type == 1;
    });
  });
  // 获取网格信息
  function fetchGridCell(groupId) {
@@ -20,7 +32,7 @@
  // 获取遥测单日数据信息
  function fetchGridData(groupId) {
    return gridApi.fetchGridData(groupId).then((res) => {
      gridDataList.value = res.data;
      allGridDataList.value = res.data;
    });
  }
@@ -35,7 +47,9 @@
  return {
    gridInfo,
    allGridDataList,
    gridDataList,
    mixGridDataList,
    fetchGridCell,
    fetchGridData,
    fetchGridDataDetail