diff --git a/public/map/index.vue b/public/map/index.vue index 1df0a65..76a67d4 100644 --- a/public/map/index.vue +++ b/public/map/index.vue @@ -734,7 +734,7 @@ const getShipStatus = (ship: ShipRespVo) => { try { capacity = Number(ship.shorePowerEquipment.capacity) } catch (error) { - return '获取岸电容量失败' + return '故障' // 获取岸电用量 } const power = (Vobj?.measureValue ?? 0) * (Cobj?.measureValue ?? 0); if (power / 1000 > capacity) { @@ -1177,15 +1177,15 @@ const handleBuildCompanyShorePower = (realtimeDeviceData: RealtimeDeviceData[]) const handleBuildCompanyShorePowerYear = async (shipData: any) => { const applyShipCount = await MapApi.getApplyShipCount() as number // const aa = realtimeDeviceData. - const aa = realtimeDeviceData.value.filter(item => getBerthingShipsIds.value.includes(item.deviceId)) + /* const aa = realtimeDeviceData.value.filter(item => getBerthingShipsIds.value.includes(item.deviceId)) const bb = aa.reduce((total, row) => { const rowSum = row.measureValue return total + rowSum; - }, 0); + }, 0); */ // console.log(first) shipTotalData.value = { 'allPortAreaCount': applyShipCount, - 'berthingShips': bb, + 'berthingShips': shipData.length, 'shorePowerShips': shipData.filter(ship => ['在用'].includes(ship.shipStatus || '')).length, 'noShorePowerShips': applyShipCount - shipData.filter(ship => ['在用'].includes(ship.shipStatus || '')).length, } @@ -1259,7 +1259,7 @@ const handleBuildTimeComparison = async (): Promise => { const calculateTotalUsage = (apiResponse: Record): number => { const dataArrays = Object.values(apiResponse).filter(Array.isArray) as { measureValue: number }[][]; return dataArrays.reduce((total, row) => { - const rowSum = row.reduce((sum, item) => sum + item.measureValue, 0); + const rowSum = row[row.length - 1].measureValue return total + rowSum; }, 0); };