Commit 37e05e0e authored by 陈龙's avatar 陈龙

feat: 提交变更

parent ff3d1098
import React from 'react'; import React from 'react';
import HistoryView from '../index'; import HistoryView from '../index';
/*const deviceParams = [ const deviceParams = [
{ {
deviceCode: 'EGBF00000146', deviceCode: 'EGBF00000146',
sensors: '进水压力,出水瞬时流量,出水累计流量', sensors: '进水压力,出水瞬时流量,出水累计流量',
...@@ -21,8 +21,8 @@ import HistoryView from '../index'; ...@@ -21,8 +21,8 @@ import HistoryView from '../index';
deviceType: '二供泵房', deviceType: '二供泵房',
pointAddressID: 4, pointAddressID: 4,
}, },
];*/ ];
const deviceParams = [ /*const deviceParams = [
{ {
"deviceCode": "LLJ00000055", "deviceCode": "LLJ00000055",
"sensors": "瞬时流量,正累计流量,是否在线", "sensors": "瞬时流量,正累计流量,是否在线",
...@@ -33,7 +33,7 @@ const deviceParams = [ ...@@ -33,7 +33,7 @@ const deviceParams = [
"sensors": "瞬时流量,正累计流量,是否在线", "sensors": "瞬时流量,正累计流量,是否在线",
"deviceType": "流量计" "deviceType": "流量计"
} }
] ]*/
const Demo = () => { const Demo = () => {
return <div style={{ height: 700 }}> return <div style={{ height: 700 }}>
<HistoryView deviceParams={deviceParams} grid /> <HistoryView deviceParams={deviceParams} grid />
......
...@@ -3,13 +3,13 @@ import HistoryView from '../index'; ...@@ -3,13 +3,13 @@ import HistoryView from '../index';
import {MobileHistoryChart} from "../mobile"; import {MobileHistoryChart} from "../mobile";
const deviceParams = [ const deviceParams = [
{ /* {
deviceCode: 'EGBF00000141', deviceCode: 'EGBF00000141',
// sensors: '进水压力,出水瞬时流量,出水累计流量', // sensors: '进水压力,出水瞬时流量,出水累计流量',
sensors: '进水压力', sensors: '进水压力',
deviceType: '二供泵房', deviceType: '二供泵房',
pointAddressID: 208, pointAddressID: 208,
}, },*/
/* { /* {
// deviceCode: 'EGBF00000002', // deviceCode: 'EGBF00000002',
// deviceCode: 'EGBF00000018', // deviceCode: 'EGBF00000018',
...@@ -37,6 +37,12 @@ const deviceParams = [ ...@@ -37,6 +37,12 @@ const deviceParams = [
"sensors": "进水压力,是否在线", "sensors": "进水压力,是否在线",
"deviceType": "二供机组" "deviceType": "二供机组"
}*/ }*/
// 邳州张楼水厂
{
"deviceCode": "LLJ00000004",
"sensors": "瞬时流量,是否在线",
"deviceType": "流量计"
}
]; ];
const Demo = () => { const Demo = () => {
return ( return (
......
...@@ -554,10 +554,11 @@ const HistoryView = (props) => { ...@@ -554,10 +554,11 @@ const HistoryView = (props) => {
let fileName = `数据报表-${i.deviceType}-${i.deviceCode}-${moment(timeFrom).format( let fileName = `数据报表-${i.deviceType}-${i.deviceCode}-${moment(timeFrom).format(
dateFormat, dateFormat,
)}${moment(timeTo).format(dateFormat)}`; )}${moment(timeTo).format(dateFormat)}`;
let _quotas = i.sensors.split(',').filter(item=> item!=='是否在线').join(',')
getExportDeviceHistoryUrl({ getExportDeviceHistoryUrl({
deviceType: i.deviceType, deviceType: i.deviceType,
deviceCode: i.deviceCode, deviceCode: i.deviceCode,
quotas: i.sensors, quotas: _quotas,
startTime: timeFrom, startTime: timeFrom,
endTime: timeTo, endTime: timeTo,
fileName: fileName, fileName: fileName,
...@@ -576,6 +577,8 @@ const HistoryView = (props) => { ...@@ -576,6 +577,8 @@ const HistoryView = (props) => {
}; };
const handleTableData = useCallback((data) => { const handleTableData = useCallback((data) => {
// eslint-disable-next-line no-param-reassign
data = data.filter(item => item.sensorName !== '是否在线');
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;
...@@ -659,7 +662,7 @@ const HistoryView = (props) => { ...@@ -659,7 +662,7 @@ const HistoryView = (props) => {
const tableData = times.map((time) => timeData[time]); const tableData = times.map((time) => timeData[time]);
setColumns([timeColumn, ...columnsData]); setColumns([timeColumn, ...columnsData]);
setTableData(tableData); setTableData(tableData);
}, [timeOrder]); }, [timeOrder, timeValue, contrastOption]);
const [deviceAlarmSchemes, setDeviceAlarmSchemes] = useState([]); const [deviceAlarmSchemes, setDeviceAlarmSchemes] = useState([]);
const beforChangeParams = (value = {}) => { const beforChangeParams = (value = {}) => {
...@@ -778,6 +781,8 @@ const HistoryView = (props) => { ...@@ -778,6 +781,8 @@ const HistoryView = (props) => {
handleTableData(data); handleTableData(data);
setChartDataSource(data); setChartDataSource(data);
} }
}).catch(err => {
setLoading(false)
}); });
}; };
...@@ -811,6 +816,16 @@ const HistoryView = (props) => { ...@@ -811,6 +816,16 @@ const HistoryView = (props) => {
dataSource={tableData.sort((a, b) => { dataSource={tableData.sort((a, b) => {
let _a = a.time; let _a = a.time;
let _b = b.time let _b = b.time
if (timeValue === 'contrast') {
if (contrastOption === 'day') {
_a = `2000-01-01 ${a.time}:00`;
_b = `2000-01-01 ${b.time}:00`;
}
if (contrastOption === 'month') {
_a = `2000-01-${a.time}:00`;
_b = `2000-01-${b.time}:00`;
}
}
return timeOrder === 'ascend' ? moment(_a) - moment(_b) : moment(_b) - moment(_a); return timeOrder === 'ascend' ? moment(_a) - moment(_b) : moment(_b) - moment(_a);
})} })}
columns={columns} columns={columns}
......
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