生产管理

This commit is contained in:
‘937886381’
2025-10-24 11:19:34 +08:00
parent 463706663a
commit f11dfe04d5
29 changed files with 5927 additions and 1303 deletions

View File

@@ -80,8 +80,18 @@ export default {
immediate: true,
},
},
methods: {
initChart() {
methods: {
getUniqueTimes() {
const { edgeCt, temperCt, downCt } = this.barData;
// 合并所有包含时间的数组
const allTimeEntries = [...(edgeCt || []), ...(temperCt || []), ...(downCt || [])];
// 提取时间戳并去重(使用 Set
const uniqueTimes = [...new Set(allTimeEntries.map(item => item.recordTime))];
// 按时间戳排序(确保时间顺序正确)
return uniqueTimes.sort((a, b) => a - b);
},
initChart() {
const uniqueTimes = this.getUniqueTimes();
const _this = this;
this.chart.setOption({
title: {
@@ -124,9 +134,7 @@ export default {
},
xAxis: {
type: 'category',
data: this.barData.edgeCt.map((item) => {
return parseTime(item.recordTime, '{m}-{d} {h}:{i}');
}),
data: uniqueTimes.map(time => parseTime(time, '{m}-{d} {h}:{i}')),
axisPointer: {
type: 'shadow',
},
@@ -152,44 +160,50 @@ export default {
end: 100,
},
],
series: [
{
name: '磨边节拍',
type: 'line',
tooltip: {
valueFormatter: function (value) {
return value + 'pcs/min';
},
},
data: this.barData.edgeCt.map((item) => {
return item.ct;
}),
},
{
name: '钢化节拍',
type: 'line',
tooltip: {
valueFormatter: function (value) {
return value + 'pcs/min';
},
},
data: this.barData.temperCt.map((item) => {
return item.ct;
}),
},
{
name: '下片节拍',
type: 'line',
tooltip: {
valueFormatter: function (value) {
return value + 'pcs/min';
},
},
data: this.barData.downCt.map((item) => {
return item.ct;
}),
},
],
series: [
{
name: '磨边节拍',
type: 'line',
tooltip: {
valueFormatter: function (value) {
return value + 'pcs/min';
},
},
data: uniqueTimes.map(time => {
// 查找当前时间对应的 ct 值,没有则补 null图表中会显示为断点
const match = this.barData.edgeCt.find(item => item.recordTime === time);
return match ? match.ct : 0;
})
},
// 钢化节拍
{
name: '钢化节拍',
type: 'line',
tooltip: {
valueFormatter: function (value) {
return value + 'pcs/min';
},
},
data: uniqueTimes.map(time => {
const match = this.barData.temperCt.find(item => item.recordTime === time);
return match ? match.ct : 0;
})
},
// 下片节拍
{
name: '下片节拍',
type: 'line',
tooltip: {
valueFormatter: function (value) {
return value + 'pcs/min';
},
},
data: uniqueTimes.map(time => {
const match = this.barData.downCt.find(item => item.recordTime === time);
return match ? match.ct : 0;
})
}
]
});
},
},