Files
hb_pqs_web/src/views/componentschild/steadystaterate.vue

970 lines
30 KiB
Vue
Raw Normal View History

2025-01-09 19:02:44 +08:00
<template>
<div>
<div style="height:30px;height:20px;position:absolute;right:10px">
<el-tag style="background:#CC0000;width:30px;height:15px;border:1px solid #CC0000;float:left;margin-top:2px"></el-tag>
<span style="color:#CC0000;font-weight:400;;float:left">&nbsp&nbsp合格率<60% &nbsp&nbsp</span>
<el-tag size="mini" style="background:#FFCC33;width:30px;height:15px;border:1px solid #FFCC33;float:left;margin-top:2px"></el-tag>
<span style="color:#FFCC33;font-weight:400;float:left" >&nbsp&nbsp60%合格率<90% &nbsp&nbsp</span>
<el-tag style="background:#339966;width:30px;height:15px;border:1px solid #339966;float:left;margin-top:2px"></el-tag>
<span style="color:#339966;font-weight:400;float:left" >&nbsp&nbsp合格率90%</span>
</div>
<div
ref="sty"
id="steadyqualification"
style="width: 100%;"
></div>
</div>
</template>
<script>
import yan from "@/assets/commjs/color";
import { dicData } from "@/assets/commjs/dictypeData";
import api from "@/api/integraliy/integraliy";
export default {
props: {
item: {
type: Object,
default: null,
},
item2: {
type: Object,
default: null,
},
height:{
type:Number,
default: null,
},
height2:{
type:Number,
default: null,
}
},
watch: {
height2(a, b) {
if (a == 24) {
this.$refs.sty.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('steadystaterate').style.height
let strsec = str.split('p')
let height = parseInt(strsec) - 50 +'px'
this.$refs.sty.style.height = height
},200)
} else {
return;
}
},
},
data() {
return {
tableData: [],
statisticalType: null,
classificationData: [],
time: this.timefamt(),
xdata: [],
ydata: [],
zoom:'',
formData:{
statisticalType:null,
scale:null,
manufacturer:null,
loadType:null,
monitorFlag: 2,
powerFlag: 2,
deptIndex:JSON.parse(window.sessionStorage.getItem('Info')).deptId
},
voltageleveloption:[],
terminaloption:[],
interfereoption:[],
classificationData:[],
xdata:[],ydata1:[],ydata2:[],ydata3:[],ydata4:[],ydata5:[],ydata6:[],ydata7:[],ydata8:[]
};
},
created() {
this.getVoltage();
this.getManufacturer();
this.getclassificationData();
this.getLoadType();
this.queryData();
},
mounted() {
setTimeout(()=>{
let str = document.getElementById('steadystaterate').style.height
let strsec = str.split('p')
let height = parseInt(strsec) - 50 +'px'
this.$refs.sty.style.height = height
},300)
},
methods: {
//字典获取数据电压等级
getVoltage() {
var code = "Dev_Voltage_Stand";
this.voltageleveloption = dicData(code, []);
this.formData.scale = this.voltageleveloption;
},
//字典获取数据终端厂家
getManufacturer() {
var code = "Dev_Manufacturers";
this.terminaloption = dicData(code, []);
this.formData.manufacturer = this.terminaloption;
},
//字典获取数据干扰源类型
getLoadType() {
var code = "Interference_Source";
this.interfereoption = dicData(code, []);
this.formData.loadType = this.interfereoption;
},
//获取统计类型
getclassificationData() {
var code = "Statistical_Type";
this.classificationData = dicData(code, ["Report_Type"]);
this.formData.statisticalType = this.classificationData[0];
},
queryData() {
this.formData.searchBeginTime=this.time[0]
this.formData.searchEndTime=this.time[1]
api.getSteadyQualifyCensus(this.formData).then((res) => {
if(res.code == "A0000"){
this.xdata = res.data.type;
this.ydata1 = res.data.freqOffset;
this.ydata2 = res.data.flicker;
this.ydata3 = res.data.voltageUnbalance;
this.ydata4 = res.data.harmonicVoltage;
this.ydata5 = res.data.voltageOffset;
this.ydata6 = res.data.harmonicCurrent;
this.ydata7 = res.data.negativeCurrent;
this.ydata8 = res.data.interHarmonic;
this.steadyqualification();
}
});
},
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 time1 = year + "-" + month + "-01";
arr.push(time1);
var time2 = year + "-" + month + "-" + day ;
arr.push(time2);
return arr;
},
steadyqualification() {
const echarts = require("echarts");
let domID1 = document.getElementById("steadyqualification")
var myChartes = echarts.init(domID1);
myChartes.clear();
var option = {
title: {
left: "center",
// subtext: '单位(%)'
},
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 += params[0].name + "</br/>";
for (var i = 0; i < params.length; i++) {
if (params[i].value == 1) {
tips += params[i].seriesName + ":暂无数据<br/>";
} else {
tips += params[i].seriesName + ":" + params[i].value + "<br/>";
}
}
return tips;
},
},
grid: yan.EchartObject.gridf,
dataZoom:yan.EchartObject.dataZoom,
xAxis: [
{
name:yan.EchartObject.area,
type: "category",
data: this.xdata,
splitLine: {
show: false,
},
axisTick: {
alignWithLabel: true,
},
axisLabel: {
textStyle: {
fontFamily: yan.EchartObject.fontFamily,
color: "#fff",
fontSize:yan.EchartObject.xNamefontSize
}
},
axisLine: {
show: true,
lineStyle: {
color: "#fff",
},
symbol: ["none", "arrow"],
},
},
],
yAxis: [
{
name:yan.EchartObject.nuit1,
nameTextStyle: {
color: "#fff",
fontSize: 12,
},
type: "value",
min: 0,
max: 100,
splitLine: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: "#fff",
},
symbol: ["none", "arrow"],
},
splitArea: {
show: false,
},
axisLabel: {
textStyle: {
fontFamily: "dinproRegular",
color: "#fff",
fontSize:yan.EchartObject.xNamefontSize
}
},
},
],
series: [
{
name: "频率偏差",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
//show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
data: this.ydata1,
},
{
name: "闪变",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
// show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
data: this.ydata2,
},
{
name: "三相电压不平衡",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
// show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
data: this.ydata3,
},
{
name: "谐波电压",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
//show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
data: this.ydata4,
},
{
name: "电压偏差",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
//show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
data: this.ydata5,
},
{
name: "谐波电流",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
// show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
data: this.ydata6,
},
{
name: "负序电流",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
// show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
data: this.ydata7,
},
{
name: "间谐波电压含有率",
barMaxWidth:yan.EchartObject.barMaxWidth,
type: "bar",
label: {
normal: {
//show: true,
position: "top",
},
},
itemStyle: {
normal: {
// 随机显示
//color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
// 定制显示(按顺序)
color: function (params) {
if (params.value >= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate1,
},
],
false
);
} else if (params.value >= 60 && params.value <= 90) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate2,
},
],
false
);
} else if (params.value <= 60 && params.value !== 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: yan.ColorObject.qualifiedRate3,
},
],
false
);
} else if (params.value == 3.14159) {
return new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 1,
color: "#cccccc",
},
],
false
);
}
},
},
},
markLine: {
silent: false,
symbol: "circle",
data: [
{
name: "",
yAxis: 100,
lineStyle: {
color: yan.ColorObject.qualifiedRate1,
},
label: {
//position: "middle",
formatter: "{b}",
textStyle: {
color: yan.ColorObject.qualifiedRate1,
},
},
},
{
name: "",
yAxis: 90,
lineStyle: {
color: yan.ColorObject.qualifiedRate2,
},
label: {
//position: "middle",
formatter: "{b}",
textStyle: {
color: yan.ColorObject.qualifiedRate2,
},
},
},
{
name: "",
yAxis: 60,
lineStyle: {
color: yan.ColorObject.qualifiedRate3,
},
label: {
// position: "middle",
formatter: "{b}",
textStyle: {
color: yan.ColorObject.qualifiedRate3,
},
},
},
],
},
data: this.ydata8,
},
],
};
myChartes.setOption(option)
window.echartsArr.push(myChartes);
setTimeout(() => {
myChartes.resize();
}, 100);
this.loadingd = false;
let _this = this;
_this.$erd.listenTo(_this.$refs.sty, (element) => {
_this.$nextTick(() => {
myChartes.resize();
});
});
window.onresize = function () {
myChartes.resize();
};
},
},
};
</script>