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
837c1f15
Commit
837c1f15
authored
Feb 22, 2024
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 优化获取点表的逻辑,修复因逻辑问题导致的异常
parent
742989d8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
9 deletions
+24
-9
EC_HistoryView.md
...es/extend-components/EC_HistoryView/src/EC_HistoryView.md
+1
-1
GridChart.js
packages/extend-components/EC_HistoryView/src/GridChart.js
+4
-6
GridDemo.js
...es/extend-components/EC_HistoryView/src/demos/GridDemo.js
+6
-1
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+13
-1
No files found.
packages/extend-components/EC_HistoryView/src/EC_HistoryView.md
View file @
837c1f15
...
...
@@ -37,7 +37,7 @@ path: /
## 多图表
[
//
]:
#
(<code src="./demos/GridDemo.js"></code>)
<code
src=
"./demos/GridDemo.js"
></code>
## API
...
...
packages/extend-components/EC_HistoryView/src/GridChart.js
View file @
837c1f15
...
...
@@ -29,7 +29,6 @@ const GridChart = memo((props) => {
}
=
props
;
const
{
prefixCls
}
=
props
;
const
[
gridData
,
setGridData
]
=
useState
([]);
const
[
pointAddressData
,
setPointAddressData
]
=
useState
(
null
);
const
[
pointAddressEntryData
,
setPointAddressEntryData
]
=
useState
(
null
);
const
[
sensorType
,
setSensorType
]
=
useState
(
null
);
// 新增逻辑:需要区分出哪些是统计值
...
...
@@ -40,6 +39,7 @@ const GridChart = memo((props) => {
const
handleDataSource
=
async
(
dataSource
)
=>
{
props
.
setLoading
(
true
);
// 1. 统计设备
try
{
let
_deviceTypes
=
[];
let
_deviceCodes
=
dataSource
.
reduce
((
final
,
cur
)
=>
{
if
(
!
final
.
includes
(
cur
.
stationCode
)
&&
!
_deviceTypes
.
includes
(
cur
.
deviceType
))
{
...
...
@@ -50,13 +50,8 @@ const GridChart = memo((props) => {
},
[]);
// 2. 获取对应的版本id
let
_ids
=
[];
if
(
pointAddressData
!==
null
)
{
_ids
=
pointAddressData
;
}
else
{
let
_idRequest
=
await
getPointAddress
({
code
:
_deviceCodes
.
join
(
','
)});
_ids
=
_idRequest
?.
data
??
[];
setPointAddressData
(
_ids
)
}
// 3. 获取对应的点表
let
_map
=
{};
for
await
(
let
item
of
_ids
)
{
...
...
@@ -162,6 +157,9 @@ const GridChart = memo((props) => {
}
props
.
setLoading
(
false
);
return
_dataSource
}
catch
(
e
)
{
props
.
setLoading
(
false
);
}
};
const
returnDateType
=
(
date
)
=>
{
let
{
dateFrom
,
dateTo
}
=
date
;
...
...
packages/extend-components/EC_HistoryView/src/demos/GridDemo.js
View file @
837c1f15
...
...
@@ -72,6 +72,11 @@ import HistoryView from '../index';
]*/
const
deviceParams
=
[
{
"deviceCode"
:
"EGBF00000141"
,
"sensors"
:
"进水压力,出水瞬时流量,今日用电量"
,
"deviceType"
:
"二供泵房"
}
/* {
"deviceCode": "EGBF00000244",
"sensors": "进水压力,出水瞬时流量,今日用电量,今日供水量",
"deviceType": "二供泵房"
...
...
@@ -85,7 +90,7 @@ const deviceParams = [
"deviceCode": "EGBF00000184",
"sensors": "进水压力,出水瞬时流量,今日用电量,今日供水量",
"deviceType": "二供泵房"
}
}
*/
];
const
Demo
=
()
=>
{
return
<
div
style
=
{{
height
:
700
}}
>
...
...
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
837c1f15
...
...
@@ -191,10 +191,22 @@ import { MobileHistoryChart } from '../mobile';
}
];*/
const
deviceParams
=
[
{
// 预测的
/* {
"deviceCode": "YLB00000041",
"sensors": "进水压力",
"deviceType": "压力表"
}*/
/* {
"deviceCode": "SSBF00000001",
"sensors": "出水压力",
"deviceType": "送水泵房"
}*/
//预测结束
{
"deviceCode"
:
"EGBF00000141"
,
"sensors"
:
"进水压力,出水瞬时流量,今日用电量"
,
"deviceType"
:
"二供泵房"
}
]
const
Demo
=
()
=>
{
...
...
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