|
@@ -62,8 +62,8 @@
|
|
|
<div>
|
|
|
<el-select v-model="objCode" placeholder="选择设施" clearable @visible-change="handleObjSelectClick"
|
|
|
@change="getList">
|
|
|
- <el-option v-for="item in objOptions" :label="item.facsName" :value="item.facsCode"
|
|
|
- :key="item.facsCode" />
|
|
|
+ <el-option v-for="item in objOptions" :label="item.objName" :value="item.objCode"
|
|
|
+ :key="item.objCode" />
|
|
|
|
|
|
</el-select>
|
|
|
<el-date-picker v-model="dateRange" type="datetimerange" @change="getList"
|
|
@@ -86,7 +86,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="用电量(kW·h)" align="center" prop="elecQuantity">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.elecQuantity }}</span>
|
|
|
+ <span>{{ scope.row.quantity }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -108,12 +108,14 @@
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-tab-pane>
|
|
|
+
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import * as echarts from 'echarts/core';
|
|
|
+import {listByFacs,listFacsMeter} from '@/api/device/elecMeterH'
|
|
|
import {listHSum, sumByFacsH, sumBySubCategoryH, getPowerData, getPowerMaxLoad} from '@/api/mgr/elecUseH'
|
|
|
import {getFacsCategorygetByCode} from '@/api/basecfg/emsfacs'
|
|
|
import {areaTreeByFacsCategory} from '@/api/basecfg/area'
|
|
@@ -220,7 +222,9 @@ export default {
|
|
|
facsSubCategory: null,
|
|
|
date: null,
|
|
|
time: null,
|
|
|
- timeIndex: null
|
|
|
+ timeIndex: null,
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
queryObjParams: {
|
|
|
refArea: null,
|
|
@@ -562,6 +566,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**平均功率-15分钟*/
|
|
|
getPowerChart () {
|
|
|
this.powerMaxLoad = ''
|
|
|
this.powerChartData = []
|
|
@@ -619,7 +624,15 @@ export default {
|
|
|
getList () {
|
|
|
this.loading = true
|
|
|
this.queryParams.objCode = this.objCode
|
|
|
- listHSum(this.queryParams).then(response => {
|
|
|
+ const params = {
|
|
|
+ startRecTime: dayjs(this.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ endRecTime: dayjs(this.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ meterCls:45,
|
|
|
+ areaCode: this.queryParams.areaCode,
|
|
|
+ facsCategory:this.queryParams.facsCategory,
|
|
|
+ facsSubCategory: this.activeName,
|
|
|
+ };
|
|
|
+ listFacsMeter(params).then(response => {
|
|
|
this.hList = response.rows
|
|
|
this.total = response.total
|
|
|
this.loading = false
|
|
@@ -632,12 +645,18 @@ export default {
|
|
|
const params = {
|
|
|
startRecTime: dayjs(this.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
endRecTime: dayjs(this.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ meterCls:45,
|
|
|
areaCode: this.queryParams.areaCode,
|
|
|
+ facsCategory:this.queryParams.facsCategory,
|
|
|
facsSubCategory: this.activeName,
|
|
|
- objCode: this.queryParams.objCode
|
|
|
};
|
|
|
- sumByFacsH(params).then(response => {
|
|
|
- this.sumByFacsList = response.data
|
|
|
+ listByFacs(params).then(response => {
|
|
|
+ this.sumByFacsList = response.data.map(item => ({
|
|
|
+ objCode: item.objCode,
|
|
|
+ objName: item.objName,
|
|
|
+ quantity: item.quantity || 0,
|
|
|
+ }));
|
|
|
+ console.log(" this.sumByFacsList ", this.sumByFacsList )
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -670,43 +689,39 @@ export default {
|
|
|
startRecTime: dayjs(this.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
endRecTime: dayjs(this.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
areaCode: this.queryParams.areaCode,
|
|
|
+ meterCls:45,
|
|
|
+ facsCategory:this.queryParams.facsCategory,
|
|
|
};
|
|
|
- sumBySubCategoryH(params).then(response => {
|
|
|
- this.processDataForChart(response.data); // 处理数据并生成图表配置
|
|
|
+ listByFacs(params).then(response => {
|
|
|
console.log("pie图", response.data)
|
|
|
this.tableData = response.data.map(item => ({
|
|
|
name: item.objName,
|
|
|
- value: item.elecQuantity || 0
|
|
|
+ value: item.quantity || 0
|
|
|
}))
|
|
|
-
|
|
|
+ console.log("能耗总览",this.tableData)
|
|
|
+ this.processDataForChart(response.data); // 处理数据并生成图表配置
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
- processDataForChart (data) {
|
|
|
- this.totalElecQuantity = data.reduce((sum, item) => sum + (item.elecQuantity || 0), 0);
|
|
|
+ processDataForChart(data) {
|
|
|
+ console.log("data", data);
|
|
|
+ this.totalElecQuantity = data.reduce((sum, item) => sum + (item.quantity || 0), 0);
|
|
|
// 处理数据,生成图表配置
|
|
|
const seriesData = data.map(item => ({
|
|
|
name: item.objName,
|
|
|
- value: item.elecQuantity,
|
|
|
- percent: ((item.elecQuantity || 0) / this.totalElecQuantity * 100).toFixed(2),
|
|
|
- subentry: item.subentry.map(subItem => ({
|
|
|
- name: subItem.objName,
|
|
|
- value: subItem.elecQuantity
|
|
|
- }))
|
|
|
+ value: item.quantity || 0,
|
|
|
+ percent: ((item.quantity || 0) / this.totalElecQuantity * 100).toFixed(2),
|
|
|
}));
|
|
|
|
|
|
+ console.log("seriesData", seriesData);
|
|
|
+
|
|
|
// 设置图表配置
|
|
|
this.sumBySubCategoryChartOption = {
|
|
|
tooltip: {
|
|
|
trigger: 'item',
|
|
|
- formatter: function (params) {
|
|
|
- const {name, value, percent} = params;
|
|
|
- const subentries = params.data.subentry;
|
|
|
- let tooltipContent = `<div><h4>${name}</h4><p>${value}kW·h (${percent}%)</p><ul>`;
|
|
|
- subentries.forEach(subItem => {
|
|
|
- tooltipContent += `<li>${subItem.name}: ${subItem.value} kW·h</li>`;
|
|
|
- });
|
|
|
- tooltipContent += `</ul></div>`;
|
|
|
- return tooltipContent;
|
|
|
+ formatter: function(params) {
|
|
|
+ const { name, value, percent } = params;
|
|
|
+ return `<div><h4>${name}</h4><p>${value}kW·h (${percent}%)</p></div>`;
|
|
|
}
|
|
|
},
|
|
|
legend: {
|
|
@@ -732,7 +747,6 @@ export default {
|
|
|
position: 'outside',
|
|
|
formatter: '{b}\n{d}%',
|
|
|
},
|
|
|
-
|
|
|
labelLine: {
|
|
|
show: true,
|
|
|
length: 30, // 标签线长度
|
|
@@ -770,8 +784,20 @@ export default {
|
|
|
this.queryObjParams.facsCategory = category
|
|
|
this.queryObjParams.subCategory = subCategory
|
|
|
|
|
|
- listAllFacs(this.queryObjParams).then(response => {
|
|
|
+ // listAllFacs(this.queryObjParams).then(response => {
|
|
|
+ // this.objOptions = response.data
|
|
|
+ // })
|
|
|
+ const params = {
|
|
|
+ startRecTime: dayjs(this.dateRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ endRecTime: dayjs(this.dateRange[1]).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ meterCls:45,
|
|
|
+ areaCode: this.queryParams.areaCode,
|
|
|
+ facsCategory:this.queryParams.facsCategory,
|
|
|
+ facsSubCategory: this.activeName,
|
|
|
+ };
|
|
|
+ listByFacs(params).then(response => {
|
|
|
this.objOptions = response.data
|
|
|
+ console.log(" this.objOptions ",this.objOptions )
|
|
|
})
|
|
|
},
|
|
|
tabClick () {
|
|
@@ -791,10 +817,10 @@ export default {
|
|
|
handleQuery () {
|
|
|
this.queryParams.pageNum = 1
|
|
|
this.getList()
|
|
|
+ this.getsumByFacsH()
|
|
|
},
|
|
|
handleObjSelectClick () {
|
|
|
this.getFacsObj(this.queryParams.areaCode, this.facsCategory, this.activeName)
|
|
|
- this.getsumByFacsH();
|
|
|
},
|
|
|
// 筛选节点
|
|
|
filterNode (value, data) {
|