Commit 863ce357 authored by 崔佳豪's avatar 崔佳豪

fix(EC_HistoryView): 优化历史曲线多图表标题

parent af793980
...@@ -4,12 +4,12 @@ import { BasicChart } from '@wisdom-components/basicchart'; ...@@ -4,12 +4,12 @@ import { BasicChart } from '@wisdom-components/basicchart';
import PandaEmpty from '@wisdom-components/empty'; import PandaEmpty from '@wisdom-components/empty';
import optionGenerator from './utils'; import optionGenerator from './utils';
const ChartTitle = ({ prefixCls }) => { const ChartTitle = ({ prefixCls, title, unit }) => {
const cls = `${prefixCls}-grid-item-title`; const cls = `${prefixCls}-grid-item-title`;
return ( return (
<div className={cls}> <div className={cls}>
<span className={`${cls}_text`}>进水压力</span> <span className={`${cls}_text`}>{title}</span>
<span className={`${cls}_unit`}>(单位:MPa</span> {unit && <span className={`${cls}_unit`}>(单位:{unit}</span>}
</div> </div>
); );
}; };
...@@ -80,14 +80,15 @@ const GridChart = memo((props) => { ...@@ -80,14 +80,15 @@ const GridChart = memo((props) => {
return ( return (
<div className={`${prefixCls}-grid`}> <div className={`${prefixCls}-grid`}>
{options.map((item) => { {options.map((item, index) => {
const { sensorName, unit } = gridData[index];
const isEmpty = const isEmpty =
!item.option.series.length || !item.option.series.length ||
!item.option.series.find((e) => e.data && e.data.length > 0); !item.option.series.find((e) => e.data && e.data.length > 0);
return ( return (
<div key={item.key} className={`${prefixCls}-grid-item`}> <div key={item.key} className={`${prefixCls}-grid-item`}>
<div className={`${prefixCls}-grid-item-wrap`}> <div className={`${prefixCls}-grid-item-wrap`}>
<ChartTitle prefixCls={prefixCls} /> <ChartTitle prefixCls={prefixCls} title={sensorName} unit={unit} />
{isEmpty ? ( {isEmpty ? (
<PandaEmpty /> <PandaEmpty />
) : ( ) : (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment