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
af793980
Commit
af793980
authored
Feb 01, 2023
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(EC_HistoryView): 优化历史曲线缺省页显示
parent
923bf559
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
8 deletions
+85
-8
GridChart.js
packages/extend-components/EC_HistoryView/src/GridChart.js
+33
-7
SingleChart.js
packages/extend-components/EC_HistoryView/src/SingleChart.js
+13
-1
index.less
packages/extend-components/EC_HistoryView/src/index.less
+39
-0
No files found.
packages/extend-components/EC_HistoryView/src/GridChart.js
View file @
af793980
import
React
,
{
memo
,
useMemo
}
from
'react'
;
import
React
,
{
memo
,
useMemo
}
from
'react'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
BasicChart
}
from
'@wisdom-components/basicchart'
;
import
{
BasicChart
}
from
'@wisdom-components/basicchart'
;
import
PandaEmpty
from
'@wisdom-components/empty'
;
import
optionGenerator
from
'./utils'
;
import
optionGenerator
from
'./utils'
;
const
ChartTitle
=
({
prefixCls
})
=>
{
const
cls
=
`
${
prefixCls
}
-grid-item-title`
;
return
(
<
div
className
=
{
cls
}
>
<
span
className
=
{
`
${
cls
}
_text`
}
>
进水压力
<
/span
>
<
span
className
=
{
`
${
cls
}
_unit`
}
>
(单位:
MPa
)
<
/span
>
<
/div
>
);
};
const
GridChart
=
memo
((
props
)
=>
{
const
GridChart
=
memo
((
props
)
=>
{
const
{
const
{
dataSource
,
dataSource
,
...
@@ -39,7 +50,8 @@ const GridChart = memo((props) => {
...
@@ -39,7 +50,8 @@ const GridChart = memo((props) => {
const
cusOption
=
{
const
cusOption
=
{
title
:
{
title
:
{
show
:
true
,
show
:
true
,
text
:
`{prefix|}{t|
${
sensorName
}
}
${
unit
?
'{suffix|(单位:'
+
unit
+
')}'
:
''
}
`
,
// text: `{prefix|}{t|${sensorName}}${unit ? '{suffix|(单位:' + unit + ')}' : ''}`,
text
:
' '
,
textStyle
:
{
textStyle
:
{
width
:
200
,
width
:
200
,
overflow
:
'truncate'
,
overflow
:
'truncate'
,
...
@@ -68,13 +80,27 @@ const GridChart = memo((props) => {
...
@@ -68,13 +80,27 @@ const GridChart = memo((props) => {
return
(
return
(
<
div
className
=
{
`
${
prefixCls
}
-grid`
}
>
<
div
className
=
{
`
${
prefixCls
}
-grid`
}
>
{
options
.
map
((
item
)
=>
(
{
options
.
map
((
item
)
=>
{
<
div
key
=
{
item
.
key
}
className
=
{
`
${
prefixCls
}
-grid-item`
}
>
const
isEmpty
=
<
div
className
=
{
`
${
prefixCls
}
-grid-item-wrap`
}
>
!
item
.
option
.
series
.
length
||
<
BasicChart
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
option
=
{
item
.
option
}
notMerge
/>
!
item
.
option
.
series
.
find
((
e
)
=>
e
.
data
&&
e
.
data
.
length
>
0
);
return
(
<
div
key
=
{
item
.
key
}
className
=
{
`
${
prefixCls
}
-grid-item`
}
>
<
div
className
=
{
`
${
prefixCls
}
-grid-item-wrap`
}
>
<
ChartTitle
prefixCls
=
{
prefixCls
}
/
>
{
isEmpty
?
(
<
PandaEmpty
/>
)
:
(
<
BasicChart
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
option
=
{
item
.
option
}
notMerge
/>
)}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
);
)
)}
}
)}
<
/div
>
<
/div
>
);
);
});
});
...
...
packages/extend-components/EC_HistoryView/src/SingleChart.js
View file @
af793980
import
React
,
{
memo
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
React
,
{
memo
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
BasicChart
}
from
'@wisdom-components/basicchart'
;
import
{
BasicChart
}
from
'@wisdom-components/basicchart'
;
import
PandaEmpty
from
'@wisdom-components/empty'
;
import
optionGenerator
from
'./utils'
;
import
optionGenerator
from
'./utils'
;
const
SimgleChart
=
memo
((
props
)
=>
{
const
SimgleChart
=
memo
((
props
)
=>
{
...
@@ -24,7 +25,18 @@ const SimgleChart = memo((props) => {
...
@@ -24,7 +25,18 @@ const SimgleChart = memo((props) => {
chartRef
.
current
?.
resize
?.();
chartRef
.
current
?.
resize
?.();
},
[]);
},
[]);
return
(
// 数据都为空显示缺省页
const
isEmpty
=
useMemo
(
()
=>
!
dataSource
||
!
dataSource
.
length
||
!
dataSource
.
find
((
e
)
=>
e
.
dataModel
&&
e
.
dataModel
.
length
>
0
),
[
dataSource
],
);
return
isEmpty
?
(
<
PandaEmpty
/>
)
:
(
<
BasicChart
ref
=
{
chartRef
}
option
=
{
option
}
notMerge
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
/
>
<
BasicChart
ref
=
{
chartRef
}
option
=
{
option
}
notMerge
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
/
>
);
);
});
});
...
...
packages/extend-components/EC_HistoryView/src/index.less
View file @
af793980
...
@@ -129,10 +129,49 @@
...
@@ -129,10 +129,49 @@
width: 50%;
width: 50%;
height: 50%;
height: 50%;
padding: 4px;
padding: 4px;
&-title {
position: absolute;
top: 16px;
left: 20px;
z-index: 2;
max-width: 200px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
&::before {
display: inline-block;
width: 5px;
height: 16px;
vertical-align: -0.2em;
background-color: #1685ff;
content: '';
}
&_text {
padding-left: 10px;
color: '#333333';
font-weight: bold;
font-size: 15px;
font-family: 'Microsoft YaHei';
}
&_unit {
padding-left: 5px;
color: #999999;
font-size: 12px;
}
}
}
}
&-item-wrap {
&-item-wrap {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
height: 100%;
overflow: hidden;
background-color: #fff;
background-color: #fff;
border-radius: 4px;
border-radius: 4px;
}
}
...
...
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