Browse Source

1.生活热水供水监控系统添加:项目总览、能源分析(能耗报表、温度变化表、水位变化表)、用能查询(能耗、水表读数、电表读数)、数据分析四个静态页面内容

2.修改空间区域页面未定义错误
meizhou
selia-zx 2 weeks ago
parent
commit
eec0e3cabb
  1. 3
      package.json
  2. BIN
      src/assets/images/overview1.png
  3. BIN
      src/assets/images/overview2.png
  4. BIN
      src/assets/images/overview3.png
  5. BIN
      src/assets/images/overview4.png
  6. BIN
      src/assets/images/use1.png
  7. BIN
      src/assets/images/use2.png
  8. BIN
      src/assets/images/use3.png
  9. 2
      src/views/centerairC/temHistoryQuery/index.vue
  10. 691
      src/views/hotWater/dataAnalysis/components/analyzeMonth.vue
  11. 638
      src/views/hotWater/dataAnalysis/components/analyzeYear.vue
  12. 448
      src/views/hotWater/dataAnalysis/index.vue
  13. 958
      src/views/hotWater/energyAnalysis/components/energyReport.vue
  14. 779
      src/views/hotWater/energyAnalysis/components/temReport.vue
  15. 779
      src/views/hotWater/energyAnalysis/components/waterReport.vue
  16. 94
      src/views/hotWater/energyAnalysis/index.vue
  17. 439
      src/views/hotWater/energyQuery/components/electReading.vue
  18. 583
      src/views/hotWater/energyQuery/components/energy.vue
  19. 439
      src/views/hotWater/energyQuery/components/waterReading.vue
  20. 439
      src/views/hotWater/energyQuery/index.vue
  21. 735
      src/views/hotWater/overview/index.vue
  22. 2
      src/views/region/index.vue

3
package.json

@ -59,7 +59,8 @@
"vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
"vuex": "3.6.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.6",

BIN
src/assets/images/overview1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
src/assets/images/overview2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
src/assets/images/overview3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
src/assets/images/overview4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
src/assets/images/use1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/assets/images/use2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
src/assets/images/use3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

2
src/views/centerairC/temHistoryQuery/index.vue

@ -125,11 +125,11 @@ export default {
this.monthValue = `${year}-${month}`;
},
mounted() {
this.getList();
this.initChart();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.getChartData();
this.getList();
},
methods: {
tableRowStyle({ row, column, rowIndex, columnIndex }) {

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

@ -0,0 +1,691 @@
<!-- 报表查询-用能查询-年数据 -->
<template>
<div>
<div class="findwatercharts" ref="findwater_ref"></div>
<!-- 表格 -->
<el-table
class="maintable"
header-align="center"
:data="tableData"
style="margin-right: 0.13rem"
:cell-style="tableRowStyle"
>
<el-table-column prop="itemType" label="类别" width="160" fixed="left">
</el-table-column>
<el-table-column align="center" prop="day01" label="1日" width="100">
</el-table-column>
<el-table-column align="center" prop="day02" label="2日" width="100">
</el-table-column>
<el-table-column align="center" prop="day03" label="3日" width="100">
</el-table-column>
<el-table-column align="center" prop="day04" label="4日" width="100">
</el-table-column>
<el-table-column align="center" prop="day05" label="5日" width="100">
</el-table-column>
<el-table-column align="center" prop="day06" label="6日" width="100">
</el-table-column>
<el-table-column align="center" prop="day07" label="7日" width="100">
</el-table-column>
<el-table-column align="center" prop="day08" label="8日" width="100">
</el-table-column>
<el-table-column align="center" prop="day09" label="9日" width="100">
</el-table-column>
<el-table-column align="center" prop="day10" label="10日" width="100">
</el-table-column>
<el-table-column align="center" prop="day11" label="11日" width="100">
</el-table-column>
<el-table-column align="center" prop="day12" label="12日" width="100">
</el-table-column>
<el-table-column align="center" prop="day13" label="13日" width="100">
</el-table-column>
<el-table-column align="center" prop="day14" label="14日" width="100">
</el-table-column>
<el-table-column align="center" prop="day15" label="15日" width="100">
</el-table-column>
<el-table-column align="center" prop="day16" label="16日" width="100">
</el-table-column>
<el-table-column align="center" prop="day17" label="17日" width="100">
</el-table-column>
<el-table-column align="center" prop="day18" label="18日" width="100">
</el-table-column>
<el-table-column align="center" prop="day19" label="19日" width="100">
</el-table-column>
<el-table-column align="center" prop="day20" label="20日" width="100">
</el-table-column>
<el-table-column align="center" prop="day21" label="21日" width="100">
</el-table-column>
<el-table-column align="center" prop="day22" label="22日" width="100">
</el-table-column>
<el-table-column align="center" prop="day23" label="23日" width="100">
</el-table-column>
<el-table-column align="center" prop="day24" label="24日" width="100">
</el-table-column>
<el-table-column align="center" prop="day25" label="25日" width="100">
</el-table-column>
<el-table-column align="center" prop="day26" label="26日" width="100">
</el-table-column>
<el-table-column align="center" prop="day27" label="27日" width="100">
</el-table-column>
<el-table-column align="center" prop="day28" label="28日" width="100">
</el-table-column>
<el-table-column align="center" prop="day29" label="29日" width="100">
</el-table-column>
<el-table-column align="center" prop="day30" label="30日" width="100">
</el-table-column>
<el-table-column align="center" prop="day31" label="31日" width="100">
</el-table-column>
<el-table-column
align="center"
prop="totalValue"
label="合计"
fixed="right"
width="130"
>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { getDay, getMonth, getYear } from "@/utils/datetime";
import * as echarts from "echarts";
export default {
props: {
chType: {
type: Number,
},
chTime: {
type: String,
},
jtData: {
type: String,
},
},
data() {
return {
chartInstance1: null,
option1: {
series: [],
},
//
endTime: "",
//
tableData: [],
// 线
data1: [],
data2: [],
data3: [],
data4: [],
data5: [],
//
data6: [],
// x
data8: [],
};
},
watch: {
chType: {
immediate: true,
deep: true,
handler(newVal, val) {
// console.log("", newVal);
this.$nextTick(function () {
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.initChart1();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
tableRowStyle({ row, column, rowIndex, columnIndex }) {
// 1
if (columnIndex === 0) {
return "background-color: #31354e !important;";
}
},
//
getMothData() {
//
//
// id
// select
if (this.chTime) {
this.endTime = this.chTime;
} else {
this.endTime = getMonth(0)
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
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();
// }
// });
},
//
outTable() {
// console.log("");
import("@/assets/excel/Export2Excel").then((excel) => {
const tHeader = [
"类别",
"1日",
"2日",
"3日",
"4日",
"5日",
"6日",
"7日",
"8日",
"9日",
"10日",
"11日",
"12日",
"13日",
"14日",
"15日",
"16日",
"17日",
"18日",
"19日",
"20日",
"21日",
"22日",
"23日",
"24日",
"25日",
"26日",
"27日",
"28日",
"29日",
"30日",
"31日",
"合计",
]; // excel
const filterVal = [
"itemType",
"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",
"totalValue",
]; // excel
// const list = this.tableData;
// console.log(list)
if (this.chTime) {
this.endTime = this.chTime;
} else {
this.endTime = getMonth(0)
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
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, //
// });
// }
// });
});
},
//,
formatJson(filterVal, jsonData) {
return jsonData.map((v) =>
filterVal.map((j) => {
if (j === "installDate") {
return format(v[j]);
} else {
return v[j];
}
})
);
},
//chartInstance1
// x 1 2 3
// x 1 2 3
initChart1() {
this.$emit("initChart1");
this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
this.option1 = {
tooltip: {
trigger: "axis",
// hover
showDelay: 0, // ms
axisPointer: {
type: "shadow",
shadowStyle: {
color: "rgba(30, 69, 113, 0.15)",
width: "1",
},
},
},
legend: {
// icon
// icon: "cricle",
//
textStyle: {
color: "#ffff",
fontSize: 12, //
},
left: "56%",
top: "5%",
//
itemGap: 5,
itemWidth: 10,
itemHeight: 5,
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0,
// rotate: 30, //x30
color: "rgba(255,255,255,.7)",
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
},
},
//splitLine: { show: true } //x线
},
yAxis: [
//y
{
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
},
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
},
},
//y线
splitNumber: 10,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
},
},
},
{
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
formatter: "{value} %",
},
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
},
},
//y线
splitNumber: 5,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
},
},
},
],
series: [
{
type: "bar",
barWidth: 10, //
// tooltip: {
// valueFormatter: function (value) {
// return value + "";
// },
// },
//线
itemStyle: {
color: "#db9215",
lineStyle: {
color: "#db9215", //线
},
},
},
{
type: "bar",
// tooltip: {
// valueFormatter: function (value) {
// return value + "";
// },
// },
barWidth: 10, //
//线
itemStyle: {
color: "#1ab395",
lineStyle: {
color: "#1ab395", //线
},
},
},
{
type: "line",
tooltip: {
valueFormatter: function (value) {
return value + "%";
},
},
// stack: 'Total',
symbol: "circle",
//
symbolSize: 6,
yAxisIndex: 1,
//
showSymbol: false,
// data: this.data3,
//线
itemStyle: {
color: "#e23131",
lineStyle: {
color: "#e23131", //线
},
},
},
{
type: "line",
tooltip: {
valueFormatter: function (value) {
return value + "%";
},
},
// stack: 'Total',
symbol: "circle",
//
symbolSize: 6,
//y
yAxisIndex: 1,
//
showSymbol: false,
// data: this.data4,
//线
itemStyle: {
color: "#4a98ff",
lineStyle: {
color: "#4a98ff", //线
},
},
},
],
};
//
this.chartInstance1.setOption(this.option1, true);
},
// 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = (this.$refs.findwater_ref.offsetWidth / 100) * 1.8;
//optionoption
const adapterOption = {
//fontSize
textStyle: {
fontSize: titleFontSize,
},
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
},
},
};
</script>
<style scoped>
.findwatercharts {
margin-bottom: 0.35rem;
width: 100%;
height: 4.5rem;
/* background-color: pink; */
}
</style>

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

