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

feat: 提交历史曲线变更

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