diff --git a/src/views/heating/heatanalysis/HeatanalysisListJx.vue b/src/views/heating/heatanalysis/HeatanalysisListJx.vue index 391b255..052ae72 100644 --- a/src/views/heating/heatanalysis/HeatanalysisListJx.vue +++ b/src/views/heating/heatanalysis/HeatanalysisListJx.vue @@ -72,12 +72,12 @@ diff --git a/src/views/heating/heatanalysis/components/ZxtJX.vue b/src/views/heating/heatanalysis/components/ZxtJX.vue index 570fc14..4ad5afb 100644 --- a/src/views/heating/heatanalysis/components/ZxtJX.vue +++ b/src/views/heating/heatanalysis/components/ZxtJX.vue @@ -76,20 +76,31 @@ function initChartsOptions(records: any[]) { return (isNaN(ta) ? 0 : ta) - (isNaN(tb) ? 0 : tb); }); - // 横坐标使用 view032 或 datatime const xAxis = records.map((r: any) => r.view032 || r.datatime || ''); + // ⚡ 只改温度指标:根据每条记录的 fromFlow 判断取值 const tempSeries = [ - { name: '供水温度', key: 'view005' }, - { name: '回水温度', key: 'view006' }, - ].map(s => ({ - name: s.name, - type: 'line', - showSymbol: false, - connectNulls: false, - data: records.map((r: any) => safeNum(r[s.key])), - })); + { + name: '供水温度', + type: 'line', + showSymbol: false, + connectNulls: false, + data: records.map((r: any) => { + return safeNum(r.fromFlow == 1 ? r.view035 : r.view005); + }), + }, + { + name: '回水温度', + type: 'line', + showSymbol: false, + connectNulls: false, + data: records.map((r: any) => { + return safeNum(r.fromFlow == 1 ? r.view036 : r.view006); + }), + }, + ]; + // 压力指标(不变) const pressSeries = [ { name: '供水压力', key: 'view007' }, { name: '回水压力', key: 'view008' }, @@ -101,7 +112,7 @@ function initChartsOptions(records: any[]) { data: records.map((r: any) => safeNum(r[s.key])), })); - // 热量指标: 瞬时热量 view041,正累积热量 view042 + // 热量指标(不变) const heatSeries = [ { name: '瞬时热量', key: 'view041' }, { name: '正累积热量', key: 'view042' }, @@ -113,7 +124,7 @@ function initChartsOptions(records: any[]) { data: records.map((r: any) => safeNum(r[s.key])), })); - // 流量指标: 瞬时流量 view037,正累积流量 view038 + // 流量指标(不变) const flowSeries = [ { name: '瞬时流量', key: 'view037' }, { name: '正累积流量', key: 'view038' }, @@ -133,20 +144,18 @@ function initChartsOptions(records: any[]) { type: 'category', data: xAxis, boundaryGap: false, - axisLabel: { - interval: 0, - formatter: (val: string) => val ? val.replace(' ', '\n') : val, - }, + axisLabel: { interval: 0, formatter: (v: string) => (v ? v.replace(' ', '\n') : v) }, }, yAxis: { type: 'value', scale: true }, }; - tempOption = { ...baseOption, title: { text: '温度指标', left: 'center', top: 8 }, series: tempSeries }; + tempOption = { ...baseOption, title: { text: '温度指标', left: 'center', top: 8 }, series: tempSeries }; pressOption = { ...baseOption, title: { text: '压力指标', left: 'center', top: 8 }, series: pressSeries }; - heatOption = { ...baseOption, title: { text: '热量指标', left: 'center', top: 8 }, series: heatSeries }; - flowOption = { ...baseOption, title: { text: '流量指标', left: 'center', top: 8 }, series: flowSeries }; + heatOption = { ...baseOption, title: { text: '热量指标', left: 'center', top: 8 }, series: heatSeries }; + flowOption = { ...baseOption, title: { text: '流量指标', left: 'center', top: 8 }, series: flowSeries }; } + let resizeAdded = false; function ensureResizeListener() { if (resizeAdded) return;