Commit 333537c8 authored by 李纪文's avatar 李纪文

Merge branch 'dev' into 'master'

Dev See merge request !42
parents 04b0aa18 055ba32b
Pipeline #28295 failed with stages
in 15 seconds
......@@ -81,6 +81,7 @@ export default {
{
title: '通用',
children: [
'BasicChart',
'BasicTable',
'BasicTools',
'ImageSelect',
......
......@@ -138,7 +138,7 @@
"registry": "https://g.civnet.cn:4873"
},
"dependencies": {
"@wisdom-components/basictable": "^1.5.5",
"@wisdom-components/basictable": "^1.5.6",
"@wisdom-components/empty": "^1.3.9",
"@wisdom-components/timerangepicker": "^1.3.4",
"@wisdom-utils/utils": "0.0.46",
......
# Change Log
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# 1.3.0 (2021-05-20)
### Features
- add basicchart ([4875c63](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/4875c634d12599e1d65c08a58ed126919dd3b02d))
# 1.2.0 (2021-05-14)
### Features
- add basicchart ([7652990](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/7652990b734c05378e8e863904bbb495cb63cec2))
# `@wisdom-components/basicchart`
> TODO: description
## Usage
```
import BasicChart from '@wisdom-components/basicchart';
// TODO: DEMONSTRATE API
```
{
"name": "@wisdom-components/basicchart",
"version": "1.3.0",
"description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>",
"homepage": "",
"license": "ISC",
"main": "lib/index.js",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"publishConfig": {
"registry": "https://g.civnet.cn:4873/"
},
"repository": {
"type": "git",
"url": "https://g.civnet.cn:8443/ReactWeb5/wisdom-components.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
}
}
---
title: BasicChart - 标准图表
nav:
title: 基础组件
path: /components
group:
path: /
---
# BasicChart 标准图表
基础组件
- 支持的图表类型有直线图、曲线图等 20 种图表,其中很多图表可以集成在同一个图形中形成混合图
## 何时使用
- 当需要展现图表时;
## 代码演示
### 常规使用
<code src="./demos/Basic.tsx">
## API
api 参考 highcharts 库 https://api.highcharts.com.cn/highcharts
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
| --- | --- | --- | --- | --- |
| constructorType | 标题 | string | chart | - 'chart' 用于 Highcharts 图表 <br/> - 'stockChart' 用于 Highstock 图表 <br/> - 'mapChart' 用于 Highmaps 图表 <br/> - 'ganttChart' 用于甘特图 |
| chartOptions`必需` | Highcharts 图表配置对象 | object | { } | - |
import React from 'react';
import BasicChart from '../index';
const Demo = () => {
return (
<div>
<h3>折线图</h3>
<div style={{ height: '600px' }}>
<BasicChart chartOptions={chartOptions1} />
</div>
<h3 style={{ marginTop: '40px' }}>曲线面积图</h3>
<div style={{ height: '600px' }}>
<BasicChart chartOptions={chartOptions2} />
</div>
<h3 style={{ marginTop: '40px' }}>带滚动条曲线图</h3>
<div style={{ height: '600px' }}>
<BasicChart chartOptions={chartOptions3} constructorType={'stockChart'} />
</div>
</div>
);
};
export default Demo;
const chartOptions1 = {
// ...
series: [
{
name: '今日供水量',
color: '#1884EC',
data: [
[1620720173000, 122],
[1620720473000, 122],
[1620720773000, 122],
[1620721073000, 123],
[1620721373000, 123],
[1620721673000, 123],
[1620721973000, 124],
[1620722274000, 124],
[1620722724000, 125],
[1620723024000, 125],
[1620723324000, 125],
],
},
],
};
const chartOptions2 = {
// ...
series: [
{
type: 'areaspline',
name: '出水瞬时流量',
color: '#68cbd1',
data: [
[1620720173000, 1.85],
[1620720473000, 8.22],
[1620720773000, 2.83],
[1620721073000, 2.62],
[1620721373000, 2.05],
[1620721673000, 8.7],
[1620721973000, 2.38],
[1620722274000, 3.31],
[1620722724000, 2.36],
[1620723024000, 2.98],
[1620723324000, 2.58],
],
marker: {
enabled: false,
},
},
],
plotOptions: {
areaspline: {
fillOpacity: 0.5,
},
},
};
const chartOptions3 = {
// ...
series: [
{
type: 'spline',
name: '进水压力',
color: '#1884EC',
data: [
[1620720173000, 0.08],
[1620720473000, 0.09],
[1620720773000, 0.09],
[1620721073000, 0.09],
[1620721373000, 0.09],
[1620721673000, 0.08],
[1620721973000, 0.09],
[1620722274000, 0.09],
[1620722724000, 0.09],
[1620723024000, 0.08],
[1620723324000, 0.08],
],
},
],
};
import React, { useContext, useEffect, useRef, useState } from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import Highcharts from 'highcharts/highstock';
import HighchartsReact from 'highcharts-react-official';
import { ConfigProvider } from 'antd';
import './index.less';
let chartWidth = 0; // chart width
let chartHeight = 0; // chart height
const BasicChart = (props) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('basic-chart');
const { chartOptions, constructorType } = props;
const [options, setOptions] = useState(defaultOptions);
const container = useRef(null);
// 处理图表options
const handleChartOptions = () => {
const options = {
...defaultOptions,
...chartOptions,
};
if (container.current) {
if (container.current.offsetWidth !== 0) {
chartWidth = container.current.offsetWidth;
chartHeight = container.current.offsetHeight;
}
Highcharts.setOptions({
// 处理 chart 高度坍塌
chart: {
width: container.current.offsetWidth === 0 ? chartWidth : container.current.offsetWidth,
height:
container.current.offsetHeight === 0 ? chartHeight : container.current.offsetHeight,
},
});
}
Highcharts.setOptions({
global: { timezoneOffset: -8 * 60 },
});
return options;
};
useEffect(() => {
setOptions({ ...handleChartOptions() });
}, [chartOptions]);
return (
<div className={classNames(prefixCls)} ref={container}>
<HighchartsReact
immutable={true}
highcharts={Highcharts}
constructorType={constructorType}
options={options}
{...props}
/>
</div>
);
};
BasicChart.defaultProps = {
constructorType: 'chart',
chartOptions: {},
};
BasicChart.propTypes = {
columns: PropTypes.string,
chartOptions: PropTypes.object,
};
export default BasicChart;
const defaultOptions = {
chart: {
zoomType: 'x',
backgroundColor: 'rgba(255, 255, 255, 0.5)',
},
title: null,
credits: false,
rangeSelector: {
enabled: false,
},
xAxis: [
{
lineWidth: 0,
crosshair: true,
type: 'datetime',
dateTimeLabelFormats: {
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%d',
week: '%d',
month: '%d',
year: '%Y',
},
},
],
yAxis: [
{
title: null,
opposite: false, // 即坐标轴会显示在对立面
lineWidth: 1,
},
],
tooltip: {
shared: true,
split: false,
valueDecimals: 3,
dateTimeLabelFormats: {
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%d',
week: '%d',
month: '%d',
year: '%Y',
},
},
plotOptions: {
series: {
showInNavigator: true,
connectNulls: false,
zoneAxis: 'x',
},
},
legend: {
verticalAlign: 'top',
},
series: [],
};
@import (reference) '../../../../node_modules/antd/es/style/themes/default';
@basic-chart-prefix-cls: ~'@{ant-prefix}-basic-chart';
.@{basic-chart-prefix-cls} {
width: 100%;
height: 100%;
}
......@@ -2,6 +2,30 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.5.10](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.5.9...@wisdom-components/basictable@1.5.10) (2021-05-26)
### Bug Fixes
- 组件优化 ([7a26031](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/7a26031be5de8ac17732ca1da0c4dae9489cd0a7))
## [1.5.9](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.5.8...@wisdom-components/basictable@1.5.9) (2021-05-24)
### Bug Fixes
- 修改表格 ([7faa69b](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/7faa69b2b30ca2e1682e24fc9020a8f38d617b55))
## [1.5.8](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.5.7...@wisdom-components/basictable@1.5.8) (2021-05-21)
### Bug Fixes
- 修改表格样式 ([54621ac](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/54621acdf7f68eb9bc47e3be1be9d0b43a3d0e02))
## [1.5.7](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.5.6...@wisdom-components/basictable@1.5.7) (2021-05-17)
### Bug Fixes
- 表格增加默认 show ([7420461](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/74204612855ae2a37c00f26ad49b85d84d719c60))
## [1.5.6](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/basictable@1.5.5...@wisdom-components/basictable@1.5.6) (2021-05-14)
### Bug Fixes
......
{
"name": "@wisdom-components/basictable",
"version": "1.5.6",
"version": "1.5.10",
"description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>",
"homepage": "",
......
......@@ -46,7 +46,14 @@ const Demo = () => {
// @ts-ignore
return (
<div style={{ height: '800px' }}>
{!!dataSource.length && <BasicTable dataSource={dataSource} columns={columns} bordered />}
{!!dataSource.length && (
<BasicTable
dataSource={dataSource}
columns={columns}
bordered={false}
pagination={{ pageSize: 20, size: 'default' }}
/>
)}
{!dataSource.length && <Empty description={'暂无数据'} />}
</div>
);
......
......@@ -67,7 +67,13 @@ const Demo = () => {
return (
<div style={{ height: '400px' }}>
{!!dataSource.length && (
<BasicTable dataSource={dataSource} columns={columns} bordered summary={Summary} />
<BasicTable
dataSource={dataSource}
columns={columns}
bordered
summary={Summary}
pagination={false}
/>
)}
{!dataSource.length && <Empty description={'暂无数据'} />}
</div>
......
......@@ -7,7 +7,20 @@ import './index.less';
const BasicTable = (props) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('basic-table');
return <Table className={classNames(prefixCls)} scroll={{ y: 'calc(100% - 40px)' }} {...props} />;
const pagination = typeof props.pagination !== 'undefined' ? props.pagination : {};
const showTotal = (total) => {
return `共 ${Math.ceil(
total / (props.pagination ? props.pagination.pageSize || 10 : 10),
)} 页 / 共 ${total} 条记录`;
};
return (
<Table
className={classNames(prefixCls)}
scroll={{ y: 'calc(100% - 40px)' }}
{...props}
pagination={pagination ? { showTotal, ...pagination } : pagination}
/>
);
};
BasicTable.defaultProps = {
......
......@@ -125,11 +125,20 @@
border-left: 0;
}
.ant-table-header,
.ant-table-body {
.ant-table.ant-table-bordered .ant-table-header,
.ant-table.ant-table-bordered .ant-table-body {
border-left: 1px solid #dbe7fb;
}
.ant-table-body {
overflow-y: auto !important;
}
.ant-table-cell-scrollbar {
border-left: 0px;
box-shadow: none;
}
.ant-table-summary {
tr td {
position: sticky;
......@@ -138,4 +147,18 @@
border-top: 1px solid #dbe7fb;
}
}
.ant-pagination {
display: flex;
flex-wrap: wrap;
grid-row-gap: 8px;
justify-content: flex-end;
padding-top: 10px;
border-top: 1px solid #efefef;
.ant-pagination-total-text {
margin-right: auto;
margin-left: 8px;
}
}
}
......@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/datepickercustom@1.1.1...@wisdom-components/datepickercustom@1.1.2) (2021-05-20)
### Bug Fixes
- 修改组件问题 ([44c2a03](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/44c2a0325aa84cdaeab0b68a6760115ce929bcc8))
## [1.1.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/datepickercustom@1.1.0...@wisdom-components/datepickercustom@1.1.1) (2021-05-14)
### Bug Fixes
......
{
"name": "@wisdom-components/datepickercustom",
"version": "1.1.1",
"version": "1.1.2",
"description": "> TODO: description",
"author": "lijiwen <961370825@qq.com>",
"homepage": "",
......
......@@ -14,7 +14,7 @@ const Demo = (props) => {
};
return (
<>
<DatePickerCustom onChange={onChange} picker="day" style={{ marginRight: '10px' }} />
<DatePickerCustom onChange={onChange} picker="date" style={{ marginRight: '10px' }} />
<DatePickerCustom onChange={onChange} picker="week" style={{ marginRight: '10px' }} />
<DatePickerCustom onChange={onChange} picker="month" style={{ marginRight: '10px' }} />
<DatePickerCustom onChange={onChange} picker="year" style={{ marginRight: '10px' }} />
......
......@@ -12,7 +12,7 @@ const FORMATS = {
const STANTFORMAT = 'YYYY-MM-DD 00:00:00';
const ENDFORMAT = 'YYYY-MM-DD 23:59:59';
const DatePickerCustom = (props) => {
const modes = props.picker ? props.picker : 'day';
const modes = props.picker ? (props.picker !== 'date' ? props.picker : 'day') : 'day';
const selectedDate = props.value ? props.value : new Date();
const onChange = (date, dateString) => {
const dateTime = moment(date).format('YYYY-MM-DD');
......
......@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/exportexcel@1.1.1...@wisdom-components/exportexcel@1.1.2) (2021-05-20)
### Bug Fixes
- 修改组件问题 ([44c2a03](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/44c2a0325aa84cdaeab0b68a6760115ce929bcc8))
## [1.1.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/exportexcel@1.1.0...@wisdom-components/exportexcel@1.1.1) (2021-05-12)
**Note:** Version bump only for package @wisdom-components/exportexcel
......
{
"name": "@wisdom-components/exportexcel",
"version": "1.1.1",
"version": "1.1.2",
"description": "> TODO: description",
"author": "lijiwen <961370825@qq.com>",
"homepage": "",
......
......@@ -5,11 +5,11 @@ import JSZip from 'jszip';
// 导出Excel表格
const ExportExcel = (props) => {
var option = {};
let option = {};
option.fileName = props.name;
option.datas = props.content;
var toExcel = new ExportJsonExcel(option); //new
let toExcel = new ExportJsonExcel(option); //new
toExcel.saveExcel();
};
ExportExcel.defaultProps = {
......@@ -24,17 +24,17 @@ ExportExcel.propTypes = {
// 导出压缩Excel表格
const ExportExcelZip = (props) => {
var option = {};
let option = {};
option.fileName = props.name;
option.saveAsBlob = true;
option.datas = props.content;
var toExcel = new ExportJsonExcel(option); //new
let toExcel = new ExportJsonExcel(option); //new
let file = toExcel.saveExcel();
// 压缩文件
var zip = new JSZip();
let zip = new JSZip();
// 多个excel 依次加入(fileName不能相同)
zip.file(file.name, file);
......
......@@ -2,6 +2,34 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.5.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_devicetree@1.5.0...@wisdom-components/ec_devicetree@1.5.2) (2021-05-26)
### Bug Fixes
- bug ([da122e6](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/da122e603ef2573d2e6a55a04fed6508ed4b50de))
## [1.5.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_devicetree@1.5.0...@wisdom-components/ec_devicetree@1.5.1) (2021-05-25)
### Bug Fixes
- bug ([da122e6](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/da122e603ef2573d2e6a55a04fed6508ed4b50de))
# [1.5.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_devicetree@1.3.0...@wisdom-components/ec_devicetree@1.5.0) (2021-05-20)
### Bug Fixes
- 修改组件问题 ([44c2a03](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/44c2a0325aa84cdaeab0b68a6760115ce929bcc8))
### Features
- add basicchart ([4875c63](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/4875c634d12599e1d65c08a58ed126919dd3b02d))
# [1.4.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_devicetree@1.3.0...@wisdom-components/ec_devicetree@1.4.0) (2021-05-14)
### Features
- add basicchart ([7652990](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/7652990b734c05378e8e863904bbb495cb63cec2))
# [1.3.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_devicetree@1.0.11...@wisdom-components/ec_devicetree@1.3.0) (2021-05-14)
### Bug Fixes
......
{
"name": "@wisdom-components/ec_devicetree",
"version": "1.3.0",
"version": "1.5.2",
"description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>",
"homepage": "",
......
......@@ -43,7 +43,7 @@ const Demo = () => {
pageSize: 20,
// deviceTypes: '二供泵房,二供机组',
getChild: true,
// userID: 1,
userID: 1,
// queryInfo: '',
// sortFields: '',
// direction: '',
......
import React, { useContext, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Input, Tree, Divider, message, Pagination, ConfigProvider } from 'antd';
import { Spin, Input, Tree, Divider, message, Pagination, ConfigProvider } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
import Empty from '@wisdom-components/empty';
import './index.less';
......@@ -22,7 +22,8 @@ const DeviceTree = (props) => {
const [treeData, setTreeData] = useState([]);
const [params, setParams] = useState({});
const [total, setTotal] = useState(0);
const [totalCount, setTotalCount] = useState(0);
const [loading, setLoading] = useState(false);
useEffect(() => {
const param = {
......@@ -30,7 +31,7 @@ const DeviceTree = (props) => {
pageSize: serviceParams.pageSize || 20,
deviceTypes: serviceParams.deviceTypes || '二供泵房,二供机组',
getChild: serviceParams.getChild,
userID: serviceParams.userID || 0,
userID: serviceParams.userID || '',
queryInfo: serviceParams.queryInfo || '',
sortFields: serviceParams.sortFields || '',
direction: serviceParams.direction || '',
......@@ -40,7 +41,7 @@ const DeviceTree = (props) => {
}, []);
const handleData = (data) => {
data.forEach((item) => {
data.map((item) => {
item.title = item.deviceName;
item.key = item.stationID;
item.children = handleData(item.children);
......@@ -49,6 +50,7 @@ const DeviceTree = (props) => {
};
const fetchData = (param = {}) => {
setLoading(true);
deviceTreeService(param).then((response) => {
if (response.code === 0) {
const data = response.data
......@@ -57,8 +59,9 @@ const DeviceTree = (props) => {
: []
: [];
const newData = handleData(data);
setLoading(false);
setTreeData(newData);
setTotal(response.data.totalPages);
setTotalCount(response.data.totalCount);
onTreeCheck([newData[0]]);
onTreeSelect([newData[0]]);
} else {
......@@ -104,7 +107,6 @@ const DeviceTree = (props) => {
const onPaginationChange = (page) => {
setParams({ ...params, pageIndex: page });
setTreeData([]);
};
return (
......@@ -116,20 +118,23 @@ const DeviceTree = (props) => {
onChange={onSearch}
onPressEnter={onSearch}
/>
<Divider />
<Divider className={classNames(`${prefixCls}-divider`)} />
<div className={classNames(`${prefixCls}-content`)}>
{!!treeData.length && (
<Tree
defaultCheckedKeys={[treeData[0].key]}
defaultExpandedKeys={[treeData[0].key]}
treeData={treeData}
onCheck={onCheck}
onSelect={onSelect}
checkStrictly
{...props}
/>
)}
{!treeData.length && <Empty />}
<Spin spinning={loading}>
{!!treeData.length && (
<Tree
defaultCheckedKeys={[treeData[0].key]}
defaultExpandedKeys={[treeData[0].key]}
defaultSelectedKeys={[treeData[0].key]}
treeData={treeData}
onCheck={onCheck}
onSelect={onSelect}
checkStrictly
{...props}
/>
)}
{!treeData.length && !loading && <Empty />}
</Spin>
</div>
{pagination && (
<div className={classNames(`${prefixCls}-pagination`)}>
......@@ -138,11 +143,16 @@ const DeviceTree = (props) => {
hideOnSinglePage
current={params.pageIndex || 1}
pageSize={params.pageSize || 20}
total={total}
total={totalCount}
onChange={onPaginationChange}
/>
</div>
)}
{!pagination && (
<Divider plain className={classNames(`${prefixCls}-total`)}>
{totalCount} 记录
</Divider>
)}
</div>
);
};
......
......@@ -8,7 +8,7 @@
height: 100%;
padding: 5px;
.ant-divider {
&-divider {
margin: 6px 0 12px 0;
}
......@@ -24,8 +24,8 @@
width: 100%;
}
.ant-tree-indent {
width: 0;
.ant-tree-switcher-noop {
width: 14px;
}
.ant-tree-node-content-wrapper {
......@@ -39,7 +39,21 @@
overflow-y: scroll;
}
.ant-spin-nested-loading {
height: 100%;
}
&-pagination {
margin: 10px auto;
}
&-total.ant-divider-horizontal.ant-divider-with-text {
margin: 10px auto;
color: #a4b1c7;
}
.ant-divider-horizontal.ant-divider-with-text::before,
.ant-divider-horizontal.ant-divider-with-text::after {
top: 0;
}
}
......@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyinfo@1.2.0...@wisdom-components/ec_historyinfo@1.2.1) (2021-05-20)
### Bug Fixes
- bug ([6f5b036](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/6f5b036e6c7f9554a5e81616f4bdb2a3e82141e8))
# [1.2.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyinfo@1.0.4...@wisdom-components/ec_historyinfo@1.2.0) (2021-05-14)
### Bug Fixes
......
{
"name": "@wisdom-components/ec_historyinfo",
"version": "1.2.0",
"version": "1.2.1",
"description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>",
"homepage": "",
......
......@@ -212,7 +212,6 @@ const HistoryInfo = (props) => {
const [dataThinKey, setDataThinKey] = useState(timeIntervalList[0].key);
const [options, setOptions] = useState({});
const [colors, setColors] = useState(defaultColors);
const [params, setParams] = useState(historyInfoParams);
const [tableData, setTableData] = useState([]);
const [pageSize, setPageSize] = useState(20);
const [series, setSeries] = useState([]);
......@@ -237,9 +236,21 @@ const HistoryInfo = (props) => {
const seriesData = [];
resData.forEach((item) => {
const data = [];
item.dataModel.forEach((child) => {
data.push([moment(child.pt).valueOf(), child.pv]);
});
if (item.dataModel.length) {
if (timeValue === 'contrast') {
// 同期对比
item.dataModel.forEach((child) => {
const formatTime = moment(child.pt).format(
contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00',
);
data.push([moment(formatTime).valueOf(), child.pv]);
});
} else {
item.dataModel.forEach((child) => {
data.push([moment(child.pt).valueOf(), child.pv]);
});
}
}
const obj = {
name: item.equipmentName + '-' + item.sensorName,
sensorName: item.sensorName,
......@@ -274,8 +285,11 @@ const HistoryInfo = (props) => {
// 处理采集时间
resData.forEach((item) => {
item.dataModel.forEach((data) => {
if (!timeData.includes(data.pt)) {
timeData.push(data.pt);
const formatTime = moment(data.pt).format(
contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00',
);
if (!timeData.includes(formatTime)) {
timeData.push(formatTime);
}
});
});
......@@ -301,7 +315,10 @@ const HistoryInfo = (props) => {
tableData.forEach((item, i) => {
resData.forEach((child, index) => {
child.dataModel.forEach((value, j) => {
if (timeData[i] === value.pt) item[`value${index + 1}`] = value.pv;
const formatTime = moment(value.pt).format(
contrastOption === 'day' ? '2020-01-01 HH:mm:00' : '2020-01-DD HH:mm:00',
);
if (timeData[i] === formatTime) item[`value${index + 1}`] = value.pv;
});
});
});
......@@ -315,8 +332,8 @@ const HistoryInfo = (props) => {
const requestArr = [];
dateRange.forEach((item) => {
const param = {
...params,
stream: params.stream.map((child) => ({
...historyInfoParams,
stream: historyInfoParams.stream.map((child) => ({
...child,
dateFrom: item.dateFrom,
dateTo: item.dateTo,
......
......@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.3.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_quotaselect@1.3.0...@wisdom-components/ec_quotaselect@1.3.1) (2021-05-26)
### Bug Fixes
- 组件优化 ([7a26031](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/7a26031be5de8ac17732ca1da0c4dae9489cd0a7))
# [1.3.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_quotaselect@1.0.5...@wisdom-components/ec_quotaselect@1.3.0) (2021-05-14)
### Bug Fixes
......
{
"name": "@wisdom-components/ec_quotaselect",
"version": "1.3.0",
"version": "1.3.1",
"description": "> TODO: description",
"author": "tuqian <webtuqian@163.com>",
"homepage": "",
......
......@@ -105,6 +105,7 @@ const Demo = () => {
<h3>无 user, 无“保存修改”按钮</h3>
<PandaQuotaSelect
buttonProps={{}}
// defaultSelect={'all'}
deviceList={deviceList}
quotaListService={getQuotaList}
pointType={pointType}
......
......@@ -44,12 +44,13 @@ const QuotaSelect = ({
maximum,
user,
treeProps,
defaultSelect,
}) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('ec-quota-select');
const [visible, setVisible] = useState(false);
const [targetValue, setTargetValue] = useState('emphasis');
const [targetValue, setTargetValue] = useState(defaultSelect);
const [allQuotaList, setAllQuotaList] = useState([]);
const [quotaList, setQuotaList] = useState([]);
const [groupQuotaList, setGroupQuotaList] = useState([]);
......@@ -463,6 +464,7 @@ QuotaSelect.defaultProps = {
onModalCancel: () => {},
onModalOk: () => {},
onModalClose: () => {},
defaultSelect: 'emphasis',
};
QuotaSelect.propTypes = {
......@@ -485,6 +487,7 @@ QuotaSelect.propTypes = {
onModalCancel: PropTypes.func,
onModalOk: PropTypes.func,
onModalClose: PropTypes.func,
defaultSelect: PropTypes.string,
};
export default QuotaSelect;
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