This commit is contained in:
GGJ
2025-01-09 19:02:44 +08:00
commit 92e7a7a5eb
2943 changed files with 1152283 additions and 0 deletions

View File

@@ -0,0 +1,355 @@
<template>
<div ref="glfb" id="eventChance" style="width: 100%; height: 235px"></div>
</template>
<script>
import {
onLienRate1,
onLienRate2,
onLienRate3,
colorB,
} from "@/assets/commjs/color";
import { dicData } from "@/assets/commjs/dictypeData";
import yan from "@/assets/commjs/color";
import { getProbabilityDistribution } from "@/api/monitoringpointStatistics/echart";
export default {
props: {
item: {
type: Object,
default: null,
},
item2: {
type: Object,
default: null,
},
},
watch: {
height2(a, b) {
if (a == 24) {
this.$refs.glfb.style.height = document.getElementById('conmentId').offsetHeight -50 + 'px';
} else {
return;
}
},
height(a, b) {
if (a == 6 || a==8 || a==9 || a==16) {
setTimeout(()=>{
let str = document.getElementById('timedistribution').style.height
let strsec = str.split('p')
let height = parseInt(strsec) - 50 +'px'
this.$refs.glfb.style.height = height
},200)
} else {
return;
}
},
},
data() {
return {
tableData: [],
statisticalType: null,
classificationData: [],
time: this.timefamt(),
//暂降类型模拟数据
eventList: {},
};
},
created() {
var data = window.sessionStorage.getItem("Info");
data = eval("(" + data + ")");
this.deptIndex = data.deptId;
this.getIndexType();
this.queryData();
},
mounted() {
setTimeout(()=>{
let str = document.getElementById('timedistribution').style.height
let strsec = str.split('p')
let height = parseInt(strsec) - 50 +'px'
this.$refs.glfb.style.height = height
},200)
},
methods: {
queryData() {
var formData = {
endTime: this.time[0],
lineIndex: "9509492917be55860994cb5d1a9758bd",
startTime: this.time[1],
// timeFlag: 0,
};
getProbabilityDistribution(formData).then((res) => {
this.eventList = res.data;
this.$nextTick(() => {
this.eventChance();
});
});
},
getIndexType() {
var code = "Indicator_Type";
this.classificationData = dicData(code, [
"PLPC",
"DYPC",
"SXDYBPHD",
"CSSB",
"FXDL",
"JXBDY",
]);
this.statisticalType = this.classificationData[0];
},
timefamt() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
month = month > 9 ? month : "0" + month;
day = day < 10 ? "0" + day : day;
var arr = [];
var today = year + "-" + month + "-" + day;
var today2 = year + "-01-01";
arr.push(today);
arr.push(today2);
return arr;
},
eventChance() {
var eventValue = this.eventList.eventvalue;
var pereventValue = this.eventList.pereventvalue;
const echarts = require("echarts");
var myChartes = echarts.init(document.getElementById("eventChance"));
let echartsColor = JSON.parse(window.localStorage.echartsColor);
myChartes.clear();
var option = {
title: {
text: "暂降幅值的概率分布函数",
x: "center",
textStyle: {
color: "#fff",
},
},
legend: {
show: true,
right: 50,
data: ["概率分布", "占比"],
textStyle: {
color: "#fff",
rich: {
a: {
verticalAlign: "middle",
},
},
padding: [2, 0, 0, 0], //[上、右、下、左]
},
},
toolbox: {
show: true,
feature: {
// //restore: { show: true },
saveAsImage: { show: true },
// myFull: {
// show: true,
// title: "全屏查看",
// icon: "path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891",
// onclick: (e) => {
// this.fullFlag = true;
// let element = document.getElementById("eventChance2");
// if (element.requestFullScreen) {
// // HTML W3C 提议
// element.requestFullScreen();
// } else if (element.msRequestFullscreen) {
// // IE11
// element.msRequestFullScreen();
// } else if (element.webkitRequestFullScreen) {
// // Webkit (works in Safari5.1 and Chrome 15)
// element.webkitRequestFullScreen();
// } else if (element.mozRequestFullScreen) {
// // Firefox (works in nightly)
// element.mozRequestFullScreen();
// }
// // 退出全屏
// if (element.requestFullScreen) {
// document.exitFullscreen();
// } else if (element.msRequestFullScreen) {
// document.msExitFullscreen();
// } else if (element.webkitRequestFullScreen) {
// document.webkitCancelFullScreen();
// } else if (element.mozRequestFullScreen) {
// document.mozCancelFullScreen();
// }
// },
// },
},
},
tooltip: {
//提示框组件
trigger: "axis",
axisPointer: {
type: "shadow",
label: {
color: "#fff",
fontSize: 16,
},
},
textStyle: {
color: "#fff",
fontStyle: "normal",
opacity: 0.35,
fontSize: 14,
},
backgroundColor: "rgba(0,0,0,0.35)",
formatter: function (params) {
var tips = "";
tips += "暂降幅值" + "&nbsp" + "&nbsp" + "&nbsp" + params[0].name + "</br/>";
for (var i = 0; i < params.length; i++) {
tips += params[i].seriesName + ":" + "&nbsp" + "&nbsp" + "&nbsp" + params[i].value + "%<br/>";
}
return tips;
},
backgroundColor: "rgba(0,0,0,0.35)",
borderWidth: 0,
},
calculable: true,
grid: yan.EchartObject.grid14,
xAxis: [
{
type: "category",
name: "暂降\n幅值(%)",
nameGap: 10,
axisLine: {
lineStyle: {
color: "#fff",
},
},
axisLabel: {
fontFamily: yan.EchartObject.fontFamily,
color: "#fff",
fontSize: yan.EchartObject.xNamefontSize,
},
data: [
"0",
"10%",
"20%",
"30%",
"40%",
"50%",
"60%",
"70%",
"80%",
"90%",
"100%",
],
},
],
yAxis: [
{
type: "value",
name: "概率分布",
nameTextStyle: {
fontSize: 15,
},
axisLabel: {
color: "#fff",
formatter: "{value}%",
},
nameTextStyle: {
color: "#fff",
},
axisLine: {
show: true,
lineStyle: {
color: "#fff",
fontFamily: yan.EchartObject.fontFamily,
fontSize: yan.EchartObject.yNamefontSize,
},
},
splitLine: {
lineStyle: {
// 使用深浅的间隔色
color: "#fff",
type: "dashed",
opacity: 0.5,
},
},
},
{
type: "value",
name: "占比",
nameTextStyle: {
fontSize: 15,
},
axisLabel: {
formatter: "{value}%",
color: "#fff",
},
nameTextStyle: {
color: "#fff",
},
axisLine: {
show: true,
lineStyle: {
color: "#fff",
fontFamily: yan.EchartObject.fontFamily,
fontSize: yan.EchartObject.yNamefontSize,
},
},
splitLine: {
lineStyle: {
// 使用深浅的间隔色
color: "#fff",
type: "dashed",
opacity: 0.5,
},
},
},
],
series: [
{
name: "概率分布",
type: "line",
data: eventValue,
itemStyle: {
normal: { show: true, color: echartsColor.FigureColor[0] },
},
},
{
name: "占比",
type: "bar",
data: pereventValue,
barWidth: 30,
itemStyle: {
normal: { show: true, color: echartsColor.FigureColor[1] },
},
},
],
};
myChartes.setOption(option)
window.echartsArr.push(myChartes);
setTimeout(() => {
myChartes.resize();
}, 100);
this.loadingd = false;
let _this = this;
_this.$erd.listenTo(_this.$refs.glfb, (element) => {
_this.$nextTick(() => {
myChartes.resize();
});
});
window.onresize = function () {
myChartes.resize();
};
},
},
};
</script>