From bb9fcf136d23b8624e44ed6458caaa605f72af91 Mon Sep 17 00:00:00 2001 From: Riku <risaku@163.com> Date: 星期三, 01 一月 2025 20:24:20 +0800 Subject: [PATCH] 开始添加数据融合功能 --- src/stores/satellite-grid.js | 41 +++++++++++++++++++++++++++++++++-------- 1 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/stores/satellite-grid.js b/src/stores/satellite-grid.js index 2b83df2..d88a13f 100644 --- a/src/stores/satellite-grid.js +++ b/src/stores/satellite-grid.js @@ -4,15 +4,40 @@ import { useFetchData } from '@/composables/fetchData'; // 鍗槦閬ユ祴缃戞牸 -export const usesatelliteGridStore = defineStore('satelliteGrid', () => { - const gridGropiList = ref([]); - const { loading, fetchData } = useFetchData(); +export const useSatelliteGridStore = defineStore('satelliteGrid', () => { + // 缃戞牸淇℃伅 + 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 + }; }); -- Gitblit v1.9.3