Browse Source

修改保利中央空调能耗分析系统-首页

bl_ers
selia-zx 5 days ago
parent
commit
58254adbf3
  1. 3
      .env.development
  2. 38
      src/api/index.js
  3. BIN
      src/assets/images/cold-bg.png
  4. BIN
      src/assets/images/home-icon1.png
  5. BIN
      src/assets/images/home-icon2.png
  6. BIN
      src/assets/images/home-icon3.png
  7. BIN
      src/assets/images/home-icon4.png
  8. BIN
      src/assets/images/home-icon5.png
  9. BIN
      src/assets/images/home-icon6.png
  10. BIN
      src/assets/images/home-icon7.png
  11. BIN
      src/assets/images/noactive-0.png
  12. BIN
      src/assets/images/noactive-1.png
  13. 37
      src/assets/styles/index.scss
  14. 32
      src/views/centerairC/energyAnalysis/components/ynyQnqAnalysis.vue
  15. 596
      src/views/components/chartsData.vue
  16. 144
      src/views/components/hotWater.vue
  17. 1649
      src/views/components/sysEnergy.vue
  18. 514
      src/views/components/viewColdSys.vue
  19. 2
      src/views/components/viewEnergy.vue
  20. 1164
      src/views/index.vue

3
.env.development

@ -8,8 +8,7 @@ ENV = 'development'
# VUE_APP_BASE_API = '/dev-api' # VUE_APP_BASE_API = '/dev-api'
# 后台 # 后台
VUE_APP_BASE_API = 'http://192.168.1.222:8080' VUE_APP_BASE_API = 'http://192.168.1.222:8080'
# 梅州云端
# VUE_APP_BASE_API = 'http://106.55.173.225:8091'
# 广合 # 广合
# VUE_APP_BASE_API = 'http://106.55.173.225:8092' # VUE_APP_BASE_API = 'http://106.55.173.225:8092'

38
src/api/index.js

@ -59,4 +59,40 @@ export function getCoeData() {
url: "/pro/overview/getCoe", url: "/pro/overview/getCoe",
method: "get", method: "get",
}); });
} }
// 图表
export function homeCharts() {
return request({
url: "/home/charts",
method: "get",
});
}
// 运行天数
export function homeRunTime() {
return request({
url: "/home/runTime",
method: "get",
});
}
// 实时总功率、总冷量
export function getCurrentRate() {
return request({
url: "/home/getCurrentRate",
method: "get",
});
}
// 实时能耗系数
export function getCoe() {
return request({
url: "/home/getCoe",
method: "get",
});
}
// 日月年供冷量、日月年EER
export function homeStatical() {
return request({
url: "/home/statical",
method: "get",
});
}

BIN
src/assets/images/cold-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
src/assets/images/home-icon1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
src/assets/images/home-icon2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
src/assets/images/home-icon3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
src/assets/images/home-icon4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
src/assets/images/home-icon5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
src/assets/images/home-icon6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
src/assets/images/home-icon7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
src/assets/images/noactive-0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
src/assets/images/noactive-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

37
src/assets/styles/index.scss

