Browse Source

1.生活热水-首页修改热泵总数

2.能源分析-能耗报表去掉楼栋人数、人均用量值
3.用能查询水电表读数添加计算量
4.对接数据分析页面数据
meizhou
selia-zx 5 days ago
parent
commit
46fe8ea70c
  1. 18
      src/api/hotWater/dataAnalysis.js
  2. 495
      src/views/hotWater/dataAnalysis/components/analyzeMonth.vue
  3. 451
      src/views/hotWater/dataAnalysis/components/analyzeYear.vue
  4. 241
      src/views/hotWater/dataAnalysis/index.vue
  5. 10
      src/views/hotWater/energyAnalysis/components/energyReport.vue
  6. 4
      src/views/hotWater/energyAnalysis/components/temReport.vue
  7. 4
      src/views/hotWater/energyAnalysis/components/waterReport.vue
  8. 90
      src/views/hotWater/energyQuery/components/electReading.vue
  9. 94
      src/views/hotWater/energyQuery/components/waterReading.vue
  10. 4
      src/views/hotWater/overview/index.vue

18
src/api/hotWater/dataAnalysis.js

@ -0,0 +1,18 @@
import request from "@/utils/request";
// 数据分析-月
export function queryMonthDatas(query) {
return request({
url: "/hot_energy/analysis/queryMonth",
method: "get",
params: query,
});
}
// 数据分析-年
export function queryYearDatas(query) {
return request({
url: "/hot_energy/analysis/queryYear",
method: "get",
params: query,
});
}

495
src/views/hotWater/dataAnalysis/components/analyzeMonth.vue

