|
|
@ -52,7 +52,7 @@ import timeCountHooks from '@/hooks/time-count'; |
|
|
import { useFetch } from '@/hooks/fetch'; |
|
|
import { useFetch } from '@/hooks/fetch'; |
|
|
import utilService from '@/service/utilService'; |
|
|
import utilService from '@/service/utilService'; |
|
|
import Chart from '@/components/chart.vue'; |
|
|
import Chart from '@/components/chart.vue'; |
|
|
import { costStatistic, elecPayload, monthEnergyUsageTrend, usageRanking, energyUsageDistribution, yearUsageRank } from './common/model'; |
|
|
|
|
|
|
|
|
import { costStatistic, elecPayload, monthEnergyUsageTrend, usageRanking, energyUsageDistribution, yearUsageRank, energyUsageStatistic, photovoltaicEnergyUse } from './common/model'; |
|
|
import { IObject } from '@/types/interface'; |
|
|
import { IObject } from '@/types/interface'; |
|
|
import moment from 'moment'; |
|
|
import moment from 'moment'; |
|
|
import toolHooks from '@/hooks/tool'; |
|
|
import toolHooks from '@/hooks/tool'; |
|
|
@ -129,10 +129,16 @@ export default defineComponent({ |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '年度用能排行', |
|
|
|
|
|
comp: 'chart', |
|
|
comp: 'chart', |
|
|
option: yearUsageRank(), |
|
|
|
|
|
|
|
|
title: '月度用能排行', |
|
|
|
|
|
option: usageRanking(), |
|
|
|
|
|
unit: 'kWh', |
|
|
}, |
|
|
}, |
|
|
|
|
|
// { |
|
|
|
|
|
// title: '年度用能排行', |
|
|
|
|
|
// comp: 'chart', |
|
|
|
|
|
// option: yearUsageRank(), |
|
|
|
|
|
// }, |
|
|
{ |
|
|
{ |
|
|
comp: 'chart', |
|
|
comp: 'chart', |
|
|
title: '当日电力负荷', |
|
|
title: '当日电力负荷', |
|
|
@ -144,22 +150,20 @@ export default defineComponent({ |
|
|
{ |
|
|
{ |
|
|
comp: 'chart', |
|
|
comp: 'chart', |
|
|
title: '能耗统计(月)', |
|
|
title: '能耗统计(月)', |
|
|
option: costStatistic(), |
|
|
|
|
|
unit: '', |
|
|
|
|
|
|
|
|
option: energyUsageStatistic(), |
|
|
|
|
|
unit: 'tce', |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
comp: 'chart', |
|
|
comp: 'chart', |
|
|
title: '用能排行(月)', |
|
|
|
|
|
option: usageRanking(), |
|
|
|
|
|
|
|
|
title: '光伏用能(月)', |
|
|
|
|
|
option: photovoltaicEnergyUse(), |
|
|
unit: 'kWh', |
|
|
unit: 'kWh', |
|
|
select: true, |
|
|
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '当月用能趋势', |
|
|
|
|
|
|
|
|
title: '当年用能趋势', |
|
|
comp: 'chart', |
|
|
comp: 'chart', |
|
|
option: monthEnergyUsageTrend(), |
|
|
option: monthEnergyUsageTrend(), |
|
|
unit: 'kWh', |
|
|
unit: 'kWh', |
|
|
select: true, |
|
|
|
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
bottom: { |
|
|
bottom: { |
|
|
@ -174,37 +178,6 @@ export default defineComponent({ |
|
|
const u = state.dataForm.codeMap[c]; |
|
|
const u = state.dataForm.codeMap[c]; |
|
|
state.left[2].unit = u; |
|
|
state.left[2].unit = u; |
|
|
state.right[1].unit = u; |
|
|
state.right[1].unit = u; |
|
|
|
|
|
|
|
|
//当月用能趋势 |
|
|
|
|
|
useFetch('/board/monthEnergy/analyse', { |
|
|
|
|
|
data: { |
|
|
|
|
|
month: moment().format('YYYY-MM'), |
|
|
|
|
|
type, |
|
|
|
|
|
}, |
|
|
|
|
|
cb: (res: any) => { |
|
|
|
|
|
if (utilService.isValidObject(res) && utilService.isValidArray(res.currentMonthData)) { |
|
|
|
|
|
const d = res.currentMonthData; |
|
|
|
|
|
const c = state.dataForm.code; |
|
|
|
|
|
const u = state.dataForm.codeMap[c]; |
|
|
|
|
|
state.right[2].option = monthEnergyUsageTrend(d, u); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//用能排行(月) |
|
|
|
|
|
useFetch('/board/monthEnergy/ranking', { |
|
|
|
|
|
data: { |
|
|
|
|
|
day: moment().format('YYYY-MM'), |
|
|
|
|
|
type, |
|
|
|
|
|
}, |
|
|
|
|
|
cb: (res: any) => { |
|
|
|
|
|
if (utilService.isValidArray(res)) { |
|
|
|
|
|
const c = state.dataForm.code; |
|
|
|
|
|
const u = state.dataForm.codeMap[c]; |
|
|
|
|
|
state.right[1].option = usageRanking(res, u); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const fn = () => { |
|
|
const fn = () => { |
|
|
@ -218,7 +191,9 @@ export default defineComponent({ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
//月用能统计 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//左侧 |
|
|
|
|
|
//日用能统计 |
|
|
useFetch('/board/eachEnergy', { |
|
|
useFetch('/board/eachEnergy', { |
|
|
cb: (res: any) => { |
|
|
cb: (res: any) => { |
|
|
if (utilService.isValidObject(res)) { |
|
|
if (utilService.isValidObject(res)) { |
|
|
@ -228,38 +203,73 @@ export default defineComponent({ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
//年用能统计 |
|
|
|
|
|
useFetch('/board/eachEnergyYear', { |
|
|
|
|
|
|
|
|
//月度用能排行 |
|
|
|
|
|
useFetch('/board/monthEnergy/ranking', { |
|
|
|
|
|
data: { |
|
|
|
|
|
month: moment().format('YYYY-MM'), |
|
|
|
|
|
type: '电', |
|
|
|
|
|
}, |
|
|
cb: (res: any) => { |
|
|
cb: (res: any) => { |
|
|
if (utilService.isValidObject(res)) { |
|
|
|
|
|
for (const item of state.left[1].data) { |
|
|
|
|
|
item.value = res[item.key] ?? '--'; |
|
|
|
|
|
|
|
|
if (utilService.isValidArray(res)) { |
|
|
|
|
|
const c = state.dataForm.code; |
|
|
|
|
|
const u = state.dataForm.codeMap[c]; |
|
|
|
|
|
state.left[1].option = usageRanking(res, u); |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//当日电力负荷 |
|
|
|
|
|
useFetch('/board/qcDayLoad/analyse', { |
|
|
|
|
|
data: { |
|
|
|
|
|
day: moment().format('YYYY-MM-DD'), |
|
|
|
|
|
}, |
|
|
|
|
|
cb: (res: any) => { |
|
|
|
|
|
if (utilService.isValidObject(res) && utilService.isValidArray(res.currentMonthData)) { |
|
|
|
|
|
const d = res.currentMonthData; |
|
|
|
|
|
state.left[2].option = elecPayload(d); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
//能耗费用统计 |
|
|
|
|
|
|
|
|
//右侧 |
|
|
|
|
|
//能耗统计(月) |
|
|
useFetch('/board/energyCost', { |
|
|
useFetch('/board/energyCost', { |
|
|
data: { |
|
|
data: { |
|
|
day: moment().format('YYYY-MM-DD'), |
|
|
day: moment().format('YYYY-MM-DD'), |
|
|
}, |
|
|
}, |
|
|
cb: (res: any) => { |
|
|
cb: (res: any) => { |
|
|
if (utilService.isValidArray(res)) { |
|
|
if (utilService.isValidArray(res)) { |
|
|
state.right[0].option = costStatistic(res); |
|
|
|
|
|
|
|
|
state.right[0].option = energyUsageStatistic(res); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
//当日电力负荷 |
|
|
|
|
|
useFetch('/board/qcDayLoad/analyse', { |
|
|
|
|
|
|
|
|
//光伏用能(月) |
|
|
|
|
|
useFetch('/board/photovoltaic', { |
|
|
data: { |
|
|
data: { |
|
|
day: moment().format('YYYY-MM-DD'), |
|
|
day: moment().format('YYYY-MM-DD'), |
|
|
}, |
|
|
}, |
|
|
|
|
|
cb: (res: any) => { |
|
|
|
|
|
if (utilService.isValidArray(res)) { |
|
|
|
|
|
const c = state.dataForm.code; |
|
|
|
|
|
const u = state.dataForm.codeMap[c]; |
|
|
|
|
|
state.right[1].option = photovoltaicEnergyUse(res, u); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//当年用能趋势 |
|
|
|
|
|
useFetch('/board/eachEnergyYear', { |
|
|
|
|
|
data: { |
|
|
|
|
|
day: moment().format('YYYY-MM-DD'), |
|
|
|
|
|
type: '电', |
|
|
|
|
|
}, |
|
|
cb: (res: any) => { |
|
|
cb: (res: any) => { |
|
|
if (utilService.isValidObject(res) && utilService.isValidArray(res.currentMonthData)) { |
|
|
if (utilService.isValidObject(res) && utilService.isValidArray(res.currentMonthData)) { |
|
|
const d = res.currentMonthData; |
|
|
const d = res.currentMonthData; |
|
|
state.left[2].option = elecPayload(d); |
|
|
|
|
|
|
|
|
const c = state.dataForm.code; |
|
|
|
|
|
const u = state.dataForm.codeMap[c]; |
|
|
|
|
|
state.right[2].option = monthEnergyUsageTrend(d, u); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|