Commit f8151b99 authored by 陈龙's avatar 陈龙

feat: 优化历史曲线空值的显示

parent a09e683b
......@@ -262,10 +262,16 @@ const deviceParams = [
"sensors": "进水压力",
"deviceType": "熊猫压力表"
}*/
{
/* {
"deviceCode": "LLJ00000001",
"sensors": "瞬时流量",
"deviceType": "流量计"
}*/
{
"deviceCode": "EGBF00000024",
// "deviceCode": "EGBF00000023",
"sensors": "进水压力",
"deviceType": "二供泵房"
}
]
const Demo = () => {
......
......@@ -290,10 +290,8 @@ const handleFakeData = (dateRange, deviceParams) => {
_arr.forEach(sensor => {
final.push({
dataModel: [
/* {pt: dateFrom, pv: null},
{pt: dateTo, pv: null}*/
// {pv:null}
{pv: null}
{pt: dateFrom, pv: null},
{pt: dateTo, pv: null}
],
dateFrom,
dateTo,
......@@ -979,9 +977,9 @@ const HistoryView = (props) => {
};
// 同期对比
if (timeValue === 'contrast' && dataModel[0]) {
const time = item.dataModel[0].pt
.slice(0, contrastOption === 'day' ? 10 : 7)
.replace(/-/g, '');
const time = item.dataModel[0]?.pt
?.slice(0, contrastOption === 'day' ? 10 : 7)
?.replace(/-/g, '');
col.title = `${equipmentName}-${sensorName}-${time}`;
}
return col;
......@@ -1177,7 +1175,7 @@ const HistoryView = (props) => {
emptyOrError.current.error = false;
if (results.length) {
let data = [];
let _predicateData = [];
// let _predicateData = [];
results.forEach((res, index) => {
const {dateFrom, dateTo} = dateRange?.[index] ?? {};
if (res.code === 0 && res.data.length) {
......@@ -1234,20 +1232,25 @@ const HistoryView = (props) => {
}).filter((item) => item.sensorName);
// 预测的
data = data.concat(list.filter(item => item.deviceType !== '预测'));
_predicateData = _predicateData.concat(list.filter(item => item.deviceType === '预测'));
// _predicateData = _predicateData.concat(list.filter(item => item.deviceType === '预测'));
});
}
});
setLoading(false);
if (data.length !== 0) {
emptyOrError.current.empty = false;
} else {
data = handleFakeData(dateRange, deviceParams) ?? []
}
handleTableData(data)
setChartDataSource(data);
setPredicateData(_predicateData);
// setPredicateData(_predicateData);
}
})
.catch((err) => {
let data = handleFakeData(dateRange, deviceParams) ?? [];
handleTableData(data);
setChartDataSource(data);
message.info('未查询到数据,请重试~');
setLoading(false);
});
......@@ -1451,20 +1454,20 @@ const HistoryView = (props) => {
// let _res3 = result[3];
let _checkboxData = [...checkboxData];
// 单设备单曲线时,查询是否配置为预测点
/* if (_res3.code === 0 && _res3.data) {
// 1. 如果是单曲线,并且配置了预测,那么默认开启预测;
// 2024年3月11日 物联预测功能支撑后,再开发这部分
_checkboxData.push({
key: 'predicate',
label: '数据预测',
checked: true,
showInCurve: true,
showInTable: true,
})
setPredicateDevice({..._res3.data, deviceType: '预测'});
} else {
setPredicateDevice(null);
}*/
/* if (_res3.code === 0 && _res3.data) {
// 1. 如果是单曲线,并且配置了预测,那么默认开启预测;
// 2024年3月11日 物联预测功能支撑后,再开发这部分
_checkboxData.push({
key: 'predicate',
label: '数据预测',
checked: true,
showInCurve: true,
showInTable: true,
})
setPredicateDevice({..._res3.data, deviceType: '预测'});
} else {
setPredicateDevice(null);
}*/
// 查字典配置
if (_res0.code === 0) {
let _opt = _res0.data.reduce((final, cur) => {
......
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