This commit is contained in:
zlwu committed 2026-06-29 09:21:09 +08:00
1 parent 4daf990fab
commit 1ca2668112
219 files changed
+29817 -20945

No files matched your search

@@ -725,6 +725,7 @@
fetchUpdateStorageFacility,
fetchDeleteStorageFacility,
fetchStorageSlotList,
fetchStorageSlotStats,
fetchBatchCreateSlots,
fetchClearStorageSlots,
fetchInsertStorageSlotRow,
@@ -842,26 +843,23 @@
}
})
/** 加载所有叶子节点的格子统计 */
/** 加载所有叶子节点的格子统计(单次聚合接口) */
const loadAllSlotStats = async () => {
const leafNodes = flatList.value.filter((item) => item.isLeaf === 1)
if (leafNodes.length === 0) return
const results = await Promise.allSettled(
leafNodes.map(async (node) => {
const res: any = await fetchStorageSlotList({ facilityNodeId: node.id })
const list = res?.list || res || []
const total = list.length
const occupied = list.filter((s: any) => s.slotStatus === '占用').length
return { id: node.id, total, occupied, empty: total - occupied }
})
)
const map: Record<string, any> = { ...slotStatsMap.value }
results.forEach((r) => {
if (r.status === 'fulfilled') {
map[r.value.id] = r.value
try {
const res: any = await fetchStorageSlotStats()
const list = Array.isArray(res) ? res : res?.list || []
const map: Record<string, { total: number; occupied: number; empty: number }> = {}
for (const item of list) {
const nodeId = item?.facilityNodeId
if (!nodeId) continue
const total = Number(item.total) || 0
const occupied = Number(item.occupied) || 0
map[nodeId] = { total, occupied, empty: Number(item.empty) || total - occupied }
}
})
slotStatsMap.value = map
slotStatsMap.value = map
} catch (error) {
console.error('加载格子统计失败:', error)
}
}
const handleNodeClick = (data: any) => {