diff --git a/public/map/components/CompanyShorePower.vue b/public/map/components/CompanyShorePower.vue index 7d40741..d72f38a 100644 --- a/public/map/components/CompanyShorePower.vue +++ b/public/map/components/CompanyShorePower.vue @@ -182,21 +182,10 @@ import { ref, computed } from 'vue' import { MapApi } from "@/api/shorepower/map"; import ShipHistoryDialog from './ShipHistoryDialog.vue'; -import { RealtimeDeviceData, ShipRespVo, ShorePowerBerth } from '@/types/shorepower'; +import { CompanyShorePowerData, RealtimeDeviceData, ShipRespVo, ShorePowerBerth } from '@/types/shorepower'; import { getValueById } from './utils'; // 定义组件属性 -interface companyData { - id: number; - harborDistrictId: number; - name?: string; - shorePowerCount: number; // 岸电箱总数 - shorePowerIds: number[]; // 岸电箱ID列表 - distributionList: { - id: number; - name: string; - shorePowerList: any[]; - }[]; -} + const historyVisible = ref({ visible: false, @@ -215,6 +204,7 @@ interface Props { yearData: any[]; monthData: any[]; dayData: any[]; + companyComparisonData: CompanyShorePowerData[]; } const props = defineProps() @@ -348,13 +338,13 @@ const handleTimeRangeChange = (companyId: number, range: 'realtime' | 'day' | 'm } /* 点击泊位box */ -const handleClickShorePowerName = (data: companyData) => { +const handleClickShorePowerName = (data: CompanyShorePowerData) => { const shorePower = props.shorePowerList.find(item => item.id === data.id) selectedShorePowerItem.value = shorePower console.log(shorePower) } -const handleClickhorePowerValue = (data: companyData) => { +const handleClickhorePowerValue = (data: CompanyShorePowerData) => { const shorePower = props.shorePowerList.find(item => item.id === data.id) if (!shorePower) { return @@ -374,7 +364,7 @@ const showShorePowerHistory = (berth: ShorePowerBerth) => { } } } -const companyComparisonData = ref([]) +// const companyComparisonData = ref([]) // 创建一个响应式的设备数据映射,以提高查找效率并确保响应性 const deviceDataMap = computed(() => { @@ -430,43 +420,43 @@ const handGetDeviceData = (deviceId: number | number[], range: 'realtime' | 'day return totalValue.toFixed(2); } -const handleGetBuildData = async () => { - const dockList = await MapApi.getDockIdAndNameList() - // const berthList = await MapApi.getBerthIdAndNameList() - const distributionList = groupByShorePowerEquipmentId(props.shorePowerList) - const buildData = dockList.map(dock => { - const filterData = distributionList.filter(item => item.dockId === dock.id) - const shorePowerCount = filterData.reduce((total, item) => { - return total + item.shorePowerList.length - }, 0) - return { - ...dock, - shorePowerCount: shorePowerCount, // 岸电箱总数 - shorePowerIds: filterData.map(item => item.shorePowerList.map(shorePower => shorePower.id)).flat(), - distributionList: filterData - } - }) - companyComparisonData.value = buildData - - /* 转换函数 */ - function groupByShorePowerEquipmentId(data) { - const map = new Map(); - for (const item of data) { - const { shorePowerEquipmentInfo, ...rest } = item; - const id = shorePowerEquipmentInfo.id; - if (!map.has(id)) { - map.set(id, { - ...shorePowerEquipmentInfo, - shorePowerList: [] - }); - } - map.get(id).shorePowerList.push(rest); - } - return Array.from(map.values()); - } -} +// const handleGetBuildData = async () => { +// const dockList = await MapApi.getDockIdAndNameList() +// // const berthList = await MapApi.getBerthIdAndNameList() +// const distributionList = groupByShorePowerEquipmentId(props.shorePowerList) +// const buildData = dockList.map(dock => { +// const filterData = distributionList.filter(item => item.dockId === dock.id) +// const shorePowerCount = filterData.reduce((total, item) => { +// return total + item.shorePowerList.length +// }, 0) +// return { +// ...dock, +// shorePowerCount: shorePowerCount, // 岸电箱总数 +// shorePowerIds: filterData.map(item => item.shorePowerList.map(shorePower => shorePower.id)).flat(), +// distributionList: filterData +// } +// }) +// companyComparisonData.value = buildData + +// /* 转换函数 */ +// function groupByShorePowerEquipmentId(data) { +// const map = new Map(); +// for (const item of data) { +// const { shorePowerEquipmentInfo, ...rest } = item; +// const id = shorePowerEquipmentInfo.id; +// if (!map.has(id)) { +// map.set(id, { +// ...shorePowerEquipmentInfo, +// shorePowerList: [] +// }); +// } +// map.get(id).shorePowerList.push(rest); +// } +// return Array.from(map.values()); +// } +// } onMounted(() => { - handleGetBuildData() + // handleGetBuildData() }) diff --git a/public/map/components/ShorePowerUsageRate.vue b/public/map/components/ShorePowerUsageRate.vue index d01f01c..5d36d95 100644 --- a/public/map/components/ShorePowerUsageRate.vue +++ b/public/map/components/ShorePowerUsageRate.vue @@ -67,7 +67,7 @@ interface Props { // activeHeadGroup?: number; handleClose: () => void; realtimeDeviceDataTime: string; - comparativeData: ComparativeData; + // comparativeData: ComparativeData; initialTimeRange?: 'realtime' | 'day' | 'month' | 'year'; } diff --git a/public/map/components/ShorePowerUsageSingleData.vue b/public/map/components/ShorePowerUsageSingleData.vue index be5b90b..69986c9 100644 --- a/public/map/components/ShorePowerUsageSingleData.vue +++ b/public/map/components/ShorePowerUsageSingleData.vue @@ -1133,7 +1133,7 @@ onBeforeUnmount(() => { .big { height: 100%; - width: calc(55%); + width: calc(60%); .card { height: 100%; @@ -1154,7 +1154,7 @@ onBeforeUnmount(() => { } .right-row { - width: calc(45% - 8px); + width: calc(40% - 8px); height: 100%; display: flex; flex-direction: column; diff --git a/public/map/components/ShowData.vue b/public/map/components/ShowData.vue index f133196..43a86fd 100644 --- a/public/map/components/ShowData.vue +++ b/public/map/components/ShowData.vue @@ -1,8 +1,9 @@