@ -218,6 +218,43 @@ aside {
box-shadow: inset 0px 1px 0px 0px rgba(255, 255, 255, 0.4); box-shadow: inset 0px 1px 0px 0px rgba(255, 255, 255, 0.4);
border-radius: 14px; border-radius: 14px;
} }
/** 科技感面板标题 - 左侧竖线 + 渐变底线 */
.panel-title {
position: relative;
padding: 0.1rem 0 0.1rem 0.18rem;
margin-bottom: 0.1rem;
&::before {
content: "";
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 0.06rem;
height: 0.24rem;
background: linear-gradient(180deg, #00d7e9, #0078d7);
border-radius: 0.03rem;
box-shadow: 0 0 0.08rem rgba(0, 215, 233, 0.5);
}
&::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 1px;
background: linear-gradient(90deg, rgba(0, 215, 233, 0.4), transparent);
}
.panel-title-text {
font-size: 0.2rem;
font-weight: bold;
color: #e3fff9;
letter-spacing: 0.04rem;
text-shadow: 0 0 0.06rem rgba(0, 215, 233, 0.3);
}
}
.special-div { .special-div {
display: flex; display: flex;

32
src/views/centerairC/energyAnalysis/components/ynyQnqAnalysis.vue

@ -100,9 +100,9 @@
<div class="success-btn" style="margin-left: 0.24rem"> <div class="success-btn" style="margin-left: 0.24rem">
<el-button type="success" @click="findData">查询</el-button> <el-button type="success" @click="findData">查询</el-button>
</div> </div>
<!-- <div class="warning-bnt" style="margin-left: 0.24rem"> <div class="warning-bnt" style="margin-left: 0.24rem">
<el-button type="warning" @click="exportData">导出</el-button> <el-button type="warning" @click="exportData">导出</el-button>
</div> --> </div>
</div> </div>
</div> </div>
<div class="charts-table" v-loading="listLoading"> <div class="charts-table" v-loading="listLoading">
@ -891,20 +891,20 @@ export default {
this.exportArr.push(newData); this.exportArr.push(newData);
} }
// // console.log("", this.exportArr); // console.log("", this.exportArr);
// import("@/assets/excel/Export2Excel").then((excel) => { import("@/assets/excel/Export2Excel").then((excel) => {
// let filterVal = ["dateList", "curValue2", "lastValue2", "yoy2", "mom2"]; // excel let filterVal = ["dateList", "curValue2", "lastValue2", "yoy2", "mom2"]; // excel
// let tHeader = ["", "", "", "", ""]; // excel let tHeader = ["时间", "本期", "同期", "同比", "环比"]; // excel
// const data = this.formatJson(filterVal, this.exportArr); const data = this.formatJson(filterVal, this.exportArr);
// const autoWidth = true; const autoWidth = true;
// excel.export_json_to_excel({ excel.export_json_to_excel({
// header: tHeader, // header: tHeader, //
// data, // data, //
// filename: `${this.checkList}`, // filename: `${this.checkList}同比环比分析报表`, //
// autoWidth: true, // autoWidth: true, //
// }); });
// this.$message.success("!"); this.$message.success("导出成功!");
// }); });
}, },
//, //,
formatJson(filterVal, jsonData) { formatJson(filterVal, jsonData) {

596
src/views/components/chartsData.vue

@ -0,0 +1,596 @@
<template>
<div class="chart-content">
<div class="home-chart">
<div
class="legend-li"
v-for="(item, index) in timeData2"
:key="index"
@click="handleEnter(index)"
:class="{ timeStyle: timeIndex2 == index }"
>
{{ item.title }}
</div>
<div class="home-chart-right">
<div
class="imgDiv"
v-for="(item, index) in imgData"
:key="index"
@click="handleImg(index)"
:class="{ imgStyle: imgIndex == index }"
>
<img
:src="item.imgSrc"
class="choice-icon"
id="svgImg "
alt=""
:title="item.title"
/>
</div>
</div>
</div>
<div class="charts-div" ref="analyse_ref"></div>
</div>
</template>
<script>
import { homeCharts } from "@/api/index";
export default {
data() {
return {
timeData2: [
{ title: "系统EER" },
{ title: "瞬时冷量(kwr)" },
{ title: "瞬时电量(kwh)" },
// { title: "(kwh)" },
{ title: "冷冻水供回水温度(℃)" },
// { title: "()" },
],
timeIndex2: 0, //
imgData: [
{
title: "轮播",
imgSrc: require("../../assets/images/noactive-0.png"),
},
{
title: "手动",
imgSrc: require("../../assets/images/noactive-1.png"),
},
],
imgIndex: 0, //
chartInstance2: null,
option2: {},
xTimeData: [], // 线x
//线
electData: [],
electTime: [],
waterData: [],
waterTime: [],
EERData: [],
EERTime: [],
proximityData: [],
proximityTime: [],
chartInstance2: null,
option2: {},
allDataObj: {}, //
xData: [],
chartsAeries: [],
};
},
mounted() {
this.initChart2();
this.screenAdapter2();
window.addEventListener("resize", this.screenAdapter2);
this.getChartsData();
this.move();
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter2);
//
clearInterval(this.timer);
},
methods: {
// or
handleImg(index) {
this.imgIndex = index;
// console.log("this.timeData2[index].imgSrc", this.timeData2[index].title)
//
for (let i = 0; i < this.imgData.length; i++) {
const imgSrc =
i === index ? `active-${index}.png` : `noactive-${i}.png`;
this.imgData[i].imgSrc = require(`../../assets/images/${imgSrc}`);
}
if (index == 0) {
this.move();
} else {
clearInterval(this.timer);
}
},
handleEnter(index) {
this.timeIndex2 = index;
console.log("有打印瞬时冷量的index吗", this.allDataObj);
this.chartInstance2.dispose();
this.initChart2();
this.xData = [];
this.chartsAeries = [];
if (index == 1) {
// 线
var singleSeries = {
smooth: true,
symbol: "circle",
//
showSymbol: false,
itemStyle: {
color: "#44a2ff", // 线
lineStyle: {
color: "#44a2ff", // 线
},
},
areaStyle: {
color: {
type: "linear", // 线
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(11, 117, 211, 1)", // 0%
},
{
offset: 0.8,
color: "rgba(11, 117, 211, 0.2)", // 100%
},
],
},
},
};
this.allDataObj.cloudChart.series[0] = {
...this.allDataObj.cloudChart.series[0],
...singleSeries,
};
this.chartsAeries = this.allDataObj.cloudChart.series;
this.xData = this.allDataObj.cloudChart.xaxis.data;
this.option2.xAxis.data = this.xData;
this.option2.series = this.chartsAeries;
} else if (index == 2) {
// 线
var singleSeries = {
smooth: true,
symbol: "circle",
//
showSymbol: false,
itemStyle: {
color: "#01c29b", // 线
lineStyle: {
color: "#01c29b", // 线
},
},
areaStyle: {
color: {
type: "linear", // 线
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(1, 194, 155, 1)", // 0%
},
{
offset: 0.8,
color: "rgba(1, 194, 155, 0.2)", // 100%
},
],
},
},
};
this.allDataObj.eleRateChart.series[0] = {
...this.allDataObj.eleRateChart.series[0],
...singleSeries,
};
this.chartsAeries = this.allDataObj.eleRateChart.series;
this.xData = this.allDataObj.eleRateChart.xaxis.data;
this.option2.xAxis.data = this.xData;
this.option2.series = this.chartsAeries;
} else if (index == 3) {
//
let legendData = [];
this.allDataObj.tempChart.series.forEach((element) => {
legendData.push(element.name);
});
console.log("图例数组", legendData);
this.chartsAeries = this.allDataObj.tempChart.series;
this.xData = this.allDataObj.tempChart.xaxis.data;
this.option2.legend.show = true;
this.option2.legend.data = legendData;
this.option2.xAxis.data = this.xData;
// seriesshowSymbol = false; //,
for (var i = 0; i < this.chartsAeries.length; i++) {
this.chartsAeries[i].showSymbol = false;
}
this.option2.series = this.chartsAeries;
} else if (index == 0) {
// 线
var singleSeries = {
smooth: true,
symbol: "circle",
//
showSymbol: false,
itemStyle: {
color: "#ffb219", // 线
lineStyle: {
color: "#ffb219", // 线
},
},
areaStyle: {
color: {
type: "linear", // 线
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(255, 178,25 , 0.8)", // 0%
},
{
offset: 0.8,
color: "rgba(255, 178,25 , 0.2)", // 100%
},
],
},
},
};
this.allDataObj.copChart.series[0] = {
...this.allDataObj.copChart.series[0],
...singleSeries,
};
this.chartsAeries = this.allDataObj.copChart.series;
this.xData = this.allDataObj.copChart.xaxis.data;
this.option2.xAxis.data = this.xData;
this.option2.series = this.chartsAeries;
} else if (index == 4) {
//
let legendData = [];
this.allDataObj.appChart.series.forEach((element) => {
legendData.push(element.name);
});
console.log("图例数组", legendData);
this.chartsAeries = this.allDataObj.appChart.series;
this.xData = this.allDataObj.appChart.xaxis.data;
this.option2.legend.show = true;
this.option2.legend.data = legendData;
this.option2.xAxis.data = this.xData;
// seriesshowSymbol = false; //,
for (var i = 0; i < this.chartsAeries.length; i++) {
this.chartsAeries[i].showSymbol = false;
}
this.option2.series = this.chartsAeries;
}
console.log("折线图的xAxis详情", this.xData);
console.log("折线图的series详情", this.chartsAeries);
//.chartInstanceoptiondataoption
this.chartInstance2.setOption(this.option2);
//resize
this.chartInstance2.resize();
},
//chartInstance2 线
initChart2() {
this.chartInstance2 = this.$echarts.init(this.$refs.analyse_ref);
this.option2 = {
tooltip: {
trigger: "axis",
// 使 formatter tooltip
// formatter: function (params) {
// let seriesHTML = "";
// params.forEach(function (item) {
// seriesHTML +=
// "<div>" +
// item.seriesName +
// ': <span style="color: #000000; font-weight: bold;">' +
// item.value +
// "</span></div>";
// });
// return "<div>" + params[0].name + "</div>" + seriesHTML;
// },
// tooltip
formatter: function (params) {
var res = params[0].name + "<br/>";
for (var i = 0, l = params.length; i < l; i++) {
var seriesName = params[i].seriesName;
var value = params[i].value;
var marker =
'<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' +
params[i].color +
'"></span>';
// seriesName
if (seriesName.indexOf("瞬时冷量") !== -1) {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
"kwr" +
"</span><br>";
} else if (seriesName.indexOf("用电量") !== -1) {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
"kwh" +
"</span><br>";
} else if (
seriesName.indexOf("温度") !== -1 ||
seriesName.indexOf("趋近度") !== -1
) {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
"℃" +
"</span><br>";
} else if (seriesName.indexOf("瞬时功率") !== -1) {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
"kwh" +
"</span><br>";
} else {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
"</span><br>";
}
}
return res;
},
},
legend: {
show: false, //
// data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
textStyle: { color: "#ffffff" },
// left: "0%",
top: "-1%",
},
grid: {
top: "9%",
left: "3%",
right: "2%",
bottom: "25%",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: true,
// data: ["2021", "2022", "2023"],
axisLabel: {
// interval: 0, //x
color: "rgba(255,255,255,1)",
},
axisTick: {
show: false,
},
axisLine: {
show: false,
},
},
yAxis: {
min: 0,
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255,255,255,1)",
},
// y
axisLine: {
show: true,
lineStyle: {
// X
color: "#7b918c",
},
},
// y线
splitLine: {
lineStyle: {
color: "#7b918c",
},
},
},
// X
dataZoom: [
{
type: "slider", //inside
show: this.showZoom,
height: 15, // 20
// fillerColor: 'rgba(255, 0, 0, 0.5)', //
// backgroundColor: 'rgba(0, 0, 0, 0.1)', // 0.1
start: 0,
end: 100,
xAxisIndex: [0],
handleSize: "120%", // 120%
},
],
series: [
// {
// name: "",
// type: "line",
// smooth: true,
// // data: ["1", "2", "3"],
// symbol: "circle",
// //
// symbolSize: 8,
// //
// // itemStyle: {
// // color: "#0184d5",
// // borderColor: "rgba(221, 220, 107, .1)",
// // borderWidth: 12
// // },
// //
// showSymbol: false,
// sampling: 'lttb',//
// //线
// itemStyle: {
// color: "#44a2ff", //线
// lineStyle: {
// color: "#44a2ff", //线
// },
// },
// areaStyle: {
// color: {
// //线
// type: "linear",
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// colorStops: [
// {
// offset: 0,
// color: "rgba(11, 117, 211, 1)", // 0%
// },
// {
// offset: 0.8,
// color: "rgba(11, 117, 211,0.2)", // 100%
// },
// ],
// // global: false, // false
// },
// },
// },
],
};
//
this.chartInstance2.setOption(this.option2, true);
},
screenAdapter2() {
//,2.6 mes_ref
const titleFontSize = this.$refs.analyse_ref.offsetWidth / 130;
//optionoption
const adapterOption = {
// x
xAxis: {
axisLabel: {
fontSize: titleFontSize * 1.5,
},
},
yAxis: {
axisLabel: {
fontSize: titleFontSize * 1.5,
},
},
};
//.chartInstanceoptiondataoption
this.chartInstance2.setOption(adapterOption);
//resize
this.chartInstance2.resize();
},
//
getChartsData() {
this.chartInstance2.dispose();
this.initChart2();
homeCharts().then((res) => {
console.log("图表数据查询返回", res);
if (res.code == 200) {
this.allDataObj = res.rows;
console.log("全部的数据", this.allDataObj);
//
this.handleEnter(this.timeIndex2);
} else {
this.chartsAeries = [];
const adapterOption = {
xAxis: {
data: [],
},
series: [],
};
//.chartInstanceoptiondataoption
this.chartInstance2.setOption(adapterOption);
//resize
this.chartInstance2.resize();
}
});
},
//
move() {
//
this.timer = setInterval(() => {
this.handleEnter((this.timeIndex2 + 1) % 4);
}, 1000 * 5 * 60);
},
},
};
</script>
<style lang="scss" scoped>
.home-chart {
display: flex;
flex-direction: row;
overflow: hidden;
cursor: pointer;
width: 100%;
position: relative;
.legend-li {
text-align: center;
font-size: 0.2rem;
color: #95adc8;
padding: 0.08rem 0.2rem;
white-space: nowrap;
margin-right: 0.3rem;
border: 1px solid #0076c1;
border-radius: 0.06rem;
}
.home-chart-right {
position: absolute;
right: 0;
display: flex;
flex-direction: row;
.imgDiv {
width: 0.35rem;
height: 0.35rem;
margin: 0.05rem;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.choice-icon {
width: 0.2rem;
height: 0.2rem;
}
.imgStyle {
background-color: #0076c1;
border-radius: 50%;
}
}
}
.charts-div {
margin-top: 0.3rem;
width: 100%;
height: 3.6rem;
}
</style>

144
src/views/components/hotWater.vue

@ -1,144 +0,0 @@
<template>
<div class="card-div">
<!-- 二通阀 -->
<div class="card-li">
<div class="card-header">
<h2 class="card-title">二通阀开度:</h2>
</div>
<div class="thermometer">
<div class="temprogress" :style="{ width: twoValveValue + '%' }"></div>
</div>
<div class="temperature">
<span
v-if="twoValveItem && twoValveItem.status === 1"
class="error-text"
>异常</span
>
<span v-else>{{ twoValveValue }}%</span>
</div>
</div>
<!-- 三通阀 -->
<div class="card-li">
<div class="card-header">
<h2 class="card-title">三通阀开度:</h2>
</div>
<div class="thermometer">
<div
class="temprogress"
:style="{ width: threeValveValue + '%' }"
></div>
</div>
<div class="temperature">
<span
v-if="threeValveItem && threeValveItem.status === 1"
class="error-text"
>异常</span
>
<span v-else>{{ threeValveValue }}%</span>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
subData: {
type: Array,
required: true,
},
},
data() {
return {
temData1: "",
temData2: "",
temData: [],
};
},
computed: {
//
twoValveItem() {
return this.subData.find(
(item) => item.deviceTypeName === "二通阀阀门开度"
);
},
//
threeValveItem() {
return this.subData.find(
(item) => item.deviceTypeName === "三通阀阀门开度"
);
},
//
twoValveValue() {
if (!this.twoValveItem || this.twoValveItem.status === 1) return 0;
// 0-100
const value = parseFloat(this.twoValveItem.curValue) || 0;
return Math.min(Math.max(value, 0), 100);
},
//
threeValveValue() {
if (!this.threeValveItem || this.threeValveItem.status === 1) return 0;
// 0-100
const value = parseFloat(this.threeValveItem.curValue) || 0;
return Math.min(Math.max(value, 0), 100);
},
},
};
</script>
<style lang="scss" scoped>
.card-div {
width: 100%;
padding: 20px;
.card-li {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin: 10px;
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
.card-title {
font-size: 15px;
font-weight: 600;
color: #ffffff;
}
}
.temperature {
font-size: 20px;
font-weight: 700;
color: #2ecc71;
position: relative;
display: inline-block;
}
.thermometer {
width: calc(100% - 250px);
min-width: 200px;
height: 15px;
background: #3d5581;
border-radius: 20px;
margin: 0 0.1rem;
overflow: hidden;
box-shadow: inset 0 0 1rem rgba(0, 0, 0, 0.1);
position: relative;
}
.temprogress {
position: absolute;
left: 0;
height: 100%;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
background: linear-gradient(to right, #3498db, #2ecc71) !important;
}
}
}
@media (min-width: 2000px) {
}
</style>

1649
src/views/components/sysEnergy.vue

File diff suppressed because it is too large Load Diff

514
src/views/components/viewColdSys.vue

@ -1,514 +0,0 @@
<template>
<div class="energy_content">
<div class="sys_charts" ref="sys_charts"></div>
<div class="eer">{{ title }}</div>
<div class="bad" v-if="subData.status === 1">异常</div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
props: {
subData: {
type: Object,
required: true,
},
title: "",
},
data() {
return {
chartInstance: null,
option: {},
useForm: {
useData: 5,
maxData: 10, //
},
};
},
watch: {
subData: {
immediate: true, //
handler(newVal) {
// console.log("", this.subData);
if (Object.keys(newVal).length > 0) {
console.log("newval", newVal);
this.$nextTick(() => {
this.initChart();
});
}
},
},
},
mounted() {
this.initChart();
this.screenAdapter();
window.addEventListener("resize", this.screenAdapter);
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
//
getAxisLineColor(useData, maxData) {
//
// 0.75使
const threshold = maxData * 0.75;
//
if (useData > threshold) {
return [
[
useData / maxData,
new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: "rgba(0,127,208,1)" },
{ offset: 0.6, color: "rgba(0,127,208,1)" },
{ offset: 1, color: "rgba(69, 235, 167,0.5)" },
]),
],
[1, "rgba(28,128,245,.0)"],
];
} else {
return [
[
useData / maxData,
new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: "rgba(0,127,208,1)" },
{ offset: 0.5, color: "rgba(0,127,208,1)" },
{ offset: 1, color: "rgba(0,127,208,1)" },
]),
],
[1, "rgba(28,128,245,.0)"],
];
}
},
//chartInstance2 线
initChart() {
this.chartInstance = echarts.init(this.$refs.sys_charts);
var dataArr = this.subData.curValue; //
var maxData = 10; //
this.option = {
// backgroundColor: "#0E1327",
tooltip: {
formatter: "{a} <br/>{b} : {c}%",
},
series: [
{
name: "外部线",
type: "gauge",
radius: "100%", //
startAngle: 225,
endAngle: -45,
axisLine: {
lineStyle: {
color: [
[1, "#31F3FF"], //
],
width: 1,
},
},
axisLabel: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
detail: {
show: false,
},
title: {
//
show: false,
},
},
{
name: "外部刻度",
type: "gauge",
radius: "100%",
min: 0, //
max: maxData, //
splitNumber: 10, //
startAngle: 225,
endAngle: -45,
axisLine: {
show: false,
lineStyle: {
color: [[1, "rgba(0,0,0,0)"]],
},
}, //线
axisLabel: {
show: true,
color: "#31F3FF",
fontSize: 9, //
distance: -15, //
}, //
axisTick: {
show: false,
}, //
splitLine: {
show: false,
},
},
{
name: "内部宽线条",
type: "gauge",
radius: "77%",
startAngle: 225,
endAngle: -45,
axisLine: {
lineStyle: {
color: [[1, "#122B3C"]],
width: 20,
},
},
axisLabel: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
detail: {
show: false,
},
title: {
show: false,
},
},
{
name: "内部细线条",
type: "gauge",
radius: "43%",
startAngle: 225,
endAngle: -45,
axisLine: {
lineStyle: {
color: [[1, "#385264"]],
width: 1,
},
},
axisLabel: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
detail: {
show: false,
},
title: {
show: false,
},
},
{
name: "间隔条形",
type: "gauge",
radius: "98%",
z: 4,
splitNumber: 20, //
startAngle: 225,
endAngle: -45,
axisLine: {
lineStyle: {
opacity: 0,
},
},
axisLabel: {
show: false,
},
axisTick: {
show: true,
length: 10,
splitNumber: 1,
lineStyle: {
color: "#122B3C",
width: 0.5,
},
},
splitLine: {
show: false,
},
detail: {
show: false,
},
title: {
show: false,
},
},
{
name: "数据",
type: "gauge",
radius: "70.5%",
z: 3,
startAngle: 225,
max: maxData,
endAngle: -45,
axisLine: {
lineStyle: {
color: [
[dataArr / maxData, "#31F3FF"], //
[1, "#16414D"], //-
],
width: 10,
},
},
tooltip: {
show: false,
},
axisLabel: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
detail: {
show: true,
fontWeight: "bold",
fontSize: 18,
offsetCenter: [0, "60%"], //
color: "#31F3FF",
},
pointer: {
show: true,
length: "75%", //
width: 2, //
itemStyle: {
color: "#31F3FF", //
borderWidth: 0,
shadowColor: "rgba(255, 107, 53, 0.5)", //
shadowBlur: 10, //
},
},
data: [
{
name: "",
value: dataArr,
},
],
},
// -
{
name: "内圆环",
type: "pie",
radius: "10%",
hoverAnimation: false,
tooltip: {
show: false,
},
cursor: "default",
labelLine: {
normal: {
show: false,
},
},
itemStyle: {
color: "#08ACDF",
},
animation: false,
data: [1],
},
// -
{
name: "内圆环2",
type: "pie",
radius: "5%",
hoverAnimation: false,
cursor: "default",
tooltip: {
show: false,
},
labelLine: {
normal: {
show: false,
},
},
itemStyle: {
color: "#31F3FF",
},
animation: false,
data: [1],
},
],
};
//
this.chartInstance.setOption(this.option, true);
},
screenAdapter() {
const titleFontSize = this.$refs.sys_charts.offsetWidth / 18;
const adapterOption = {
series: [],
};
this.chartInstance.setOption(adapterOption);
this.chartInstance.resize();
},
//
echartsData() {
if (this.subData.length > 0) {
this.useForm.maxData = 10;
this.useForm.useData = this.subData[0].value;
let that = this;
// 使
const axisLineColor = this.getAxisLineColor(
this.useForm.useData,
this.useForm.maxData
);
const titleFontSize = this.$refs.sys_charts.offsetWidth / 20;
const adapterOption = {
// series: [
// {
// name: "",
// axisLine: {
// lineStyle: {
// color: axisLineColor,
// //
// // width: 80,
// },
// },
// },
// {
// name: "",
// min: 0,
// max: this.useForm.maxData,
// },
// {
// name: "",
// data: [
// {
// value: 5,
// },
// ],
// },
// {
// name: "",
// label: {
// show: true,
// position: "center", //
// offset: [0, -titleFontSize * 0.6], // 10
// formatter: function () {
// // HTML 使 rich
// return `{line|${that.useForm.useData}}`;
// },
// rich: {
// line: {
// color: "#fff", //
// fontSize: titleFontSize, //
// lineHeight: 5, //
// },
// },
// },
// data: [
// {
// value: 0,
// itemStyle: {
// //
// color: {
// type: "linear",
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// colorStops: [
// {
// offset: 0,
// color: "rgb(4,112,212)", //
// },
// {
// offset: 0.3,
// color: "rgba(0, 46, 93)", //
// },
// ],
// global: false, // false
// },
// },
// },
// ],
// },
// {
// //
// name: this.energyCostText,
// max: this.useForm.maxData, //
// axisLabel: {
// formatter: (value) => {
// // 0
// if (value === 0 || value == this.useForm.maxData) {
// // 100
// return value;
// }
// return "";
// },
// },
// data: [
// {
// name: this.dateUse,
// value: this.useForm.useData,
// },
// ],
// },
// ],
};
this.chartInstance.setOption(adapterOption);
//resize
this.chartInstance.resize();
}
},
},
};
</script>
<style lang="scss" scoped>
.energy_content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100% !important;
height: 100%;
.sys_charts {
width: 100%;
height: 150px;
}
.eer {
font-size: 18px;
}
}
.bad {
font-size: 18px;
margin-top: 5px;
color: red;
// animation: colorBlink 1s infinite;
}
@keyframes colorBlink {
0%,
100% {
color: #ff0000;
} /* 亮红 */
50% {
color: #cc0000;
} /* 暗红 */
}
// 2000px
@media (min-width: 2000px) {
.sys_charts {
height: 1.5rem !important;
}
.eer {
font-size: 0.18rem !important;
margin-top: 0.25rem !important;
}
}
</style>

2
src/views/components/viewEnergy.vue

@ -81,7 +81,7 @@ export default {
); );
console.log("当前要渲染的数据对象", chartsObj); console.log("当前要渲染的数据对象", chartsObj);
console.log("当前要渲染的颜色对象", colorObj); console.log("当前要渲染的颜色对象", colorObj);
const titleFontSize = this.$refs.chart_ref.offsetWidth / 50; const titleFontSize = this.$refs.chart_ref.offsetWidth / 100;
let adapterOption = {}; let adapterOption = {};
// 线 // 线
adapterOption = { adapterOption = {

1164
src/views/index.vue

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save