@ -0,0 +1,638 @@
<!-- 报表查询-用能查询-年数据 -->
<template>
<div>
<div class="findwatercharts" ref="findwater_ref"></div>
<!-- 表格 -->
<el-table
class="maintable"
header-align="center"
:data="tableData"
style="margin-right: 0.13rem"
:cell-style="tableRowStyle"
>
<el-table-column
align="center"
prop="itemType"
label="类别"
width="160"
fixed="left"
>
</el-table-column>
<el-table-column align="center" prop="month01" label="1月">
</el-table-column>
<el-table-column align="center" prop="month02" label="2月">
</el-table-column>
<el-table-column align="center" prop="month03" label="3月">
</el-table-column>
<el-table-column align="center" prop="month04" label="4月">
</el-table-column>
<el-table-column align="center" prop="month05" label="5月">
</el-table-column>
<el-table-column align="center" prop="month06" label="6月">
</el-table-column>
<el-table-column align="center" prop="month07" label="7月">
</el-table-column>
<el-table-column align="center" prop="month08" label="8月">
</el-table-column>
<el-table-column align="center" prop="month09" label="9月">
</el-table-column>
<el-table-column align="center" prop="month10" label="10月">
</el-table-column>
<el-table-column align="center" prop="month11" label="11月">
</el-table-column>
<el-table-column align="center" prop="month12" label="12月">
</el-table-column>
<el-table-column
align="center"
prop="totalValue"
label="合计"
fixed="right"
width="100"
>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { getYear } from "@/utils/datetime";
import * as echarts from "echarts";
export default {
props: {
chType: {
type: Number,
},
chTime: {
type: String,
},
jtData: {
type: String,
},
},
data() {
return {
chartInstance1: null,
option1: {
series: [],
},
//
endTime: "",
//
tableData: [],
// 线
data1: [],
data2: [],
data3: [],
data4: [],
data5: [],
//
data6: [],
// x
data8: [],
};
},
watch: {
chType: {
immediate: true,
deep: true,
handler(newVal, val) {
// console.log("", newVal);
this.$nextTick(function () {
this.getYearData();
});
},
},
// vuexid
jtData: {
handler(newVal, oldVal) {
// console.log("vuexid", newVal, oldVal);
this.$nextTick(function () {
this.getYearData();
});
},
deep: true,
immediate: true,
},
},
mounted() {
this.getYearData();
this.initChart1();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
tableRowStyle({ row, column, rowIndex, columnIndex }) {
// 1
if (columnIndex === 0) {
return "background-color: #31354e !important;";
}
},
//
getYearData() {
//
//
// id
// select
if (this.chTime) {
this.endTime = this.chTime;
} else {
this.endTime = getYear(0);
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
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();
// }
// });
},
//
outTable() {
// console.log("");
import("@/assets/excel/Export2Excel").then((excel) => {
const tHeader = [
"类别",
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月",
"合计",
]; // excel
const filterVal = [
"itemType",
"month01",
"month02",
"month03",
"month04",
"month05",
"month06",
"month07",
"month08",
"month09",
"month10",
"month11",
"month12",
"totalValue",
]; // excel
// const list = this.tableData;
// console.log(list)
if (this.chTime) {
this.endTime = this.chTime;
} else {
this.endTime = getYear(0);
}
let params = {
curDate: this.endTime,
buildingId: this.endId,
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, //
// });
// }
// });
});
},
//,
formatJson(filterVal, jsonData) {
return jsonData.map((v) =>
filterVal.map((j) => {
if (j === "installDate") {
return format(v[j]);
} else {
return v[j];
}
})
);
},
//chartInstance1
// x 1 2 3
// x 1 2 3
initChart1() {
this.$emit("initChart1");
this.chartInstance1 = echarts.init(this.$refs.findwater_ref);
this.option1 = {
tooltip: {
trigger: "axis",
// hover
showDelay: 0, // ms
axisPointer: {
type: "shadow",
shadowStyle: {
color: "rgba(30, 69, 113, 0.15)",
width: "1",
},
},
},
legend: {
// icon
// icon: "cricle",
//
textStyle: {
color: "#ffff",
fontSize: 12, //
},
left: "56%",
top: "5%",
//
itemGap: 5,
itemWidth: 10,
itemHeight: 5,
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0,
// rotate: 30, //x30
color: "rgba(255,255,255,.7)",
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
},
},
//splitLine: { show: true } //x线
},
yAxis: [
//y
{
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
},
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
},
},
//y线
splitNumber: 10,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
},
},
},
{
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,.7)",
formatter: "{value} %",
},
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#707070",
},
},
//y线
splitNumber: 5,
// y线
splitLine: {
lineStyle: {
// color: "#252843",
color: "#707070",
},
},
},
],
series: [
{
type: "bar",
barWidth: 10, //
//线
itemStyle: {
color: "#db9215",
lineStyle: {
color: "#db9215", //线
},
},
},
{
type: "bar",
// tooltip: {
// valueFormatter: function (value) {
// return value + "";
// },
// },
tooltip: {
trigger: "axis",
formatter: function (params) {
//
var relVal = params[0].name; //x
if (params[0].seriesName == "2022年用水量") {
relVal =
params[0].name +
"<br/>" +
params[0].seriesName +
" : " +
params[0].value +
" 吨";
} else if (params[0].seriesName == "用电量") {
relVal =
params[0].name +
"<br/>" +
params[0].seriesName +
" : " +
params[0].value +
" 度";
} else if (params[0].seriesName == "耗能") {
relVal =
params[0].name +
"<br/>" +
params[0].seriesName +
" : " +
params[0].value +
" 度/吨";
} else {
relVal =
params[0].name +
"<br/>" +
params[0].seriesName +
" : " +
params[0].value +
" 次";
}
return relVal;
},
},
barWidth: 10, //
//线
itemStyle: {
color: "#1ab395",
lineStyle: {
color: "#1ab395", //线
},
},
},
{
type: "line",
tooltip: {
valueFormatter: function (value) {
return value + "%";
},
},
// stack: 'Total',
symbol: "circle",
//
symbolSize: 6,
yAxisIndex: 1,
//
showSymbol: false,
// data: this.data3,
//线
itemStyle: {
color: "#e23131",
lineStyle: {
color: "#e23131", //线
},
},
},
{
type: "line",
tooltip: {
valueFormatter: function (value) {
return value + "%";
},
},
// stack: 'Total',
symbol: "circle",
//
symbolSize: 6,
//y
yAxisIndex: 1,
//
showSymbol: false,
// data: this.data4,
//线
itemStyle: {
color: "#4a98ff",
lineStyle: {
color: "#4a98ff", //线
},
},
},
],
};
//
this.chartInstance1.setOption(this.option1, true);
},
// 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = (this.$refs.findwater_ref.offsetWidth / 100) * 1.8;
//optionoption
const adapterOption = {
//fontSize
textStyle: {
fontSize: titleFontSize,
},
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
},
},
};
</script>
<style scoped>
.findwatercharts {
margin-bottom: 0.35rem;
width: 100%;
height: 4.5rem;
/* background-color: pink; */
}
</style>

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

