Commit f8151b99 authored by 陈龙's avatar 陈龙

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

parent a09e683b
...@@ -262,10 +262,16 @@ const deviceParams = [ ...@@ -262,10 +262,16 @@ const deviceParams = [
"sensors": "进水压力", "sensors": "进水压力",
"deviceType": "熊猫压力表" "deviceType": "熊猫压力表"
}*/ }*/
{ /* {
"deviceCode": "LLJ00000001", "deviceCode": "LLJ00000001",
"sensors": "瞬时流量", "sensors": "瞬时流量",
"deviceType": "流量计" "deviceType": "流量计"
}*/
{
"deviceCode": "EGBF00000024",
// "deviceCode": "EGBF00000023",
"sensors": "进水压力",
"deviceType": "二供泵房"
} }
] ]
const Demo = () => { const Demo = () => {
......
...@@ -290,10 +290,8 @@ const handleFakeData = (dateRange, deviceParams) => { ...@@ -290,10 +290,8 @@ const handleFakeData = (dateRange, deviceParams) => {
_arr.forEach(sensor => { _arr.forEach(sensor => {
final.push({ final.push({
dataModel: [ dataModel: [
/* {pt: dateFrom, pv: null}, {pt: dateFrom, pv: null},
{pt: dateTo, pv: null}*/ {pt: dateTo, pv: null}
// {pv:null}
{pv: null}
], ],
dateFrom, dateFrom,
dateTo, dateTo,
...@@ -979,9 +977,9 @@ const HistoryView = (props) => { ...@@ -979,9 +977,9 @@ const HistoryView = (props) => {
}; };
// 同期对比 // 同期对比
if (timeValue === 'contrast' && dataModel[0]) { if (timeValue === 'contrast' && dataModel[0]) {
const time = item.dataModel[0].pt const time = item.dataModel[0]?.pt
.slice(0, contrastOption === 'day' ? 10 : 7) ?.slice(0, contrastOption === 'day' ? 10 : 7)
.replace(/-/g, ''); ?.replace(/-/g, '');
col.title = `${equipmentName}-${sensorName}-${time}`; col.title = `${equipmentName}-${sensorName}-${time}`;
} }
return col; return col;
...@@ -1177,7 +1175,7 @@ const HistoryView = (props) => { ...@@ -1177,7 +1175,7 @@ const HistoryView = (props) => {
emptyOrError.current.error = false; emptyOrError.current.error = false;
if (results.length) { if (results.length) {
let data = []; let data = [];
let _predicateData = []; // let _predicateData = [];
results.forEach((res, index) => { results.forEach((res, index) => {
const {dateFrom, dateTo} = dateRange?.[index] ?? {}; const {dateFrom, dateTo} = dateRange?.[index] ?? {};
if (res.code === 0 && res.data.length) { if (res.code === 0 && res.data.length) {
...@@ -1234,20 +1232,25 @@ const HistoryView = (props) => { ...@@ -1234,20 +1232,25 @@ const HistoryView = (props) => {
}).filter((item) => item.sensorName); }).filter((item) => item.sensorName);
// 预测的 // 预测的
data = data.concat(list.filter(item => item.deviceType !== '预测')); 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); setLoading(false);
if (data.length !== 0) { if (data.length !== 0) {
emptyOrError.current.empty = false; emptyOrError.current.empty = false;
} else {
data = handleFakeData(dateRange, deviceParams) ?? []
} }
handleTableData(data) handleTableData(data)
setChartDataSource(data); setChartDataSource(data);
setPredicateData(_predicateData); // setPredicateData(_predicateData);
} }
}) })
.catch((err) => { .catch((err) => {
let data = handleFakeData(dateRange, deviceParams) ?? [];
handleTableData(data);
setChartDataSource(data);
message.info('未查询到数据,请重试~'); message.info('未查询到数据,请重试~');
setLoading(false); setLoading(false);
}); });
...@@ -1451,20 +1454,20 @@ const HistoryView = (props) => { ...@@ -1451,20 +1454,20 @@ const HistoryView = (props) => {
// 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) => {
......
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