Commit 070fea10 authored by 陈龙's avatar 陈龙

fix: 修复多设备曲线无法显示的问题

parent 951b85f3
......@@ -24,7 +24,7 @@ path: /
<code src="./demos/index.js"></code>
## 移动端
[//]: # (## 移动端)
[//]: # (<code src="./demos/mobile.js"></code>)
......
import React from 'react';
import HistoryView from '../index';
const deviceParams = [
/*const deviceParams = [
{
deviceCode: 'EGBF00000146',
deviceCode: 'EGBF00000136',
sensors: '进水压力,出水瞬时流量,出水累计流量',
deviceType: '二供泵房',
pointAddressID: 4,
},
{
deviceCode: 'EGBF00000001',
deviceCode: 'EGBF00000137',
sensors: '进水压力,出水瞬时流量,出水累计流量',
deviceType: '二供泵房',
pointAddressID: 4,
},
{
// deviceCode: 'EGBF00000002',
deviceCode: 'EGBF00000082',
deviceCode: 'EGBF00000135',
sensors: '进水压力,出水瞬时流量,出水累计流量',
deviceType: '二供泵房',
pointAddressID: 4,
},
];
];*/
/*const deviceParams = [
{
"deviceCode": "LLJ00000055",
......@@ -34,6 +34,18 @@ const deviceParams = [
"deviceType": "流量计"
}
]*/
const deviceParams = [
{
"deviceCode": "EGBF00000023",
"sensors": "出水瞬时流量,是否在线",
"deviceType": "二供泵房"
},
{
"deviceCode": "EGBF00000019",
"sensors": "出水瞬时流量,是否在线",
"deviceType": "二供泵房"
}
]
const Demo = () => {
return <div style={{ height: 700 }}>
<HistoryView deviceParams={deviceParams} grid />
......
......@@ -920,7 +920,7 @@ const HistoryView = (props) => {
dataItem.dateFrom = dateFrom || '';
dataItem.dateTo = dateTo || '';
// 抽稀情况下,剔除掉为null的点
/* if (zoomArray[index]?.unit !== '' && zoomArray[index]?.zoom !== '') {
/* if (zoomArray[index]?.unit !== '' && zoomArray[index]?.zoom !== '') {
dataItem.dataModel = dataItem.dataModel.filter(item => item.pv !== null)
}*/
return dataItem;
......@@ -1043,10 +1043,10 @@ const HistoryView = (props) => {
}
};
// 获取字段配置
const getDefaultOptions = () => {
const getDefaultOptions = async () => {
// 非单曲线、单指标不执行
if (deviceParams?.length !== 1 || (deviceParams?.length === 1 && deviceParams?.[0]?.sensors?.split(',')?.length > 1)) return;
getDictionaryInfoAll({
if (deviceParams?.length !== 1 || (deviceParams?.length === 1 && deviceParams?.[0]?.sensors?.split(',')?.length > 1)) return setCompleteInit(true);
await getDictionaryInfoAll({
level: '组件_ec_historyview'
}).then(res => {
if (res.code === 0) {
......@@ -1062,9 +1062,9 @@ const HistoryView = (props) => {
return _item;
});
setCheckboxData(_checkboxData);
setCompleteInit(true);
}
})
setCompleteInit(true);
};
useEffect(() => {
getDefaultOptions();
......
......@@ -693,7 +693,6 @@ const returnCustomSeries = (dataSource) => {
*/
const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth, config, lineDataType = '') => {
console.log('config:', config)
const {
needUnit,
curveCenter,
......
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