Commit e3f20273 authored by 陈龙's avatar 陈龙

feat: 优化历史曲线关联指标流程

parent 66fbb24b
...@@ -2,9 +2,14 @@ import React from 'react'; ...@@ -2,9 +2,14 @@ import React from 'react';
import HistoryView from '../index'; import HistoryView from '../index';
const deviceParams = [ const deviceParams = [
/* {
"deviceCode": "EGBF00000023",
"sensors": "出水压力",
"deviceType": "二供泵房"
}, */
{ {
"deviceCode": "EGBF00000024", "deviceCode": "EGBF00000023",
"sensors": "出水瞬时流量", "sensors": "出水瞬时流量,出水压力",
"deviceType": "二供泵房" "deviceType": "二供泵房"
} }
] ]
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* 非influxdb版本的接口,使用isDilute=false实现; * 非influxdb版本的接口,使用isDilute=false实现;
* 建议:不抽稀的时候,传isDilute=false&zoom=''&unit='' * 建议:不抽稀的时候,传isDilute=false&zoom=''&unit=''
* */ * */
import React, {useContext, useEffect, useMemo, useState, useCallback, useRef} from 'react'; import React, { useContext, useEffect, useMemo, useState, useCallback, useRef } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { import {
...@@ -40,14 +40,14 @@ import { ...@@ -40,14 +40,14 @@ import {
import SingleChart from './SingleChart'; import SingleChart from './SingleChart';
import GridChart from './GridChart'; import GridChart from './GridChart';
import BIStyles from './indexForBI.less'; import BIStyles from './indexForBI.less';
import {globalConfig} from 'antd/lib/config-provider'; import { globalConfig } from 'antd/lib/config-provider';
import {getSensorType} from './apis/index'; import { getSensorType } from './apis/index';
import {ExportExcel} from '@wisdom-components/exportexcel'; import { ExportExcel } from '@wisdom-components/exportexcel';
import VirtualTable from './VirtualTable'; import VirtualTable from './VirtualTable';
const {RangePicker} = DatePicker; const { RangePicker } = DatePicker;
const {Option} = Select; const { Option } = Select;
const startFormat = 'YYYY-MM-DD 00:00:00'; const startFormat = 'YYYY-MM-DD 00:00:00';
const endFormat = 'YYYY-MM-DD 23:59:59'; const endFormat = 'YYYY-MM-DD 23:59:59';
...@@ -291,8 +291,8 @@ const handleFakeData = (dateRange, deviceParams) => { ...@@ -291,8 +291,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 }
], ],
dateFrom, dateFrom,
dateTo, dateTo,
...@@ -319,8 +319,9 @@ const timeColumn = { ...@@ -319,8 +319,9 @@ const timeColumn = {
const OriginMaxDays = 31; // 原始曲线请求数据的最大天数 const OriginMaxDays = 31; // 原始曲线请求数据的最大天数
const CharacteristicMaxDays = null; // 特征曲线或者其他曲线的最大天数 const CharacteristicMaxDays = null; // 特征曲线或者其他曲线的最大天数
const HistoryView = (props) => { const HistoryView = (props) => {
if (props.deviceParams.length===0) return '';
const [completeInit, setCompleteInit] = useState(false); const [completeInit, setCompleteInit] = useState(false);
const {getPrefixCls} = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('history-view'); const prefixCls = getPrefixCls('history-view');
const { const {
title, title,
...@@ -331,19 +332,20 @@ const HistoryView = (props) => { ...@@ -331,19 +332,20 @@ const HistoryView = (props) => {
showModels, showModels,
needMarkLine, needMarkLine,
defaultDate, defaultDate,
theme = "Normal" theme = "Normal",
// deviceParams
} = props; } = props;
// 关联指标 // 关联指标
const [combineSensors, setCombineSensors] = useState([]); const [combineSensors, setCombineSensors] = useState([]);
const deviceParams = useMemo(() => { if (theme === 'Normal') import('./index.less');
if (theme === 'BI') import('./indexForBI.less');
const deviceParams = useMemo(()=>{
let _deviceParams = _.cloneDeep(props.deviceParams); let _deviceParams = _.cloneDeep(props.deviceParams);
if (combineSensors?.length && _deviceParams.length === 1) { if (combineSensors.length && _deviceParams.length === 1) {
_deviceParams[0].sensors = combineSensors.join(',') _deviceParams[0].sensors = combineSensors.join(',');
} }
return _deviceParams; return _deviceParams;
}, [combineSensors, props.deviceParams]); },[combineSensors])
if (theme === 'Normal') import('./index.less');
if (theme === 'BI') import('./indexForBI.less');
const isBoxPlots = const isBoxPlots =
deviceParams?.length === 1 && deviceParams?.[0]?.sensors?.split(',').length === 1; deviceParams?.length === 1 && deviceParams?.[0]?.sensors?.split(',').length === 1;
const [loading, setLoading] = useState(null); const [loading, setLoading] = useState(null);
...@@ -545,13 +547,13 @@ const HistoryView = (props) => { ...@@ -545,13 +547,13 @@ const HistoryView = (props) => {
onContrastChange(contrastOption); onContrastChange(contrastOption);
setShowBoxOption(false); setShowBoxOption(false);
setChartType('lineChart'); setChartType('lineChart');
onCheckboxChange({target: {value: false}}, 'chartType'); onCheckboxChange({ target: { value: false } }, 'chartType');
onCheckboxChange({target: {value: false}}, 'ignoreOutliers'); onCheckboxChange({ target: { value: false } }, 'ignoreOutliers');
} else { } else {
// 自定义 // 自定义
// 不需要处理 // 不需要处理
setShowBoxOption(true); setShowBoxOption(true);
onCheckboxChange({target: {value: true}}, 'chartType'); onCheckboxChange({ target: { value: true } }, 'chartType');
} }
}; };
const onShortcutsChange = (e) => { const onShortcutsChange = (e) => {
...@@ -561,37 +563,37 @@ const HistoryView = (props) => { ...@@ -561,37 +563,37 @@ const HistoryView = (props) => {
switch (_val) { switch (_val) {
case '近3天': case '近3天':
_arr = [ _arr = [
{key: 1, value: moment()}, { key: 1, value: moment() },
{key: 2, value: moment().subtract(1, 'days')}, { key: 2, value: moment().subtract(1, 'days') },
{key: 3, value: moment().subtract(2, 'days')}, { key: 3, value: moment().subtract(2, 'days') },
]; ];
break; break;
case '近7天': case '近7天':
_arr = [ _arr = [
{key: 1, value: moment()}, { key: 1, value: moment() },
{key: 2, value: moment().subtract(1, 'days')}, { key: 2, value: moment().subtract(1, 'days') },
{key: 3, value: moment().subtract(2, 'days')}, { key: 3, value: moment().subtract(2, 'days') },
{key: 4, value: moment().subtract(3, 'days')}, { key: 4, value: moment().subtract(3, 'days') },
{key: 5, value: moment().subtract(4, 'days')}, { key: 5, value: moment().subtract(4, 'days') },
{key: 6, value: moment().subtract(5, 'days')}, { key: 6, value: moment().subtract(5, 'days') },
{key: 7, value: moment().subtract(6, 'days')}, { key: 7, value: moment().subtract(6, 'days') },
]; ];
break; break;
case '近3月': case '近3月':
_arr = [ _arr = [
{key: 1, value: moment()}, { key: 1, value: moment() },
{key: 2, value: moment().subtract(1, 'months')}, { key: 2, value: moment().subtract(1, 'months') },
{key: 3, value: moment().subtract(2, 'months')}, { key: 3, value: moment().subtract(2, 'months') },
]; ];
break; break;
case '近6月': case '近6月':
_arr = [ _arr = [
{key: 1, value: moment()}, { key: 1, value: moment() },
{key: 2, value: moment().subtract(1, 'months')}, { key: 2, value: moment().subtract(1, 'months') },
{key: 3, value: moment().subtract(2, 'months')}, { key: 3, value: moment().subtract(2, 'months') },
{key: 4, value: moment().subtract(3, 'months')}, { key: 4, value: moment().subtract(3, 'months') },
{key: 5, value: moment().subtract(4, 'months')}, { key: 5, value: moment().subtract(4, 'months') },
{key: 6, value: moment().subtract(5, 'months')}, { key: 6, value: moment().subtract(5, 'months') },
]; ];
break; break;
} }
...@@ -650,7 +652,7 @@ const HistoryView = (props) => { ...@@ -650,7 +652,7 @@ const HistoryView = (props) => {
{timeValue === 'contrast' && ( // 同期对比 {timeValue === 'contrast' && ( // 同期对比
<> <>
<Select value={contrastOption} getPopupContainer={trigger => trigger.parentElement} <Select value={contrastOption} getPopupContainer={trigger => trigger.parentElement}
style={{width: 60}} onChange={onContrastChange}> style={{ width: 60 }} onChange={onContrastChange}>
<Option value="day"></Option> <Option value="day"></Option>
<Option value="month" disabled={lineDataType === '原始曲线'}> <Option value="month" disabled={lineDataType === '原始曲线'}>
...@@ -675,14 +677,14 @@ const HistoryView = (props) => { ...@@ -675,14 +677,14 @@ const HistoryView = (props) => {
picker={contrastOption === 'day' ? undefined : contrastOption} picker={contrastOption === 'day' ? undefined : contrastOption}
value={child.value} value={child.value}
onChange={(date, dateString) => onContrastPickerChange(date, dateString, child)} onChange={(date, dateString) => onContrastPickerChange(date, dateString, child)}
style={{width: 130, border: !shortcutsValue ? '1px solid #1890ff' : ''}} style={{ width: 130, border: !shortcutsValue ? '1px solid #1890ff' : '' }}
/> />
{datePickerArr.length > 2 && ( {datePickerArr.length > 2 && (
<div <div
className={classNames(`${prefixCls}-contrast-delete`)} className={classNames(`${prefixCls}-contrast-delete`)}
onClick={() => handleDeleteDatePicker(index)} onClick={() => handleDeleteDatePicker(index)}
> >
<CloseCircleFilled/> <CloseCircleFilled />
</div> </div>
)} )}
</div> </div>
...@@ -691,7 +693,7 @@ const HistoryView = (props) => { ...@@ -691,7 +693,7 @@ const HistoryView = (props) => {
)} )}
</div> </div>
))} ))}
{datePickerArr.length < 4 && <PlusCircleOutlined onClick={handleAddDatePicker}/>} {datePickerArr.length < 4 && <PlusCircleOutlined onClick={handleAddDatePicker} />}
</> </>
)} )}
</div> </div>
...@@ -762,12 +764,12 @@ const HistoryView = (props) => { ...@@ -762,12 +764,12 @@ const HistoryView = (props) => {
</Checkbox> </Checkbox>
{child.tooltip && ( {child.tooltip && (
<Tooltip title={child.tooltip}> <Tooltip title={child.tooltip}>
<QuestionCircleFilled className={`${prefixCls}-question`}/> <QuestionCircleFilled className={`${prefixCls}-question`} />
</Tooltip> </Tooltip>
)} )}
{child.hasSub && child.checked && false ? ( {child.hasSub && child.checked && false ? (
<Select <Select
style={{width: 80, marginLeft: 10}} style={{ width: 80, marginLeft: 10 }}
value={algorithmValue} value={algorithmValue}
onChange={(e) => setAlgorithmValue(e)} onChange={(e) => setAlgorithmValue(e)}
> >
...@@ -787,7 +789,7 @@ const HistoryView = (props) => { ...@@ -787,7 +789,7 @@ const HistoryView = (props) => {
return ( return (
<div <div
className={classNames(`${prefixCls}-cover`)} className={classNames(`${prefixCls}-cover`)}
style={isChart && isSingle ? {width: '100%'} : {}} style={isChart && isSingle ? { width: '100%' } : {}}
> >
{isChart && !isStatus ? ( {isChart && !isStatus ? (
<> <>
...@@ -799,7 +801,7 @@ const HistoryView = (props) => { ...@@ -799,7 +801,7 @@ const HistoryView = (props) => {
</Radio.Group> </Radio.Group>
<Tooltip title={'原始曲线数据量较大,单次查询最多展示1万条数据'}> <Tooltip title={'原始曲线数据量较大,单次查询最多展示1万条数据'}>
<QuestionCircleFilled <QuestionCircleFilled
style={{marginLeft: 6}} style={{ marginLeft: 6 }}
className={`${prefixCls}-question`} className={`${prefixCls}-question`}
/> />
</Tooltip> </Tooltip>
...@@ -812,16 +814,16 @@ const HistoryView = (props) => { ...@@ -812,16 +814,16 @@ const HistoryView = (props) => {
<> <>
{lineDataType !== '原始曲线' ? ( {lineDataType !== '原始曲线' ? (
<> <>
<div style={{marginLeft: 7}} className={classNames(`${prefixCls}-label`)}> <div style={{ marginLeft: 7 }} className={classNames(`${prefixCls}-label`)}>
曲线形态 曲线形态
</div> </div>
<Radio.Group <Radio.Group
value={chartType} value={chartType}
style={{marginRight: 16}} style={{ marginRight: 16 }}
onChange={(e) => { onChange={(e) => {
let _value = e.target.value; let _value = e.target.value;
setChartType(_value); setChartType(_value);
onCheckboxChange({target: {value: _value !== 'boxChart'}}, 'chartType'); onCheckboxChange({ target: { value: _value !== 'boxChart' } }, 'chartType');
}} }}
> >
<Radio.Button value={'lineChart'}>线形图</Radio.Button> <Radio.Button value={'lineChart'}>线形图</Radio.Button>
...@@ -852,7 +854,7 @@ const HistoryView = (props) => { ...@@ -852,7 +854,7 @@ const HistoryView = (props) => {
{activeTabKey === 'table' && ( {activeTabKey === 'table' && (
<Select <Select
value={dataThinKey} value={dataThinKey}
style={{width: 90}} style={{ width: 90 }}
onChange={onTimeIntervalChange} onChange={onTimeIntervalChange}
disabled={!dataConfig.dataThin} disabled={!dataConfig.dataThin}
getPopupContainer={trigger => trigger.parentElement} getPopupContainer={trigger => trigger.parentElement}
...@@ -964,7 +966,7 @@ const HistoryView = (props) => { ...@@ -964,7 +966,7 @@ const HistoryView = (props) => {
(data) => { (data) => {
const ignoreOutliers = checkboxData.find((item) => item.key === 'ignoreOutliers').checked; const ignoreOutliers = checkboxData.find((item) => item.key === 'ignoreOutliers').checked;
const dataIndexAccess = (dataItem, index) => { const dataIndexAccess = (dataItem, index) => {
const {stationCode, sensorName} = dataItem; const { stationCode, sensorName } = dataItem;
return `${stationCode}-${sensorName}-${index}`; return `${stationCode}-${sensorName}-${index}`;
}; };
...@@ -975,7 +977,7 @@ const HistoryView = (props) => { ...@@ -975,7 +977,7 @@ const HistoryView = (props) => {
// 判断是否是单设备,单设备则不显示设备名称 // 判断是否是单设备,单设备则不显示设备名称
// 处理表头数据 // 处理表头数据
const columnsData = data.map((item, index) => { const columnsData = data.map((item, index) => {
const {stationCode, equipmentName, sensorName, unit, dataModel} = item; const { stationCode, equipmentName, sensorName, unit, dataModel } = item;
const dataIndex = dataIndexAccess(item, index); const dataIndex = dataIndexAccess(item, index);
let _title = ''; let _title = '';
if (deviceConfig.current.oneDevice) { if (deviceConfig.current.oneDevice) {
...@@ -1005,7 +1007,7 @@ const HistoryView = (props) => { ...@@ -1005,7 +1007,7 @@ const HistoryView = (props) => {
// 格式化时间对齐数据, 生成行数 // 格式化时间对齐数据, 生成行数
const timeData = {}; const timeData = {};
const buildDefaultData = (time) => { const buildDefaultData = (time) => {
const obj = {key: time, time: time}; const obj = { key: time, time: time };
data.forEach((item, index) => { data.forEach((item, index) => {
const dataIndex = dataIndexAccess(item, index); const dataIndex = dataIndexAccess(item, index);
obj[dataIndex] = ''; obj[dataIndex] = '';
...@@ -1014,31 +1016,31 @@ const HistoryView = (props) => { ...@@ -1014,31 +1016,31 @@ const HistoryView = (props) => {
return obj; return obj;
}; };
data.forEach((item, index) => { data.forEach((item, index) => {
const {stationCode, sensorName, dataModel} = item; const { stationCode, sensorName, dataModel } = item;
dataModel && dataModel &&
dataModel.forEach((data) => { dataModel.forEach((data) => {
const formatTime = moment(data.pt).format(format); const formatTime = moment(data.pt).format(format);
let time = formatTime; let time = formatTime;
if (timeValue === 'contrast') { if (timeValue === 'contrast') {
time = time.slice(contrastOption === 'day' ? 11 : 8, 16); time = time.slice(contrastOption === 'day' ? 11 : 8, 16);
} }
timeData[formatTime] = timeData[formatTime] || buildDefaultData(time); timeData[formatTime] = timeData[formatTime] || buildDefaultData(time);
}); });
}); });
// 处理表格数据 // 处理表格数据
data.forEach((child, index) => { data.forEach((child, index) => {
const {dataModel} = child; const { dataModel } = child;
const dataIndex = dataIndexAccess(child, index); const dataIndex = dataIndexAccess(child, index);
dataModel && dataModel &&
dataModel.forEach((value, j) => { dataModel.forEach((value, j) => {
const formatTime = moment(value.pt).format(format); const formatTime = moment(value.pt).format(format);
const dataRow = timeData[formatTime]; const dataRow = timeData[formatTime];
if (dataRow) { if (dataRow) {
dataRow[dataIndex] = value.pv === null || value.pv === undefined ? '' : value.pv; dataRow[dataIndex] = value.pv === null || value.pv === undefined ? '' : value.pv;
} }
}); });
}); });
const timeSort = (a, b) => { const timeSort = (a, b) => {
let aa = a, let aa = a,
...@@ -1085,34 +1087,34 @@ const HistoryView = (props) => { ...@@ -1085,34 +1087,34 @@ const HistoryView = (props) => {
}; };
const handleDataThinKey = (diffYears, diffDays, diffHours, lineDataType) => { const handleDataThinKey = (diffYears, diffDays, diffHours, lineDataType) => {
if (lineDataType === '原始曲线') { if (lineDataType === '原始曲线') {
return {unit: '', zoom: ''}; return { unit: '', zoom: '' };
} }
// edit by zy 根据选择的时长控制抽稀频度 // edit by zy 根据选择的时长控制抽稀频度
if (diffYears > 0) { if (diffYears > 0) {
if (diffYears === 1) return {unit: 'h', zoom: '24'}; if (diffYears === 1) return { unit: 'h', zoom: '24' };
return {unit: 'h', zoom: '48'}; return { unit: 'h', zoom: '48' };
} else if (diffYears === 0 && diffDays > 0) { } else if (diffYears === 0 && diffDays > 0) {
if (diffDays > 90) return {unit: 'h', zoom: '24'}; if (diffDays > 90) return { unit: 'h', zoom: '24' };
if (diffDays > 30) return {unit: 'h', zoom: '4'}; if (diffDays > 30) return { unit: 'h', zoom: '4' };
if (diffDays > 15) return {unit: 'h', zoom: '2'}; if (diffDays > 15) return { unit: 'h', zoom: '2' };
if (diffDays > 7) return {unit: 'h', zoom: '1'}; if (diffDays > 7) return { unit: 'h', zoom: '1' };
if (diffDays > 3) return {unit: 'min', zoom: '20'}; if (diffDays > 3) return { unit: 'min', zoom: '20' };
if (diffDays > 1) return {unit: 'min', zoom: '15'}; if (diffDays > 1) return { unit: 'min', zoom: '15' };
if (diffDays === 1) return {unit: 'min', zoom: '5'}; if (diffDays === 1) return { unit: 'min', zoom: '5' };
} else if (diffYears === 0 && diffDays === 0 && diffHours > 0) { } else if (diffYears === 0 && diffDays === 0 && diffHours > 0) {
if (diffHours > 12) return {unit: 'min', zoom: '5'}; if (diffHours > 12) return { unit: 'min', zoom: '5' };
if (diffHours > 4) return {unit: 'min', zoom: '1'}; if (diffHours > 4) return { unit: 'min', zoom: '1' };
if (diffHours > 1) return {unit: 's', zoom: '30'}; if (diffHours > 1) return { unit: 's', zoom: '30' };
if (diffHours > 0) return {unit: 's', zoom: '5'}; if (diffHours > 0) return { unit: 's', zoom: '5' };
return {unit: 's', zoom: '5'}; return { unit: 's', zoom: '5' };
} else { } else {
return {unit: '', zoom: ''}; return { unit: '', zoom: '' };
} }
}; };
// 处理接口服务参数的变化 // 处理接口服务参数的变化
const onChangeParams = (value = {}) => { const onChangeParams = (value = {}) => {
const {dateRange, isDilute, ignoreOutliers, zoom, unit} = value; const { dateRange, isDilute, ignoreOutliers, zoom, unit } = value;
let _diffDays = moment(dateRange[0].dateTo).diff(dateRange[0].dateFrom, 'days'); let _diffDays = moment(dateRange[0].dateTo).diff(dateRange[0].dateFrom, 'days');
// 查询时段大于7天时,不提供1分钟的抽稀选项。 // 查询时段大于7天时,不提供1分钟的抽稀选项。
if (_diffDays > 7 && zoom === '1' && unit === 'min') { if (_diffDays > 7 && zoom === '1' && unit === 'min') {
...@@ -1125,7 +1127,7 @@ const HistoryView = (props) => { ...@@ -1125,7 +1127,7 @@ const HistoryView = (props) => {
let hasDiscreteDeviceType = false; let hasDiscreteDeviceType = false;
deviceParams deviceParams
.map((item) => { .map((item) => {
let _item = {...item}; let _item = { ...item };
_item.sensors = item.sensors; _item.sensors = item.sensors;
// special 业务 // special 业务
if (special1) { if (special1) {
...@@ -1164,9 +1166,9 @@ const HistoryView = (props) => { ...@@ -1164,9 +1166,9 @@ const HistoryView = (props) => {
activeTabKey === 'curve' activeTabKey === 'curve'
? handleDataThinKey(diffYears, diffDays, diffHours, lineDataType) ? handleDataThinKey(diffYears, diffDays, diffHours, lineDataType)
: !isDilute : !isDilute
? {zoom: '', unit: ''} ? { zoom: '', unit: '' }
: {}; // 表格也支持全数据模式; : {}; // 表格也支持全数据模式;
let _finalParams = {...param, ...zoomParam}; let _finalParams = { ...param, ...zoomParam };
// 2024年1月8日 抽稀间隔大于等于12小时时,会存在线性插值导致抽稀间隔内数据条数大于预期的问题。需要增加一个额外参数处理该情况。 // 2024年1月8日 抽稀间隔大于等于12小时时,会存在线性插值导致抽稀间隔内数据条数大于预期的问题。需要增加一个额外参数处理该情况。
if (_finalParams.zoom) { if (_finalParams.zoom) {
let _num = Number(_finalParams.zoom); let _num = Number(_finalParams.zoom);
...@@ -1197,7 +1199,7 @@ const HistoryView = (props) => { ...@@ -1197,7 +1199,7 @@ const HistoryView = (props) => {
if (results.length) { if (results.length) {
let data = []; let data = [];
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) {
res.data.forEach((d) => { res.data.forEach((d) => {
d.dateFrom = dateFrom || ''; d.dateFrom = dateFrom || '';
...@@ -1211,7 +1213,7 @@ const HistoryView = (props) => { ...@@ -1211,7 +1213,7 @@ const HistoryView = (props) => {
*/ */
// d.dataModel=[]; // d.dataModel=[];
d.dataModel = d.dataModel.map((item) => { d.dataModel = d.dataModel.map((item) => {
let {firstPV, lastPV, maxPV, minPV, pv} = item; let { firstPV, lastPV, maxPV, minPV, pv } = item;
if (pv !== null && firstPV === null && lastPV === null && maxPV === null && minPV === null) { if (pv !== null && firstPV === null && lastPV === null && maxPV === null && minPV === null) {
firstPV = pv; firstPV = pv;
lastPV = pv; lastPV = pv;
...@@ -1227,8 +1229,6 @@ const HistoryView = (props) => { ...@@ -1227,8 +1229,6 @@ const HistoryView = (props) => {
}; };
}); });
}); });
// 加入预测
// (predicateDevice ? deviceParams.concat(predicateDevice) : deviceParams).forEach((p) => {
deviceParams.forEach((p) => { deviceParams.forEach((p) => {
// 返回数据按查询指标顺序排序 // 返回数据按查询指标顺序排序
const sensors = p.sensors?.split(',') ?? []; const sensors = p.sensors?.split(',') ?? [];
...@@ -1278,7 +1278,7 @@ const HistoryView = (props) => { ...@@ -1278,7 +1278,7 @@ const HistoryView = (props) => {
useEffect(() => { useEffect(() => {
if (!completeInit) return; if (!completeInit) return;
const {dataThin, ignoreOutliers, zoom, unit} = dataConfig; const { dataThin, ignoreOutliers, zoom, unit } = dataConfig;
beforChangeParams().finally(() => { beforChangeParams().finally(() => {
onChangeParams({ onChangeParams({
isDilute: dataThin, isDilute: dataThin,
...@@ -1334,7 +1334,7 @@ const HistoryView = (props) => { ...@@ -1334,7 +1334,7 @@ const HistoryView = (props) => {
}} }}
/> />
) : ( ) : (
<PandaEmpty/> <PandaEmpty />
)} )}
</div> </div>
</> </>
...@@ -1382,7 +1382,7 @@ const HistoryView = (props) => { ...@@ -1382,7 +1382,7 @@ const HistoryView = (props) => {
)} )}
</div> </div>
{lineDataType === '原始曲线' && false ? ( {lineDataType === '原始曲线' && false ? (
<div style={{marginTop: 10}}>展示区间:{returnLongestPeriod(chartDataSource)}</div> <div style={{ marginTop: 10 }}>展示区间:{returnLongestPeriod(chartDataSource)}</div>
) : ( ) : (
'' ''
)} )}
...@@ -1404,7 +1404,7 @@ const HistoryView = (props) => { ...@@ -1404,7 +1404,7 @@ const HistoryView = (props) => {
/> />
) : ( ) : (
<SingleChart <SingleChart
exportCanvas={{exportFlag, setExportFlag}} exportCanvas={{ exportFlag, setExportFlag }}
emptyOrError={emptyOrError.current} emptyOrError={emptyOrError.current}
dateRange={dateRange} dateRange={dateRange}
showBoxOption={showBoxOption} showBoxOption={showBoxOption}
...@@ -1454,7 +1454,7 @@ const HistoryView = (props) => { ...@@ -1454,7 +1454,7 @@ const HistoryView = (props) => {
) )
return setCompleteInit(true); return setCompleteInit(true);
setLoading(true); setLoading(true);
const {deviceCode, deviceType, sensors} = deviceParams[0]; const { deviceCode, deviceType, sensors } = deviceParams[0];
let _id = ( let _id = (
await getPointAddress({ await getPointAddress({
code: deviceCode, code: deviceCode,
...@@ -1510,7 +1510,7 @@ const HistoryView = (props) => { ...@@ -1510,7 +1510,7 @@ const HistoryView = (props) => {
return final; return final;
}, {}); }, {});
_checkboxData = _checkboxData.map((item) => { _checkboxData = _checkboxData.map((item) => {
let _item = {...item}; let _item = { ...item };
if (_opt[item.label] !== undefined) { if (_opt[item.label] !== undefined) {
_item.checked = _opt[item.label] === 'true'; _item.checked = _opt[item.label] === 'true';
} }
...@@ -1584,14 +1584,14 @@ const HistoryView = (props) => { ...@@ -1584,14 +1584,14 @@ const HistoryView = (props) => {
return ( return (
<div <div
className={classNames(prefixCls, theme === 'BI' ? BIStyles[`${prefixCls}-historyViewComponents`] : '', 'wkt-scroll-light')} className={classNames(prefixCls, theme === 'BI' ? BIStyles[`${prefixCls}-historyViewComponents`] : '', 'wkt-scroll-light')}
style={{background: theme === 'BI' ? '#282b34' : '#ffffff'}}> style={{ background: theme === 'BI' ? '#282b34' : '#ffffff' }}>
<div className={classNames(`${prefixCls}-spin`)} style={{position: 'relative'}}> <div className={classNames(`${prefixCls}-spin`)} style={{ position: 'relative' }}>
{loading || percent !== 0 ? ( {loading || percent !== 0 ? (
<div className={classNames(`${prefixCls}-progressWrapper`)}> <div className={classNames(`${prefixCls}-progressWrapper`)}>
{lineDataType === '原始曲线' || {lineDataType === '原始曲线' ||
(lineDataType === '特征曲线' && (lineDataType === '特征曲线' &&
moment(dateRange?.[0]?.dateTo).diff(moment(dateRange?.[0]?.dateFrom), 'days') >= moment(dateRange?.[0]?.dateTo).diff(moment(dateRange?.[0]?.dateFrom), 'days') >=
30) ? 30) ?
<div className={classNames(`${prefixCls}-contentWrapper`)}> <div className={classNames(`${prefixCls}-contentWrapper`)}>
<Progress <Progress
percent={percent} percent={percent}
...@@ -1602,7 +1602,7 @@ const HistoryView = (props) => { ...@@ -1602,7 +1602,7 @@ const HistoryView = (props) => {
<div className={classNames(`${prefixCls}-tip`)}>加载中...</div> <div className={classNames(`${prefixCls}-tip`)}>加载中...</div>
</div> : </div> :
<Spin spinning={loading || false} tip={'数据加载中...'} delay={1000} <Spin spinning={loading || false} tip={'数据加载中...'} delay={1000}
style={{background: 'transparent'}}/> style={{ background: 'transparent' }} />
} }
</div> </div>
) : ( ) : (
...@@ -1623,7 +1623,7 @@ const HistoryView = (props) => { ...@@ -1623,7 +1623,7 @@ const HistoryView = (props) => {
{activeTabKey === 'table' && ( {activeTabKey === 'table' && (
<> <>
<Button type="link" onClick={exportFeatureBtn}> <Button type="link" onClick={exportFeatureBtn}>
<DownloadOutlined/> <DownloadOutlined />
下载 下载
</Button> </Button>
</> </>
...@@ -1631,7 +1631,7 @@ const HistoryView = (props) => { ...@@ -1631,7 +1631,7 @@ const HistoryView = (props) => {
{activeTabKey === 'curve' && ( {activeTabKey === 'curve' && (
<> <>
<Button type="link" onClick={exportCanvas}> <Button type="link" onClick={exportCanvas}>
<DownloadOutlined/> <DownloadOutlined />
下载 下载
</Button> </Button>
</> </>
......
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