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

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

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