riku
2025-01-03 68ba3376731aa7a5760ba5fce1dc6ba0c80982b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
import gridApi from '@/api/gridApi';
import { useFetchData } from '@/composables/fetchData';
 
// 卫星遥测网格
export const useSatelliteGridStore = defineStore('satelliteGrid', () => {
  // 网格信息
  const gridInfo = 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) {
    return gridApi.fetchGridCell(groupId).then((res) => {
      gridInfo.value = res.data;
    });
  }
 
  // 获取遥测单日数据信息
  function fetchGridData(groupId) {
    return gridApi.fetchGridData(groupId).then((res) => {
      allGridDataList.value = res.data;
    });
  }
 
  // 获取遥测单日具体网格监测数据
  function fetchGridDataDetail(gridData) {
    return gridApi
      .fetchGridDataDetail(gridData.id, gridData.groupId)
      .then((res) => {
        gridData.dataDetail = res.data;
      });
  }
 
  return {
    gridInfo,
    allGridDataList,
    gridDataList,
    mixGridDataList,
    fetchGridCell,
    fetchGridData,
    fetchGridDataDetail
  };
});