@ -1,6 +1,6 @@
<!-- 报表查询-用能查询-年数据 -->
<template>
<div>
<div class="analy-table">
<div class="findwatercharts" ref="findwater_ref"></div>
<!-- 表格 -->
<el-table
@ -88,6 +88,7 @@
<script>
import { getDay, getMonth, getYear } from "@/utils/datetime";
import { queryMonthDatas } from "@/api/hotWater/dataAnalysis";
import * as echarts from "echarts";
export default {
props: {
@ -97,9 +98,12 @@ export default {
chTime: {
type: String,
},
jtData: {
chBuild: {
type: String,
},
currentIndex: {
type: Number,
},
},
data() {
return {
@ -124,30 +128,21 @@ export default {
};
},
watch: {
chType: {
currentIndex: {
immediate: true,
deep: true,
handler(newVal, val) {
// console.log("", newVal);
this.$nextTick(function () {
console.log("子组件接受的type类型", this.chType);
console.log("子组件这时候有building吗", this.chBuild);
this.getMothData();
});
},
},
// vuexid
jtData: {
handler(newVal, oldVal) {
// console.log("vuexid", newVal, oldVal);
this.$nextTick(function () {
this.getMothData();
});
},
deep: true,
immediate: true,
},
},
mounted() {
this.getMothData();
// this.getMothData();
this.initChart1();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
@ -160,7 +155,7 @@ export default {
tableRowStyle({ row, column, rowIndex, columnIndex }) {
// 1
if (columnIndex === 0) {
return "background-color: #31354e !important;";
return "background-color:rgb(11 ,100, 201) !important;";
}
},
//
@ -172,180 +167,228 @@ export default {
if (this.chTime) {
this.endTime = this.chTime;
} else {
this.endTime = getMonth(0)
this.endTime = getMonth(0);
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
buildingId: this.chBuild,
type: this.chType,
};
console.log("月参数", params);
// this.$api.statementfind.energyMonth(params).then((res) => {
// // console.log("", res);
// if (res.code == 200) {
// var line1 = [];
// var line2 = [];
// var line3 = [];
// var line4 = [];
// this.tableData = res.data;
// // Object.values
// line1 = Object.values(this.tableData[0]).slice(3, 35);
// line2 = Object.values(this.tableData[1]).slice(3, 35);
// line3 = Object.values(this.tableData[2]).slice(3, 35);
// line4 = Object.values(this.tableData[3]).slice(3, 35);
// // 线 filter
// this.data1 = line1.filter(function (s) {
// return s && s.trim();
// });
// this.data2 = line2.filter(function (s) {
// return s && s.trim();
// });
// //
// var line5 = line3.filter(function (s) {
// return s && s.trim();
// });
// this.data3 = [];
// this.data4 = [];
// // %
// line5.forEach((item) => {
// this.data3.push(item.split("%").join(""));
// });
// var line6 = line4.filter(function (s) {
// return s && s.trim();
// });
// line6.forEach((item) => {
// this.data4.push(item.split("%").join(""));
// });
// // 线x
// // tableData[0] [1] [2] [3],
// //
// let newObj = {};
// for (let key in this.tableData[0]) {
// if (this.tableData[0][key]) {
// newObj[key] = this.tableData[0][key];
// }
// }
// // console.log("", newObj);
// // key
// // Object.setPrototypeOf(this.newObj);
// let data7 = Object.keys(newObj);
// // console.log("x", data7);
// //
// let allArr = [
// "day01",
// "day02",
// "day03",
// "day04",
// "day05",
// "day06",
// "day07",
// "day08",
// "day09",
// "day10",
// "day11",
// "day12",
// "day13",
// "day14",
// "day15",
// "day16",
// "day17",
// "day18",
// "day19",
// "day20",
// "day21",
// "day22",
// "day23",
// "day24",
// "day25",
// "day26",
// "day27",
// "day28",
// "day29",
// "day30",
// "day31",
// ];
// //
// function compare(data7, allArr) {
// return data7.filter((v) => {
// return allArr.includes(v);
// });
// }
// // console.log("x", compare(data7, allArr));
// // data7 xx
// this.data8 = [];
// compare(data7, allArr).forEach((item) => {
// if (item) {
// this.data8.push(item.split("day").join("") + "");
// }
// });
// // console.log("x", this.data8);
// //
// this.data6 = [];
// this.data5 = this.tableData.forEach((item) => {
// return this.data6.push(item.itemType);
// });
// // console.log("data1", this.data1);
// // console.log("data2", this.data2);
// // console.log("data3", this.data3);
// // console.log("data4", this.data4);
// // console.log("", this.data6);
// //
// var Min1 = Math.floor(Math.min(...this.data1, ...this.data2)),
// Min2 = Math.floor(Math.min(...this.data3, ...this.data4) - 4),
// Max1 = Math.ceil(Math.max(...this.data1, ...this.data2) + 4),
// Max2 = Math.ceil(Math.max(...this.data3, ...this.data4) + 4);
// // console.log("Min1", Min1);
// // console.log("Min2", Min2);
// // console.log("Max1", Max1);
// // console.log("Max2", Max2);
// this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
// const adapterOption = {
// legend: {
// data: this.data6,
// },
// xAxis: {
// data: this.data8,
// },
// yAxis: [
// //y
// {
// min: Min1,
// max: Max1,
// splitNumber: 10,
// interval: (Max1 - Min1) / 10,
// },
// {
// min: Min2,
// max: Max2,
// splitNumber: 10,
// interval: (Max2 - Min2) / 10,
// },
// ],
// series: [
// {
// name: this.data6[0],
// data: this.data1,
// },
// {
// name: this.data6[1],
// data: this.data2,
// },
// {
// name: this.data6[2],
// data: this.data3,
// },
// {
// name: this.data6[3],
// data: this.data4,
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.chartInstance1.setOption(adapterOption);
// //resize
// this.chartInstance1.resize();
// }
// });
queryMonthDatas(params).then((res) => {
// console.log("", res);
if (res.code == 200 && res.rows.length > 0) {
var line1 = [];
var line2 = [];
var line3 = [];
var line4 = [];
this.tableData = res.rows;
// Object.values
line1 = Object.values(this.tableData[0]).slice(3, 35);
line2 = Object.values(this.tableData[1]).slice(3, 35);
line3 = Object.values(this.tableData[2]).slice(3, 35);
line4 = Object.values(this.tableData[3]).slice(3, 35);
// 线 filter
this.data1 = line1.filter(function (s) {
return s && s.trim();
});
this.data2 = line2.filter(function (s) {
return s && s.trim();
});
//
var line5 = line3.filter(function (s) {
return s && s.trim();
});
this.data3 = [];
this.data4 = [];
// %
line5.forEach((item) => {
this.data3.push(item.split("%").join(""));
});
var line6 = line4.filter(function (s) {
return s && s.trim();
});
line6.forEach((item) => {
this.data4.push(item.split("%").join(""));
});
// 线x
// tableData[0] [1] [2] [3],
//
let newObj = {};
for (let key in this.tableData[0]) {
if (this.tableData[0][key]) {
newObj[key] = this.tableData[0][key];
}
}
// console.log("", newObj);
// key
// Object.setPrototypeOf(this.newObj);
let data7 = Object.keys(newObj);
// console.log("x", data7);
//
let allArr = [
"day01",
"day02",
"day03",
"day04",
"day05",
"day06",
"day07",
"day08",
"day09",
"day10",
"day11",
"day12",
"day13",
"day14",
"day15",
"day16",
"day17",
"day18",
"day19",
"day20",
"day21",
"day22",
"day23",
"day24",
"day25",
"day26",
"day27",
"day28",
"day29",
"day30",
"day31",
];
//
function compare(data7, allArr) {
return data7.filter((v) => {
return allArr.includes(v);
});
}
// console.log("x", compare(data7, allArr));
// data7 xx
this.data8 = [];
compare(data7, allArr).forEach((item) => {
if (item) {
this.data8.push(item.split("day").join("") + "日");
}
});
// console.log("x", this.data8);
//
this.data6 = [];
this.data5 = this.tableData.forEach((item) => {
return this.data6.push(item.itemType);
});
// console.log("data1", this.data1);
// console.log("data2", this.data2);
// console.log("data3", this.data3);
// console.log("data4", this.data4);
// console.log("", this.data6);
//
var Min1 = Math.floor(Math.min(...this.data1, ...this.data2)),
Min2 = Math.floor(Math.min(...this.data3, ...this.data4) - 4),
Max1 = Math.ceil(Math.max(...this.data1, ...this.data2) + 4),
Max2 = Math.ceil(Math.max(...this.data3, ...this.data4) + 4);
// console.log("Min1", Min1);
// console.log("Min2", Min2);
// console.log("Max1", Max1);
// console.log("Max2", Max2);
this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
const adapterOption = {
legend: {
data: this.data6,
},
xAxis: {
data: this.data8,
},
yAxis: [
//y
{
min: Min1,
max: Max1,
splitNumber: 10,
interval: (Max1 - Min1) / 10,
},
{
min: Min2,
max: Max2,
splitNumber: 10,
interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: this.data6[0],
data: this.data1,
},
{
name: this.data6[1],
data: this.data2,
},
{
name: this.data6[2],
data: this.data3,
},
{
name: this.data6[3],
data: this.data4,
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
} else {
this.tableData = [];
this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
const adapterOption = {
legend: {
data: [],
},
xAxis: {
data: [],
},
yAxis: [
//y
{
min: 0,
max: 0,
splitNumber: 10,
interval: 0,
},
{
min: 0,
max: 0,
splitNumber: 10,
interval: 0,
},
],
series: [
{
name: "",
data: [],
},
{
name: "",
data: [],
},
{
name: "",
data: [],
},
{
name: "",
data: [],
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
}
});
},
//
outTable() {
@ -426,27 +469,27 @@ export default {
if (this.chTime) {
this.endTime = this.chTime;
} else {
this.endTime = getMonth(0)
this.endTime = getMonth(0);
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
buildingId: this.chBuild,
type: this.chType,
};
console.log("月参数", params);
// this.$api.statementfind.energyMonth(params).then((res) => {
// if (res.code == 200) {
// // console.log(res);
// const data = this.formatJson(filterVal, res.data);
// const autoWidth = true;
// excel.export_json_to_excel({
// header: tHeader, //
// data, //
// filename: "", //
// autoWidth: true, //
// });
// }
// });
queryMonthDatas(params).then((res) => {
if (res.code == 200 && res.rows.length > 0) {
// console.log(res);
const data = this.formatJson(filterVal, res.rows);
const autoWidth = true;
excel.export_json_to_excel({
header: tHeader, //
data, //
filename: "月数据报表", //
autoWidth: true, //
});
}
});
});
},
//,
@ -507,22 +550,26 @@ export default {
boundaryGap: true,
// x
axisLabel: {
// interval: 0,
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255,255,255,.7)",
color: "rgba(255, 255, 255, 1)",
fontSize: 14, //
},
axisTick: {
show: false, // 线
},
// x
// x
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
color: "#365576",
},
},
//splitLine: { show: true } //x线
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
},
yAxis: [
//y
@ -530,50 +577,53 @@ export default {
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
color: "rgba(255, 255, 255, 1)",
},
// y
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
splitNumber: 10,
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
//y线
splitNumber: 10,
},
{
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
formatter: "{value} %",
color: "rgba(255, 255, 255, 1)",
},
// y
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
splitNumber: 5,
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
//y线
splitNumber: 10,
},
],
@ -688,4 +738,9 @@ export default {
height: 4.5rem;
/* background-color: pink; */
}
.analy-table >>> .el-table th.el-table__cell.is-leaf,
.analy-table >>> .el-table td.el-table__cell {
border-bottom: 1px solid #093769 !important;
border-right: 1px solid #093769 !important;
}
</style>

451
src/views/hotWater/dataAnalysis/components/analyzeYear.vue

@ -1,6 +1,6 @@
<!-- 报表查询-用能查询-年数据 -->
<template>
<div>
<div class="analy-table">
<div class="findwatercharts" ref="findwater_ref"></div>
<!-- 表格 -->
<el-table
@ -56,6 +56,7 @@
<script>
import { getYear } from "@/utils/datetime";
import { queryYearDatas } from "@/api/hotWater/dataAnalysis";
import * as echarts from "echarts";
export default {
props: {
@ -65,9 +66,12 @@ export default {
chTime: {
type: String,
},
jtData: {
chBuild: {
type: String,
},
currentIndex: {
type: Number,
},
},
data() {
return {
@ -92,7 +96,7 @@ export default {
};
},
watch: {
chType: {
currentIndex: {
immediate: true,
deep: true,
handler(newVal, val) {
@ -102,20 +106,9 @@ export default {
});
},
},
// vuexid
jtData: {
handler(newVal, oldVal) {
// console.log("vuexid", newVal, oldVal);
this.$nextTick(function () {
this.getYearData();
});
},
deep: true,
immediate: true,
},
},
mounted() {
this.getYearData();
// this.getYearData();
this.initChart1();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
@ -128,7 +121,7 @@ export default {
tableRowStyle({ row, column, rowIndex, columnIndex }) {
// 1
if (columnIndex === 0) {
return "background-color: #31354e !important;";
return "background-color:rgb(11 ,100, 201) !important;";
}
},
//
@ -144,157 +137,205 @@ export default {
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
buildingId: this.chBuild,
type: this.chType,
};
console.log("年表格参数", params);
// this.$api.statementfind.energyYear(params).then((res) => {
// // console.log("", res);
// if (res.code == 200) {
// var line1 = [];
// var line2 = [];
// var line3 = [];
// var line4 = [];
// this.tableData = res.data;
// // Object.values
// line1 = Object.values(this.tableData[0]).slice(3, 15);
// line2 = Object.values(this.tableData[1]).slice(3, 15);
// line3 = Object.values(this.tableData[2]).slice(3, 15);
// line4 = Object.values(this.tableData[3]).slice(3, 15);
// // 线 filter
// this.data1 = line1.filter(function (s) {
// return s && s.trim();
// });
// this.data2 = line2.filter(function (s) {
// return s && s.trim();
// });
// //
// var line5 = line3.filter(function (s) {
// return s && s.trim();
// });
// this.data3 = [];
// this.data4 = [];
// // %
// line5.forEach((item) => {
// this.data3.push(item.split("%").join(""));
// });
// var line6 = line4.filter(function (s) {
// return s && s.trim();
// });
// line6.forEach((item) => {
// this.data4.push(item.split("%").join(""));
// });
// // 线x
// // tableData[0] [1] [2] [3],
// //
// let newObj = {};
// for (let key in this.tableData[0]) {
// if (this.tableData[0][key]) {
// newObj[key] = this.tableData[0][key];
// }
// }
// // console.log("", newObj);
// // key
// // Object.setPrototypeOf(this.newObj);
// let data7 = Object.keys(newObj);
// // console.log("x", data7);
// //
// let allArr = [
// "month01",
// "month02",
// "month03",
// "month04",
// "month05",
// "month06",
// "month07",
// "month08",
// "month09",
// "month10",
// "month11",
// "month12",
// ];
// //
// function compare(data7, allArr) {
// return data7.filter((v) => {
// return allArr.includes(v);
// });
// }
// // console.log("x", compare(data7, allArr));
// // data7 xx
// this.data8 = [];
// compare(data7, allArr).forEach((item) => {
// if (item) {
// this.data8.push(item.split("month").join("") + "");
// }
// });
// // console.log("x", this.data8);
// //
// this.data6 = [];
// this.data5 = this.tableData.forEach((item) => {
// return this.data6.push(item.itemType);
// });
// // console.log("data1", this.data1);
// // console.log("data2", this.data2);
// // console.log("data3", this.data3);
// // console.log("data4", this.data4);
// // console.log("", this.data6);
// //
// var Min1 = Math.floor(Math.min(...this.data1, ...this.data2)),
// Min2 = Math.floor(Math.min(...this.data3, ...this.data4) - 4),
// Max1 = Math.ceil(Math.max(...this.data1, ...this.data2) + 4),
// Max2 = Math.ceil(Math.max(...this.data3, ...this.data4) + 4);
// // console.log("Min1", Min1);
// // console.log("Min2", Min2);
// // console.log("Max1", Max1);
// // console.log("Max2", Max2);
// this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
// const adapterOption = {
// legend: {
// data: this.data6,
// },
// xAxis: {
// data: this.data8,
// },
// yAxis: [
// //y
// {
// min: Min1,
// max: Max1,
// splitNumber: 10,
// interval: (Max1 - Min1) / 10,
// },
// {
// min: Min2,
// max: Max2,
// splitNumber: 10,
// interval: (Max2 - Min2) / 10,
// },
// ],
// series: [
// {
// name: this.data6[0],
// data: this.data1,
// },
// {
// name: this.data6[1],
// data: this.data2,
// },
// {
// name: this.data6[2],
// data: this.data3,
// },
// {
// name: this.data6[3],
// data: this.data4,
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.chartInstance1.setOption(adapterOption);
// //resize
// this.chartInstance1.resize();
// }
// });
queryYearDatas(params).then((res) => {
// console.log("", res);
if (res.code == 200 && res.rows.length > 0) {
var line1 = [];
var line2 = [];
var line3 = [];
var line4 = [];
this.tableData = res.rows;
// Object.values
line1 = Object.values(this.tableData[0]).slice(3, 15);
line2 = Object.values(this.tableData[1]).slice(3, 15);
line3 = Object.values(this.tableData[2]).slice(3, 15);
line4 = Object.values(this.tableData[3]).slice(3, 15);
// 线 filter
this.data1 = line1.filter(function (s) {
return s && s.trim();
});
this.data2 = line2.filter(function (s) {
return s && s.trim();
});
//
var line5 = line3.filter(function (s) {
return s && s.trim();
});
this.data3 = [];
this.data4 = [];
// %
line5.forEach((item) => {
this.data3.push(item.split("%").join(""));
});
var line6 = line4.filter(function (s) {
return s && s.trim();
});
line6.forEach((item) => {
this.data4.push(item.split("%").join(""));
});
// 线x
// tableData[0] [1] [2] [3],
//
let newObj = {};
for (let key in this.tableData[0]) {
if (this.tableData[0][key]) {
newObj[key] = this.tableData[0][key];
}
}
// console.log("", newObj);
// key
// Object.setPrototypeOf(this.newObj);
let data7 = Object.keys(newObj);
// console.log("x", data7);
//
let allArr = [
"month01",
"month02",
"month03",
"month04",
"month05",
"month06",
"month07",
"month08",
"month09",
"month10",
"month11",
"month12",
];
//
function compare(data7, allArr) {
return data7.filter((v) => {
return allArr.includes(v);
});
}
// console.log("x", compare(data7, allArr));
// data7 xx
this.data8 = [];
compare(data7, allArr).forEach((item) => {
if (item) {
this.data8.push(item.split("month").join("") + "月");
}
});
// console.log("x", this.data8);
//
this.data6 = [];
this.data5 = this.tableData.forEach((item) => {
return this.data6.push(item.itemType);
});
// console.log("data1", this.data1);
// console.log("data2", this.data2);
// console.log("data3", this.data3);
// console.log("data4", this.data4);
// console.log("", this.data6);
//
var Min1 = Math.floor(Math.min(...this.data1, ...this.data2)),
Min2 = Math.floor(Math.min(...this.data3, ...this.data4) - 4),
Max1 = Math.ceil(Math.max(...this.data1, ...this.data2) + 4),
Max2 = Math.ceil(Math.max(...this.data3, ...this.data4) + 4);
// console.log("Min1", Min1);
// console.log("Min2", Min2);
// console.log("Max1", Max1);
// console.log("Max2", Max2);
this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
const adapterOption = {
legend: {
data: this.data6,
},
xAxis: {
data: this.data8,
},
yAxis: [
//y
{
min: Min1,
max: Max1,
splitNumber: 10,
interval: (Max1 - Min1) / 10,
},
{
min: Min2,
max: Max2,
splitNumber: 10,
interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: this.data6[0],
data: this.data1,
},
{
name: this.data6[1],
data: this.data2,
},
{
name: this.data6[2],
data: this.data3,
},
{
name: this.data6[3],
data: this.data4,
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
} else {
this.tableData = [];
this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
const adapterOption = {
legend: {
data: [],
},
xAxis: {
data: [],
},
yAxis: [
//y
{
min: 0,
max: 0,
splitNumber: 10,
interval: 0,
},
{
min: 0,
max: 0,
splitNumber: 10,
interval: 0,
},
],
series: [
{
name: "",
data: [],
},
{
name: "",
data: [],
},
{
name: "",
data: [],
},
{
name: "",
data: [],
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
}
});
},
//
outTable() {
@ -341,23 +382,23 @@ export default {
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
buildingId: this.chBuild,
type: this.chType,
};
console.log("年表格参数", params);
// this.$api.statementfind.energyYear(params).then((res) => {
// if (res.code == 200) {
// // console.log(res);
// const data = this.formatJson(filterVal, res.data);
// const autoWidth = true;
// excel.export_json_to_excel({
// header: tHeader, //
// data, //
// filename: "", //
// autoWidth: true, //
// });
// }
// });
queryYearDatas(params).then((res) => {
if (res.code == 200 && res.rows.length > 0) {
// console.log(res);
const data = this.formatJson(filterVal, res.rows);
const autoWidth = true;
excel.export_json_to_excel({
header: tHeader, //
data, //
filename: "年数据报表", //
autoWidth: true, //
});
}
});
});
},
//,
@ -418,22 +459,26 @@ export default {
boundaryGap: true,
// x
axisLabel: {
// interval: 0,
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255,255,255,.7)",
color: "rgba(255, 255, 255, 1)",
fontSize: 14, //
},
axisTick: {
show: false, // 线
},
// x
// x
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
color: "#365576",
},
},
//splitLine: { show: true } //x线
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
},
yAxis: [
//y
@ -441,50 +486,53 @@ export default {
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
color: "rgba(255, 255, 255, 1)",
},
// y
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
splitNumber: 10,
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
//y线
splitNumber: 10,
},
{
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
formatter: "{value} %",
color: "rgba(255, 255, 255, 1)",
},
// y
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
splitNumber: 5,
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
//y线
splitNumber: 10,
},
],
@ -635,4 +683,9 @@ export default {
height: 4.5rem;
/* background-color: pink; */
}
.analy-table >>> .el-table th.el-table__cell.is-leaf,
.analy-table >>> .el-table td.el-table__cell {
border-bottom: 1px solid #093769 !important;
border-right: 1px solid #093769 !important;
}
</style>

241
src/views/hotWater/dataAnalysis/index.vue

@ -1,33 +1,5 @@
<template>
<div class="app-container">
<div class="left-tree">
<!-- el-tree 设置一个固定的高度和滚动条 -->
<div style="height: 7rem; overflow-y: auto">
<el-tree
ref="tree"
:data="treeData"
node-key="id"
:default-expand-all="false"
:default-expanded-keys="expandedKeys"
:auto-expand-parent="true"
icon-class="none"
@node-expand="handleNodeExpand"
@node-collapse="handleNodeCollapse"
:highlight-current="true"
@node-click="handleNodeClick"
>
<template #default="{ node }">
<span class="custom-tree-node">
<!-- 根据节点状态动态设置图标类名 -->
<div class="tree-left">
<i :class="getIconClass(node)" class="custom-tree-icon"></i>
<span class="tree-label">{{ node.label }}</span>
</div>
</span>
</template>
</el-tree>
</div>
</div>
<div class="right-monitor">
<div class="buildingDiv">
<div class="buildingDiv-left">
@ -42,6 +14,20 @@
<!-- 条件 -->
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
@change="handleBuildingChange"
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.building_name"
:value="item.id"
/>
</el-select>
<el-select
style="margin-right: 0.1rem"
v-model="analysisType"
@ -94,24 +80,25 @@
<analyze-month
v-if="currentIndex === 0"
ref="monthRef"
:currentIndex="currentIndex"
:chType="analysisType"
:chTime="monthDate"
:chBuild="building"
></analyze-month>
<analyze-year
v-if="currentIndex === 1"
:currentIndex="currentIndex"
ref="yearRef"
:chType="analysisType"
:chTime="yearDate"
:chBuild="building"
></analyze-year>
</div>
</div>
</template>
<script>
import { spaceTree } from "@/api/region";
import { format } from "@/utils/datetime";
import { temList, temHistory } from "@/api/temSys/temMonitor";
import * as echarts from "echarts";
import { hotBuildList } from "@/api/hotWater/energyAnalysis";
import analyzeMonth from "./components/analyzeMonth.vue";
import analyzeYear from "./components/analyzeYear.vue";
export default {
@ -119,7 +106,9 @@ export default {
data() {
return {
loading: false,
treeData: [],
currentName: "",
building: "", //
builds: [], //
analysisType: 1,
analysisTypes: [
{
@ -134,177 +123,61 @@ export default {
label: "耗能",
value: 3,
},
{
label: "维保量",
value: 4,
},
{
label: "使用时间",
value: 5,
},
],
monthDate: "",
yearDate: "",
timeData2: [{ title: "月" }, { title: "年" }],
currentIndex: 0, //
defaultProps: {
children: "children",
label: "label",
},
deviceList: [],
expandedKeys: [],
currentId: "", //id
currentName: "", //
currentLevel: "", //
currentParentId: "", //id
tableData: [], //
chartInstance: null,
option: {},
chartData1: [],
chartData2: [],
bottomData: [],
currentIndex: null, //
};
},
mounted() {
this.getSysBuild();
this.getBuildList();
},
methods: {
handleEnter(index) {
this.currentIndex = index;
// this.renderingBroken();
console.log("切换日月");
},
handleBuildingChange(selectedId) {
//
const selectedItem = this.builds.find((item) => item.id === selectedId);
if (selectedItem) {
this.currentName = selectedItem.building_name;
console.log("选中的楼栋 ID:", selectedId);
console.log("选中的楼栋名称:", this.currentName);
//
}
},
getSysBuild() {
spaceTree().then((res) => {
/** 查询楼栋 */
getBuildList() {
let data = {
systemType: "1",
};
hotBuildList(data).then((res) => {
if (res.code == 200) {
//
console.log("楼栋返回值", res);
let newRes = { ...res };
if (newRes.data && newRes.data[0] && newRes.data[0].children) {
newRes.data[0].children = newRes.data[0].children.filter((item) => {
// label ""
return item.label && item.label.includes("热水");
});
}
// 1 4
const targetLevel = 4;
// data[0] 1
if (newRes.data[0]) {
this.removeChildrenAfterLevel(newRes.data[0], 1, targetLevel);
}
console.log("筛选后的新结果", newRes);
this.treeData = newRes.data;
this.$nextTick(() => {
//
this.getExpandedKeys(this.treeData, 1);
if (this.treeData.length > 0) {
//
const lastLevelFirstChild = this.findLastLevelFirstChild(
this.treeData[0]
);
// this.$refs.tree.setCurrentKey(
// this.treeData[0].children[0].children[0].children[0].id
// );
// ,
this.$refs.tree.setCurrentKey(lastLevelFirstChild.id);
//
this.currentId = lastLevelFirstChild.id;
this.currentLevel = lastLevelFirstChild.level;
this.currentName = lastLevelFirstChild.label;
console.log("当前选中节点ID", this.currentId);
console.log("当前选中节点层级", this.currentLevel);
console.log("当前选中节点名称", this.currentName);
// this.getTemList();
// building_name ""
const filteredRows = res.rows.filter((row, index) => {
if (index === 0 && row.building_name === "所有") {
return false;
}
return true;
});
this.builds = filteredRows;
// console.log("", this.builds);
if (this.builds.length > 0) {
this.building = this.builds[0].id;
this.currentName = this.builds[0].building_name;
console.log("选中的第一个楼栋id-传给子组件", this.building);
this.handleEnter(0); //
}
}
});
},
// children
removeChildrenAfterLevel(obj, currentLevel, targetLevel) {
if (currentLevel >= targetLevel) {
// children
obj.children = [];
return;
}
if (obj.children && obj.children.length > 0) {
// children
for (let i = 0; i < obj.children.length; i++) {
this.removeChildrenAfterLevel(
obj.children[i],
currentLevel + 1,
targetLevel
);
}
}
},
//
findLastLevelFirstChild(node, level = 1) {
if (!node.children || node.children.length === 0) {
return {
id: node.id,
level,
label: node.label,
};
}
return this.findLastLevelFirstChild(node.children[0], level + 1);
},
//
getExpandedKeys(nodes, level) {
nodes.forEach((node) => {
if (level <= this.currentId + 4) {
this.expandedKeys.push(node.id);
}
if (node.children) {
this.getExpandedKeys(node.children, level + 1);
}
});
},
//
getIconClass(node) {
// console.log("", node);
if (node.level === 4) {
// 4
if (node.expanded) {
return "el-icon-document"; // 4
}
return "el-icon-document"; // 4
}
if (node.expanded) {
return "el-icon-folder-opened"; // 4
}
return "el-icon-folder-add"; // 4
},
handleNodeExpand(node) {
//
},
handleNodeCollapse(node) {
//
},
//
handleNodeClick(node, data) {
console.log("点击的当前节点", node, data);
if (data.level !== 4) {
console.log("不是第4层000");
// ,
this.$refs.tree.setCurrentKey(this.currentId);
console.log("当前选中节点ID", this.currentId);
console.log("当前选中节点层级", this.currentLevel);
console.log("当前选中节点名称", this.currentName);
} else {
console.log("第5层111");
this.currentId = node.id;
this.currentLevel = data.level;
this.currentName = node.label;
// ,
this.$refs.tree.setCurrentKey(this.currentId);
console.log("当前选中节点ID", this.currentId);
console.log("当前选中节点层级", this.currentLevel);
console.log("当前选中节点名称", this.currentName);
// this.getTemList();
}
},
//
findData() {
if (this.currentIndex == 0) {
@ -358,7 +231,7 @@ export default {
border: 1px solid #004b8c;
}
.right-monitor {
width: calc(100% - 280px);
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;

10
src/views/hotWater/energyAnalysis/components/energyReport.vue

@ -176,8 +176,6 @@
<el-table-column label="用水量(吨)" align="center" prop="useHotWater" />
<el-table-column label="用电量(度)" align="center" prop="electValue" />
<el-table-column label="单耗(度/吨)" align="center" prop="electWater" />
<el-table-column label="楼栋人数" align="center" prop="checkInCount" />
<el-table-column label="人均用水(人/升)" align="center" prop="perWater" />
</el-table>
<pagination
@ -627,16 +625,12 @@ export default {
"用水量(吨)",
"用电量(度)",
"单耗(度/吨)",
"楼栋人数",
"人均用水(人/升)",
]; // excel
var filterVal = [
"curDate",
"useHotWater",
"electValue",
"electWater",
"checkInCount",
"perWater",
];
} else {
var tHeader = [
@ -645,8 +639,6 @@ export default {
"用水量(吨)",
"用电量(度)",
"单耗(度/吨)",
"楼栋人数",
"人均用水(人/升)",
]; // excel
var filterVal = [
"curDate",
@ -654,8 +646,6 @@ export default {
"useHotWater",
"electValue",
"electWater",
"checkInCount",
"perWater",
];
}
const data = this.formatJson(filterVal, this.exportData);

4
src/views/hotWater/energyAnalysis/components/temReport.vue

@ -165,12 +165,12 @@ export default {
this.listLoading = true;
//
hotWaterTemp(data).then((res) => {
if (res.code == 200 && res.rows.length >0) {
if (res.code == 200 && res.rows.length > 0) {
this.tableData = res.rows;
// this.firstRow();
this.handlerow(this.tableData[0]);
} else {
this.rows = [];
this.tableData = [];
}
});
// Just to simulate the time of the request

4
src/views/hotWater/energyAnalysis/components/waterReport.vue

@ -164,12 +164,12 @@ export default {
this.listLoading = true;
//
hotWaterLevel(data).then((res) => {
if (res.code == 200 && res.rows.length >0) {
if (res.code == 200 && res.rows.length > 0) {
this.tableData = res.rows;
// this.firstRow();
this.handlerow(this.tableData[0]);
} else {
this.rows = [];
this.tableData = [];
}
});
// Just to simulate the time of the request

90
src/views/hotWater/energyQuery/components/electReading.vue

@ -54,6 +54,7 @@
<el-table-column label="采集读数" align="center" prop="curValue" />
<el-table-column label="用量" align="center" prop="usedValue" />
<el-table-column label="倍率" align="center" prop="ratio" />
<el-table-column label="计算量" align="center" prop="calcValue" />
</el-table>
<pagination
@ -170,7 +171,7 @@ export default {
startDate: this.dayDate[0],
endDate: this.dayDate[1],
buildingId: this.building,
deviceType: "18",
deviceType: "16",
};
console.log("查询数据参数", data);
this.listLoading = true;
@ -192,43 +193,74 @@ export default {
},
//
exportData() {
if (this.dayDate.length == 0) {
this.initializeTimeDate();
}
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
pageNum: this.queryParams.pageNum,
pageSize: this.total,
startDate: this.dayDate[0],
endDate: this.dayDate[1],
buildingId: this.building,
deviceType: "16",
};
console.log("导出数据参数", data);
analyzeExport(data).then((res) => {
console.log("导出返回", res);
if (res) {
//
// blob URL
const url = window.URL.createObjectURL(new Blob([res]));
// <a>hrefdownload
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "机房能耗报表.xls"); //
//
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// blob URL
window.URL.revokeObjectURL(url);
this.$message({
type: "success",
message: "导出成功!",
console.log("查询数据参数", data);
queryDeviceDatas(data).then((res) => {
console.log("返回", res);
if (res.code == 200) {
import("@/assets/excel/Export2Excel").then((excel) => {
var tHeader = [
"所属楼栋",
"设备编号",
"设备名称",
"抄表时间",
"采集读数",
"用量",
"倍率",
"计算量",
]; // excel
var filterVal = [
"buildingName",
"deviceNum",
"deviceName",
"curTime",
"curValue",
"usedValue",
"ratio",
"calcValue",
];
const data = this.formatJson(filterVal, res.rows);
const autoWidth = true;
excel.export_json_to_excel({
header: tHeader, //
data, //
filename: "电表读数报表", //
autoWidth: true, //
});
this.$message({
type: "success",
message: "导出成功!",
});
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
//,
formatJson(filterVal, jsonData) {
return jsonData.map((v) =>
filterVal.map((j) => {
if (j === "installDate") {
return format(v[j]);
} else {
return v[j];
}
})
);
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 6) {
if (columnIndex === 6 || columnIndex === 8) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";

94
src/views/hotWater/energyQuery/components/waterReading.vue

@ -54,6 +54,7 @@
<el-table-column label="采集读数" align="center" prop="curValue" />
<el-table-column label="用量" align="center" prop="usedValue" />
<el-table-column label="倍率" align="center" prop="ratio" />
<el-table-column label="计算量" align="center" prop="calcValue" />
</el-table>
<pagination
@ -155,7 +156,9 @@ export default {
},
//
indexAdd(index) {
return index + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize;
return (
index + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
);
},
//
getList() {
@ -168,7 +171,7 @@ export default {
startDate: this.dayDate[0],
endDate: this.dayDate[1],
buildingId: this.building,
deviceType: "16",
deviceType: "18",
};
console.log("查询数据参数", data);
this.listLoading = true;
@ -190,43 +193,74 @@ export default {
},
//
exportData() {
if (this.dayDate.length == 0) {
this.initializeTimeDate();
}
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
pageNum: this.queryParams.pageNum,
pageSize: this.total,
startDate: this.dayDate[0],
endDate: this.dayDate[1],
buildingId: this.building,
deviceType: "18",
};
console.log("导出数据参数", data);
analyzeExport(data).then((res) => {
console.log("导出返回", res);
if (res) {
//
// blob URL
const url = window.URL.createObjectURL(new Blob([res]));
// <a>hrefdownload
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "机房能耗报表.xls"); //
//
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// blob URL
window.URL.revokeObjectURL(url);
this.$message({
type: "success",
message: "导出成功!",
console.log("查询数据参数", data);
queryDeviceDatas(data).then((res) => {
console.log("返回", res);
if (res.code == 200) {
import("@/assets/excel/Export2Excel").then((excel) => {
var tHeader = [
"所属楼栋",
"设备编号",
"设备名称",
"抄表时间",
"采集读数",
"用量",
"倍率",
"计算量",
]; // excel
var filterVal = [
"buildingName",
"deviceNum",
"deviceName",
"curTime",
"curValue",
"usedValue",
"ratio",
"calcValue",
];
const data = this.formatJson(filterVal, res.rows);
const autoWidth = true;
excel.export_json_to_excel({
header: tHeader, //
data, //
filename: "水表读数报表", //
autoWidth: true, //
});
this.$message({
type: "success",
message: "导出成功!",
});
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
//,
formatJson(filterVal, jsonData) {
return jsonData.map((v) =>
filterVal.map((j) => {
if (j === "installDate") {
return format(v[j]);
} else {
return v[j];
}
})
);
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 6) {
if (columnIndex === 6 || columnIndex === 8) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";

4
src/views/hotWater/overview/index.vue

@ -149,9 +149,9 @@ export default {
console.log("进行赋值", res.rows);
this.chartData1 = res.rows[0].pumpOnline;
this.chartData2 = parseInt(
res.rows[0].deviceNum - res.rows[0].pumpOnline
res.rows[0].pumpNum - res.rows[0].pumpOnline
);
this.allData = res.rows[0].deviceNum;
this.allData = res.rows[0].pumpNum;
const titleFontSize =
(this.$refs.pumpChart_ref.offsetWidth / 100) * 2;
const colorList = ["#ffe21e", "#08c8ff"]; //

Loading…
Cancel
Save