Browse Source

Update index.vue

feature
jiangAB 1 week ago
parent
commit
86b72ae916
  1. 10
      public/map/index.vue

10
public/map/index.vue

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

Loading…
Cancel
Save