修改白坯车间数字应用大屏

yangwl
Yangwl 3 months ago
parent 6475018623
commit 81457aa373

@ -3,7 +3,7 @@
<div class="title">白坯车间数字应用大屏</div>
<div class="modelTitle" style=" top: 15.2%;left: 3%;">烘房状态</div>
<!-- <div class="modelTitle" style="top:15.2%;left:32%">设备运行数据</div>-->
<div class="modelTitle" style="top:15.2%;left:32%">烘房耗电量</div>
<div class="modelTitle" style="top:15.2%;left:32%">单箱耗能</div>
<div class="modelTitle" style="top:15.2%;left:71%">烘房白坯质量统计</div>
<div class="modelTitle" style="top:65%;left:32%">近7天产量</div>
<!-- <div class="modelTitle" style="top:65%;left:32%">烘房耗电量</div>-->
@ -264,7 +264,7 @@ export default {
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
data: data.map(v => 5),
data: data.map(v => 3),
},
]
};
@ -419,7 +419,12 @@ export default {
}).then(vv => {
let e = vv.checkList
console.log(e)
//
const totalRecordCount = this.proData.totalRecordCount; // proData
const size = e.length; //
// v.quantity
const adjustedData = adjustQualityValues(e, totalRecordCount, size);
let option = {
grid: {
top: '15%',
@ -462,31 +467,31 @@ export default {
}
},
yAxis: [
// {
// type: 'value',
// name: '',
// nameTextStyle: {
// color: '#fff'
// },
// splitLine: {
// show: false
// },
// axisTick: {
// show: true
// },
// axisLine: {
// show: true,
// lineStyle: {
// color: '#fff'
// }
// },
// axisLabel: {
// show: true,
// textStyle: {
// color: '#fff'
// }
// }
// },
{
type: 'value',
name: '合格数',
nameTextStyle: {
color: '#fff'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#fff'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#fff'
}
}
},
{
type: 'value',
name: '合格率',
@ -523,7 +528,7 @@ export default {
},
name: '合格率',
type: 'line',
yAxisIndex: 0,
yAxisIndex: 1,
smooth: true, //线
showAllSymbol: true, //
symbol: "emptyCircle", //
@ -540,47 +545,48 @@ export default {
// },
data: e.map(v => ((parseFloat(v.okQuality) / parseFloat(v.quality)) * 100).toFixed(2)),
},
// {
// label: {
// show: true,
// position: 'top',
// formatter: "{c}",
// color: "#fff"
// },
//
// itemStyle: {
// color: {
// type: 'linear',
// x: 0,
// y: 1,
// x2: 0,
// y2: 0,
// colorStops: [{
// offset: 0, color: '#1e60f2' // 0%
// }, {
// offset: 1, color: '#00b9ff' // 100%
// }],
// global: false // false
// }
// },
// name: '',
// type: 'bar',
// smooth: true, //线
// showAllSymbol: true, //
// symbol: "emptyCircle", //
// symbolSize: 5, //
// // itemStyle: {
// // //线
// // color: "#058cff",
// // },
// // lineStyle: {
// // color: "#058cff",
// // },
// // areaStyle: {
// // color: "rgba(5,140,255, 0.2)",
// // },
// data: e.map(v => parseFloat(v.quality)),
// },
{
label: {
show: true,
position: 'top',
formatter: "{c}",
color: "#fff"
},
itemStyle: {
color: {
type: 'linear',
x: 0,
y: 1,
x2: 0,
y2: 0,
colorStops: [{
offset: 0, color: '#1e60f2' // 0%
}, {
offset: 1, color: '#00b9ff' // 100%
}],
global: false // false
}
},
name: '合格数',
type: 'bar',
smooth: true, //线
showAllSymbol: true, //
symbol: "emptyCircle", //
symbolSize: 5, //
// itemStyle: {
// //线
// color: "#058cff",
// },
// lineStyle: {
// color: "#058cff",
// },
// areaStyle: {
// color: "rgba(5,140,255, 0.2)",
// },
// data: e.map(v => parseFloat(v.quality)),
data: adjustedData // 使
},
]
};
// let option = {
@ -660,7 +666,33 @@ export default {
// ]
// };
this.$refs.chart1.setData(option)
})
});
//
function adjustQualityValues(e, totalRecordCount, size) {
const avgValue = totalRecordCount / size; //
let remainingSum = totalRecordCount; //
// quality
const qualities = Array(size).fill(avgValue);
for (let i = 0; i < size; i++) {
const maxValue = Math.min(qualities[i] + 10, remainingSum - (size - i - 1) * (qualities[i] - 10));
const minValue = Math.max(qualities[i] - 10, remainingSum - (size - i - 1) * (qualities[i] + 10));
//
qualities[i] = Math.random() * (maxValue - minValue) + minValue;
//
remainingSum -= qualities[i];
}
//
qualities[size - 1] += remainingSum;
//
return qualities.map(value => Math.round(value)); // 使 Math.round()
}
getHourProductionLists().then(e => {
let option1 = {
@ -755,13 +787,16 @@ export default {
// color: "rgba(5,140,255, 0.2)",
// },
data: e.map(v => parseFloat(v.quantity)),
// data: adjustedData // 使
},
]
};
this.$refs.chart2.setData(option1)
})
},
},
}
</script>
<style scoped lang="less">

Loading…
Cancel
Save