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
ebcef43e
Commit
ebcef43e
authored
Dec 29, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 优化历史曲线指标分组及排序
parent
b50bc3db
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
31 deletions
+48
-31
GridChart.js
packages/extend-components/EC_HistoryView/src/GridChart.js
+10
-11
GridDemo.js
...es/extend-components/EC_HistoryView/src/demos/GridDemo.js
+13
-7
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+10
-10
index.js
packages/extend-components/EC_HistoryView/src/index.js
+15
-3
No files found.
packages/extend-components/EC_HistoryView/src/GridChart.js
View file @
ebcef43e
...
...
@@ -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
=>
(
<
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
>
{
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
>
);
});
...
...
packages/extend-components/EC_HistoryView/src/demos/GridDemo.js
View file @
ebcef43e
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
>
);
...
...
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
ebcef43e
...
...
@@ -2,16 +2,16 @@ import React from 'react';
import
HistoryView
from
'../index'
;
const
deviceParams
=
[
//
{
// deviceCode: "EGBF00000146"
,
// sensors: "进水压力,出水瞬时流量,出水累计流量"
,
// deviceType: "二供泵房"
//
},
//
{
// deviceCode: "EGJZ00001113"
,
// sensors: "出水瞬时流量,出水压力,泵1状态"
,
// deviceType: "二供机组"
// }
{
deviceCode
:
'EGBF00000146'
,
sensors
:
'进水压力,出水瞬时流量,出水累计流量'
,
deviceType
:
'二供泵房'
,
},
{
deviceCode
:
'EGJZ00001113'
,
sensors
:
'出水瞬时流量,出水压力,泵1状态'
,
deviceType
:
'二供机组'
,
},
];
const
Demo
=
()
=>
{
return
(
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
ebcef43e
...
...
@@ -175,7 +175,7 @@ const timeColumn = {
title
:
'采集时间'
,
dataIndex
:
'time'
,
key
:
'time'
,
width
:
1
6
0
,
width
:
1
7
0
,
fixed
:
'left'
,
ellipsis
:
true
,
align
:
'center'
,
...
...
@@ -533,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
);
...
...
@@ -611,7 +623,7 @@ const HistoryView = (props) => {
dataSource
=
{
tableData
}
columns
=
{
columns
}
{...
tableProps
}
pagination
=
{
{
showQuickJumper
:
true
,
showSizeChanger
:
true
}
}
pagination
=
{
false
}
onChange
=
{()
=>
{}}
/
>
)
:
(
...
...
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