Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
34a7dba7
Commit
34a7dba7
authored
Aug 10, 2023
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复单位问题
parent
c2e87df9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
45 deletions
+68
-45
EC_HistoryView.md
...es/extend-components/EC_HistoryView/src/EC_HistoryView.md
+3
-3
GridDemo.js
...es/extend-components/EC_HistoryView/src/demos/GridDemo.js
+17
-3
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+31
-26
mobile.js
...ages/extend-components/EC_HistoryView/src/demos/mobile.js
+4
-4
index.js
packages/extend-components/EC_HistoryView/src/index.js
+7
-3
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+6
-6
No files found.
packages/extend-components/EC_HistoryView/src/EC_HistoryView.md
View file @
34a7dba7
...
...
@@ -22,15 +22,15 @@ path: /
## 单图表
<code
src=
"./demos/index.js"
>
<code
src=
"./demos/index.js"
>
</code>
## 移动端
<code
src=
"./demos/mobile.js"
>
<code
src=
"./demos/mobile.js"
>
</code>
## 多图表
[
//
]:
#
(<code src="./demos/GridDemo.js">)
<code
src=
"./demos/GridDemo.js"
></code>
## API
...
...
packages/extend-components/EC_HistoryView/src/demos/GridDemo.js
View file @
34a7dba7
import
React
from
'react'
;
import
HistoryView
from
'../index'
;
const
deviceParams
=
[
/*
const deviceParams = [
{
deviceCode: 'EGBF00000146',
sensors: '进水压力,出水瞬时流量,出水累计流量',
...
...
@@ -21,9 +21,23 @@ const deviceParams = [
deviceType: '二供泵房',
pointAddressID: 4,
},
];
];*/
const
deviceParams
=
[
{
"deviceCode"
:
"LLJ00000055"
,
"sensors"
:
"瞬时流量,正累计流量,是否在线"
,
"deviceType"
:
"流量计"
},
{
"deviceCode"
:
"LLJ00000056"
,
"sensors"
:
"瞬时流量,正累计流量,是否在线"
,
"deviceType"
:
"流量计"
}
]
const
Demo
=
()
=>
{
return
<
div
style
=
{{
height
:
700
}}
>
{
/*<HistoryView deviceParams={deviceParams} grid />*/
}
<
/div>
;
return
<
div
style
=
{{
height
:
700
}}
>
<
HistoryView
deviceParams
=
{
deviceParams
}
grid
/>
<
/div>
;
};
export
default
Demo
;
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
34a7dba7
...
...
@@ -3,34 +3,39 @@ import HistoryView from '../index';
import
{
MobileHistoryChart
}
from
"../mobile"
;
const
deviceParams
=
[
/
/
{
// deviceCode: 'EGBF00000146
',
//
sensors: '进水压力,出水瞬时流量,出水累计流量',
//
deviceType: '二供泵房',
// pointAddressID: 4
,
// },
/* {
// deviceCode: 'EGBF00000002',
// deviceCode: 'EGBF00000018',
deviceCode: 'XMYL00000345',
// deviceCode: 'XMYL00000000',
//
deviceCode: 'EGBF00000014',
// sensors: '今日供水量,今日用电量,1#水箱液位,是否在线',
sensors: '进水压力',
deviceType: '熊猫压力表',
pointAddressID: 4,
},*/
/
/
{
// deviceCode: 'EGJZ00001113
',
//
sensors: '出水压力',
//
deviceType: '二供机组',
//
pointAddressID: 4,
// },
/
*
{
deviceCode: 'EGBF00000141
',
sensors: '进水压力,出水瞬时流量,出水累计流量',
deviceType: '二供泵房',
pointAddressID: 208
,
},*/
/* {
// deviceCode: 'EGBF00000002',
// deviceCode: 'EGBF00000018',
//
deviceCode: 'XMYL00000345',
// deviceCode: 'XMYL00000000',
deviceCode: 'EGBF00000014',
// sensors: '今日供水量,今日用电量,1#水箱液位,是否在线',
sensors: '进水压力',
deviceType: '熊猫压力表',
pointAddressID: 4,
},*/
/
*
{
deviceCode: 'EGJZ00000226
',
sensors: '出水压力',
deviceType: '二供机组',
pointAddressID: 4,
}, */
{
"deviceCode"
:
"
EGJZ00000163
"
,
"sensors"
:
"
进水压力
,是否在线"
,
"deviceType"
:
"
二供机组
"
"deviceCode"
:
"
LLJ00000055
"
,
"sensors"
:
"
正累计流量,瞬时流量
,是否在线"
,
"deviceType"
:
"
流量计
"
}
/* {
"deviceCode": "EGJZ00000163",
"sensors": "进水压力,是否在线",
"deviceType": "二供机组"
}*/
];
const
Demo
=
()
=>
{
return
(
...
...
packages/extend-components/EC_HistoryView/src/demos/mobile.js
View file @
34a7dba7
...
...
@@ -2,18 +2,18 @@ import React, {useEffect, useState} from 'react';
import
{
MobileHistoryChart
}
from
"../mobile"
;
import
moment
from
'moment'
const
deviceParams
=
[
/*
{
{
deviceCode
:
'EGBF00000141'
,
sensors
:
'今日供水量,今日用电量'
,
deviceType
:
'二供泵房'
,
pointAddressID
:
208
,
},
*/
{
},
/*
{
deviceCode: 'EGBF00000141',
sensors: '今日供水量',
deviceType: '二供泵房',
pointAddressID: 208,
},
},
*/
];
const
Demo
=
()
=>
{
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
34a7dba7
...
...
@@ -682,7 +682,11 @@ const HistoryView = (props) => {
return Promise.resolve();
});
};
const handleTime = (diffDays, base = 1000) => {
let unit = 'min', zoom = 0;
zoom = Math.ceil(diffDays * 24 * 60 / 1000).toFixed();
return {unit, zoom};
}
const handleDataThinKey = (diffDays) => {
// edit by zy 根据选择的时长控制抽稀频度
if (diffDays >= 7 && diffDays < 15) {
...
...
@@ -735,7 +739,8 @@ const HistoryView = (props) => {
isBoxPlots: isBoxPlots,
};
let diffDays = moment(item.dateTo).diff(moment(item.dateFrom), 'days');
let zoomParam = activeTabKey === 'curve' ? handleDataThinKey(diffDays) : {};
// let zoomParam = activeTabKey === 'curve' ? handleDataThinKey(diffDays) : {};
let zoomParam = activeTabKey === 'curve' ? handleTime(diffDays,50) : {};
requestArr.push(getHistoryInfo({...param, ...zoomParam}));
});
setLoading(true);
...
...
@@ -790,7 +795,6 @@ const HistoryView = (props) => {
}, [dateRange, dataConfig, deviceParams, chartType]);
const handleChange = (pagination, filter, sort) => {
if (sort.field === 'time') {
debugger
setTimeOrder(sort.order)
}
};
...
...
packages/extend-components/EC_HistoryView/src/utils.js
View file @
34a7dba7
...
...
@@ -316,7 +316,7 @@ const seriesTemplate = (param, unit) => {
if
(
!
param
)
return
''
;
const
{
value
,
encode
}
=
param
;
// const val = value[encode.y[0]];
const
_unit
=
unit
||
'
Mpa
'
;
const
_unit
=
unit
||
''
;
const
color
=
'#008CFF'
;
if
(
!
isArray
(
value
))
return
` <div style="display: flex; align-items: center;">
...
...
@@ -362,11 +362,11 @@ const tooltipAccessor = (unit) => {
if (isArray(params)) {
tooltipHeader = headTemplate(params[0]);
params.forEach((param) => {
tooltipContent += seriesTemplate(param, unit);
tooltipContent += seriesTemplate(param, unit
?.[param?.seriesIndex]
);
});
} else {
tooltipHeader = headTemplate(params);
tooltipContent += seriesTemplate(params, unit);
tooltipContent += seriesTemplate(params, unit
?.[params?.seriesIndex]
);
}
return `
<
div
>
...
...
@@ -626,9 +626,9 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
}) || []; //当存在othersData的时候,只是单曲线
xAxis = {type: 'time'};
decorateAxisGridLine(xAxis, showGridLine);
let unit =
''
;
let unit =
[]
;
series = series.map((item) => {
if (item.unit) unit
= item.unit
;
if (item.unit) unit
.push(item.unit)
;
item.areaStyle = null;
return {...item, symbol: 'none'};
});
...
...
@@ -725,7 +725,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
};
}
}
else
{
tooltip
=
tooltipAccessor
();
tooltip
=
tooltipAccessor
(
series
.
map
(
item
=>
item
.
unit
)
);
}
tooltip
.
timeFormat
=
tooltipTimeFormat
;
let
_legendData
=
series
.
filter
(
item
=>
!
[
'最大值'
,
'最小值'
].
includes
(
item
.
name
)).
map
(
item
=>
item
.
name
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment