shuinichang_/.history/src/views/Zhou/NXGL_20231205164629.vue

1579 lines
55 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="box">
<div class="a">
<img src="../../assets/img/能效.png" alt="" @click="sendMessageToCSharp" />
</div>
<div class="left">
<img src="../../assets/img/标题/能效管理.png" class="title" />
<div class="nylx">
<div class="imgBox">
<img src="../../assets/img/小标题栏.png" class="img" />
<p>能源流向</p>
</div>
<div id="nylx"></div>
</div>
<div class="ffl">
<div class="imgBox">
<img src="../../assets/img/小标题栏.png" class="img" />
<p>复费率</p>
</div>
<div id="ffl"></div>
</div>
<div class="nxdb">
<div class="imgBox">
<img src="../../assets/img/小标题栏.png" class="img" />
<p>能效对标定额管理</p>
</div>
<div id="nxdb">
<div class="table">
<el-table :data="tableData" :row-class-name="tableRowClassName" style="width: 100%"
header-cell-style="background-color: #1969A8; color: white">
<el-table-column prop="date1" label="" align="center" width="480">
</el-table-column>
<el-table-column prop="date2" label="先进值" align="center">
</el-table-column>
<el-table-column prop="date3" label="企业" align="center">
</el-table-column>
<el-table-column prop="date4" label="同比" align="center">
<template scope="scope">
<span style="color: #40FFF1;">{{ scope.row.date4 }}</span>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
<div class="right">
<div class="jnl">
<div class="imgBox">
<img src="../../assets/img/小标题栏.png" class="img" />
<p>节能量节电率</p>
</div>
<div class="chartBox">
<div id="jnl">
<img src="../../assets/NXGL/r1.png" alt="" />
<div class="zx">
<span>节能量节电率:</span>
</div>
<div class="span_jnl">
<span style="color: #07CDFF; font-size: 40px">24.32tce(24%)</span>
</div>
</div>
</div>
</div>
<div class="dfdj">
<div class="imgBox">
<img src="../../assets/img/小标题栏.png" class="img" />
<p>电费电价</p>
</div>
<div class="chartBox">
<div id="dfdj">
</div>
</div>
</div>
<div class="sbyxqk">
<div class="imgBox">
<img src="../../assets/img/小标题栏.png" class="img" />
<p>设备运行情况</p>
</div>
<div id="sbyxqk">
<div class="table">
<el-table :data="devices" style="width: 100%" :row-class-name="tableRowClassName">
<el-table-column prop="date1" label="设备名称" align="center">
</el-table-column>
<el-table-column prop="date2" label="开关状态" align="center">
<template scope="scope">
<img src="../../assets/KDFH/tongguo.png" v-if="scope.row.date2 == true" />
<img src="../../assets/KDFH/jinggao.png" v-else />
</template>
</el-table-column>
<el-table-column prop="date3" label="实时负荷" align="center">
<template scope="scope">
<span class="count">{{ scope.row.date3 }}</span>
<span class="danwei">kW</span>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
data() {
return {
tableData: [
{
date1: "水泥单位产品综合能耗",
date2: "80kgce/t",
date3: "84kgce/t",
date4: "5%",
},
{
date1: "水泥大内产品综合电耗",
date2: "40kWh/t",
date3: "53kWh/t",
date4: "32.5%",
},
{
date1: "熟料单位产品综合能耗",
date2: "100kgce/t",
date3: "114kgce/t",
date4: "14%",
},
{
date1: "熟料单位产品综合电耗",
date2: "48kWh/t",
date3: "55kWh/t",
date4: "14.58%",
},
{
date1: "熟料单位产品综合煤耗",
date2: "94kgce/",
date3: "108kgce/",
date4: "14.89%",
},
],
devices: [
{
date1: "回转窑",
date2: true,
date3: "102.00",
},
{
date1: "熟料收尘",
date2: true,
date3: "29.00",
},
{
date1: "篦冷机",
date2: true,
date3: "45.00",
},
{
date1: "生料收尘",
date2: false,
date3: "102.00",
},
{
date1: "回转窑",
date2: true,
date3: "29.00",
},
{
date1: "熟料收尘",
date2: false,
date3: "45.00",
}
],
option1: {
tooltip: {
trigger: "item",
triggerOn: "mousemove",
},
grid: {
top: "25px",
left: "10px",
right: "10px",
bottom: "6%",
containLabel: true,
},
series: {
type: "sankey",
layout: "none",
top: "2%",
bottom: "5%",
left: "5%",
right: "13%",
lineStyle: {
opacity: 0.3,
color: "gradient",
curveness: 0.7,
},
label: {
color: "#fff",
fontSize: 16,
formatter: function (params) {
return params.name
},
rich: {
white: {
fontSize: 20,
padding: [10, 0, 0, 0],
},
},
},
nodeGap: 20,
layoutIterations: 1,
emphasis: {
// focus: "adjacency",
},
data: [
{ name: "原始值折标煤", itemStyle: { color: "#5FE3D9" }, depth: 0 },
{ name: "水", itemStyle: { color: "#55A9CE" }, depth: 1 },
{ name: "电", itemStyle: { color: "#55A9CE" }, depth: 1 },
{ name: "余热发电", itemStyle: { color: "#55A9CE" }, depth: 1 },
{ name: "煤", itemStyle: { color: "#55A9CE" }, depth: 1 },
{ name: "1号生产线", id: "1", itemStyle: { color: "#52DBF1" }, depth: 2 },
{ name: "2号生产线", id: "2", itemStyle: { color: "#52DBF1" }, depth: 2 },
{ name: "3号生产线", id: "3", itemStyle: { color: "#52DBF1" }, depth: 2 },
{ name: "1号生产线", id: "11", itemStyle: { color: "#52DBF1" }, depth: 2 },
{ name: "2号生产线", id: "22", itemStyle: { color: "#52DBF1" }, depth: 2 },
{ name: "3号生产线", id: "33", itemStyle: { color: "#52DBF1" }, depth: 2 },
],
links: [
// L1→L3 4509
{ source: "原始值折标煤", target: "水", value: 800 },
{ source: "原始值折标煤", target: "电", value: 800 },
{ source: "原始值折标煤", target: "余热发电", value: 800 },
{ source: "原始值折标煤", target: "煤", value: 800 },
// L1→L2→L3 2404
{ source: "煤", target: "11", value: 200 },
{ source: "煤", target: "22", value: 200 },
{ source: "煤", target: "33", value: 200 },
{ source: "余热发电", target: "1", value: 200 },
{ source: "余热发电", target: "2", value: 200 },
{ source: "余热发电", target: "3", value: 200 },
],
},
},
};
},
methods: {
//U3D交互的绑定
sendMessageToCSharp() {
// window.vuplex.postMessage({
// type: "Tog",
// message: "能效管理_true",
// });
window.vuplex.postMessage("能效管理");
this.$router.push('/nxglnh');
},
defineEcharts(dom, option) {
var chartDom = document.getElementById(dom);
var myChart = this.$echarts.init(chartDom);
myChart.setOption(option);
},
tableRowClassName({ row, rowIndex }) {
if ((rowIndex + 1) % 2 === 0) {
return "success-row";
}
return "";
},
// dfdj() {
// const offsetX = 24; //bar宽
// const offsetY = 8; //倾斜角度
// // 绘制左侧面
// const CubeLeft = this.$echarts.graphic.extendShape({
// shape: {
// x: 0,
// y: 0,
// },
// buildPath: function (ctx, shape) {
// // 会canvas的应该都能看得懂shape是从custom传入的
// const xAxisPoint = shape.xAxisPoint;
// // console.log(shape);
// const c0 = [shape.x, shape.y];
// const c1 = [shape.x - offsetX, shape.y - offsetY];
// const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY];
// const c3 = [xAxisPoint[0], xAxisPoint[1]];
// ctx
// .moveTo(c0[0], c0[1])
// .lineTo(c1[0], c1[1])
// .lineTo(c2[0], c2[1])
// .lineTo(c3[0], c3[1])
// .closePath();
// },
// });
// // 绘制右侧面
// const CubeRight = this.$echarts.graphic.extendShape({
// shape: {
// x: 0,
// y: 0,
// },
// buildPath: function (ctx, shape) {
// const xAxisPoint = shape.xAxisPoint;
// const c1 = [shape.x, shape.y];
// const c2 = [xAxisPoint[0], xAxisPoint[1]];
// const c3 = [xAxisPoint[0] + offsetX, xAxisPoint[1] - offsetY];
// const c4 = [shape.x + offsetX, shape.y - offsetY];
// ctx
// .moveTo(c1[0], c1[1])
// .lineTo(c2[0], c2[1])
// .lineTo(c3[0], c3[1])
// .lineTo(c4[0], c4[1])
// .closePath();
// },
// });
// // 绘制顶面
// const CubeTop = this.$echarts.graphic.extendShape({
// shape: {
// x: 0,
// y: 0,
// },
// buildPath: function (ctx, shape) {
// const c1 = [shape.x, shape.y];
// const c2 = [shape.x + offsetX, shape.y - offsetY]; //右点
// // const c3 = [shape.x, shape.y - offsetX];
// const c3 = [shape.x, shape.y - offsetY * 2];
// const c4 = [shape.x - offsetX, shape.y - offsetY];
// ctx
// .moveTo(c1[0], c1[1])
// .lineTo(c2[0], c2[1])
// .lineTo(c3[0], c3[1])
// .lineTo(c4[0], c4[1])
// .closePath();
// },
// });
// // 注册三个面图形
// this.$echarts.graphic.registerShape("CubeLeft", CubeLeft);
// this.$echarts.graphic.registerShape("CubeRight", CubeRight);
// this.$echarts.graphic.registerShape("CubeTop", CubeTop);
// let xAxisData = ["1月", "2月", "3月", "4月", "5月"];
// let seriesData = [34, 36, 48, 13, 38];
// //拿到最大值
// const maxValue = Math.max(...seriesData);
// let colorArr = [
// ["#0A67FF"],
// ["#10C6FF", "rgba(60,113,255,1)"],
// ["#0774D6", "rgba(17,94,213,1)"],
// ];
// let option = {
// legend: {
// data: [
// {
// icon: "rect",
// name: "电费",
// },
// ],
// textStyle: {
// color: "#fff",
// fontSize: "20px",
// },
// },
// tooltip: {
// trigger: "axis",
// axisPointer: {
// type: "shadow",
// },
// formatter: function (params, ticket, callback) {
// const item = params[1];
// return item.name + " : " + item.value;
// },
// },
// grid: {
// // 让图表占满容器
// left: "5%",
// right: "5%",
// bottom: "0%",
// containLabel: true,
// },
// xAxis: {
// type: "category",
// data: xAxisData,
// axisLine: {
// show: true,
// },
// axisTick: {
// show: false,
// },
// axisLabel: {
// fontSize: 20,
// color: "#fff",
// margin: 15,
// },
// },
// yAxis: [{
// type: "value",
// name: "单位:kWh",
// nameTextStyle: {
// color: "#fff",
// fontSize: 20,
// padding: 10,
// },
// splitLine: {
// show: true,
// lineStyle: {},
// },
// axisTick: {
// show: false,
// },
// axisLabel: {
// show: true,
// textStyle: {
// color: "#fff",
// fontSize: 20,
// },
// },
// // boundaryGap: ['20%', '20%'],
// }, {
// show: true,
// }],
// series: [
// {
// type: "custom",
// name: "电费",
// renderItem: (params, api) => {
// const location = api.coord([api.value(0), api.value(1)]);
// return {
// type: "group",
// children: [
// {
// type: "CubeLeft",
// shape: {
// api,
// xValue: api.value(0),
// yValue: api.value(1),
// x: location[0],
// y: location[1],
// xAxisPoint: api.coord([api.value(0), 0]),
// },
// style: {
// fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {
// offset: 0,
// color: colorArr[1][0],
// },
// {
// offset: 1,
// color: colorArr[1][1],
// },
// ]),
// },
// },
// {
// type: "CubeRight",
// shape: {
// api,
// xValue: api.value(0),
// yValue: api.value(1),
// x: location[0],
// y: location[1],
// xAxisPoint: api.coord([api.value(0), 0]),
// },
// style: {
// fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {
// offset: 0,
// color: colorArr[2][0],
// },
// {
// offset: 1,
// color: colorArr[2][1],
// },
// ]),
// },
// },
// {
// type: "CubeTop",
// shape: {
// api,
// xValue: api.value(0),
// yValue: api.value(1),
// x: location[0],
// y: location[1],
// xAxisPoint: api.coord([api.value(0), 0]),
// },
// style: {
// fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {
// offset: 0,
// color: colorArr[0][0],
// },
// {
// offset: 1,
// color: colorArr[0][0],
// },
// ]),
// },
// },
// ],
// };
// },
// data: seriesData,
// },
// {
// type: "bar",
// label: {
// normal: {
// show: true,
// position: "top",
// formatter: (e) => {
// return e.value === maxValue ? e.value : "";
// },
// fontSize: 20,
// color: "#11C3FF",
// offset: [0, -15],
// },
// },
// itemStyle: {
// color: "transparent",
// },
// tooltip: {},
// data: seriesData,
// },
// ],
// };
// this.defineEcharts("dfdj", option);
// },
dfdj2() {
// mock 数据
const dataArr = {
xdata: ['1月', '2月', '3月', '4月', '5月'],
rateData: [0.4, 0.6, 0.5, 0.16, 0.62],
disinfeced: [32, 34, 48, 14, 38],
// placeData: [320, 435, 490, 340, 320, 270, 360]
}
const legend = {
data: [
{
name: '电费',
icon: "rect"
}, {
name: '销售电价',
icon: "rect"
}],
textStyle: {
color: "#fff",
fontSize: "20px",
},
itemWidth: 25,
itemHeight: 15,
itemGap: 15,
// bottom: '5%',
selectedMode: false
}
const grid = { top: '10%', left: '10%', right: '3%', bottom: '15%' }
// xAxis
const xAxis = {
axisTick: { show: true },
axisLine: { lineStyle: { color: 'rgba(255,255,255, .2)' } },
axisLabel: { textStyle: { fontSize: 20, color: '#fff' }, },
data: dataArr.xdata
}
// yAxis
const yAxis = [{
type: "value",
name: "单位:kWh",
splitLine: { lineStyle: { color: 'rgba(255,255,255, .05)' } },
axisLine: { show: false, lineStyle: { color: "#fff" } },
axisLabel: { textStyle: { fontSize: 20, color: '#fff' } }
}, {
// 双y轴主要用于折线图所以不需要显示坐标
type: "value",
show: true,
min: 0,
max: 1,
axisLabel: { textStyle: { fontSize: 20, color: '#fff' } }
}]
// series
const series = [
{
z: 2,
name: '底部',
type: 'pictorialBar',
data: [1, 1, 1, 1, 1, 1, 1, 1],
symbol: 'diamond',
symbolOffset: [0, '50%'],
symbolSize: [30, 20],
itemStyle: {
color: {
type: 'linear',
x: 0, x2: 1, y: 0, y2: 0,
colorStops: [{ offset: 0, color: 'rgba(17, 195, 255, 1)' }, { offset: 0.5, color: 'rgba(17, 195, 255, 1)' }, { offset: 0.5, color: 'rgba(17, 195, 255, .7)' }, { offset: 1, color: 'rgba(17, 195, 255, 1)' }]
}
},
}, {
z: 3,
name: '上部1',
type: 'pictorialBar',
symbolPosition: 'end',
data: dataArr.disinfeced,
symbol: 'diamond',
symbolOffset: [0, '-50%'],
symbolSize: [30, 20],
itemStyle: {
borderColor: 'rgba(17, 195, 255, 1)',
borderWidth: 2,
color: 'rgba(17, 195, 255, 1)'
},
}, {
z: 1,
stack: '总量',
type: 'bar',
name: '电费',
barWidth: 30,
// barGap: '-100%',
data: dataArr.disinfeced,
itemStyle: {
color: {
type: 'linear',
x: 0, x2: 1, y: 0, y2: 0,
colorStops: [{ offset: 0, color: 'rgba(17, 195, 255, .7)' }, { offset: 0.5, color: 'rgba(17, 195, 255, .5)' }, { offset: 0.5, color: 'rgba(17, 195, 255, .5)' }, { offset: 1, color: 'rgba(17, 195, 255, .7)' }]
}
},
}, {
z: 9,
// 双y轴
yAxisIndex: 1,
name: '销售电价', type: 'line',
symbol: 'circle',
symbolSize: [12, 12],
color: {
type: 'linear', x: 1, y: 0, x2: 0, y2: 0,
// 0% 处的颜色 // 100% 处的颜色
colorStops: [{ offset: 0, color: '#43FFF4 ' }, { offset: 1, color: '#43FFF4' }],
global: false // 缺省为 false
},
lineStyle: {
color: {
type: 'linear', x: 1, y: 0, x2: 0, y2: 0,
// 0% 处的颜色 // 100% 处的颜色
colorStops: [{ offset: 0, color: '#43FFF4 ' }, { offset: 1, color: '#43FFF4' }],
global: false // 缺省为 false
}
},
// 修改的是线下区域的颜色
areaStyle: {
color: new echarts.graphic.LinearGradient(
// 右/下/左/上
0, 0, 0, 1, [
{ offset: 0, color: 'rgba(255, 209, 26, .2)' },
{ offset: 1, color: 'transparent' }
])
},
label: {
show: true,
textStyle: { fontSize: 16, color: '#ffd11a' }
},
data: dataArr.rateData
}]
let option = { xAxis, yAxis, series, grid, legend }
this.defineEcharts("dfdj", option);
},
ffl() {
let lengthData = [];
let Lengths = []
let data = [[], [], [], [], []]
let sum = 0
let arr = []
let dom = 800;
let barWidth = dom / 20;
let JsonData = [
{
"FXDJ": "尖峰时段用电量",
"ZTSL": "373",
"ZTLB": "1月",
"TJRQ": "2023-09",
"ID": "1",
"JCRWS": "52"
},
{
"FXDJ": "平时段用电量",
"ZTSL": "534",
"ZTLB": "1月",
"TJRQ": "2023-09",
"ID": "2",
"JCRWS": "15"
},
{
"FXDJ": "深谷时段用电量",
"ZTSL": "338",
"ZTLB": "1月",
"TJRQ": "2023-09",
"ID": "3",
"JCRWS": "20"
},
{
"FXDJ": "峰时段用电量",
"ZTSL": "133",
"ZTLB": "1月",
"TJRQ": "2023-09",
"ID": "4",
"JCRWS": "99"
},
{
"FXDJ": "谷时段用电量",
"ZTSL": "133",
"ZTLB": "1月",
"TJRQ": "2023-09",
"ID": "5",
"JCRWS": "99"
},
{
"FXDJ": "尖峰时段用电量",
"ZTSL": "201",
"ZTLB": "2月",
"TJRQ": "2023-09",
"ID": "6",
"JCRWS": "31"
},
{
"FXDJ": "平时段用电量",
"ZTSL": "327",
"ZTLB": "2月",
"TJRQ": "2023-09",
"ID": "7",
"JCRWS": "99"
},
{
"FXDJ": "深谷时段用电量",
"ZTSL": "621",
"ZTLB": "2月",
"TJRQ": "2023-09",
"ID": "8",
"JCRWS": "70"
},
{
"FXDJ": "峰时段用电量",
"ZTSL": "327",
"ZTLB": "2月",
"TJRQ": "2023-09",
"ID": "9",
"JCRWS": "107"
},
{
"FXDJ": "谷时段用电量",
"ZTSL": "327",
"ZTLB": "2月",
"TJRQ": "2023-09",
"ID": "10",
"JCRWS": "107"
},
{
"FXDJ": "尖峰时段用电量",
"ZTSL": "737",
"ZTLB": "3月",
"TJRQ": "2023-09",
"ID": "11",
"JCRWS": "40"
},
{
"FXDJ": "平时段用电量",
"ZTSL": "491",
"ZTLB": "3月",
"TJRQ": "2023-09",
"ID": "12",
"JCRWS": "45"
},
{
"FXDJ": "深谷时段用电量",
"ZTSL": "541",
"ZTLB": "3月",
"TJRQ": "2023-09",
"ID": "13",
"JCRWS": "57"
},
{
"FXDJ": "峰时段用电量",
"ZTSL": "128",
"ZTLB": "3月",
"TJRQ": "2023-09",
"ID": "14",
"JCRWS": "55"
},
{
"FXDJ": "谷时段用电量",
"ZTSL": "128",
"ZTLB": "3月",
"TJRQ": "2023-09",
"ID": "14",
"JCRWS": "55"
},
{
"FXDJ": "尖峰时段用电量",
"ZTSL": "795",
"ZTLB": "4月",
"TJRQ": "2023-09",
"ID": "16",
"JCRWS": "90"
},
{
"FXDJ": "平时段用电量",
"ZTSL": "1056",
"ZTLB": "4月",
"TJRQ": "2023-09",
"ID": "17",
"JCRWS": "57"
},
{
"FXDJ": "深谷时段用电量",
"ZTSL": "181",
"ZTLB": "4月",
"TJRQ": "2023-09",
"ID": "18",
"JCRWS": "53"
},
{
"FXDJ": "峰时段用电量",
"ZTSL": "204",
"ZTLB": "4月",
"TJRQ": "2023-09",
"ID": "19",
"JCRWS": "39"
},
{
"FXDJ": "谷时段用电量",
"ZTSL": "204",
"ZTLB": "4月",
"TJRQ": "2023-09",
"ID": "20",
"JCRWS": "39"
},
{
"FXDJ": "尖峰时段用电量",
"ZTSL": "446",
"ZTLB": "5月",
"TJRQ": "2023-09",
"ID": "21",
"JCRWS": "54"
},
{
"FXDJ": "平时段用电量",
"ZTSL": "791",
"ZTLB": "5月",
"TJRQ": "2023-09",
"ID": "22",
"JCRWS": "84"
},
{
"FXDJ": "深谷时段用电量",
"ZTSL": "607",
"ZTLB": "5月",
"TJRQ": "2023-09",
"ID": "23",
"JCRWS": "86"
},
{
"FXDJ": "峰时段用电量",
"ZTSL": "831",
"ZTLB": "5月",
"TJRQ": "2023-09",
"ID": "24",
"JCRWS": "94"
},
{
"FXDJ": "谷时段用电量",
"ZTSL": "831",
"ZTLB": "5月",
"TJRQ": "2023-09",
"ID": "25",
"JCRWS": "94"
}
]
for (let item of JsonData) {
// x轴数据
if (!lengthData.some(t => t === item.ZTLB)) {
lengthData.push(item.ZTLB);
}
// 图例数据
if (!Lengths.some(t => t === item.FXDJ)) {
Lengths.push(item.FXDJ);
}
}
Lengths.forEach((e, j) => {
JsonData.forEach((k, i) => {
lengthData.forEach((m, n) => {
console.log(m, k.ZTLB, k.ZTSL)
if (m == k.ZTLB && e == k.FXDJ) {
data[j][n] = k.ZTSL
}
})
})
})
let xData = lengthData.map((item, index) => {
return {
value: item,
};
});
let colors = [{
type: 'linear',
x: 0,
x2: 1,
y: 0,
y2: 0,
colorStops: [{
offset: 0,
color: '#FF3FDA'
}, {
offset: 0.5,
color: '#FF3FDA'
}, {
offset: 0.5,
color: '#CC1BAA'
}, {
offset: 1,
color: '#CC1BAA'
}]
},
{
type: 'linear',
x: 0,
x2: 1,
y: 0,
y2: 0,
colorStops: [{
offset: 0,
color: '#E7EE01'
}, {
offset: 0.5,
color: '#E7EE01'
}, {
offset: 0.5,
color: '#556B1E'
}, {
offset: 1,
color: '#556B1E'
}]
},
{
type: 'linear',
x: 0,
x2: 1,
y: 0,
y2: 0,
colorStops: [{
offset: 0,
color: '#03D258'
}, {
offset: 0.5,
color: '#03D258'
}, {
offset: 0.5,
color: '#359542'
}, {
offset: 1,
color: '#359542'
}]
},
{
type: 'linear',
x: 0,
x2: 1,
y: 0,
y2: 0,
colorStops: [{
offset: 0,
color: '#1B9EE4'
}, {
offset: 0.5,
color: '#1B9EE4'
}, {
offset: 0.5,
color: '#1B9EE4'
}, {
offset: 1,
color: '#1B9EE4'
}]
},
{
type: 'linear',
x: 0,
x2: 1,
y: 0,
y2: 0,
colorStops: [{
offset: 0,
color: '#02CFCD'
}, {
offset: 0.5,
color: '#02CFCD'
}, {
offset: 0.5,
color: '#02CFCD'
}, {
offset: 1,
color: '#DEA821'
}]
},
];
let option = {
//提示框
tooltip: {
show: true,
trigger: "axis", //axis , item
backgroundColor: "RGBA(0, 49, 85, 0.5)",
borderColor: "rgba(0, 151, 251, 0)",
borderWidth: 1,
borderRadius: 0,
textStyle: {
color: "#BCE9FC",
fontSize: 20,
align: "left",
},
confine: true,
// formatter(e,i){
// console.log(e,i)
// },
},
/**区域位置*/
grid: {
left: '6%',
right: '4%',
top: 50,
bottom: 40,
},
/**图例大小*/
legend: {
icon: "rect",
data: Lengths,
textStyle: {
color: '#BFEBFF',
fontSize: 30,
},
itemHeight: 16,
itemWidth: 30,
left: '15%',
top: 0,
itemGap: 50,
},
//X轴
xAxis: {
data: xData,
axisLabel: {
margin: 20,
interval: 0, //设置为 1表示『隔一个标签显示一个标签』
textStyle: {
color: "#BFEBFF",
fontStyle: "normal",
fontSize: 16,
},
},
axisLine: {
show: true,
lineStyle: {
color: "#BFEBFF",
},
},
splitLine: {
//坐标轴在 grid 区域中的分隔线。
show: false,
lineStyle: {
color: "rgba(77, 128, 254, 0.2)",
},
},
axisTick: {
//坐标轴刻度相关设置。
show: false,
},
},
yAxis: {
name: "单位kWh",
nameTextStyle: {
fontSize: 18,
color: "#BFEBFF",
},
show: true,
splitNumber: 4,
axisLine: {
show: true,
lineStyle: {
color: "#BFEBFF",
},
},
splitLine: {
//坐标轴在 grid 区域中的分隔线。
show: false,
lineStyle: {
color: "rgba(77, 128, 254, 0.2)",
},
},
axisLabel: {
//坐标轴刻度标签的相关设置。
interval: 0, //设置为 1表示『隔一个标签显示一个标签』
textStyle: {
color: "#BFEBFF",
fontStyle: "normal",
fontSize: 18,
},
},
axisTick: {
//坐标轴刻度相关设置。
show: false,
},
},
series: [
{
//图例一底部底片
z: 2,
type: 'pictorialBar',
data: data[0],
symbol: 'diamond',
symbolOffset: [0, '50%'],
symbolSize: [barWidth, barWidth * 0.5],
itemStyle: {
normal: {
color: function (params) {
return colors[0];
},
}
},
tooltip: {
show: false,
},
},
{
//图例一顶部底片
z: 3,
type: 'pictorialBar',
symbolPosition: 'end',
data: data[0],
symbol: 'diamond',
symbolOffset: [0, '-50%'],
symbolSize: [barWidth, barWidth * 0.5],
itemStyle: {
normal: {
borderWidth: 0,
color: function (params) {
return colors[0].colorStops[0].color;
},
}
},
tooltip: {
show: false,
},
},
],
};
data.forEach((e, i) => {
arr.push(e)
if (sum < i) {
sum++
option.series.push(
{
//图例二顶部底片
z: 3,
type: 'pictorialBar',
symbolPosition: 'end',
data: this.addArray(arr),
symbol: 'diamond',
symbolOffset: [0, '-50%'],
symbolSize: [barWidth, barWidth * 0.5],
itemStyle: {
normal: {
color: function (params) {
return colors[i].colorStops[0].color;
},
}
},
tooltip: {
show: false,
},
}
)
}
option.series.push(
{
type: 'bar',
name: Lengths[i],
barWidth: barWidth,
itemStyle: {
normal: {
color: function (params) {
return colors[i];
}
},
},
stack: '1',
data: e,
}
)
})
this.defineEcharts("ffl", option)
},
addArray(arr) {
let result = []
for (let i = 0; i < arr.length; i++) {
arr[i].forEach((value, index) => {
if (result[index] == null || result[index] == "") {
result[index] = 0;
}
result[index] += parseInt(value);
})
}
return result
}
},
created() {
// if (window.vuplex) {
// addMessageListener();
// } else {
// window.addEventListener("vuplexready", addEventListener);
// } function addEventListener() {
// window.vuplex.addEventListener("message", function (event) {
// let json = event.data;
// console.log("JSON received" + json);
// })
// }
},
mounted() {
this.defineEcharts("nylx", this.option1);
// this.dfdj();
this.dfdj2();
this.ffl();
// this.defineEcharts("yysl", this.option2);
// this.defineEcharts("nysl", this.option3);
// this.defineEcharts("nhfx", this.option4);
},
};
</script>
<style scoped lang="less">
.box {
width: 100%;
height: 100%;
box-sizing: border-box;
background-color: transparent;
display: flex;
background-image: url(../../assets/img/左遮罩.png), url(../../assets/img/右遮罩.png);
padding-top: 400px;
justify-content: space-between;
position: relative;
.a {
position: absolute;
width: 1300px;
z-index: 2;
top: 420px;
right: 480px;
z-index: 100;
img {
margin-right: 102px;
pointer-events: all;
cursor: pointer;
}
}
.left {
width: 1237px;
height: 2500px;
margin-left: 61px;
background-image: url("../../assets/img/侧边.png");
padding-left: 59px;
padding-right: 45px;
box-sizing: border-box;
.title {
margin-top: 15px;
margin-left: 60px;
}
.nylx {
position: relative;
margin-top: 56px;
.imgBox {
height: 93px;
width: 1156px;
p {
position: absolute;
color: #fff;
top: 20px;
left: 50px;
font-size: 30px;
font-family: "MicrosoftYaHei";
}
}
#nylx {
width: 1155px;
height: 500px;
margin-top: 50px;
}
}
.ffl {
position: relative;
margin-top: 56px;
.imgBox {
height: 93px;
width: 1156px;
p {
position: absolute;
color: #fff;
top: 20px;
left: 50px;
font-size: 30px;
font-family: "MicrosoftYaHei";
}
}
#ffl {
width: 1155px;
height: 500px;
margin-top: 50px;
}
}
.nxdb {
position: relative;
margin-top: 56px;
.imgBox {
height: 93px;
width: 1156px;
p {
position: absolute;
color: #fff;
top: 20px;
left: 50px;
font-size: 30px;
font-family: "MicrosoftYaHei";
}
}
#nxdb {
width: 1155px;
height: 500px;
margin-top: 50px;
/deep/ .table {
margin-top: 50px;
.time {
font-size: 20px;
}
.count {
color: #05F0FF;
font-size: 28px;
}
//表体颜色
.el-table tr {
background: #16253b;
color: #fff;
font-size: 30px;
height: 40px;
.cell {
line-height: 40px;
}
}
// 去掉eltable的hover效果
.el-table tbody tr:hover>td {
background-color: #0b679e !important;
}
//修改表头颜色
.has-gutter {
background-color: #1969a8;
th {
background-color: #1969a8;
}
}
//奇偶行颜色
.el-table .success-row {
background: #184167;
}
//去掉边框白线
.el-table__row>td {
border: none;
}
.el-table::before {
height: 0px;
}
/* 移除表头的下边框 */
.el-table__header th {
border-bottom: none;
}
}
}
}
}
.right {
width: 1237px;
height: 2500px;
margin-right: 61px;
background-image: url("../../assets/img/侧边.png");
padding-left: 59px;
padding-right: 45px;
box-sizing: border-box;
.jnl {
position: relative;
margin-top: 130px;
.imgBox {
height: 93px;
width: 1156px;
p {
position: absolute;
color: #fff;
top: 20px;
left: 50px;
font-size: 30px;
font-family: "MicrosoftYaHei";
}
}
.chartBox {
margin-top: 50px;
#jnl {
width: 1156px;
font-size: 20px;
color: #fff;
position: relative;
img {
width: 320px;
height: auto;
margin-left: 80px;
}
.zx {
font-size: 30px;
position: absolute;
top: 100px;
left: 700px;
}
.span_jnl {
position: absolute;
top: 150px;
left: 700px;
}
}
}
}
.dfdj {
position: relative;
margin-top: 56px;
.imgBox {
height: 93px;
width: 1156px;
p {
position: absolute;
color: #fff;
top: 20px;
left: 50px;
font-size: 30px;
font-family: "MicrosoftYaHei";
}
}
#dfdj {
width: 1155px;
height: 630px;
margin-top: 50px;
}
}
.sbyxqk {
position: relative;
margin-top: 56px;
// margin-bottom: 50px;
/deep/ .table {
margin-top: 50px;
.time {
font-size: 20px;
}
.count {
color: #05F0FF;
font-size: 28px;
}
//表体颜色
.el-table tr {
background: #16253b;
color: #fff;
font-size: 30px;
height: 40px;
.cell {
line-height: 40px;
}
}
// 去掉eltable的hover效果
.el-table tbody tr:hover>td {
background-color: #0b679e !important;
}
//修改表头颜色
.has-gutter {
background-color: #1969a8;
th {
background-color: #1969a8;
}
}
//奇偶行颜色
.el-table .success-row {
background: #184167;
}
//去掉边框白线
.el-table__row>td {
border: none;
}
.el-table::before {
height: 0px;
}
/* 移除表头的下边框 */
.el-table__header th {
border-bottom: none;
}
}
.imgBox {
height: 93px;
width: 1156px;
p {
position: absolute;
color: #fff;
top: 20px;
left: 50px;
font-size: 30px;
font-family: "MicrosoftYaHei";
}
}
#sbyxqk {
width: 1155px;
height: 400px;
margin-top: 50px;
}
}
}
}
</style>