Commit 76c03200 authored by 陈龙's avatar 陈龙

feat: 提交历史曲线变更

parents 17390a00 905e5c19
...@@ -44,4 +44,5 @@ host/ ...@@ -44,4 +44,5 @@ host/
webpack.host.js webpack.host.js
.env .env
.env.local .env.local
\ No newline at end of file yarn.lock
\ No newline at end of file
...@@ -124,6 +124,7 @@ export default { ...@@ -124,6 +124,7 @@ export default {
'EC_HistoryInfo', 'EC_HistoryInfo',
'EC_RealTimeInfo', 'EC_RealTimeInfo',
'EC_ConfigurationView', 'EC_ConfigurationView',
'EC_HistoryView',
], ],
}, },
], ],
......
...@@ -2,7 +2,7 @@ const proxyURL = process.env.PANDA_ENV_PROXY || 'http://192.168.8.28:8911'; ...@@ -2,7 +2,7 @@ const proxyURL = process.env.PANDA_ENV_PROXY || 'http://192.168.8.28:8911';
export default { export default {
'/api': { '/api': {
target: 'http://192.168.10.150:8669', target: proxyURL,
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^/api': '' }, pathRewrite: { '^/api': '' },
}, },
......
...@@ -122,6 +122,7 @@ ...@@ -122,6 +122,7 @@
"slash2": "^2.0.0", "slash2": "^2.0.0",
"style-loader": "^2.0.0", "style-loader": "^2.0.0",
"stylelint": "^13.0.0", "stylelint": "^13.0.0",
"swiper": "^6.8.1",
"terser-webpack-plugin": "^5.1.1", "terser-webpack-plugin": "^5.1.1",
"typescript": "^4.1.2", "typescript": "^4.1.2",
"umi": "^3.5.20", "umi": "^3.5.20",
...@@ -134,8 +135,7 @@ ...@@ -134,8 +135,7 @@
"webpack-cli": "^4.5.0", "webpack-cli": "^4.5.0",
"write-pkg": "^4.0.0", "write-pkg": "^4.0.0",
"xhr-mock": "^2.5.1", "xhr-mock": "^2.5.1",
"yorkie": "^2.0.0", "yorkie": "^2.0.0"
"swiper": "^6.8.1"
}, },
"gitHooks": { "gitHooks": {
"pre-commit": "pretty-quick --staged", "pre-commit": "pretty-quick --staged",
...@@ -160,7 +160,9 @@ ...@@ -160,7 +160,9 @@
"highcharts-react-official": "^3.0.0", "highcharts-react-official": "^3.0.0",
"js-export-excel": "^1.1.4", "js-export-excel": "^1.1.4",
"jszip": "^3.5.0", "jszip": "^3.5.0",
"less": "^3.13.1",
"mqtt-client": "^1.0.12", "mqtt-client": "^1.0.12",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"parseForm": "1.0.0", "parseForm": "1.0.0",
"react-redux": "^8.0.5", "react-redux": "^8.0.5",
"sha1": "^1.1.1" "sha1": "^1.1.1"
......
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.4.1...@wisdom-components/ec_historyview@1.4.2) (2022-12-29)
### Bug Fixes
- 优化历史曲线指标分组及排序 ([ebcef43](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/ebcef43e77b09387f6783bf9488269766bf029ca))
### Performance Improvements
- 优化历史曲线组件添加缺省页 ([b50bc3d](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/b50bc3dba8f6eb5ea2c652a984e299072695f5b3))
## [1.4.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.4.0...@wisdom-components/ec_historyview@1.4.1) (2022-12-21) ## [1.4.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.4.0...@wisdom-components/ec_historyview@1.4.1) (2022-12-21)
### Bug Fixes ### Bug Fixes
......
{ {
"name": "@wisdom-components/ec_historyview", "name": "@wisdom-components/ec_historyview",
"version": "1.4.1", "version": "1.4.2",
"description": "> TODO: description", "description": "> TODO: description",
"author": "cuijiahao <15927252954@163.com>", "author": "cuijiahao <15927252954@163.com>",
"homepage": "", "homepage": "",
......
...@@ -9,12 +9,13 @@ const GridChart = memo((props) => { ...@@ -9,12 +9,13 @@ const GridChart = memo((props) => {
const gridData = useMemo(() => { const gridData = useMemo(() => {
const grids = dataSource.reduce((pre, item, index) => { const grids = dataSource.reduce((pre, item, index) => {
const { sensorName } = item; const { sensorName, deviceType } = item;
let grid = pre.find((g) => g.key === sensorName); const key = `${deviceType}_${sensorName}`; // 同设备类型同指标才在同一组
let grid = pre.find((g) => g.key === key);
if (!grid) { if (!grid) {
const restProp = _.pick(item, ['equipmentName', 'sensorName', 'stationCode', 'unit']); const restProp = _.pick(item, ['equipmentName', 'sensorName', 'stationCode', 'unit']);
grid = { grid = {
key: sensorName, key: key,
list: [], list: [],
...restProp, ...restProp,
}; };
...@@ -45,15 +46,13 @@ const GridChart = memo((props) => { ...@@ -45,15 +46,13 @@ const GridChart = memo((props) => {
return ( return (
<div className={`${prefixCls}-grid`}> <div className={`${prefixCls}-grid`}>
{ {options.map((item) => (
options.map(item => ( <div key={item.key} className={`${prefixCls}-grid-item`}>
<div key={item.key} className={`${prefixCls}-grid-item`}> <div className={`${prefixCls}-grid-item-wrap`}>
<div className={`${prefixCls}-grid-item-wrap`}> <BasicChart style={{ width: '100%', height: '100%' }} option={item.option} notMerge />
<BasicChart style={{ width: '100%', height: '100%' }} option={item.option} notMerge />
</div>
</div> </div>
)) </div>
} ))}
</div> </div>
); );
}); });
......
import React from 'react'; import React from 'react';
import HistoryView from '../index'; import HistoryView from '../index';
const deviceParams = [{ const deviceParams = [
deviceCode: "EGBF00000146", {
sensors: "进水压力,出水瞬时流量,出水累计流量", deviceCode: 'EGBF00000146',
deviceType: "二供泵房" sensors: '进水压力,出水瞬时流量,出水累计流量',
}] deviceType: '二供泵房',
},
{
deviceCode: 'EGJZ00001113',
sensors: '出水瞬时流量,出水压力,泵1状态',
deviceType: '二供机组',
},
];
const Demo = () => { const Demo = () => {
return ( return (
<div style={{height: 700}}> <div style={{ height: 700 }}>
<HistoryView deviceParams={deviceParams} grid /> <HistoryView deviceParams={deviceParams} grid />
</div> </div>
); );
......
import React from 'react'; import React from 'react';
import HistoryView from '../index'; import HistoryView from '../index';
const deviceParams = [{ const deviceParams = [
deviceCode: "EGBF00000146", {
sensors: "进水压力,出水瞬时流量,出水累计流量", deviceCode: 'EGBF00000146',
deviceType: "二供泵房" sensors: '进水压力,出水瞬时流量,出水累计流量',
}] deviceType: '二供泵房',
},
{
deviceCode: 'EGJZ00001113',
sensors: '出水瞬时流量,出水压力,泵1状态',
deviceType: '二供机组',
},
];
const Demo = () => { const Demo = () => {
return ( return (
<div style={{height: 700}}> <div style={{ height: 700 }}>
<HistoryView deviceParams={deviceParams} /> <HistoryView deviceParams={deviceParams} />
</div> </div>
); );
......
...@@ -6,6 +6,7 @@ import { CloseCircleFilled, DownloadOutlined, PlusCircleOutlined } from '@ant-de ...@@ -6,6 +6,7 @@ import { CloseCircleFilled, DownloadOutlined, PlusCircleOutlined } from '@ant-de
import moment from 'moment'; import moment from 'moment';
import _ from 'lodash'; import _ from 'lodash';
import TimeRangePicker from '@wisdom-components/timerangepicker'; import TimeRangePicker from '@wisdom-components/timerangepicker';
import PandaEmpty from '@wisdom-components/empty';
import BasicTable from '@wisdom-components/basictable'; import BasicTable from '@wisdom-components/basictable';
import { getHistoryInfo } from './apis'; import { getHistoryInfo } from './apis';
import SimgleChart from './SingleChart'; import SimgleChart from './SingleChart';
...@@ -174,7 +175,7 @@ const timeColumn = { ...@@ -174,7 +175,7 @@ const timeColumn = {
title: '采集时间', title: '采集时间',
dataIndex: 'time', dataIndex: 'time',
key: 'time', key: 'time',
width: 160, width: 170,
fixed: 'left', fixed: 'left',
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
...@@ -532,7 +533,19 @@ const HistoryView = (props) => { ...@@ -532,7 +533,19 @@ const HistoryView = (props) => {
d.dateFrom = dateFrom; d.dateFrom = dateFrom;
d.dateTo = dateTo; d.dateTo = dateTo;
}); });
data = data.concat(res.data); deviceParams.forEach((p) => {
// 返回数据按查询指标顺序排序
const sensors = p.sensors?.split(',') ?? [];
const list = sensors.map((s) => {
const dataItem = res.data.find(
(d) => d.stationCode === p.deviceCode && d.sensorName === s,
);
dataItem.dateFrom = dateFrom;
dataItem.dateTo = dateTo;
return dataItem;
});
data = data.concat(list);
});
} }
}); });
setLoading(false); setLoading(false);
...@@ -580,7 +593,9 @@ const HistoryView = (props) => { ...@@ -580,7 +593,9 @@ const HistoryView = (props) => {
{renderCurveOption()} {renderCurveOption()}
</div> </div>
<div className={`${prefixCls}-content`}> <div className={`${prefixCls}-content`}>
{grid === true ? ( {!chartDataSource.length ? (
<PandaEmpty />
) : grid === true ? (
<GridChart <GridChart
prefixCls={prefixCls} prefixCls={prefixCls}
dataSource={chartDataSource} dataSource={chartDataSource}
...@@ -603,15 +618,17 @@ const HistoryView = (props) => { ...@@ -603,15 +618,17 @@ const HistoryView = (props) => {
{renderCurveOption()} {renderCurveOption()}
</div> </div>
<div className={`${prefixCls}-content`}> <div className={`${prefixCls}-content`}>
{ {chartDataSource.length > 0 ? (
<BasicTable <BasicTable
dataSource={tableData} dataSource={tableData}
columns={columns} columns={columns}
{...tableProps} {...tableProps}
pagination={{ showQuickJumper: true, showSizeChanger: true }} pagination={false}
onChange={() => {}} onChange={() => {}}
/> />
} ) : (
<PandaEmpty />
)}
</div> </div>
</Tabs.TabPane> </Tabs.TabPane>
</Tabs> </Tabs>
......
...@@ -104,13 +104,17 @@ ...@@ -104,13 +104,17 @@
} }
.@{history-view}-content { .@{history-view}-content {
display: flex;
flex: 1; flex: 1;
align-items: center;
justify-content: center;
overflow: hidden; overflow: hidden;
} }
.@{history-view}-grid { .@{history-view}-grid {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
width: 100%;
height: 100%; height: 100%;
padding: 4px; padding: 4px;
overflow-y: auto; overflow-y: auto;
......
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