@ -0,0 +1,448 @@
<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">
<img
class="title-bg"
src="../../../assets/images/title-bg.png"
alt=""
/>
<div class="title-word">位置{{ currentName }}</div>
</div>
</div>
<!-- 条件 -->
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="analysisType"
placeholder="请选择"
clearable
>
<el-option
v-for="(item, index) in analysisTypes"
:key="index"
:label="item.label"
:value="item.value"
/>
</el-select>
<div class="choice">
<div
class="mr20"
v-for="(item, index) in timeData2"
:key="index"
@click="handleEnter(index, $event)"
:class="{ timeStyle: currentIndex == index }"
>
{{ item.title }}
</div>
</div>
<el-date-picker
v-model="monthDate"
type="month"
v-if="currentIndex === 0"
placeholder="选择开始月份"
value-format="yyyy-MM"
>
</el-date-picker>
<el-date-picker
v-model="yearDate"
v-if="currentIndex === 1"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<analyze-month
v-if="currentIndex === 0"
ref="monthRef"
:chType="analysisType"
:chTime="monthDate"
></analyze-month>
<analyze-year
v-if="currentIndex === 1"
ref="yearRef"
:chType="analysisType"
:chTime="yearDate"
></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 analyzeMonth from "./components/analyzeMonth.vue";
import analyzeYear from "./components/analyzeYear.vue";
export default {
components: { analyzeMonth, analyzeYear },
data() {
return {
loading: false,
treeData: [],
analysisType: 1,
analysisTypes: [
{
label: "用水量",
value: 1,
},
{
label: "用电量",
value: 2,
},
{
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: [],
};
},
mounted() {
this.getSysBuild();
},
methods: {
handleEnter(index) {
this.currentIndex = index;
// this.renderingBroken();
},
getSysBuild() {
spaceTree().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();
}
});
}
});
},
// 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) {
//
this.$refs.monthRef.getMothData();
} else {
//
this.$refs.yearRef.getYearData();
}
},
//
exportData() {
if (this.currentIndex == 0) {
//
this.$refs.monthRef.outTable();
} else {
//
this.$refs.yearRef.outTable();
}
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
}
}
.app-container {
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: nowrap;
align-items: stretch;
height: 100%;
.left-tree {
width: 256px;
padding: 15px 10px 10px 10px;
border: 1px solid #004b8c;
}
.right-monitor {
width: calc(100% - 280px);
display: flex;
flex-direction: column;
justify-content: flex-start;
.buildingDiv {
padding-left: 54px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
position: relative;
.title-bg {
width: 208px;
height: 38px;
position: absolute;
left: 0;
z-index: 0;
}
.title-word {
z-index: 10;
font-family: YouSheBiaoTiHei;
font-size: 24px;
color: #ffffff;
white-space: nowrap;
}
}
}
}
.choice {
margin-left: 0px;
.mr20 {
padding: 0.05rem 0.3rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 870px;
height: 300px;
}
.tree-container {
height: 330px; /* 设置固定高度 */
overflow-y: auto; /* 启用垂直滚动条 */
}
//
:-webkit-scrollbar {
width: 10px; /* 滚动条宽度 */
}
::-webkit-scrollbar-track {
background: transparent !important; /* 滚动条轨道背景色 */
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
.tree-left {
.custom-tree-icon {
margin-right: 5px;
}
}
}
@media (min-width: 1200px) and (max-width: 1540px) {
.tem-li {
width: calc(49% - 20px) !important;
}
}
@media (max-width: 1200px) {
.tem-li {
width: calc(100% - 40px) !important;
}
}
</style>
<style scoped>
/* 自定义高亮颜色 */
.left-tree
>>> .el-tree--highlight-current
.el-tree-node.is-current
> .el-tree-node__content {
background-color: #285b9e !important;
/* color: #f56c6c; */
color: #25f1f8;
}
</style>

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

@ -0,0 +1,958 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="data-content">
<div class="data-li type2">
<img class="use-icon" src="../../../../assets/images/use1.png" alt="" />
<div class="use-text">
<div>用水量()</div>
<div class="data-text">2</div>
</div>
<div class="use-text">
<div>与昨日相比</div>
<div class="downText">
<i class="el-icon-bottom"></i>
<span>-10%</span>
</div>
</div>
<img
class="type-img"
src="../../../../assets/images/texture2.png"
alt=""
/>
</div>
<div class="data-li type3">
<img class="use-icon" src="../../../../assets/images/use2.png" alt="" />
<div class="use-text">
<div>用电量()</div>
<div class="data-text">31.600</div>
</div>
<div class="use-text">
<div>与昨日相比</div>
<div class="upText">
<i class="el-icon-top"></i>
<span>64.41%</span>
</div>
</div>
<img
class="type-img"
src="../../../../assets/images/texture2.png"
alt=""
/>
</div>
<div class="data-li type4">
<img class="use-icon" src="../../../../assets/images/use3.png" alt="" />
<div class="use-text">
<div>单耗(/)</div>
<div class="data-text">2</div>
</div>
<div class="use-text">
<div>与昨日相比</div>
<div class="upText">
<i class="el-icon-top"></i>
<span>64.41%</span>
</div>
</div>
<img
class="type-img"
src="../../../../assets/images/texture2.png"
alt=""
/>
</div>
</div>
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.label"
:value="item.id"
/>
</el-select>
<div class="time-label">时间类型:</div>
<el-radio-group
v-model="dateType"
style="margin-right: 0.24rem"
@change="updateDateType"
>
<el-radio label="day"></el-radio>
<el-radio label="month"></el-radio>
<el-radio label="year"></el-radio>
</el-radio-group>
<el-date-picker
v-model="dayDate"
type="daterange"
v-if="dateType == 'day'"
:key="this.dateType"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<el-date-picker
v-model="monthDate"
type="monthrange"
v-if="dateType == 'month'"
:key="this.dateType"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
value-format="yyyy-MM"
@change="dateChange"
>
</el-date-picker>
<div class="years-div" v-if="dateType == 'year'" :key="this.dateType">
<el-date-picker
v-model="startYear"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="years-word"></div>
<el-date-picker
v-model="endYear"
type="year"
placeholder="选择结束年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
</div>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<div class="choice">
<div
class="mr20"
v-for="(item, index) in timeData2"
:key="index"
@click="handleEnter(index, $event)"
:class="{ timeStyle: currentIndex == index }"
>
{{ item.title }}
</div>
</div>
<div class="charts" ref="chart_ref"></div>
<el-table
v-loading="loading"
:data="postList"
stripe
:cell-style="tableRowStyle"
>
<el-table-column label="日期" align="center" prop="dateAndWeek" />
<el-table-column label="所属楼栋" align="center" prop="maxTemp" />
<el-table-column label="用水量(吨)" align="center" prop="minTemp" />
<el-table-column
label="用电量(度)"
align="center"
prop="weatherConditions"
/>
<el-table-column
label="单耗(度/吨)"
align="center"
prop="windDirection"
/>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { formatDay } from "@/utils/datetime";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { spaceTree } from "@/api/region";
import * as echarts from "echarts";
export default {
data() {
return {
listLoading: false,
dateType: "day", //
dayDate: [], //
monthDate: [], //
startYear: "", //
endYear: "", //
dialogVisible: false,
building: "", //
builds: [], //
//
loading: true,
//
total: 0,
//
postList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
startTime: "",
endTime: "",
},
brokenInstanc: null,
brokenOption: {},
timeData2: [{ title: "用水量" }, { title: "用电量" }, { title: "单耗" }],
currentIndex: 0,
brokenData1: [],
brokenData2: [],
brokenData3: [],
brokenTime: [],
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getBuildList();
this.getList();
this.initChart();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.getChartData();
},
destroyed() {
//
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
handleEnter(index) {
this.currentIndex = index;
this.renderingBroken();
},
/** 查询楼栋 */
getBuildList() {
spaceTree().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);
}
this.builds = newRes.data[0].children[0].children[0].children;
// console.log("", this.builds);
this.building = this.builds[0].id;
this.getList();
}
});
},
// 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
);
}
}
},
//
initializeTimeDate() {
const now = new Date();
//
const start = new Date(now.getFullYear(), now.getMonth(), 1);
//
const end = new Date(now.getFullYear(), now.getMonth(), now.getDate());
this.dayDate = [formatDay(start), formatDay(end)]; //
},
//
updateDateType() {
// this.dateType = this.radio;
console.log(this.dateType);
(this.dayDate = []), //
(this.monthDate = []), //
(this.startYear = ""), //
(this.endYear = ""); //
},
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
if (!this.monthDate) {
this.$nextTick(() => {
this.monthDate = [];
});
}
},
//
findData() {
console.log("this.dateType", this.dateType);
switch (this.dateType) {
case "day":
if (this.dayDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const newLength =
new Date(this.dayDate[1]).getTime() -
new Date(this.dayDate[0]).getTime();
const dayDiff = Math.floor(newLength / (1000 * 60 * 60 * 24));
if (dayDiff > 31) {
this.showMessage(
"最多只能选择30天区间,请重新选择再查询!",
"warning"
);
} else {
this.getList();
}
}
break;
case "month":
if (this.monthDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const [start, end] = this.monthDate;
const startDate = new Date(start);
const endDate = new Date(end);
const startYear = startDate.getFullYear();
const startMonth = startDate.getMonth();
const endYear = endDate.getFullYear();
const endMonth = endDate.getMonth();
const monthDiff =
(endYear - startYear) * 12 + (endMonth - startMonth);
if (monthDiff > 12) {
this.showMessage(
"最多只能选择12个月区间,请重新选择再查询!",
"warning"
);
} else {
this.getList();
}
}
break;
case "year":
if (!this.startYear || !this.endYear) {
this.showMessage("请选择全年份区间!", "warning");
} else if (this.startYear > this.endYear) {
this.showMessage("结束年份要大于开始年份!", "warning");
} else {
this.getList();
}
break;
default:
break;
}
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getList() {
if (this.dateType == "day") {
this.queryParams.startTime =
this.dayDate.length > 0 ? this.dayDate[0] : "";
this.queryParams.endTime =
this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.queryParams.startTime =
this.monthDate.length > 0 ? this.monthDate[0] : "";
this.queryParams.endTime =
this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.queryParams.startTime = this.startYear),
(this.queryParams.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.queryParams.endTime,
building: this.building,
};
console.log("查询数据参数", data);
this.listLoading = true;
//
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
getChartData() {
this.queryParams.pageNum = 0;
console.log("图表参数", this.queryParams);
this.brokenData1 = [30, 40, 29];
this.brokenData2 = [10, 23, 12];
this.brokenData3 = [3, 4, 2];
this.brokenTime = ["3月", "4月", "5月"];
// weatherTempData(this.queryParams).then((response) => {
// console.log("");
// if (response.rows.length > 0) {
// let data = response.rows;
// let timeValue = [];
// let hightValue = [];
// let lowValue = [];
// data.forEach((element) => {
// timeValue.push(element.weatherDate);
// hightValue.push(element.maxTemp);
// lowValue.push(element.minTemp);
// });
// let adapterOption = {};
// adapterOption = {
// xAxis: {
// data: timeValue,
// },
// series: [
// {
// data: hightValue,
// //线
// itemStyle: {
// color: "rgb(18, 126, 226)", //线
// },
// lineStyle: {
// color: "rgb(18, 126, 226)", //线
// },
// },
// {
// data: lowValue,
// //线
// itemStyle: {
// color: "rgb(250, 169, 19)", //线
// },
// lineStyle: {
// color: "rgb(250, 169, 19)", //线
// },
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.brokenInstanc.setOption(adapterOption);
// //resize
// this.brokenInstanc.resize();
// } else {
// let adapterOption = {};
// adapterOption = {
// xAxis: {
// data: [],
// },
// series: [
// {
// data: [],
// },
// {
// data: [],
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.brokenInstanc.setOption(adapterOption);
// //resize
// this.brokenInstanc.resize();
// }
// });
this.renderingBroken();
},
renderingBroken() {
if (this.currentIndex === 0) {
this.brokenOption.series[0].data = this.brokenData1;
this.brokenOption.series[0].itemStyle.color = "#d48e17";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(212, 142, 23, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(212, 142, 23,0)", // 100%
},
];
} else if (this.currentIndex === 1) {
this.brokenOption.series[0].data = this.brokenData2;
this.brokenOption.series[0].itemStyle.color = "#1ab395";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(26, 179, 149, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(26, 179, 149,0)", // 100%
},
];
} else if (this.currentIndex === 2) {
this.brokenOption.series[0].data = this.brokenData3;
this.brokenOption.series[0].itemStyle.color = "#1f8dee";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(31, 141, 238, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(31, 141, 238,0)", // 100%
},
];
}
//
const currentIndex = this.currentIndex;
// tooltip
this.brokenOption.tooltip = {
trigger: "axis",
formatter: function (params) {
//
const data = params[0];
const month = data.name;
const value = data.value;
//
if (currentIndex === 0) {
return `${month}<br/>用水量: ${value}`;
} else if (currentIndex === 1) {
return `${month}<br/>用电量: ${value}`;
} else if (currentIndex === 2) {
return `${month}<br/>单耗: ${value} 度/吨`;
}
},
};
this.brokenOption.xAxis.data = this.brokenTime;
this.brokenInstanc.setOption(this.brokenOption);
},
//
exportData() {
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
};
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: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
//
if (columnIndex === 1) {
return "color: #fd1e00;!important;text-align:center";
}
if (columnIndex === 2) {
return "color: #3390ff;!important;text-align:center";
}
if (columnIndex === 4) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";
},
// 线+ + 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = this.$refs.chart_ref.offsetWidth / 130;
//optionoption
const adapterOption = {};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
},
//chartInstance
initChart() {
this.brokenInstanc = echarts.init(this.$refs.chart_ref);
this.brokenOption = {
tooltip: {
trigger: "axis",
},
legend: {
show: false,
selectedMode: false, //
icon: "cricle", //
//
textStyle: {
color: "#ffff",
fontSize: 16, //
},
// left: "73%",
left: "66%",
top: "0",
//
itemGap: 5,
itemWidth: 10,
itemHeight: 5,
},
grid: {
top: "4%",
left: "3%",
right: "4%",
bottom: "5%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
fontSize: 14, //
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
data: this.brokenTime,
},
yAxis: {
min: 0,
// max:20,
// // // min:'dataMin',
// // // max:'dataMax',
// name: "kwh", // y
// name
nameTextStyle: {
color: "rgba(255, 255, 255, 1)",
fontSize: 12,
},
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
series: [
{
type: "line",
//
symbolSize: 8,
smooth: true,
showSymbol: false,
data: this.brokenData1,
//线
itemStyle: {
color: "#d48e17", //线
lineStyle: {
color: "#d48e17", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [],
},
},
},
],
};
//
this.brokenInstanc.setOption(this.brokenOption, true);
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.data-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
margin-top: 23px;
.data-li {
background-color: transparent;
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0.3rem;
width: 31%;
justify-content: space-between;
margin-bottom: 0.24rem;
font-family: SourceHanSansCN-Regular;
font-size: 0.16rem;
position: relative;
overflow: hidden;
.use-icon {
width: 0.6rem;
height: 0.6rem;
}
.use-text {
width: 33%;
display: flex;
flex-direction: column;
align-items: flex-start;
color: #dbdbdb;
.data-text {
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
color: #ffffff;
}
.downText {
color: #ff4027;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom {
margin-right: 0.08rem;
}
}
.upText {
color: #2ff016;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom,
.el-icon-top {
margin-right: 0.08rem;
}
}
}
}
.type-img {
position: absolute;
bottom: 0;
width: 3.17rem;
height: 0.52rem;
z-index: 10;
}
.type1 {
border: 1px solid #e8aa13;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(26, 56, 65, 0.5), rgba(184, 196, 51, 0.5));
}
.type1::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(243, 166, 23, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type2 {
border: 1px solid #27a0f2;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 43, 88, 0.5), rgba(8, 96, 179, 0.5));
}
.type2::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(28, 128, 241, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type3 {
border: 1px solid #1ad3ef;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 50, 89, 0.5), rgba(17, 145, 151, 0.5));
}
.type3::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(117, 242, 248, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type4 {
border: 1px solid #11d47b;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 57, 82, 0.5), rgba(5, 91, 90, 0.5));
}
.type4::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(115, 245, 176, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
}
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 100%;
height: 300px;
margin-bottom: 0.1rem;
}
// 2000px
@media (min-width: 2000px) {
.condition {
.condition-left {
.years-div {
.years-word {
font-size: 0.14rem !important;
margin: 0 0.05rem !important;
}
}
.time-label {
font-size: 0.16rem !important;
line-height: 0.07rem !important;
margin-right: 0.12rem !important;
}
}
}
}
</style>

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

@ -0,0 +1,779 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.label"
:value="item.id"
/>
</el-select>
<el-date-picker
v-model="dayDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<div class="charts" ref="chart_ref"></div>
<el-table
:data="postList"
stripe
:cell-style="tableRowStyle"
@row-click="handlerow"
highlight-current-row
height="500"
>
<el-table-column label="楼栋名称" align="center" prop="dateAndWeek" />
<el-table-column label="0点" align="center" prop="maxTemp" />
<el-table-column label="2点" align="center" prop="minTemp" />
<el-table-column label="6点" align="center" prop="minTemp" />
<el-table-column label="8点" align="center" prop="minTemp" />
<el-table-column label="11点" align="center" prop="minTemp" />
<el-table-column label="13点" align="center" prop="minTemp" />
<el-table-column label="14点" align="center" prop="minTemp" />
<el-table-column label="15点" align="center" prop="minTemp" />
<el-table-column label="16点" align="center" prop="minTemp" />
<el-table-column label="17点" align="center" prop="minTemp" />
<el-table-column label="18点" align="center" prop="minTemp" />
<el-table-column label="19点" align="center" prop="minTemp" />
<el-table-column label="20点" align="center" prop="minTemp" />
<el-table-column label="21点" align="center" prop="minTemp" />
<el-table-column label="22点" align="center" prop="minTemp" />
<el-table-column label="23点" align="center" prop="minTemp" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { formatDay } from "@/utils/datetime";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { spaceTree } from "@/api/region";
import * as echarts from "echarts";
export default {
data() {
return {
listLoading: false,
dayDate: [], //
dialogVisible: false,
building: "", //
builds: [], //
//
loading: false,
//
total: 0,
//
postList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
startTime: "",
endTime: "",
},
brokenInstanc: null,
brokenOption: {},
brokenData1: [],
brokenTime: [],
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getBuildList();
this.getList();
this.initChart();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.getChartData();
},
destroyed() {
//
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询楼栋 */
getBuildList() {
spaceTree().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);
}
this.builds = newRes.data[0].children[0].children[0].children;
// console.log("", this.builds);
this.building = this.builds[0].id;
this.getList();
}
});
},
// 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
);
}
}
},
//
initializeTimeDate() {
this.dayDate = formatDay(new Date()); //
},
//
findData() {
this.getList();
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getList() {
let data = {
startTime: this.dayDate,
endTime: this.dayDate,
building: this.building,
};
console.log("查询数据参数", data);
this.listLoading = true;
//
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
getChartData() {
this.queryParams.pageNum = 0;
console.log("图表参数", this.queryParams);
this.brokenData1 = [30, 40, 29];
this.brokenTime = ["3月", "4月", "5月"];
this.brokenOption.series[0].data = this.brokenData1;
this.brokenOption.series[0].itemStyle.color = "#1f8dee";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(31, 141, 238, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(31, 141, 238,0)", // 100%
},
];
// tooltip
this.brokenOption.tooltip = {
trigger: "axis",
formatter: function (params) {
//
const data = params[0];
const month = data.name;
const value = data.value;
return `${month}<br/>温度: ${value}`;
},
};
this.brokenOption.xAxis.data = this.brokenTime;
this.brokenInstanc.setOption(this.brokenOption);
// weatherTempData(this.queryParams).then((response) => {
// console.log("");
// if (response.rows.length > 0) {
// let data = response.rows;
// let timeValue = [];
// let hightValue = [];
// let lowValue = [];
// data.forEach((element) => {
// timeValue.push(element.weatherDate);
// hightValue.push(element.maxTemp);
// lowValue.push(element.minTemp);
// });
// let adapterOption = {};
// adapterOption = {
// xAxis: {
// data: timeValue,
// },
// series: [
// {
// data: hightValue,
// //线
// itemStyle: {
// color: "rgb(18, 126, 226)", //线
// },
// lineStyle: {
// color: "rgb(18, 126, 226)", //线
// },
// },
// {
// data: lowValue,
// //线
// itemStyle: {
// color: "rgb(250, 169, 19)", //线
// },
// lineStyle: {
// color: "rgb(250, 169, 19)", //线
// },
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.brokenInstanc.setOption(adapterOption);
// //resize
// this.brokenInstanc.resize();
// } else {
// let adapterOption = {};
// adapterOption = {
// xAxis: {
// data: [],
// },
// series: [
// {
// data: [],
// },
// {
// data: [],
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.brokenInstanc.setOption(adapterOption);
// //resize
// this.brokenInstanc.resize();
// }
// });
},
//
handlerow(row, event, column) {
// console.log("----", row)
if (row) {
const obj = Object.assign({}, row);
//
delete obj.buildingID;
delete obj.curDate;
delete obj.pumpID;
delete obj.pumpName;
delete obj.buildingName;
//
let newObj = {};
for (let key in obj) {
if (obj[key]) {
newObj[key] = obj[key];
}
}
// console.log("", newObj);
// key
// Object.setPrototypeOf(this.newObj);
// let data7 = Object.keys(newObj);
// console.log("x", data7);
const keysArr = Object.keys(newObj); //
this.brokenTime = [];
keysArr.forEach((item) => {
if (item) {
this.brokenTime.push(item.split("temp").join("") + ":00");
}
});
const valuesArr = keysArr.map((key) => newObj[key]); //
// console.log("", valuesArr);
// console.log("", this.brokenTime);
this.brokenData1 = valuesArr;
const adapterOption = {
xAxis: {
data: this.brokenTime,
},
series: [
{
name: "温度",
data: this.brokenData1,
itemStyle: {
color: "#1f8dee",
},
areaStyle: {
color: {
colorStops: [
{
offset: 0,
color: "rgba(31, 141, 238, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(31, 141, 238,0)", // 100%
},
],
},
},
},
],
};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
} else {
const adapterOption = {
xAxis: {
data: [],
},
series: [
{
name: "温度",
data: [],
},
],
};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
}
},
//
exportData() {
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
};
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: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
//
if (columnIndex === 1) {
return "color: #fd1e00;!important;text-align:center";
}
if (columnIndex === 2) {
return "color: #3390ff;!important;text-align:center";
}
if (columnIndex === 4) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";
},
// 线+ + 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = this.$refs.chart_ref.offsetWidth / 130;
//optionoption
const adapterOption = {};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
},
//chartInstance
initChart() {
this.brokenInstanc = echarts.init(this.$refs.chart_ref);
this.brokenOption = {
tooltip: {
trigger: "axis",
},
legend: {
show: false,
selectedMode: false, //
icon: "cricle", //
//
textStyle: {
color: "#ffff",
fontSize: 16, //
},
// left: "73%",
left: "66%",
top: "0",
//
itemGap: 5,
itemWidth: 10,
itemHeight: 5,
},
grid: {
top: "4%",
left: "3%",
right: "4%",
bottom: "5%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
fontSize: 14, //
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
data: this.brokenTime,
},
yAxis: {
min: 0,
// max:20,
// // // min:'dataMin',
// // // max:'dataMax',
// name: "kwh", // y
// name
nameTextStyle: {
color: "rgba(255, 255, 255, 1)",
fontSize: 12,
},
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
series: [
{
type: "line",
//
symbolSize: 8,
smooth: true,
showSymbol: false,
data: this.brokenData1,
//线
itemStyle: {
color: "#d48e17", //线
lineStyle: {
color: "#d48e17", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [],
},
},
},
],
};
//
this.brokenInstanc.setOption(this.brokenOption, true);
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.data-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
margin-top: 23px;
.data-li {
background-color: transparent;
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0.3rem;
width: 31%;
justify-content: space-between;
margin-bottom: 0.24rem;
font-family: SourceHanSansCN-Regular;
font-size: 0.16rem;
position: relative;
overflow: hidden;
.use-icon {
width: 0.6rem;
height: 0.6rem;
}
.use-text {
width: 33%;
display: flex;
flex-direction: column;
align-items: flex-start;
color: #dbdbdb;
.data-text {
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
color: #ffffff;
}
.downText {
color: #ff4027;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom {
margin-right: 0.08rem;
}
}
.upText {
color: #2ff016;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom,
.el-icon-top {
margin-right: 0.08rem;
}
}
}
}
.type-img {
position: absolute;
bottom: 0;
width: 3.17rem;
height: 0.52rem;
z-index: 10;
}
.type1 {
border: 1px solid #e8aa13;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(26, 56, 65, 0.5), rgba(184, 196, 51, 0.5));
}
.type1::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(243, 166, 23, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type2 {
border: 1px solid #27a0f2;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 43, 88, 0.5), rgba(8, 96, 179, 0.5));
}
.type2::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(28, 128, 241, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type3 {
border: 1px solid #1ad3ef;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 50, 89, 0.5), rgba(17, 145, 151, 0.5));
}
.type3::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(117, 242, 248, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type4 {
border: 1px solid #11d47b;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 57, 82, 0.5), rgba(5, 91, 90, 0.5));
}
.type4::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(115, 245, 176, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
}
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 100%;
height: 300px;
margin-bottom: 0.1rem;
}
// 2000px
@media (min-width: 2000px) {
.condition {
.condition-left {
.years-div {
.years-word {
font-size: 0.14rem !important;
margin: 0 0.05rem !important;
}
}
.time-label {
font-size: 0.16rem !important;
line-height: 0.07rem !important;
margin-right: 0.12rem !important;
}
}
}
}
</style>

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

@ -0,0 +1,779 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.label"
:value="item.id"
/>
</el-select>
<el-date-picker
v-model="dayDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<div class="charts" ref="chart_ref"></div>
<el-table
:data="postList"
stripe
:cell-style="tableRowStyle"
@row-click="handlerow"
highlight-current-row
height="500"
>
<el-table-column label="楼栋名称" align="center" prop="dateAndWeek" />
<el-table-column label="0点" align="center" prop="maxTemp" />
<el-table-column label="2点" align="center" prop="minTemp" />
<el-table-column label="6点" align="center" prop="minTemp" />
<el-table-column label="8点" align="center" prop="minTemp" />
<el-table-column label="11点" align="center" prop="minTemp" />
<el-table-column label="13点" align="center" prop="minTemp" />
<el-table-column label="14点" align="center" prop="minTemp" />
<el-table-column label="15点" align="center" prop="minTemp" />
<el-table-column label="16点" align="center" prop="minTemp" />
<el-table-column label="17点" align="center" prop="minTemp" />
<el-table-column label="18点" align="center" prop="minTemp" />
<el-table-column label="19点" align="center" prop="minTemp" />
<el-table-column label="20点" align="center" prop="minTemp" />
<el-table-column label="21点" align="center" prop="minTemp" />
<el-table-column label="22点" align="center" prop="minTemp" />
<el-table-column label="23点" align="center" prop="minTemp" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { formatDay } from "@/utils/datetime";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { spaceTree } from "@/api/region";
import * as echarts from "echarts";
export default {
data() {
return {
listLoading: false,
dayDate: [], //
dialogVisible: false,
building: "", //
builds: [], //
//
loading: false,
//
total: 0,
//
postList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
startTime: "",
endTime: "",
},
brokenInstanc: null,
brokenOption: {},
brokenData1: [],
brokenTime: [],
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getBuildList();
this.getList();
this.initChart();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.getChartData();
},
destroyed() {
//
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询楼栋 */
getBuildList() {
spaceTree().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);
}
this.builds = newRes.data[0].children[0].children[0].children;
// console.log("", this.builds);
this.building = this.builds[0].id;
this.getList();
}
});
},
// 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
);
}
}
},
//
initializeTimeDate() {
this.dayDate = formatDay(new Date()); //
},
//
findData() {
this.getList();
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getList() {
let data = {
startTime: this.dayDate,
endTime: this.dayDate,
building: this.building,
};
console.log("查询数据参数", data);
this.listLoading = true;
//
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
getChartData() {
this.queryParams.pageNum = 0;
console.log("图表参数", this.queryParams);
this.brokenData1 = [30, 40, 29];
this.brokenTime = ["3月", "4月", "5月"];
this.brokenOption.series[0].data = this.brokenData1;
this.brokenOption.series[0].itemStyle.color = "#1f8dee";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(31, 141, 238, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(31, 141, 238,0)", // 100%
},
];
// tooltip
this.brokenOption.tooltip = {
trigger: "axis",
formatter: function (params) {
//
const data = params[0];
const month = data.name;
const value = data.value;
return `${month}<br/>水位: ${value} %`;
},
};
this.brokenOption.xAxis.data = this.brokenTime;
this.brokenInstanc.setOption(this.brokenOption);
// weatherTempData(this.queryParams).then((response) => {
// console.log("");
// if (response.rows.length > 0) {
// let data = response.rows;
// let timeValue = [];
// let hightValue = [];
// let lowValue = [];
// data.forEach((element) => {
// timeValue.push(element.weatherDate);
// hightValue.push(element.maxTemp);
// lowValue.push(element.minTemp);
// });
// let adapterOption = {};
// adapterOption = {
// xAxis: {
// data: timeValue,
// },
// series: [
// {
// data: hightValue,
// //线
// itemStyle: {
// color: "rgb(18, 126, 226)", //线
// },
// lineStyle: {
// color: "rgb(18, 126, 226)", //线
// },
// },
// {
// data: lowValue,
// //线
// itemStyle: {
// color: "rgb(250, 169, 19)", //线
// },
// lineStyle: {
// color: "rgb(250, 169, 19)", //线
// },
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.brokenInstanc.setOption(adapterOption);
// //resize
// this.brokenInstanc.resize();
// } else {
// let adapterOption = {};
// adapterOption = {
// xAxis: {
// data: [],
// },
// series: [
// {
// data: [],
// },
// {
// data: [],
// },
// ],
// };
// //.chartInstanceoptiondataoption
// this.brokenInstanc.setOption(adapterOption);
// //resize
// this.brokenInstanc.resize();
// }
// });
},
//
handlerow(row, event, column) {
// console.log("----", row)
if (row) {
const obj = Object.assign({}, row);
//
delete obj.buildingID;
delete obj.curDate;
delete obj.pumpID;
delete obj.pumpName;
delete obj.buildingName;
//
let newObj = {};
for (let key in obj) {
if (obj[key]) {
newObj[key] = obj[key];
}
}
// console.log("", newObj);
// key
// Object.setPrototypeOf(this.newObj);
// let data7 = Object.keys(newObj);
// console.log("x", data7);
const keysArr = Object.keys(newObj); //
this.brokenTime = [];
keysArr.forEach((item) => {
if (item) {
this.brokenTime.push(item.split("temp").join("") + ":00");
}
});
const valuesArr = keysArr.map((key) => newObj[key]); //
// console.log("", valuesArr);
// console.log("", this.brokenTime);
this.brokenData1 = valuesArr;
const adapterOption = {
xAxis: {
data: this.brokenTime,
},
series: [
{
name: "温度",
data: this.brokenData1,
itemStyle: {
color: "#1f8dee",
},
areaStyle: {
color: {
colorStops: [
{
offset: 0,
color: "rgba(31, 141, 238, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(31, 141, 238,0)", // 100%
},
],
},
},
},
],
};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
} else {
const adapterOption = {
xAxis: {
data: [],
},
series: [
{
name: "温度",
data: [],
},
],
};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
}
},
//
exportData() {
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
};
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: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
//
if (columnIndex === 1) {
return "color: #fd1e00;!important;text-align:center";
}
if (columnIndex === 2) {
return "color: #3390ff;!important;text-align:center";
}
if (columnIndex === 4) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";
},
// 线+ + 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = this.$refs.chart_ref.offsetWidth / 130;
//optionoption
const adapterOption = {};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
},
//chartInstance
initChart() {
this.brokenInstanc = echarts.init(this.$refs.chart_ref);
this.brokenOption = {
tooltip: {
trigger: "axis",
},
legend: {
show: false,
selectedMode: false, //
icon: "cricle", //
//
textStyle: {
color: "#ffff",
fontSize: 16, //
},
// left: "73%",
left: "66%",
top: "0",
//
itemGap: 5,
itemWidth: 10,
itemHeight: 5,
},
grid: {
top: "4%",
left: "3%",
right: "4%",
bottom: "5%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
fontSize: 14, //
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
data: this.brokenTime,
},
yAxis: {
min: 0,
// max:20,
// // // min:'dataMin',
// // // max:'dataMax',
// name: "kwh", // y
// name
nameTextStyle: {
color: "rgba(255, 255, 255, 1)",
fontSize: 12,
},
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
series: [
{
type: "line",
//
symbolSize: 8,
smooth: true,
showSymbol: false,
data: this.brokenData1,
//线
itemStyle: {
color: "#d48e17", //线
lineStyle: {
color: "#d48e17", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [],
},
},
},
],
};
//
this.brokenInstanc.setOption(this.brokenOption, true);
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.data-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
margin-top: 23px;
.data-li {
background-color: transparent;
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0.3rem;
width: 31%;
justify-content: space-between;
margin-bottom: 0.24rem;
font-family: SourceHanSansCN-Regular;
font-size: 0.16rem;
position: relative;
overflow: hidden;
.use-icon {
width: 0.6rem;
height: 0.6rem;
}
.use-text {
width: 33%;
display: flex;
flex-direction: column;
align-items: flex-start;
color: #dbdbdb;
.data-text {
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
color: #ffffff;
}
.downText {
color: #ff4027;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom {
margin-right: 0.08rem;
}
}
.upText {
color: #2ff016;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom,
.el-icon-top {
margin-right: 0.08rem;
}
}
}
}
.type-img {
position: absolute;
bottom: 0;
width: 3.17rem;
height: 0.52rem;
z-index: 10;
}
.type1 {
border: 1px solid #e8aa13;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(26, 56, 65, 0.5), rgba(184, 196, 51, 0.5));
}
.type1::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(243, 166, 23, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type2 {
border: 1px solid #27a0f2;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 43, 88, 0.5), rgba(8, 96, 179, 0.5));
}
.type2::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(28, 128, 241, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type3 {
border: 1px solid #1ad3ef;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 50, 89, 0.5), rgba(17, 145, 151, 0.5));
}
.type3::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(117, 242, 248, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type4 {
border: 1px solid #11d47b;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 57, 82, 0.5), rgba(5, 91, 90, 0.5));
}
.type4::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(115, 245, 176, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
}
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 100%;
height: 300px;
margin-bottom: 0.1rem;
}
// 2000px
@media (min-width: 2000px) {
.condition {
.condition-left {
.years-div {
.years-word {
font-size: 0.14rem !important;
margin: 0 0.05rem !important;
}
}
.time-label {
font-size: 0.16rem !important;
line-height: 0.07rem !important;
margin-right: 0.12rem !important;
}
}
}
}
</style>

94
src/views/hotWater/energyAnalysis/index.vue

@ -0,0 +1,94 @@
<template>
<div class="paramsDetails">
<div class="details-content">
<div class="details-header">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="能耗报表" name="first">
<energy-report v-if="activeName === 'first'"></energy-report>
</el-tab-pane>
<el-tab-pane label="温度变化表" name="second">
<tem-report v-if="activeName === 'second'"></tem-report>
</el-tab-pane>
<el-tab-pane label="水位变化表" name="three">
<water-report v-if="activeName === 'three'"></water-report>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import EnergyReport from "./components/energyReport.vue";
import TemReport from "./components/temReport.vue";
import WaterReport from "./components/waterReport.vue";
export default {
components: { EnergyReport, TemReport, WaterReport },
data() {
return {
activeName: "first", //
};
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
//switch-tab
// activeName'second'tabtab
switchToEquitesMess() {
this.activeName = "second";
},
switchToPatrolTem() {
// this.activeName = 'fourth';
},
//
},
};
</script>
<style lang="scss" scoped>
.paramsDetails {
display: flex;
flex-direction: row;
align-items: stretch;
justify-content: space-between;
.details-content {
width: 100%;
// height: 0.42rem;
position: relative;
}
}
</style>
<style scoped>
.none-div {
padding-top: 0.31rem;
}
.none-div >>> .el-tree {
background: transparent;
color: #789d9f;
}
.none-div >>> .el-tree-node:focus > .el-tree-node__content {
background-color: #00be97;
color: #fff;
}
.none-div >>> .el-tree-node__content:hover,
.none-div >>> .el-upload-list__item:hover {
background-color: #00be97;
color: #fff;
}
.none-div >>> .el-tree-node__content {
height: 0.48rem;
justify-content: center;
}
.none-div >>> .el-tree-node__expand-icon.is-leaf {
display: none !important;
}
</style>

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

@ -0,0 +1,439 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.label"
:value="item.id"
/>
</el-select>
<el-date-picker
v-model="dayDate"
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<el-table
:data="postList"
stripe
:cell-style="tableRowStyle"
highlight-current-row
height="500"
>
<el-table-column label="所属楼栋" align="center" prop="dateAndWeek" />
<el-table-column label="设备编号" align="center" prop="maxTemp" />
<el-table-column label="设备名称" align="center" prop="minTemp" />
<el-table-column label="抄表时间" align="center" prop="minTemp" />
<el-table-column label="采集读数" align="center" prop="minTemp" />
<el-table-column label="用量" align="center" prop="minTemp" />
<el-table-column label="倍率" align="center" prop="minTemp" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { formatDay } from "@/utils/datetime";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { spaceTree } from "@/api/region";
export default {
data() {
return {
listLoading: false,
dayDate: [], //
dialogVisible: false,
building: "", //
builds: [], //
//
loading: false,
//
total: 0,
//
postList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
startTime: "",
endTime: "",
},
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getBuildList();
this.getList();
},
methods: {
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
},
/** 查询楼栋 */
getBuildList() {
spaceTree().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);
}
this.builds = newRes.data[0].children[0].children[0].children;
// console.log("", this.builds);
this.getList();
}
});
},
// 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
);
}
}
},
//
initializeTimeDate() {
this.dayDate = formatDay(new Date()); //
},
//
findData() {
this.getList();
},
//
getList() {
let data = {
startTime: this.dayDate,
endTime: this.dayDate,
building: this.building,
};
console.log("查询数据参数", data);
this.listLoading = true;
//
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
exportData() {
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
};
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: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
//
if (columnIndex === 1) {
return "color: #fd1e00;!important;text-align:center";
}
if (columnIndex === 2) {
return "color: #3390ff;!important;text-align:center";
}
if (columnIndex === 4) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.data-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
margin-top: 23px;
.data-li {
background-color: transparent;
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0.3rem;
width: 31%;
justify-content: space-between;
margin-bottom: 0.24rem;
font-family: SourceHanSansCN-Regular;
font-size: 0.16rem;
position: relative;
overflow: hidden;
.use-icon {
width: 0.6rem;
height: 0.6rem;
}
.use-text {
width: 33%;
display: flex;
flex-direction: column;
align-items: flex-start;
color: #dbdbdb;
.data-text {
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
color: #ffffff;
}
.downText {
color: #ff4027;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom {
margin-right: 0.08rem;
}
}
.upText {
color: #2ff016;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom,
.el-icon-top {
margin-right: 0.08rem;
}
}
}
}
.type-img {
position: absolute;
bottom: 0;
width: 3.17rem;
height: 0.52rem;
z-index: 10;
}
.type1 {
border: 1px solid #e8aa13;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(26, 56, 65, 0.5), rgba(184, 196, 51, 0.5));
}
.type1::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(243, 166, 23, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type2 {
border: 1px solid #27a0f2;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 43, 88, 0.5), rgba(8, 96, 179, 0.5));
}
.type2::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(28, 128, 241, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type3 {
border: 1px solid #1ad3ef;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 50, 89, 0.5), rgba(17, 145, 151, 0.5));
}
.type3::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(117, 242, 248, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type4 {
border: 1px solid #11d47b;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 57, 82, 0.5), rgba(5, 91, 90, 0.5));
}
.type4::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(115, 245, 176, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
}
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 100%;
height: 300px;
margin-bottom: 0.1rem;
}
// 2000px
@media (min-width: 2000px) {
.condition {
.condition-left {
.years-div {
.years-word {
font-size: 0.14rem !important;
margin: 0 0.05rem !important;
}
}
.time-label {
font-size: 0.16rem !important;
line-height: 0.07rem !important;
margin-right: 0.12rem !important;
}
}
}
}
</style>

583
src/views/hotWater/energyQuery/components/energy.vue

@ -0,0 +1,583 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.label"
:value="item.id"
/>
</el-select>
<el-date-picker
v-model="dayDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
>
</el-date-picker>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
</div>
</div>
<div class="choice">
<div
class="mr20"
v-for="(item, index) in timeData2"
:key="index"
@click="handleEnter(index, $event)"
:class="{ timeStyle: currentIndex == index }"
>
{{ item.title }}
</div>
</div>
<div class="charts" ref="chart_ref"></div>
</div>
</template>
<script>
import { formatDay } from "@/utils/datetime";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { spaceTree } from "@/api/region";
import * as echarts from "echarts";
export default {
data() {
return {
listLoading: false,
dayDate: [], //
dialogVisible: false,
building: "", //
builds: [], //
timeData2: [{ title: "用水量" }, { title: "用电量" }],
currentIndex: 0,
//
loading: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
startTime: "",
endTime: "",
},
brokenInstanc: null,
brokenOption: {},
brokenData1: [],
brokenTime: [],
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getBuildList();
this.initChart();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.getList();
},
destroyed() {
//
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询楼栋 */
getBuildList() {
spaceTree().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);
}
this.builds = newRes.data[0].children[0].children[0].children;
// console.log("", this.builds);
this.building = this.builds[0].id;
this.getList();
}
});
},
// 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
);
}
}
},
//
initializeTimeDate() {
this.dayDate = formatDay(new Date()); //
},
//
findData() {
this.getList();
},
//
getList() {
let data = {
startTime: this.dayDate,
endTime: this.dayDate,
building: this.building,
};
console.log("查询数据参数", data);
this.listLoading = true;
//
this.brokenData1 = [30, 40, 29];
this.brokenData2 = [40, 42, 29];
this.brokenTime = ["3月", "4月", "5月"];
this.getChartData();
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
getChartData() {
this.brokenOption.series[0].data = this.brokenData1;
this.brokenOption.series[0].itemStyle.color = "#1f8dee";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(31, 141, 238, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(31, 141, 238,0)", // 100%
},
];
if (this.currentIndex === 0) {
this.brokenOption.series[0].data = this.brokenData1;
this.brokenOption.series[0].itemStyle.color = "#1f8dee";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(31, 141, 238, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(31, 141, 238,0)", // 100%
},
];
} else if (this.currentIndex === 1) {
this.brokenOption.series[0].data = this.brokenData2;
this.brokenOption.series[0].itemStyle.color = "#1ab395";
this.brokenOption.series[0].areaStyle.color.colorStops = [
{
offset: 0,
color: "rgba(26, 179, 149, 0.3)", // 0%
},
{
offset: 0.8,
color: "rgba(26, 179, 149,0)", // 100%
},
];
}
//
const currentIndex = this.currentIndex;
// tooltip
this.brokenOption.tooltip = {
trigger: "axis",
formatter: function (params) {
//
const data = params[0];
const month = data.name;
const value = data.value;
//
if (currentIndex === 0) {
return `${month}<br/>用水量: ${value}`;
} else if (currentIndex === 1) {
return `${month}<br/>用电量: ${value}`;
}
},
};
this.brokenOption.xAxis.data = this.brokenTime;
this.brokenInstanc.setOption(this.brokenOption);
},
handleEnter(index) {
this.currentIndex = index;
this.getChartData();
},
// 线+ + 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = this.$refs.chart_ref.offsetWidth / 130;
//optionoption
const adapterOption = {};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
},
//chartInstance
initChart() {
this.brokenInstanc = echarts.init(this.$refs.chart_ref);
this.brokenOption = {
tooltip: {
trigger: "axis",
},
legend: {
show: false,
selectedMode: false, //
icon: "cricle", //
//
textStyle: {
color: "#ffff",
fontSize: 16, //
},
// left: "73%",
left: "66%",
top: "0",
//
itemGap: 5,
itemWidth: 10,
itemHeight: 5,
},
grid: {
top: "4%",
left: "3%",
right: "4%",
bottom: "5%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
fontSize: 14, //
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
data: this.brokenTime,
},
yAxis: {
min: 0,
// max:20,
// // // min:'dataMin',
// // // max:'dataMax',
// name: "kwh", // y
// name
nameTextStyle: {
color: "rgba(255, 255, 255, 1)",
fontSize: 12,
},
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
series: [
{
type: "line",
//
symbolSize: 8,
smooth: true,
showSymbol: false,
data: this.brokenData1,
//线
itemStyle: {
color: "#d48e17", //线
lineStyle: {
color: "#d48e17", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [],
},
},
},
],
};
//
this.brokenInstanc.setOption(this.brokenOption, true);
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.data-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
margin-top: 23px;
.data-li {
background-color: transparent;
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0.3rem;
width: 31%;
justify-content: space-between;
margin-bottom: 0.24rem;
font-family: SourceHanSansCN-Regular;
font-size: 0.16rem;
position: relative;
overflow: hidden;
.use-icon {
width: 0.6rem;
height: 0.6rem;
}
.use-text {
width: 33%;
display: flex;
flex-direction: column;
align-items: flex-start;
color: #dbdbdb;
.data-text {
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
color: #ffffff;
}
.downText {
color: #ff4027;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom {
margin-right: 0.08rem;
}
}
.upText {
color: #2ff016;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom,
.el-icon-top {
margin-right: 0.08rem;
}
}
}
}
.type-img {
position: absolute;
bottom: 0;
width: 3.17rem;
height: 0.52rem;
z-index: 10;
}
.type1 {
border: 1px solid #e8aa13;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(26, 56, 65, 0.5), rgba(184, 196, 51, 0.5));
}
.type1::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(243, 166, 23, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type2 {
border: 1px solid #27a0f2;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 43, 88, 0.5), rgba(8, 96, 179, 0.5));
}
.type2::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(28, 128, 241, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type3 {
border: 1px solid #1ad3ef;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 50, 89, 0.5), rgba(17, 145, 151, 0.5));
}
.type3::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(117, 242, 248, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type4 {
border: 1px solid #11d47b;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 57, 82, 0.5), rgba(5, 91, 90, 0.5));
}
.type4::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(115, 245, 176, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
}
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 100%;
height: 700px;
margin-bottom: 0.1rem;
}
// 2000px
@media (min-width: 2000px) {
.condition {
.condition-left {
.years-div {
.years-word {
font-size: 0.14rem !important;
margin: 0 0.05rem !important;
}
}
.time-label {
font-size: 0.16rem !important;
line-height: 0.07rem !important;
margin-right: 0.12rem !important;
}
}
}
}
</style>

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

@ -0,0 +1,439 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.label"
:value="item.id"
/>
</el-select>
<el-date-picker
v-model="dayDate"
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<el-table
:data="postList"
stripe
:cell-style="tableRowStyle"
highlight-current-row
height="500"
>
<el-table-column label="所属楼栋" align="center" prop="dateAndWeek" />
<el-table-column label="设备编号" align="center" prop="maxTemp" />
<el-table-column label="设备名称" align="center" prop="minTemp" />
<el-table-column label="抄表时间" align="center" prop="minTemp" />
<el-table-column label="采集读数" align="center" prop="minTemp" />
<el-table-column label="用量" align="center" prop="minTemp" />
<el-table-column label="倍率" align="center" prop="minTemp" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { formatDay } from "@/utils/datetime";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { spaceTree } from "@/api/region";
export default {
data() {
return {
listLoading: false,
dayDate: [], //
dialogVisible: false,
building: "", //
builds: [], //
//
loading: false,
//
total: 0,
//
postList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
startTime: "",
endTime: "",
},
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getBuildList();
this.getList();
},
methods: {
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
},
/** 查询楼栋 */
getBuildList() {
spaceTree().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);
}
this.builds = newRes.data[0].children[0].children[0].children;
// console.log("", this.builds);
this.getList();
}
});
},
// 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
);
}
}
},
//
initializeTimeDate() {
this.dayDate = formatDay(new Date()); //
},
//
findData() {
this.getList();
},
//
getList() {
let data = {
startTime: this.dayDate,
endTime: this.dayDate,
building: this.building,
};
console.log("查询数据参数", data);
this.listLoading = true;
//
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
exportData() {
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
};
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: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
//
if (columnIndex === 1) {
return "color: #fd1e00;!important;text-align:center";
}
if (columnIndex === 2) {
return "color: #3390ff;!important;text-align:center";
}
if (columnIndex === 4) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.data-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
margin-top: 23px;
.data-li {
background-color: transparent;
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0.3rem;
width: 31%;
justify-content: space-between;
margin-bottom: 0.24rem;
font-family: SourceHanSansCN-Regular;
font-size: 0.16rem;
position: relative;
overflow: hidden;
.use-icon {
width: 0.6rem;
height: 0.6rem;
}
.use-text {
width: 33%;
display: flex;
flex-direction: column;
align-items: flex-start;
color: #dbdbdb;
.data-text {
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
color: #ffffff;
}
.downText {
color: #ff4027;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom {
margin-right: 0.08rem;
}
}
.upText {
color: #2ff016;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom,
.el-icon-top {
margin-right: 0.08rem;
}
}
}
}
.type-img {
position: absolute;
bottom: 0;
width: 3.17rem;
height: 0.52rem;
z-index: 10;
}
.type1 {
border: 1px solid #e8aa13;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(26, 56, 65, 0.5), rgba(184, 196, 51, 0.5));
}
.type1::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(243, 166, 23, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type2 {
border: 1px solid #27a0f2;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 43, 88, 0.5), rgba(8, 96, 179, 0.5));
}
.type2::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(28, 128, 241, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type3 {
border: 1px solid #1ad3ef;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 50, 89, 0.5), rgba(17, 145, 151, 0.5));
}
.type3::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(117, 242, 248, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type4 {
border: 1px solid #11d47b;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 57, 82, 0.5), rgba(5, 91, 90, 0.5));
}
.type4::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(115, 245, 176, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
}
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 100%;
height: 300px;
margin-bottom: 0.1rem;
}
// 2000px
@media (min-width: 2000px) {
.condition {
.condition-left {
.years-div {
.years-word {
font-size: 0.14rem !important;
margin: 0 0.05rem !important;
}
}
.time-label {
font-size: 0.16rem !important;
line-height: 0.07rem !important;
margin-right: 0.12rem !important;
}
}
}
}
</style>

439
src/views/hotWater/energyQuery/index.vue

@ -0,0 +1,439 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="condition">
<div class="condition-left">
<el-select
style="margin-right: 0.1rem"
v-model="building"
placeholder="请选择楼栋"
clearable
>
<el-option
v-for="(item, index) in builds"
:key="index"
:label="item.label"
:value="item.id"
/>
</el-select>
<el-date-picker
v-model="dayDate"
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<div class="success-btn" style="margin: 0 0.12rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<el-table
:data="postList"
stripe
:cell-style="tableRowStyle"
highlight-current-row
height="500"
>
<el-table-column label="所属楼栋" align="center" prop="dateAndWeek" />
<el-table-column label="设备编号" align="center" prop="maxTemp" />
<el-table-column label="设备名称" align="center" prop="minTemp" />
<el-table-column label="抄表时间" align="center" prop="minTemp" />
<el-table-column label="采集读数" align="center" prop="minTemp" />
<el-table-column label="用量" align="center" prop="minTemp" />
<el-table-column label="倍率" align="center" prop="minTemp" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { formatDay } from "@/utils/datetime";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { spaceTree } from "@/api/region";
export default {
data() {
return {
listLoading: false,
dayDate: [], //
dialogVisible: false,
building: "", //
builds: [], //
//
loading: false,
//
total: 0,
//
postList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
startTime: "",
endTime: "",
},
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getBuildList();
this.getList();
},
methods: {
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
},
/** 查询楼栋 */
getBuildList() {
spaceTree().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);
}
this.builds = newRes.data[0].children[0].children[0].children;
// console.log("", this.builds);
this.getList();
}
});
},
// 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
);
}
}
},
//
initializeTimeDate() {
this.dayDate = formatDay(new Date()); //
},
//
findData() {
this.getList();
},
//
getList() {
let data = {
startTime: this.dayDate,
endTime: this.dayDate,
building: this.building,
};
console.log("查询数据参数", data);
this.listLoading = true;
//
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
exportData() {
let data = {
timeType: this.dateType,
startTime: this.queryParams.startTime,
endTime: this.endTime,
building: this.building,
};
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: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
tableRowStyle({ row, column, rowIndex, columnIndex }) {
//
if (columnIndex === 1) {
return "color: #fd1e00;!important;text-align:center";
}
if (columnIndex === 2) {
return "color: #3390ff;!important;text-align:center";
}
if (columnIndex === 4) {
return "color: #75d148;!important;text-align:center";
}
// return "text-align:center";
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.data-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
margin-top: 23px;
.data-li {
background-color: transparent;
border-radius: 8px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0.3rem;
width: 31%;
justify-content: space-between;
margin-bottom: 0.24rem;
font-family: SourceHanSansCN-Regular;
font-size: 0.16rem;
position: relative;
overflow: hidden;
.use-icon {
width: 0.6rem;
height: 0.6rem;
}
.use-text {
width: 33%;
display: flex;
flex-direction: column;
align-items: flex-start;
color: #dbdbdb;
.data-text {
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
color: #ffffff;
}
.downText {
color: #ff4027;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom {
margin-right: 0.08rem;
}
}
.upText {
color: #2ff016;
z-index: 11 !important;
font-family: DIN-Bold;
font-size: 0.24rem;
margin-top: 0.05rem;
.el-icon-bottom,
.el-icon-top {
margin-right: 0.08rem;
}
}
}
}
.type-img {
position: absolute;
bottom: 0;
width: 3.17rem;
height: 0.52rem;
z-index: 10;
}
.type1 {
border: 1px solid #e8aa13;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(26, 56, 65, 0.5), rgba(184, 196, 51, 0.5));
}
.type1::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(243, 166, 23, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type2 {
border: 1px solid #27a0f2;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 43, 88, 0.5), rgba(8, 96, 179, 0.5));
}
.type2::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(28, 128, 241, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type3 {
border: 1px solid #1ad3ef;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 50, 89, 0.5), rgba(17, 145, 151, 0.5));
}
.type3::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(117, 242, 248, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
.type4 {
border: 1px solid #11d47b;
border-radius: 10px;
/* 设置渐变背景 */
background: linear-gradient(rgba(2, 57, 82, 0.5), rgba(5, 91, 90, 0.5));
}
.type4::after {
content: "";
width: 100%;
height: 90%;
box-shadow: 0 0 30px 40px rgba(115, 245, 176, 0.3);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: -100% !important;
z-index: 1;
}
}
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.charts {
width: 100%;
height: 300px;
margin-bottom: 0.1rem;
}
// 2000px
@media (min-width: 2000px) {
.condition {
.condition-left {
.years-div {
.years-word {
font-size: 0.14rem !important;
margin: 0 0.05rem !important;
}
}
.time-label {
font-size: 0.16rem !important;
line-height: 0.07rem !important;
margin-right: 0.12rem !important;
}
}
}
}
</style>

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

@ -0,0 +1,735 @@
<template>
<div class="app-container" v-loading="loading">
<div class="overview-top">
<div class="overview-top-left">
<div class="special-div">
<div class="special-top">
<div class="special-title">项目概况</div>
</div>
<div class="overview-data">
<div class="overview-data-li">
<img
class="overview-img"
src="../../../assets/images/overview1.png"
alt=""
/>
<div class="overview-num">640.4</div>
<div class="overview-title">昨日用水量()</div>
</div>
<div class="overview-data-li">
<img
class="overview-img"
src="../../../assets/images/overview2.png"
alt=""
/>
<div class="overview-num">2428.88</div>
<div class="overview-title">昨日用电量()</div>
</div>
<div class="overview-data-li">
<img
class="overview-img"
src="../../../assets/images/overview3.png"
alt=""
/>
<div class="overview-num">3.79</div>
<div class="overview-title">昨日单耗(/)</div>
</div>
<div class="overview-data-li">
<img
class="overview-img"
src="../../../assets/images/overview4.png"
alt=""
/>
<div class="overview-num">186</div>
<div class="overview-title">通讯设备设备总数()</div>
</div>
</div>
</div>
</div>
<div class="overview-top-right">
<div class="special-div">
<div class="special-top">
<div class="special-title">热泵运行状态</div>
</div>
<div class="pump-charts" ref="pumpChart_ref"></div>
</div>
</div>
</div>
<div class="overview-bottom">
<div class="overview-top-left">
<div class="special-div">
<div class="special-top">
<div class="special-title">当月数据统计</div>
</div>
<div class="choice">
<div
class="mr20"
v-for="(item, index) in timeData2"
:key="index"
@click="handleEnter(index, $event)"
:class="{ timeStyle: currentIndex == index }"
>
{{ item.title }}
</div>
</div>
<div class="brokenEcharts" ref="analyse_ref"></div>
</div>
</div>
</div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
data() {
return {
loading: false,
chartInstance: null,
option: {},
chartData1: "",
chartData2: "",
allData: "",
timeData2: [{ title: "用水量" }, { title: "用电量" }, { title: "单耗" }],
currentIndex: 0,
brokenOption: "",
brokenInstanc: null,
brokenData1: [],
brokenData2: [],
brokenData3: [],
brokenTime: [],
};
},
mounted() {
this.initChart();
this.initChart2();
this.getTableData();
window.addEventListener("resize", this.screenAdapter);
window.addEventListener("resize", this.screenAdapter2);
this.screenAdapter();
// this.screenAdapter2();
this.pumpEchartsData();
},
destroyed() {
//
window.removeEventListener("resize", this.screenAdapter);
window.removeEventListener("resize", this.screenAdapter2);
},
methods: {
//
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = this.$refs.pumpChart_ref.offsetWidth / 30;
//optionoption
const adapterOption = {
title: {
subtextStyle: {
fontSize: titleFontSize,
},
},
};
//.chartInstanceoptiondataoption
this.chartInstance.setOption(adapterOption);
//resize
this.chartInstance.resize();
},
//
pumpEchartsData() {
let data = true;
this.chartData1 = 10;
this.chartData2 = 3;
this.allData = 13;
if (data) {
const titleFontSize = (this.$refs.pumpChart_ref.offsetWidth / 100) * 2;
const colorList = ["#ffe21e", "#08c8ff"]; //
const adapterOption = {
tooltip: {
trigger: "item",
formatter: "{a} <br/>{b} : {c} ({d}%)",
},
//
title: {
subtext: this.allData,
},
legend: {
itemWidth: titleFontSize,
itemHeight: titleFontSize,
itemGap: titleFontSize * 2,
formatter: function (name) {
var arr = [];
let data = adapterOption.series[0].data;
var index = 0;
var total = 0;
for (var i = 0; i < data.length; i++) {
total += data[i].value;
if (data[i].name == name) {
index = i;
}
}
arr.push(
"{name|" + name + "}",
"{text|" + " " + ":" + " " + "}",
"{value|" + data[index].value + "}",
"{text|" + " " + "台" + "}"
);
return arr.join("");
},
textStyle: {
color: function (name) {
const dataSeries = adapterOption.series[1].data; // data
const index = dataSeries.findIndex(
(item) => item.name === name
);
const colorList = ["#2df499", "#08c8ff"]; //
return colorList[index];
},
rich: {
name: {
align: "left",
fontSize: titleFontSize * 1.6,
},
text: {
align: "left",
fontSize: titleFontSize * 1.6,
},
value: {
align: "left",
fontSize: titleFontSize * 1.6,
// color: function (params) {
// let data = adapterOption.series[1].data;
// return data.itemStyle.color({ dataIndex: params.dataIndex });
// },
},
percentage: {
align: "left",
fontSize: titleFontSize * 2,
// color: function (params) {
// let data = adapterOption.series[1].data;
// return data.itemStyle.color({ dataIndex: params.dataIndex });
// },
},
},
},
},
series: [
{
name: "温度监测:",
data: [
{ value: this.chartData1, name: "运行" },
{ value: this.chartData2, name: "不运行" },
],
itemStyle: {
color: function (params) {
var colorList = ["#2df499", "#08c8ff"];
return colorList[params.dataIndex];
},
// borderWidth: 5,
borderColor: "#002a56",
},
},
{
data: [
{ value: this.chartData1, name: "运行" },
{ value: this.chartData2, name: "不运行" },
],
},
],
};
this.chartInstance.setOption(adapterOption);
this.chartInstance.resize();
} else {
const titleFontSize = (this.$refs.pumpChart_ref.offsetWidth / 100) * 2;
const adapterOption = {
tooltip: {
trigger: "item",
formatter: "{a} <br/>{b} : {c} ({d}%)",
},
//
title: {
subtext: 0,
},
legend: {
itemWidth: titleFontSize,
itemHeight: titleFontSize,
itemGap: titleFontSize * 2,
formatter: function (name) {
var arr = [];
let data = adapterOption.series[0].data;
var index = 0;
var total = 0;
for (var i = 0; i < data.length; i++) {
total += data[i].value;
if (data[i].name == name) {
index = i;
}
}
arr.push(
"{name|" + name + "}",
"{text|" + " " + ":" + " " + "}",
"{value|" + data[index].value + "}",
"{text|" + " " + "台" + "}"
);
return arr.join("");
},
textStyle: {
color: function (name) {
const dataSeries = adapterOption.series[1].data; // data
const index = dataSeries.findIndex(
(item) => item.name === name
);
const colorList = ["#2df499", "#08c8ff"]; //
return colorList[index];
},
rich: {
name: {
align: "left",
fontSize: titleFontSize * 1.6,
},
text: {
align: "left",
fontSize: titleFontSize * 1.6,
},
value: {
align: "left",
fontSize: titleFontSize * 1.6,
// color: function (params) {
// let data = adapterOption.series[1].data;
// return data.itemStyle.color({ dataIndex: params.dataIndex });
// },
},
percentage: {
align: "left",
fontSize: titleFontSize * 1.6,
// color: function (params) {
// let data = adapterOption.series[1].data;
// return data.itemStyle.color({ dataIndex: params.dataIndex });
// },
},
},
},
},
series: [
{
name: "温度监测:",
data: [
{ value: 0, name: "运行" },
{ value: 0, name: "不运行" },
],
itemStyle: {
color: function (params) {
var colorList = ["#2df499", "#08c8ff"];
return colorList[params.dataIndex];
},
// borderWidth: 5,
borderColor: "#002a56",
},
},
{
data: [
{ value: 0, name: "运行" },
{ value: 0, name: "不运行" },
],
},
],
};
this.chartInstance.setOption(adapterOption);
this.chartInstance.resize();
}
},
//chartInstance-
initChart() {
this.chartInstance = echarts.init(this.$refs.pumpChart_ref);
this.option = {
//
title: {
subtext: this.allData,
textStyle: {
color: "#ffffff",
fontSize: 20,
},
subtextStyle: {
color: "#ffffff",
},
textAlign: "center",
x: "28.5%",
y: "35%", //
},
tooltip: {
trigger: "item",
formatter: "{a} <br/>{b} : {c} ({d}%)",
},
//
legend: {
orient: "vertical", //
right: "10%", //
top: "center", //
//
textStyle: {
color: "#ffffff",
// fontSize: 18,
},
},
series: [
//
{
name: "温度监测:",
type: "pie",
radius: ["50%", "62%"],
center: ["30%", "44%"],
avoidLabelOverlap: false,
label: {
show: false,
position: "center",
},
labelLine: {
show: false,
},
itemStyle: {
color: function (params) {
var colorList = ["#2df499", "#08c8ff"];
return colorList[params.dataIndex];
},
borderWidth: 5,
borderColor: "#002a56",
},
z: 10, //,
},
//
{
type: "pie",
radius: ["40%", "52%"],
center: ["30%", "44%"],
avoidLabelOverlap: false,
label: {
show: false,
position: "center",
},
silent: true,
labelLine: {
show: false,
},
//
itemStyle: {
color: function (colors) {
var colorList = ["#09596b", "#024e7d"];
return colorList[colors.dataIndex];
},
},
z: 15,
},
//
{
//
color: ["#305376"],
type: "pie",
silent: true, //
// hoverAnimation: false, //
// 使emphasis.scale true
// silent: true,
// center
radius: ["28%", "29%"],
center: ["30%", "44%"],
label: {
show: false,
},
data: [
{
value: 0,
name: "",
itemStyle: {},
},
],
},
//
{
//
type: "pie",
silent: true, //
// hoverAnimation: false, //
// 使emphasis.scale true
// silent: true,
// center
radius: ["0%", "29%"],
center: ["30%", "44%"],
label: {
show: false,
},
data: [
{
value: 0,
name: "",
itemStyle: {},
},
],
itemStyle: {
color: {
type: "linear",
x: 0,
y: 0,
x2: 1,
y2: 1,
colorStops: [
{ offset: 0, color: "#002a55" }, // 0%
{ offset: 1, color: "#0a457a" }, // 100%
],
global: false, // false
},
},
},
],
};
//
this.chartInstance.setOption(this.option, true);
},
handleEnter(index) {
this.currentIndex = index;
this.renderingBroken();
},
//chartInstance2 线
initChart2() {
this.brokenInstanc = echarts.init(this.$refs.analyse_ref);
this.brokenOption = {
tooltip: {
trigger: "axis",
},
legend: {
show: false,
selectedMode: false, //
icon: "cricle", //
//
textStyle: {
color: "#ffff",
fontSize: 16, //
},
// left: "73%",
left: "66%",
top: "0",
//
itemGap: 5,
itemWidth: 10,
itemHeight: 5,
},
grid: {
top: "4%",
left: "3%",
right: "4%",
bottom: "5%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
fontSize: 14, //
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
data: this.brokenTime,
},
yAxis: {
min: 0,
// max:20,
// // // min:'dataMin',
// // // max:'dataMax',
// name: "kwh", // y
// name
nameTextStyle: {
color: "rgba(255, 255, 255, 1)",
fontSize: 12,
},
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
fontSize: 14, //
},
//y线
// splitNumber: 10,
// y线
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
series: [
{
type: "line",
//
symbolSize: 8,
data: this.brokenData1,
//线
itemStyle: {
color: "#d48e17", //线
lineStyle: {
color: "#d48e17", //线
},
},
},
],
};
//
this.brokenInstanc.setOption(this.brokenOption, true);
},
//线
screenAdapter2() {
console.log("没有数据吗", this.brokenData1);
//,2.6 mes_ref
const titleFontSize = this.$refs.analyse_ref.offsetWidth / 130;
const adapterOption = {};
//.chartInstanceoptiondataoption
this.brokenInstanc.setOption(adapterOption);
//resize
this.brokenInstanc.resize();
},
// 线
getTableData() {
this.brokenData1 = [30, 40, 29];
this.brokenData2 = [10, 23, 12];
this.brokenData3 = [3, 4, 2];
this.brokenTime = ["3月", "4月", "5月"];
this.renderingBroken();
},
renderingBroken() {
if (this.currentIndex === 0) {
this.brokenOption.series[0].data = this.brokenData1;
this.brokenOption.series[0].itemStyle.color = "#d48e17";
} else if (this.currentIndex === 1) {
this.brokenOption.series[0].data = this.brokenData2;
this.brokenOption.series[0].itemStyle.color = "#1ab395";
} else if (this.currentIndex === 2) {
this.brokenOption.series[0].data = this.brokenData3;
this.brokenOption.series[0].itemStyle.color = "#1f8dee";
}
//
const currentIndex = this.currentIndex;
// tooltip
this.brokenOption.tooltip = {
trigger: "axis",
formatter: function (params) {
//
const data = params[0];
const month = data.name;
const value = data.value;
//
if (currentIndex === 0) {
return `${month}<br/>用水量: ${value}`;
} else if (currentIndex === 1) {
return `${month}<br/>用电量: ${value}`;
} else if (currentIndex === 2) {
return `${month}<br/>单耗: ${value} 度/吨`;
}
},
};
this.brokenOption.xAxis.data = this.brokenTime;
this.brokenInstanc.setOption(this.brokenOption);
},
},
};
</script>
<style lang="scss" scoped>
.overview-top {
width: 100%;
display: flex;
flex-direction: row;
align-items: stretch;
justify-content: space-between;
margin-bottom: 0.2rem;
.overview-top-left {
width: 65%;
.overview-data {
width: 100%;
padding: 0.5rem;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.overview-data-li {
width: 1.8rem;
height: 1.65rem;
position: relative;
.overview-img {
width: 1.8rem;
height: 1.65rem;
position: absolute;
top: 0;
}
.overview-num {
font-family: DIN-Bold;
font-size: 0.3rem;
font-weight: bold;
font-stretch: normal;
line-height: 0.5rem;
letter-spacing: 0px;
color: #ffffff;
position: absolute;
top: 0.28rem;
right: 0;
}
.overview-title {
font-family: SourceHanSansCN-Regular;
font-size: 0.18rem;
font-weight: normal;
font-stretch: normal;
line-height: 0.22rem;
letter-spacing: 0px;
color: #ffffff;
position: absolute;
top: 0.77rem;
right: 0;
}
}
}
}
.overview-top-right {
width: 33%;
.pump-charts {
width: 100%;
height: 2.65rem;
}
}
}
.overview-bottom {
.choice {
margin: 20px;
.mr20 {
padding: 0.05rem 0.2rem;
white-space: nowrap;
width: auto;
}
}
.brokenEcharts {
width: 100%;
height: 4rem;
}
}
</style>

2
src/views/region/index.vue

@ -587,7 +587,7 @@ export default {
this.getRoomMes();
} else if (this.currentLevel === 4) {
// id
getHouse(th8is.currentId).then((res) => {
getHouse(this.currentId).then((res) => {
console.log("详情返回", res);
if (res.code == 200) {
this.tableData = [res.data];

Loading…
Cancel
Save