feat(mes): 更新混炼曲线图表功能

- 移除上顶栓图例显示
- 集成新的混炼曲线数据源文件
- 切换到演示模式固定使用假数据条码 QUXIAN_DEMO_001
- 重构图表初始化逻辑,优化数据处理流程
- 调整坐标轴配置,重新分配左右Y轴参数分组
- 更新图表系列配置,修改线条样式为平滑曲线
- 增加延迟渲染时间以确保图表正确加载
- 添加新的模拟数据文件用于混炼追踪功能
master
zangch@mesnac.com 1 week ago
parent 7a93b2f491
commit 5da3ed1078

File diff suppressed because it is too large Load Diff

@ -169,7 +169,6 @@
<span class="legend-item"><i class="legend-dot" style="background: #36cfc9"></i>能量</span>
<span class="legend-item"><i class="legend-dot" style="background: #95de64"></i>压力</span>
<span class="legend-item"><i class="legend-dot" style="background: #f7d13d"></i>转速</span>
<span class="legend-item"><i class="legend-dot" style="background: #ffa07a"></i>上顶栓</span>
</div>
<el-button size="small" text type="primary" style="color: #fff" @click="toggleCurve"></el-button>
</div>
@ -188,6 +187,7 @@ import { ArrowRight, Document, Folder } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import * as echarts from 'echarts';
import backwardData from './data/backward2.json';
import curveDataJson from './data/混炼曲线数据.json';
type BarcodeType = '1' | '2' | '3' | '4';
@ -224,9 +224,8 @@ const productionInfo = computed(() => {
return detailMap[detailId.value]?.production || {};
});
const curveDataSource = computed(() => {
return detailMap[detailId.value]?.curveData || {};
});
// 使 QUXIAN_DEMO_001
const curveDataSource = computed(() => (curveDataJson as any)['QUXIAN_DEMO_001'] || {});
const resolveDetailId = (routeId: string, routeType: string): string => {
if (routeId && detailMap[routeId]) return routeId;
@ -270,70 +269,35 @@ const loadData = () => {
const initChart = () => {
if (!chartRef.value) return;
const cd = curveDataSource.value;
const mixingRows = Array.isArray(mixingProcessData.value) ? mixingProcessData.value : [];
const toNumberOrNull = (value: any): number | null => {
const num = Number(value);
return Number.isFinite(num) ? num : null;
};
const listLength = (value: any): number => {
return Array.isArray(value) ? value.length : 0;
};
const buildPositionFromAction = (row: any): number | null => {
const actionText = String(row?.action || row?.condition || '');
if (actionText.includes('压上顶栓')) return 1;
if (actionText.includes('升上顶栓')) return 0;
return null;
};
let xAxisData: Array<string | number> = [];
let temperatureData: Array<number | null> = [];
let powerData: Array<number | null> = [];
let energyData: Array<number | null> = [];
let pressureData: Array<number | null> = [];
let speedData: Array<number | null> = [];
let positionData: Array<number | null> = [];
if (mixingRows.length > 0) {
xAxisData = mixingRows.map((row: any, idx: number) => row.step ?? idx + 1);
temperatureData = mixingRows.map((row: any) => toNumberOrNull(row.temperature));
powerData = mixingRows.map((row: any) => toNumberOrNull(row.power));
energyData = mixingRows.map((row: any) => toNumberOrNull(row.energy));
pressureData = mixingRows.map((row: any) => toNumberOrNull(row.pressure));
speedData = mixingRows.map((row: any) => toNumberOrNull(row.rpm));
positionData = mixingRows.map((row: any) => buildPositionFromAction(row));
} else {
const maxLen = Math.max(
listLength(cd.mixingTime),
listLength(cd.temperature),
listLength(cd.power),
listLength(cd.energy),
listLength(cd.pressure),
listLength(cd.speed),
listLength(cd.position)
);
xAxisData =
Array.isArray(cd.mixingTime) && cd.mixingTime.length > 0
? cd.mixingTime.map((v: any, i: number) => {
const num = Number(v);
return Number.isFinite(num) ? num : i + 1;
})
: Array.from({ length: maxLen }, (_, i) => i + 1);
if (Array.isArray(cd.time) && cd.time.length > 0) {
xAxisData = cd.time.map((v: any) => {
const num = Number(v);
return Number.isFinite(num) ? num : 0;
});
const buildSeriesData = (source: any): Array<number | null> => {
const arr = Array.isArray(source) ? source : [];
return xAxisData.map((_, idx) => toNumberOrNull(arr[idx]));
return arr.map((v: any) => toNumberOrNull(v));
};
temperatureData = buildSeriesData(cd.temperature);
powerData = buildSeriesData(cd.power);
energyData = buildSeriesData(cd.energy);
pressureData = buildSeriesData(cd.pressure);
speedData = buildSeriesData(cd.speed);
positionData = buildSeriesData(cd.position);
temperatureData = buildSeriesData(cd.MixingTemp);
powerData = buildSeriesData(cd.MixingPower);
energyData = buildSeriesData(cd.MixingEnergy);
pressureData = buildSeriesData(cd.MixingPress);
speedData = buildSeriesData(cd.MixingSpeed);
}
const calcRange = (arr: Array<number | null>) => {
@ -348,8 +312,8 @@ const initChart = () => {
};
};
const leftAxisRange = calcRange(temperatureData);
const rightAxisRange = calcRange([...powerData, ...energyData, ...pressureData, ...speedData, ...positionData]);
const leftAxisRange = calcRange([...temperatureData, ...energyData, ...pressureData, ...speedData]);
const rightAxisRange = calcRange(powerData);
if (chartInstance) {
chartInstance.dispose();
@ -378,29 +342,18 @@ const initChart = () => {
type: 'category',
data: xAxisData,
boundaryGap: false,
name: mixingRows.length > 0 ? '混炼步骤' : '时间(s)'
name: '时间(s)'
},
yAxis: [
{ type: 'value', name: '温度(℃)', position: 'left', axisLine: { show: true }, ...leftAxisRange },
{ type: 'value', name: '其他参数', position: 'right', axisLine: { show: true }, ...rightAxisRange }
{ type: 'value', name: '温度/能量/压力/转速', position: 'left', axisLine: { show: true }, ...leftAxisRange },
{ type: 'value', name: '功率(kW)', position: 'right', axisLine: { show: true }, ...rightAxisRange }
],
series: [
{ name: '温度', type: 'line', yAxisIndex: 0, data: temperatureData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#ff4d4f' } },
{ name: '功率', type: 'line', yAxisIndex: 1, data: powerData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#40a9ff' } },
{ name: '能量', type: 'line', yAxisIndex: 1, data: energyData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#36cfc9' } },
{ name: '压力', type: 'line', yAxisIndex: 1, data: pressureData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#95de64' } },
{ name: '转速', type: 'line', yAxisIndex: 1, data: speedData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#f7d13d' } },
{
name: '上顶栓',
type: 'line',
yAxisIndex: 1,
data: positionData,
smooth: false,
connectNulls: false,
showSymbol: true,
lineStyle: { type: 'dashed' },
itemStyle: { color: '#ffa07a' }
}
{ name: '温度', type: 'line', yAxisIndex: 0, data: temperatureData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#ff4d4f' } },
{ name: '功率', type: 'line', yAxisIndex: 1, data: powerData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#40a9ff' } },
{ name: '能量', type: 'line', yAxisIndex: 0, data: energyData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#36cfc9' } },
{ name: '压力', type: 'line', yAxisIndex: 0, data: pressureData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#95de64' } },
{ name: '转速', type: 'line', yAxisIndex: 0, data: speedData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#f7d13d' } }
]
});
};
@ -414,7 +367,7 @@ const renderChartWithDelay = () => {
setTimeout(() => {
initChart();
resizeChart();
}, 180);
}, 320);
});
};

@ -0,0 +1,424 @@
{
"machineOptions": [
{ "machineId": "M-01", "machineName": "XK-270A" },
{ "machineId": "M-02", "machineName": "XK-270B" }
],
"shiftOptions": [
{ "shiftId": "S-1", "shiftName": "白班" },
{ "shiftId": "S-2", "shiftName": "中班" }
],
"classTeamOptions": [
{ "classTeamId": "T-1", "teamName": "甲班" },
{ "classTeamId": "T-2", "teamName": "乙班" }
],
"traceList": [
{
"recipeId": 9001,
"recipeCode": "RX-9001",
"planId": 7001,
"planCode": "PL-20260226-01",
"planDetailId": "PD-001",
"planDetailCode": "PD-001",
"productionBarcode": "260101J83N030091",
"machineName": "XK-270A",
"materialName": "KB110-F",
"shiftId": "S-1",
"shiftName": "白班",
"classTeamId": "T-1",
"classTeamName": "甲班",
"trainNumber": 91,
"realBeginTime": "2026-02-26 08:05:00",
"totalWeight": 344.4,
"realWeight": 344.1,
"testResult": "合格",
"totalTrainNo": 192,
"planDetailStatus": "已完成"
},
{
"recipeId": 9001,
"recipeCode": "RX-9001",
"planId": 7001,
"planCode": "PL-20260226-01",
"planDetailId": "PD-002",
"planDetailCode": "PD-002",
"productionBarcode": "260101J83N030092",
"machineName": "XK-270A",
"materialName": "KB110-F",
"shiftId": "S-1",
"shiftName": "白班",
"classTeamId": "T-1",
"classTeamName": "甲班",
"trainNumber": 92,
"realBeginTime": "2026-02-26 08:35:00",
"totalWeight": 344.4,
"realWeight": 344.7,
"testResult": "合格",
"totalTrainNo": 193,
"planDetailStatus": "已完成"
},
{
"recipeId": 9002,
"recipeCode": "RX-9002",
"planId": 7002,
"planCode": "PL-20260226-02",
"planDetailId": "PD-003",
"planDetailCode": "PD-003",
"productionBarcode": "260101J83N030093",
"machineName": "XK-270B",
"materialName": "KB120-A",
"shiftId": "S-2",
"shiftName": "中班",
"classTeamId": "T-2",
"classTeamName": "乙班",
"trainNumber": 93,
"realBeginTime": "2026-02-26 14:10:00",
"totalWeight": 352.0,
"realWeight": 351.4,
"testResult": "合格",
"totalTrainNo": 194,
"planDetailStatus": "已完成"
}
],
"detailMap": {
"9001": {
"recipeInfo": {
"recipeCode": "RX-9001",
"planCode": "PL-20260226-01",
"productionBarcode": "260101J83N030091",
"machineName": "XK-270A",
"materialName": "KB110-F",
"shiftName": "白班",
"classTeamName": "甲班"
},
"summaryInfo": {
"recipeId": 9001,
"recipeCode": "RX-9001",
"planCode": "PL-20260226-01",
"productionBarcode": "260101J83N030091",
"machineName": "XK-270A",
"materialName": "KB110-F",
"shiftName": "白班",
"classTeamName": "甲班",
"planAmount": 688.8,
"settingWeight": 344.4,
"completedWeight": 344.1,
"eachCarEnergy": 20.7,
"mixingTrainNo": 91,
"totalTrainNo": 193,
"overToleranceAlarm": "无",
"mixingStatus": "完成",
"testResult": "合格",
"dischargeTemp": 108.6,
"dischargePower": 258.0,
"dischargeEnergy": 20.7,
"mixingTime": 173.0,
"consumeTime": 175.0,
"intervalTime": 12.0,
"recipeTime": 170.0,
"beginProduceTime": "2026-02-26 08:05:00"
},
"materialTraceTree": [
{
"id": "mat-1",
"label": "炭黑 N330",
"children": [
{ "id": "mat-1-1", "label": "批次 CB20260226001" }
]
},
{
"id": "mat-2",
"label": "天然胶 RSS3",
"children": [
{ "id": "mat-2-1", "label": "批次 NR20260225015" }
]
}
],
"usageList": [
{
"weightSeq": 1,
"categoryName": "胶料",
"materialName": "天然胶 RSS3",
"setWeight": 120.0,
"actualWeight": 119.8,
"diffWeight": -0.2,
"tolerance": 0.5,
"overToleranceFlag": "0",
"actionStatus": "完成"
},
{
"weightSeq": 2,
"categoryName": "粉料",
"materialName": "炭黑 N330",
"setWeight": 78.0,
"actualWeight": 78.1,
"diffWeight": 0.1,
"tolerance": 0.3,
"overToleranceFlag": "0",
"actionStatus": "完成"
},
{
"weightSeq": 3,
"categoryName": "油料",
"materialName": "芳烃油 A1",
"setWeight": 12.0,
"actualWeight": 12.0,
"diffWeight": 0.0,
"tolerance": 0.2,
"overToleranceFlag": "0",
"actionStatus": "完成"
}
],
"mixingStepList": [
{
"mixId": 1,
"condName": "加料",
"actName": "投料",
"mixingTime": 20,
"mixingTemp": 101.2,
"mixingEnergy": 2.1,
"mixingPower": 620.0,
"mixingPress": 2.6,
"mixingSpeed": 39.0,
"setTime": 20,
"setTemp": 102
},
{
"mixId": 2,
"condName": "主混",
"actName": "压砣",
"mixingTime": 88,
"mixingTemp": 106.5,
"mixingEnergy": 12.8,
"mixingPower": 890.0,
"mixingPress": 4.1,
"mixingSpeed": 30.0,
"setTime": 90,
"setTemp": 108
},
{
"mixId": 3,
"condName": "排胶",
"actName": "开门",
"mixingTime": 173,
"mixingTemp": 108.6,
"mixingEnergy": 20.7,
"mixingPower": 258.0,
"mixingPress": 0.2,
"mixingSpeed": 26.0,
"setTime": 175,
"setTemp": 110
}
],
"batchList": [
{
"batchCode": "CB20260226001",
"materialName": "炭黑 N330",
"instockTime": "2026-02-25 10:32:10",
"supplierName": "宁波炭材"
},
{
"batchCode": "NR20260225015",
"materialName": "天然胶 RSS3",
"instockTime": "2026-02-25 11:20:45",
"supplierName": "泰国天然胶"
}
]
},
"9002": {
"recipeInfo": {
"recipeCode": "RX-9002",
"planCode": "PL-20260226-02",
"productionBarcode": "260101J83N030093",
"machineName": "XK-270B",
"materialName": "KB120-A",
"shiftName": "中班",
"classTeamName": "乙班"
},
"summaryInfo": {
"recipeId": 9002,
"recipeCode": "RX-9002",
"planCode": "PL-20260226-02",
"productionBarcode": "260101J83N030093",
"machineName": "XK-270B",
"materialName": "KB120-A",
"shiftName": "中班",
"classTeamName": "乙班",
"planAmount": 704.0,
"settingWeight": 352.0,
"completedWeight": 351.4,
"eachCarEnergy": 21.1,
"mixingTrainNo": 93,
"totalTrainNo": 194,
"overToleranceAlarm": "无",
"mixingStatus": "完成",
"testResult": "合格",
"dischargeTemp": 109.4,
"dischargePower": 264.0,
"dischargeEnergy": 21.1,
"mixingTime": 176.0,
"consumeTime": 178.0,
"intervalTime": 10.0,
"recipeTime": 172.0,
"beginProduceTime": "2026-02-26 14:10:00"
},
"materialTraceTree": [
{
"id": "mat-a",
"label": "炭黑 N330",
"children": [{ "id": "mat-a-1", "label": "批次 CB20260226002" }]
}
],
"usageList": [
{
"weightSeq": 1,
"categoryName": "胶料",
"materialName": "天然胶 RSS3",
"setWeight": 125.0,
"actualWeight": 124.7,
"diffWeight": -0.3,
"tolerance": 0.5,
"overToleranceFlag": "0",
"actionStatus": "完成"
}
],
"mixingStepList": [
{
"mixId": 1,
"condName": "主混",
"actName": "压砣",
"mixingTime": 176,
"mixingTemp": 109.4,
"mixingEnergy": 21.1,
"mixingPower": 264.0,
"mixingPress": 0.2,
"mixingSpeed": 26.0,
"setTime": 178,
"setTemp": 110
}
],
"batchList": [
{
"batchCode": "CB20260226002",
"materialName": "炭黑 N330",
"instockTime": "2026-02-26 09:18:10",
"supplierName": "宁波炭材"
}
]
}
},
"spc": {
"samples": [
{
"recipeCode": "RX-9001",
"machineName": "XK-270A",
"mixId": 1,
"termCode": "TEMP_1",
"mixingTemp": 101.2,
"mixingTime": 20,
"mixingEnergy": 2.1,
"mixingPower": 620.0,
"mixingPress": 2.6,
"mixingSpeed": 39.0,
"createTime": "2026-02-26 08:10:00"
},
{
"recipeCode": "RX-9001",
"machineName": "XK-270A",
"mixId": 2,
"termCode": "TEMP_2",
"mixingTemp": 106.5,
"mixingTime": 88,
"mixingEnergy": 12.8,
"mixingPower": 890.0,
"mixingPress": 4.1,
"mixingSpeed": 30.0,
"createTime": "2026-02-26 08:25:00"
},
{
"recipeCode": "RX-9001",
"machineName": "XK-270A",
"mixId": 3,
"termCode": "TEMP_3",
"mixingTemp": 108.6,
"mixingTime": 173,
"mixingEnergy": 20.7,
"mixingPower": 258.0,
"mixingPress": 0.2,
"mixingSpeed": 26.0,
"createTime": "2026-02-26 08:40:00"
},
{
"recipeCode": "RX-9002",
"machineName": "XK-270B",
"mixId": 1,
"termCode": "TEMP_1",
"mixingTemp": 102.0,
"mixingTime": 21,
"mixingEnergy": 2.3,
"mixingPower": 635.0,
"mixingPress": 2.5,
"mixingSpeed": 39.0,
"createTime": "2026-02-26 14:15:00"
},
{
"recipeCode": "RX-9002",
"machineName": "XK-270B",
"mixId": 2,
"termCode": "TEMP_2",
"mixingTemp": 107.0,
"mixingTime": 90,
"mixingEnergy": 13.0,
"mixingPower": 905.0,
"mixingPress": 4.2,
"mixingSpeed": 29.0,
"createTime": "2026-02-26 14:32:00"
},
{
"recipeCode": "RX-9002",
"machineName": "XK-270B",
"mixId": 3,
"termCode": "TEMP_3",
"mixingTemp": 109.4,
"mixingTime": 176,
"mixingEnergy": 21.1,
"mixingPower": 264.0,
"mixingPress": 0.2,
"mixingSpeed": 26.0,
"createTime": "2026-02-26 14:48:00"
}
],
"capability": {
"sampleCount": 12,
"mean": 106.84,
"sigma": 1.48,
"cp": 1.43,
"cpk": 1.31,
"ppk": 1.28,
"usl": 111.0,
"lsl": 103.0,
"target": 107.0,
"histogramBins": ["103-104", "104-105", "105-106", "106-107", "107-108", "108-109", "109-110", "110-111"],
"histogramCounts": [1, 1, 1, 2, 2, 2, 2, 1]
},
"runChart": {
"sampleCount": 12,
"sampleLabels": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
"sampleValues": [104.2, 105.1, 106.2, 106.8, 107.3, 108.0, 108.4, 107.9, 107.2, 106.8, 106.0, 105.4],
"usl": 111.0,
"lsl": 103.0,
"target": 107.0
},
"xbarR": {
"sampleCount": 6,
"subgroupLabels": ["G1", "G2", "G3", "G4", "G5", "G6"],
"xbarValues": [106.1, 106.7, 107.2, 107.0, 106.6, 106.3],
"rValues": [1.2, 1.5, 1.4, 1.3, 1.1, 1.2],
"uclX": 108.2,
"clX": 106.65,
"lclX": 105.1,
"uclR": 2.2,
"clR": 1.28,
"lclR": 0.35
}
}
}

File diff suppressed because it is too large Load Diff

@ -142,7 +142,6 @@
<span class="legend-item"><i class="legend-dot" style="background: #36cfc9"></i>能量</span>
<span class="legend-item"><i class="legend-dot" style="background: #95de64"></i>压力</span>
<span class="legend-item"><i class="legend-dot" style="background: #f7d13d"></i>转速</span>
<span class="legend-item"><i class="legend-dot" style="background: #ffa07a"></i>上顶栓</span>
</div>
<el-button size="small" text type="primary" style="color: #fff" @click="toggleCurve"></el-button>
</div>
@ -162,6 +161,7 @@ import { ArrowRight, Document, Folder } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus';
import * as echarts from 'echarts';
import forwardData from './data/forward.json';
import curveDataJson from './data/混炼曲线数据.json';
const source = forwardData as any;
const detailMap = source.detailMap || {};
@ -194,7 +194,9 @@ const productionInfo = computed(() => currentDetail.value.productionInfo || {});
const qualityData = computed(() => currentDetail.value.qualityData || []);
const weighingData = computed(() => currentDetail.value.weighingData || []);
const mixingProcessData = computed(() => currentDetail.value.mixingProcessData || []);
const curveDataSource = computed(() => currentDetail.value.curveData || {});
// 使 QUXIAN_DEMO_001
const curveDataSource = computed(() => (curveDataJson as any)['QUXIAN_DEMO_001'] || {});
const filterTreeNode = (value: string, data: any) => {
if (!value) return true;
@ -256,70 +258,35 @@ const initFromRoute = () => {
const initChart = () => {
if (!chartRef.value) return;
const cd = curveDataSource.value;
const mixingRows = Array.isArray(mixingProcessData.value) ? mixingProcessData.value : [];
const toNumberOrNull = (value: any): number | null => {
const num = Number(value);
return Number.isFinite(num) ? num : null;
};
const listLength = (value: any): number => {
return Array.isArray(value) ? value.length : 0;
};
const buildPositionFromAction = (row: any): number | null => {
const actionText = String(row?.action || row?.condition || '');
if (actionText.includes('压上顶栓')) return 1;
if (actionText.includes('升上顶栓')) return 0;
return null;
};
let xAxisData: Array<string | number> = [];
let temperatureData: Array<number | null> = [];
let powerData: Array<number | null> = [];
let energyData: Array<number | null> = [];
let pressureData: Array<number | null> = [];
let speedData: Array<number | null> = [];
let positionData: Array<number | null> = [];
if (mixingRows.length > 0) {
xAxisData = mixingRows.map((row: any, idx: number) => row.step ?? idx + 1);
temperatureData = mixingRows.map((row: any) => toNumberOrNull(row.temperature));
powerData = mixingRows.map((row: any) => toNumberOrNull(row.power));
energyData = mixingRows.map((row: any) => toNumberOrNull(row.energy));
pressureData = mixingRows.map((row: any) => toNumberOrNull(row.pressure));
speedData = mixingRows.map((row: any) => toNumberOrNull(row.rpm));
positionData = mixingRows.map((row: any) => buildPositionFromAction(row));
} else {
const maxLen = Math.max(
listLength(cd.mixingTime),
listLength(cd.temperature),
listLength(cd.power),
listLength(cd.energy),
listLength(cd.pressure),
listLength(cd.speed),
listLength(cd.position)
);
xAxisData =
Array.isArray(cd.mixingTime) && cd.mixingTime.length > 0
? cd.mixingTime.map((v: any, i: number) => {
const num = Number(v);
return Number.isFinite(num) ? num : i + 1;
})
: Array.from({ length: maxLen }, (_, i) => i + 1);
if (Array.isArray(cd.time) && cd.time.length > 0) {
xAxisData = cd.time.map((v: any) => {
const num = Number(v);
return Number.isFinite(num) ? num : 0;
});
const buildSeriesData = (source: any): Array<number | null> => {
const arr = Array.isArray(source) ? source : [];
return xAxisData.map((_, idx) => toNumberOrNull(arr[idx]));
return arr.map((v: any) => toNumberOrNull(v));
};
temperatureData = buildSeriesData(cd.temperature);
powerData = buildSeriesData(cd.power);
energyData = buildSeriesData(cd.energy);
pressureData = buildSeriesData(cd.pressure);
speedData = buildSeriesData(cd.speed);
positionData = buildSeriesData(cd.position);
temperatureData = buildSeriesData(cd.MixingTemp);
powerData = buildSeriesData(cd.MixingPower);
energyData = buildSeriesData(cd.MixingEnergy);
pressureData = buildSeriesData(cd.MixingPress);
speedData = buildSeriesData(cd.MixingSpeed);
}
const calcRange = (arr: Array<number | null>) => {
@ -334,8 +301,8 @@ const initChart = () => {
};
};
const leftAxisRange = calcRange(temperatureData);
const rightAxisRange = calcRange([...powerData, ...energyData, ...pressureData, ...speedData, ...positionData]);
const leftAxisRange = calcRange([...temperatureData, ...energyData, ...pressureData, ...speedData]);
const rightAxisRange = calcRange(powerData);
if (chartInstance) {
chartInstance.dispose();
@ -364,29 +331,18 @@ const initChart = () => {
type: 'category',
data: xAxisData,
boundaryGap: false,
name: mixingRows.length > 0 ? '混炼步骤' : '时间(s)'
name: '时间(s)'
},
yAxis: [
{ type: 'value', name: '温度(℃)', position: 'left', axisLine: { show: true }, ...leftAxisRange },
{ type: 'value', name: '其他参数', position: 'right', axisLine: { show: true }, ...rightAxisRange }
{ type: 'value', name: '温度/能量/压力/转速', position: 'left', axisLine: { show: true }, ...leftAxisRange },
{ type: 'value', name: '功率(kW)', position: 'right', axisLine: { show: true }, ...rightAxisRange }
],
series: [
{ name: '温度', type: 'line', yAxisIndex: 0, data: temperatureData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#ff4d4f' } },
{ name: '功率', type: 'line', yAxisIndex: 1, data: powerData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#40a9ff' } },
{ name: '能量', type: 'line', yAxisIndex: 1, data: energyData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#36cfc9' } },
{ name: '压力', type: 'line', yAxisIndex: 1, data: pressureData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#95de64' } },
{ name: '转速', type: 'line', yAxisIndex: 1, data: speedData, smooth: false, connectNulls: false, showSymbol: true, itemStyle: { color: '#f7d13d' } },
{
name: '上顶栓',
type: 'line',
yAxisIndex: 1,
data: positionData,
smooth: false,
connectNulls: false,
showSymbol: true,
lineStyle: { type: 'dashed' },
itemStyle: { color: '#ffa07a' }
}
{ name: '温度', type: 'line', yAxisIndex: 0, data: temperatureData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#ff4d4f' } },
{ name: '功率', type: 'line', yAxisIndex: 1, data: powerData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#40a9ff' } },
{ name: '能量', type: 'line', yAxisIndex: 0, data: energyData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#36cfc9' } },
{ name: '压力', type: 'line', yAxisIndex: 0, data: pressureData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#95de64' } },
{ name: '转速', type: 'line', yAxisIndex: 0, data: speedData, smooth: true, connectNulls: false, showSymbol: false, itemStyle: { color: '#f7d13d' } }
]
});
};
@ -400,14 +356,14 @@ const renderChartWithDelay = () => {
setTimeout(() => {
initChart();
resizeChart();
}, 180);
}, 320);
});
};
const toggleCurve = () => {
curveCollapsed.value = !curveCollapsed.value;
if (!curveCollapsed.value) {
nextTick(() => initChart());
renderChartWithDelay();
}
};

Loading…
Cancel
Save