Commit 6c311207 authored by 陈龙's avatar 陈龙

feat:升级历史曲线、统计曲线的错误空值交互;剔除预测值的曲线

parent 30223b18
...@@ -24,7 +24,8 @@ const SingleChart = memo((props) => { ...@@ -24,7 +24,8 @@ const SingleChart = memo((props) => {
lineDataType, lineDataType,
showBoxOption, showBoxOption,
special, special,
predicateData predicateData,
emptyOrError
} = props; } = props;
const chartRef = useRef(); const chartRef = useRef();
const timerRef = useRef(); const timerRef = useRef();
...@@ -57,10 +58,16 @@ const SingleChart = memo((props) => { ...@@ -57,10 +58,16 @@ const SingleChart = memo((props) => {
return specialTypeChartOptionGenerator({dataSource, config}); return specialTypeChartOptionGenerator({dataSource, config});
} }
let _option = optionGenerator(dataSource, null, contrast, contrastOption, smooth, config, lineDataType, predicateData); let _option = optionGenerator(dataSource, null, contrast, contrastOption, smooth, config, lineDataType, predicateData);
let isEmpty = _option.series.length===0; if (emptyOrError.empty || emptyOrError.error) {
if (isEmpty) { if (isArray(_option.yAxis)) {
_option.yAxis.max=100; _option.yAxis.forEach(item => {
_option.yAxis.min=0; item.max = 100;
item.min = 0;
})
} else {
_option.yAxis.max = 100;
_option.yAxis.min = 0;
}
} }
return _option; return _option;
}, [dataSource, smooth, curveCenter, chartType, predicateData]); }, [dataSource, smooth, curveCenter, chartType, predicateData]);
......
...@@ -69,7 +69,7 @@ export function getSensorType() { ...@@ -69,7 +69,7 @@ export function getSensorType() {
export function getPredicateSensor(params) { export function getPredicateSensor(params) {
return request({ return request({
url: `${baseUrl}/PandaWater/CityWater/PiZhou/GetPredicateSensor`, url: `${monitorDeviceUrl}/GetPredicateSensor`,
method: REQUEST_METHOD_GET, method: REQUEST_METHOD_GET,
params params
}) })
...@@ -84,9 +84,9 @@ export function getStatisticsInfo(data) { ...@@ -84,9 +84,9 @@ export function getStatisticsInfo(data) {
}); });
} }
export function getSensorsRealName (data) { export function getSensorsRealName(data) {
return request({ return request({
url:`${baseUrl}/PandaMonitor/Monitor/Device/GetStaticRealName`, url: `${baseUrl}/PandaMonitor/Monitor/Device/GetStaticRealName`,
method: REQUEST_METHOD_POST, method: REQUEST_METHOD_POST,
data, data,
}) })
......
...@@ -211,17 +211,62 @@ import { MobileHistoryChart } from '../mobile'; ...@@ -211,17 +211,62 @@ import { MobileHistoryChart } from '../mobile';
];*/ ];*/
const deviceParams = [ const deviceParams = [
// 新乐,水厂数据异常的问题 // 新乐,水厂数据异常的问题
{ /* {
"deviceCode": "SC00000004", "deviceCode": "SC00000004",
"sensors": "进水瞬时流量,1#出水瞬时流量,2#出水瞬时流量", "sensors": "进水瞬时流量,1#出水瞬时流量,2#出水瞬时流量",
"deviceType": "水厂" "deviceType": "水厂"
} }*/
/* {
"deviceCode": "EGJZ00000073",
"sensors": "进水压力",
"deviceType": "二供机组"
}*/
/* {
"deviceCode": "EGJZ00000006",
"sensors": "进水压力",
"deviceType": "二供机组"
}*/
/* {
"deviceCode": "EGBF00000002",
"deviceType": "二供泵房",
"sensors": "进水压力"
},
{
"deviceType": "二供机组",
"deviceCode": "EGJZ00000005",
"sensors": "出水压力"
},
{
"deviceType": "二供机组",
"deviceCode": "EGJZ00000001",
"sensors": "出水压力"
},
{
"deviceType": "二供机组",
"deviceCode": "EGJZ00000004",
"sensors": "出水压力"
},
{
"deviceType": "二供机组",
"deviceCode": "EGJZ00000003",
"sensors": "出水压力"
},
{
"deviceType": "二供机组",
"deviceCode": "EGJZ00000002",
"sensors": "出水压力"
}*/
// 182:8088 报警设备 // 182:8088 报警设备
/* { /* {
"deviceCode": "XMYL00000043", "deviceCode": "XMYL00000043",
"sensors": "进水压力", "sensors": "进水压力",
"deviceType": "熊猫压力表" "deviceType": "熊猫压力表"
}*/ }*/
{
"deviceCode": "LLJ00000001",
"sensors": "瞬时流量",
"deviceType": "流量计"
}
] ]
const Demo = () => { const Demo = () => {
return ( return (
......
...@@ -376,7 +376,11 @@ const HistoryView = (props) => { ...@@ -376,7 +376,11 @@ const HistoryView = (props) => {
const [predicateDevice, setPredicateDevice] = useState(null); const [predicateDevice, setPredicateDevice] = useState(null);
const [predicateData, setPredicateData] = useState([]); const [predicateData, setPredicateData] = useState([]);
const [predicateTime, setPredicateTime] = useState(null); const [predicateTime, setPredicateTime] = useState(null);
// 需要处理默认数据,确保图表能够一直显示坐标轴。用来存储当前的请求状态。
const emptyOrError = useRef({
empty: true,
error: true
})
// 这部分功能有问题,等待解决后上线 2024年3月13日 // 这部分功能有问题,等待解决后上线 2024年3月13日
const [discreteDeviceType, setDiscreteDeviceType] = useState(['水厂']) const [discreteDeviceType, setDiscreteDeviceType] = useState(['水厂'])
// 历史数据相关的特征描述 // 历史数据相关的特征描述
...@@ -1170,6 +1174,7 @@ const HistoryView = (props) => { ...@@ -1170,6 +1174,7 @@ const HistoryView = (props) => {
Promise.all(requestArr) Promise.all(requestArr)
.then((results) => { .then((results) => {
setLoading(false); setLoading(false);
emptyOrError.current.error = false;
if (results.length) { if (results.length) {
let data = []; let data = [];
let _predicateData = []; let _predicateData = [];
...@@ -1234,6 +1239,9 @@ const HistoryView = (props) => { ...@@ -1234,6 +1239,9 @@ const HistoryView = (props) => {
} }
}); });
setLoading(false); setLoading(false);
if (data.length !== 0) {
emptyOrError.current.empty = false;
}
handleTableData(data) handleTableData(data)
setChartDataSource(data); setChartDataSource(data);
setPredicateData(_predicateData); setPredicateData(_predicateData);
...@@ -1356,6 +1364,7 @@ const HistoryView = (props) => { ...@@ -1356,6 +1364,7 @@ const HistoryView = (props) => {
<div className={`${prefixCls}-content`}> <div className={`${prefixCls}-content`}>
{grid === true ? ( {grid === true ? (
<GridChart <GridChart
emptyOrError={emptyOrError.current}
curveCenter={curveCenter} curveCenter={curveCenter}
prefixCls={prefixCls} prefixCls={prefixCls}
dataSource={chartDataSource} dataSource={chartDataSource}
...@@ -1370,6 +1379,7 @@ const HistoryView = (props) => { ...@@ -1370,6 +1379,7 @@ const HistoryView = (props) => {
/> />
) : ( ) : (
<SingleChart <SingleChart
emptyOrError={emptyOrError.current}
dateRange={dateRange} dateRange={dateRange}
showBoxOption={showBoxOption} showBoxOption={showBoxOption}
lineDataType={lineDataType} lineDataType={lineDataType}
...@@ -1432,29 +1442,29 @@ const HistoryView = (props) => { ...@@ -1432,29 +1442,29 @@ const HistoryView = (props) => {
// 以下请求为处理状态值、开关值的图表,只允许单曲线单指标情况下展示 // 以下请求为处理状态值、开关值的图表,只允许单曲线单指标情况下展示
let _request1 = getPointAddressEntry(_params); let _request1 = getPointAddressEntry(_params);
let _request2 = getSensorType(); let _request2 = getSensorType();
let _request3 = getPredicateSensor({deviceCode, sensors}); // let _request3 = getPredicateSensor({deviceCode, sensors});
await Promise.all([_request0, _request1, _request2, _request3]).then((result) => { await Promise.all([_request0, _request1, _request2]).then((result) => {
if (result) { if (result) {
let _res0 = result[0]; let _res0 = result[0];
let _res1 = result[1]; let _res1 = result[1];
let _res2 = result[2]; let _res2 = result[2];
let _res3 = result[3]; // let _res3 = result[3];
let _checkboxData = [...checkboxData]; let _checkboxData = [...checkboxData];
// 单设备单曲线时,查询是否配置为预测点 // 单设备单曲线时,查询是否配置为预测点
if (_res3.code === 0 && _res3.data) { /* if (_res3.code === 0 && _res3.data) {
// 1. 如果是单曲线,并且配置了预测,那么默认开启预测; // 1. 如果是单曲线,并且配置了预测,那么默认开启预测;
// 2024年3月11日 物联预测功能支撑后,再开发这部分 // 2024年3月11日 物联预测功能支撑后,再开发这部分
/* _checkboxData.push({ _checkboxData.push({
key: 'predicate', key: 'predicate',
label: '数据预测', label: '数据预测',
checked: true, checked: true,
showInCurve: true, showInCurve: true,
showInTable: true, showInTable: true,
})*/ })
setPredicateDevice({..._res3.data, deviceType: '预测'}); setPredicateDevice({..._res3.data, deviceType: '预测'});
} else { } else {
setPredicateDevice(null); setPredicateDevice(null);
} }*/
// 查字典配置 // 查字典配置
if (_res0.code === 0) { if (_res0.code === 0) {
let _opt = _res0.data.reduce((final, cur) => { let _opt = _res0.data.reduce((final, cur) => {
......
...@@ -9,11 +9,17 @@ const Demo = () => { ...@@ -9,11 +9,17 @@ const Demo = () => {
// deviceType: '加压泵站', // deviceType: '加压泵站',
// statisticType: '', // statisticType: '',
// } // }
const params = { /* const params = {
deviceCode: 'LLJ00000001', deviceCode: 'LLJ00000001',
sensors: '今日水量', sensors: '今日水量',
deviceType: '流量计', deviceType: '流量计',
statisticType: '', statisticType: '',
} */
const params = {
deviceCode: 'EGBF00000023',
sensors: '今日供水量',
deviceType: '二供泵房',
statisticType: '',
} }
return ( return (
<> <>
......
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