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
fb4c9a27
Commit
fb4c9a27
authored
Dec 14, 2022
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 发布历史曲线
parent
e6ad7ff7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
35 deletions
+56
-35
package.json
packages/extend-components/EC_HistoryView/package.json
+3
-0
index.js
packages/extend-components/EC_HistoryView/src/index.js
+53
-35
No files found.
packages/extend-components/EC_HistoryView/package.json
View file @
fb4c9a27
...
@@ -22,5 +22,8 @@
...
@@ -22,5 +22,8 @@
},
},
"scripts"
:
{
"scripts"
:
{
"test"
:
"echo
\"
Error: run tests from root
\"
&& exit 1"
"test"
:
"echo
\"
Error: run tests from root
\"
&& exit 1"
},
"dependencies"
:
{
"@babel/runtime"
:
"^7.17.9"
}
}
}
}
packages/extend-components/EC_HistoryView/src/index.js
View file @
fb4c9a27
...
@@ -108,8 +108,8 @@ const timeIntervalList = [
...
@@ -108,8 +108,8 @@ const timeIntervalList = [
];
];
const
updateTime
=
(
key
)
=>
{
const
updateTime
=
(
key
)
=>
{
let
start
=
''
,
let
start
=
''
;
end
=
''
;
let
end
=
''
;
if
(
Array
.
isArray
(
key
))
{
if
(
Array
.
isArray
(
key
))
{
start
=
moment
(
key
[
0
]).
format
(
timeFormat
);
start
=
moment
(
key
[
0
]).
format
(
timeFormat
);
end
=
moment
(
key
[
1
]).
format
(
timeFormat
);
end
=
moment
(
key
[
1
]).
format
(
timeFormat
);
...
@@ -180,7 +180,7 @@ const timeColumn = {
...
@@ -180,7 +180,7 @@ const timeColumn = {
align
:
'center'
,
align
:
'center'
,
};
};
const
HistoryView
=
props
=>
{
const
HistoryView
=
(
props
)
=>
{
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
prefixCls
=
getPrefixCls
(
'history-view'
);
const
prefixCls
=
getPrefixCls
(
'history-view'
);
...
@@ -225,21 +225,24 @@ const HistoryView = props => {
...
@@ -225,21 +225,24 @@ const HistoryView = props => {
unit
:
''
,
// 数据抽稀时间单位
unit
:
''
,
// 数据抽稀时间单位
};
};
// 曲线居中,过滤异常值,数据抽稀
// 曲线居中,过滤异常值,数据抽稀
const
config
=
checkboxData
.
reduce
((
pre
,
item
)
=>
((
item
.
key
!==
'curveCenter'
&&
(
pre
[
item
.
key
]
=
item
.
checked
)),
pre
),
initial
);
const
config
=
checkboxData
.
reduce
(
(
pre
,
item
)
=>
(
item
.
key
!==
'curveCenter'
&&
(
pre
[
item
.
key
]
=
item
.
checked
),
pre
),
initial
,
);
// 数据抽稀时间单位
// 数据抽稀时间单位
const
dataThin
=
timeIntervalList
.
find
(
item
=>
item
.
key
===
dataThinKey
);
const
dataThin
=
timeIntervalList
.
find
(
(
item
)
=>
item
.
key
===
dataThinKey
);
config
.
zoom
=
activeTabKey
===
'curve'
?
''
:
(
dataThin
?.
zoom
??
''
)
;
config
.
zoom
=
activeTabKey
===
'curve'
?
''
:
dataThin
?.
zoom
??
''
;
config
.
unit
=
activeTabKey
===
'curve'
?
''
:
(
dataThin
?.
unit
??
''
)
;
config
.
unit
=
activeTabKey
===
'curve'
?
''
:
dataThin
?.
unit
??
''
;
config
.
dataThin
=
activeTabKey
===
'curve'
?
true
:
config
.
dataThin
;
// 曲线强制抽稀
config
.
dataThin
=
activeTabKey
===
'curve'
?
true
:
config
.
dataThin
;
// 曲线强制抽稀
return
config
;
return
config
;
},
[
checkboxData
,
dataThinKey
,
activeTabKey
]);
},
[
checkboxData
,
dataThinKey
,
activeTabKey
]);
// 图表居中
// 图表居中
const
curveCenter
=
useMemo
(()
=>
checkboxData
.
find
(
item
=>
item
.
key
===
'curveCenter'
)?.
checked
,
[
checkboxData
]);
const
curveCenter
=
useMemo
(
()
=>
checkboxData
.
find
((
item
)
=>
item
.
key
===
'curveCenter'
)?.
checked
,
[
checkboxData
],
);
// 自定义模式: 快速选择
// 自定义模式: 快速选择
const
onCustomerTimeChange
=
(
key
)
=>
{
const
onCustomerTimeChange
=
(
key
)
=>
{
...
@@ -341,9 +344,7 @@ const HistoryView = props => {
...
@@ -341,9 +344,7 @@ const HistoryView = props => {
<
DatePicker
<
DatePicker
picker
=
{
contrastOption
}
picker
=
{
contrastOption
}
value
=
{
child
.
value
}
value
=
{
child
.
value
}
onChange
=
{(
date
,
dateString
)
=>
onChange
=
{(
date
,
dateString
)
=>
onContrastPickerChange
(
date
,
dateString
,
child
)}
onContrastPickerChange
(
date
,
dateString
,
child
)
}
/
>
/
>
{
datePickerArr
.
length
>
2
&&
(
{
datePickerArr
.
length
>
2
&&
(
<
div
<
div
...
@@ -383,10 +384,7 @@ const HistoryView = props => {
...
@@ -383,10 +384,7 @@ const HistoryView = props => {
};
};
const
renderCheckbox
=
(
child
)
=>
(
const
renderCheckbox
=
(
child
)
=>
(
<
Checkbox
<
Checkbox
checked
=
{
child
.
checked
}
onChange
=
{(
e
)
=>
onCheckboxChange
(
e
,
child
.
key
)}
>
checked
=
{
child
.
checked
}
onChange
=
{(
e
)
=>
onCheckboxChange
(
e
,
child
.
key
)}
>
{
child
.
label
}
{
child
.
label
}
<
/Checkbox
>
<
/Checkbox
>
);
);
...
@@ -402,7 +400,12 @@ const HistoryView = props => {
...
@@ -402,7 +400,12 @@ const HistoryView = props => {
<
/div
>
<
/div
>
))}
))}
{
activeTabKey
===
'table'
&&
(
{
activeTabKey
===
'table'
&&
(
<
Select
value
=
{
dataThinKey
}
style
=
{{
width
:
90
}}
onChange
=
{
onTimeIntervalChange
}
disabled
=
{
!
dataConfig
.
dataThin
}
>
<
Select
value
=
{
dataThinKey
}
style
=
{{
width
:
90
}}
onChange
=
{
onTimeIntervalChange
}
disabled
=
{
!
dataConfig
.
dataThin
}
>
{
timeIntervalList
.
map
((
child
)
=>
(
{
timeIntervalList
.
map
((
child
)
=>
(
<
Option
key
=
{
child
.
key
}
unit
=
{
child
.
unit
}
value
=
{
child
.
key
}
>
<
Option
key
=
{
child
.
key
}
unit
=
{
child
.
unit
}
value
=
{
child
.
key
}
>
{
child
.
name
}
{
child
.
name
}
...
@@ -411,11 +414,10 @@ const HistoryView = props => {
...
@@ -411,11 +414,10 @@ const HistoryView = props => {
<
/Select
>
<
/Select
>
)}
)}
<
/div
>
<
/div
>
)
)
;
};
};
const
exportExcelBtn
=
()
=>
{};
const
exportExcelBtn
=
()
=>
{
};
const
handleTableData
=
(
data
)
=>
{
const
handleTableData
=
(
data
)
=>
{
const
ignoreOutliers
=
checkboxData
.
find
((
item
)
=>
item
.
key
===
'ignoreOutliers'
).
checked
;
const
ignoreOutliers
=
checkboxData
.
find
((
item
)
=>
item
.
key
===
'ignoreOutliers'
).
checked
;
...
@@ -459,8 +461,8 @@ const HistoryView = props => {
...
@@ -459,8 +461,8 @@ const HistoryView = props => {
const
dataIndex
=
dataIndexAccess
(
item
,
index
);
const
dataIndex
=
dataIndexAccess
(
item
,
index
);
obj
[
dataIndex
]
=
'--'
;
obj
[
dataIndex
]
=
'--'
;
});
});
return
obj
return
obj
;
}
}
;
data
.
forEach
((
item
,
index
)
=>
{
data
.
forEach
((
item
,
index
)
=>
{
const
{
stationCode
,
sensorName
,
dataModel
}
=
item
;
const
{
stationCode
,
sensorName
,
dataModel
}
=
item
;
dataModel
.
forEach
((
data
)
=>
{
dataModel
.
forEach
((
data
)
=>
{
...
@@ -526,7 +528,7 @@ const HistoryView = props => {
...
@@ -526,7 +528,7 @@ const HistoryView = props => {
results
.
forEach
((
res
,
index
)
=>
{
results
.
forEach
((
res
,
index
)
=>
{
const
{
dateFrom
,
dateTo
}
=
dateRange
?.[
index
]
??
{};
const
{
dateFrom
,
dateTo
}
=
dateRange
?.[
index
]
??
{};
if
(
res
.
code
===
0
&&
res
.
data
.
length
)
{
if
(
res
.
code
===
0
&&
res
.
data
.
length
)
{
res
.
data
.
forEach
(
d
=>
{
res
.
data
.
forEach
(
(
d
)
=>
{
d
.
dateFrom
=
dateFrom
;
d
.
dateFrom
=
dateFrom
;
d
.
dateTo
=
dateTo
;
d
.
dateTo
=
dateTo
;
});
});
...
@@ -569,7 +571,7 @@ const HistoryView = props => {
...
@@ -569,7 +571,7 @@ const HistoryView = props => {
</Button>
</Button>
)} */
}
)} */
}
<
/div
>
<
/div
>
)
)
,
}}
}}
>
>
<
Tabs
.
TabPane
key
=
"curve"
tab
=
"曲线"
>
<
Tabs
.
TabPane
key
=
"curve"
tab
=
"曲线"
>
...
@@ -578,13 +580,21 @@ const HistoryView = props => {
...
@@ -578,13 +580,21 @@ const HistoryView = props => {
{
renderCurveOption
()}
{
renderCurveOption
()}
<
/div
>
<
/div
>
<
div
className
=
{
`
${
prefixCls
}
-content`
}
>
<
div
className
=
{
`
${
prefixCls
}
-content`
}
>
{
{
grid
===
true
?
(
grid
===
true
?
(
<
GridChart
<
GridChart
prefixCls
=
{
prefixCls
}
dataSource
=
{
chartDataSource
}
contrast
=
{
timeValue
===
'contrast'
}
contrastOption
=
{
contrastOption
}
/
>
prefixCls
=
{
prefixCls
}
dataSource
=
{
chartDataSource
}
contrast
=
{
timeValue
===
'contrast'
}
contrastOption
=
{
contrastOption
}
/
>
)
:
(
)
:
(
<
SimgleChart
prefixCls
=
{
prefixCls
}
dataSource
=
{
chartDataSource
}
contrast
=
{
timeValue
===
'contrast'
}
contrastOption
=
{
contrastOption
}
/
>
<
SimgleChart
)
prefixCls
=
{
prefixCls
}
}
dataSource
=
{
chartDataSource
}
contrast
=
{
timeValue
===
'contrast'
}
contrastOption
=
{
contrastOption
}
/
>
)}
<
/div
>
<
/div
>
<
/Tabs.TabPane
>
<
/Tabs.TabPane
>
<
Tabs
.
TabPane
key
=
"table"
tab
=
"表格"
>
<
Tabs
.
TabPane
key
=
"table"
tab
=
"表格"
>
...
@@ -613,13 +623,21 @@ const HistoryView = props => {
...
@@ -613,13 +623,21 @@ const HistoryView = props => {
HistoryView
.
propTypes
=
{
HistoryView
.
propTypes
=
{
grid
:
PropTypes
.
bool
,
grid
:
PropTypes
.
bool
,
title
:
PropTypes
.
string
,
title
:
PropTypes
.
string
,
defaultChecked
:
PropTypes
.
oneOf
([
'oneHour'
,
'fourHour'
,
'twelveHours'
,
'roundClock'
,
'yesterday'
]),
defaultChecked
:
PropTypes
.
oneOf
([
'oneHour'
,
'fourHour'
,
'twelveHours'
,
'roundClock'
,
'yesterday'
,
]),
tableProps
:
PropTypes
.
object
,
tableProps
:
PropTypes
.
object
,
deviceParams
:
PropTypes
.
arrayOf
(
PropTypes
.
objectOf
({
deviceParams
:
PropTypes
.
arrayOf
(
PropTypes
.
objectOf
({
deviceCode
:
PropTypes
.
string
,
deviceCode
:
PropTypes
.
string
,
sensors
:
PropTypes
.
string
,
sensors
:
PropTypes
.
string
,
deviceType
:
PropTypes
.
string
,
deviceType
:
PropTypes
.
string
,
}))
}),
),
};
};
HistoryView
.
defaultProps
=
{
HistoryView
.
defaultProps
=
{
...
...
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