diff --git a/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue b/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue index 0dd276861..f421d9969 100644 --- a/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue +++ b/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue @@ -323,19 +323,20 @@ const GAUGE_DEV_RANGE = { min: -5, max: 5 } * yAxisSuffix: 纵轴标签后缀,如 '%' * yRange: 可选 { min, max },不传则按全量数据自适应 */ -function makeLine(title, xData, yData, extras = [], yAxisSuffix = '', yRange = null) { +function makeLine(title, xData, yData, extras = [], yAxisSuffix = '', yRange = null, xAxisOpts = null) { const allVals = [yData, ...extras.map(e => e.data)].flat() const range = yRange || calcYRange(allVals) const hasExtras = extras.length > 0 + const toSeriesData = arr => xAxisOpts ? xData.map((x, i) => [x, arr[i]]) : arr const mainSeries = { name: title, type: 'line', smooth: false, symbol: 'none', - lineStyle: { width: 1.5, color: '#409EFF' }, data: yData, z: 3 + lineStyle: { width: 1.5, color: '#409EFF' }, data: toSeriesData(yData), z: 3 } const extraSeries = extras.map(e => ({ name: e.name, type: 'line', smooth: false, symbol: 'none', lineStyle: { width: 1, color: e.color || '#E6A23C', type: e.dash !== false ? 'dashed' : 'solid' }, - data: e.data, z: 2 + data: toSeriesData(e.data), z: 2 })) return { title: { text: title, textStyle: { fontSize: 12, fontWeight: 'normal' }, top: 4, left: 8 }, @@ -350,10 +351,15 @@ function makeLine(title, xData, yData, extras = [], yAxisSuffix = '', yRange = n : undefined }, grid: { top: hasExtras ? 44 : 36, bottom: 28, left: 8, right: 16, containLabel: true }, - xAxis: { - type: 'category', data: xData, - name: 'pos(m)', nameTextStyle: { fontSize: 10 }, axisLabel: { fontSize: 10 } - }, + xAxis: xAxisOpts + ? { + type: 'value', min: xAxisOpts.min, interval: xAxisOpts.interval, + name: 'pos(m)', nameTextStyle: { fontSize: 10 }, axisLabel: { fontSize: 10 } + } + : { + type: 'category', data: xData, + name: 'pos(m)', nameTextStyle: { fontSize: 10 }, axisLabel: { fontSize: 10 } + }, yAxis: { type: 'value', min: range.min, max: range.max, nameTextStyle: { fontSize: 10 }, @@ -382,6 +388,16 @@ function xLocData(rows) { }) } +function xLocNumData(rows) { + return rows.map(r => { + const v = r.XLOCATION !== undefined ? r.XLOCATION : r.xlocation + return v == null ? null : Number(v) + }) +} + +// 厚度曲线横坐标:从 0 开始,步长 500 +const GAUGE_X_AXIS_OPTS = { min: 0, interval: 500 } + export default { name: 'ActualPerformance', components: { QualityReportDialog }, @@ -631,7 +647,7 @@ export default { renderGaugeCharts() { const rows = this.gaugeRows if (!rows || !rows.length) return - const xData = xLocData(rows) + const xData = xLocNumData(rows) // THICK0~THICK4 对应的参考列 const refColMap = { THICK0: 'THICK0REF', THICK1: 'THICK1REF', THICK4: 'THICK4REF', THICK5: 'THICK5REF' } const chartRefs = ['chartGauge1', 'chartGauge2', 'chartGauge3', 'chartGauge4'] @@ -641,25 +657,14 @@ export default { if (refCol) { // ── 厚度偏差图:THICKx 即相对设定值的偏差%,纵轴直接画偏差、0 为基准 ── - // 实测数据验证(卷 26061045000):THICK0 在 -3% 上下、THICK0REF=3.0mm, - // 与 L2 原生 HMI 一致——蓝色 0 线为设定值,曲线为实测偏差 const yData = rows.map(r => { const v = getRowVal(r, col) const rv = getRowVal(r, refCol) if (v == null || rv == null || rv === 0) return null return parseFloat(v.toFixed(3)) }) - // 设定值(绝对厚度 mm):取首个非空 REF,写入标题 - let refVal = null - for (const r of rows) { - const rv = getRowVal(r, refCol) - if (rv != null && rv !== 0) { refVal = rv; break } - } - const chartTitle = refVal != null ? `${title} - 设定值: ${refVal.toFixed(2)}[mm]` : title - + const chartTitle = title const extras = [] - // 设定基准线恒为 0 - extras.push({ name: '设定值(0)', data: yData.map(v => v == null ? null : 0), color: '#909399', dash: false }) // TOPLIMIT/BOTLIMIT 是冷轧机出口厚度的 AGC 公差带(逐行变化, // 头尾加减速段约 ±2.5%、稳态段收紧到约 ±1%),只约束出口厚度。 @@ -677,14 +682,14 @@ export default { if (upData.some(v => v != null)) extras.push({ name: '上限', data: upData, color: '#F56C6C', dash: true }) if (loData.some(v => v != null)) extras.push({ name: '下限', data: loData, color: '#67C23A', dash: true }) } - return this.makeChart(ref, makeLine(chartTitle, xData, yData, extras, '%', GAUGE_DEV_RANGE)) + return this.makeChart(ref, makeLine(chartTitle, xData, yData, extras, '%', GAUGE_DEV_RANGE, GAUGE_X_AXIS_OPTS)) } else { // ── 速度等无参考值的图:保持原始单位 ── const yData = rows.map(r => { const v = getRowVal(r, col) return v == null ? null : parseFloat(v.toFixed(4)) }) - return this.makeChart(ref, makeLine(title, xData, yData)) + return this.makeChart(ref, makeLine(title, xData, yData, [], '', null, GAUGE_X_AXIS_OPTS)) } }) this.chartInstances = charts.filter(Boolean)