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
|
};
|
});
|