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
e22b257e
Commit
e22b257e
authored
Aug 23, 2023
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 提交曲线版本
parent
b6846e0f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
12 deletions
+46
-12
EC_HistoryView.md
...es/extend-components/EC_HistoryView/src/EC_HistoryView.md
+1
-1
index.js
packages/extend-components/EC_HistoryView/src/apis/index.js
+5
-1
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+5
-5
index.js
packages/extend-components/EC_HistoryView/src/index.js
+35
-5
No files found.
packages/extend-components/EC_HistoryView/src/EC_HistoryView.md
View file @
e22b257e
...
...
@@ -30,7 +30,7 @@ path: /
## 多图表
[
//
]:
#
(<code src="./demos/GridDemo.js"></code>)
<code
src=
"./demos/GridDemo.js"
></code>
## API
...
...
packages/extend-components/EC_HistoryView/src/apis/index.js
View file @
e22b257e
import
{
request
}
from
'@wisdom-utils/utils'
;
import
{
instanceRequest
,
request
}
from
'@wisdom-utils/utils'
;
const
REQUEST_METHOD_GET
=
'get'
;
const
REQUEST_METHOD_POST
=
'post'
;
...
...
@@ -7,6 +7,10 @@ const baseUrl = typeof DUMI_TYPE !== 'undefined' && DUMI_TYPE === 'dumi' ? '/api
const
monitorDeviceUrl
=
`
${
baseUrl
}
/PandaMonitor/Monitor/Device`
;
let
_customRequest
=
(
data
)
=>
{
return
request
({...
data
,
headers
:
{
spe
:
1111
}})
}
// 获取历史数据
export
function
getHistoryInfo
(
data
)
{
return
request
({
...
...
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
e22b257e
...
...
@@ -3,14 +3,14 @@ import HistoryView from '../index';
import
{
MobileHistoryChart
}
from
"../mobile"
;
const
deviceParams
=
[
/* {
/* {
deviceCode: 'EGBF00000141',
// sensors: '进水压力,出水瞬时流量,出水累计流量',
sensors: '进水压力',
deviceType: '二供泵房',
pointAddressID: 208,
},*/
/* {
/* {
"deviceCode": "SYJ00000008",
"sensors": "瞬时流量",
"deviceType": "水源井"
...
...
@@ -26,13 +26,13 @@ const deviceParams = [
deviceType: '熊猫压力表',
pointAddressID: 4,
},*/
/* {
/* {
deviceCode: 'EGJZ00000226',
sensors: '出水压力',
deviceType: '二供机组',
pointAddressID: 4,
},*/
/* {
/* {
"deviceCode": "LLJ00000055",
"sensors": "正累计流量,瞬时流量,是否在线",
"deviceType": "流量计"
...
...
@@ -48,7 +48,7 @@ const deviceParams = [
"sensors"
:
"出水累计流量"
,
"deviceType"
:
"流量计"
}
/* {
/* {
"deviceCode": "JFJ00000001",
"sensors": "沉淀池投矾量瞬时,是否在线",
"deviceType": "加矾间"
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
e22b257e
...
...
@@ -11,7 +11,7 @@ import {
Tabs
,
Tooltip
,
Button
,
message
message
,
Segmented
}
from
'antd'
;
import
{
CloseCircleFilled
,
...
...
@@ -254,6 +254,7 @@ const HistoryView = (props) => {
const
[
timeOrder
,
setTimeOrder
]
=
useState
(
'descend'
);
const
[
chartType
,
setChartType
]
=
useState
(
'lineChart'
);
const
[
showBoxOption
,
setShowBoxOption
]
=
useState
(
true
);
const
[
lineDataType
,
setLineDataType
]
=
useState
(
'特征曲线'
);
// 选择的时间范围值
const
dateRange
=
useMemo
(()
=>
{
if
(
timeValue
===
'customer'
)
{
...
...
@@ -298,6 +299,10 @@ const HistoryView = (props) => {
// 自定义模式: 快速选择
const
onCustomerTimeChange
=
(
key
)
=>
{
if
(
key
===
'oneMonth'
&&
lineDataType
===
'原始曲线'
)
{
setLineDataType
(
'特征曲线'
);
message
.
info
(
'时间区间超过7天,已切换为特征曲线'
)
}
setCustomerChecked
(
key
);
!!
customerTime
&&
setCustomerTime
(
null
);
};
...
...
@@ -310,6 +315,11 @@ const HistoryView = (props) => {
setCustomerTime
(
value
);
}
else
{
setCustomerChecked
(
null
);
let
diffDays
=
moment
(
value
[
1
]).
diff
(
moment
(
value
[
0
]),
'days'
);
if
(
diffDays
>
7
&&
lineDataType
===
'原始曲线'
)
{
setLineDataType
(
'特征曲线'
);
message
.
info
(
'时间区间超过7天,已切换为特征曲线'
);
}
setCustomerTime
(
value
);
}
};
...
...
@@ -461,7 +471,16 @@ const HistoryView = (props) => {
const
onTimeIntervalChange
=
(
value
)
=>
{
setDataThinKey
(
value
);
};
// 切换数据类型
const
switchLineDataType
=
(
e
)
=>
{
let
_startDate
=
dateRange
[
0
]?.
dateFrom
;
let
_endDate
=
dateRange
[
0
]?.
dateTo
;
let
diffDays
=
moment
(
_endDate
).
diff
(
moment
(
_startDate
),
'days'
);
if
(
e
===
'原始曲线'
&&
diffDays
>
7
)
{
return
message
.
info
(
'查阅原始曲线时,请选择小于或等于7天的时间间隔'
);
}
setLineDataType
(
e
)
};
const
renderCheckbox
=
(
child
,
showJustLine
)
=>
{
const
curveAccess
=
activeTabKey
===
'curve'
&&
child
.
showInCurve
;
const
tableAccess
=
activeTabKey
===
'table'
&&
child
.
showInTable
;
...
...
@@ -492,6 +511,12 @@ const HistoryView = (props) => {
>
{
isChart
&&
isSingle
&&
showBoxOption
?
(
<>
<
div
key
=
{
''
}
className
=
{
`
${
prefixCls
}
-cover-item`
}
>
<
Segmented
value
=
{
lineDataType
}
options
=
{[
'特征曲线'
,
'原始曲线'
]}
onChange
=
{
switchLineDataType
}
/
>
<
Tooltip
title
=
{
'原始曲线数据量较大,请查阅小于7天的数据~'
}
>
<
QuestionCircleFilled
style
=
{{
marginLeft
:
6
}}
className
=
{
`
${
prefixCls
}
-question`
}
/
>
<
/Tooltip
>
<
/div
>
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-label`
)}
>
曲线形态
<
/div
>
<
Radio
.
Group
value
=
{
chartType
}
...
...
@@ -677,7 +702,10 @@ const HistoryView = (props) => {
return Promise.resolve();
});
};
const handleDataThinKey = (diffYears, diffDays, diffHours) => {
const handleDataThinKey = (diffYears, diffDays, diffHours, lineDataType) => {
if (lineDataType === '原始曲线') {
return {unit: '', zoom: ''}
}
// edit by zy 根据选择的时长控制抽稀频度
if (diffYears > 0) {
return {unit: 'h', zoom: '48'}
...
...
@@ -732,7 +760,7 @@ const HistoryView = (props) => {
let diffYears = moment(item.dateTo).diff(moment(item.dateFrom), 'years');
let diffDays = moment(item.dateTo).diff(moment(item.dateFrom), 'days');
let diffHours = moment(item.dateTo).diff(moment(item.dateFrom), 'hours');
let zoomParam = activeTabKey === 'curve' ? handleDataThinKey(diffYears, diffDays, diffHours) : {};
let zoomParam = activeTabKey === 'curve' ? handleDataThinKey(diffYears, diffDays, diffHours
, lineDataType
) : {};
requestArr.push(getHistoryInfo({...param, ...zoomParam}));
});
setLoading(true);
...
...
@@ -788,7 +816,7 @@ const HistoryView = (props) => {
isBoxPlots: isBoxPlots,
});
});
}, [dateRange, dataConfig, deviceParams, chartType]);
}, [dateRange, dataConfig, deviceParams, chartType
, lineDataType
]);
const handleChange = (pagination, filter, sort) => {
if (sort.field === 'time') {
setTimeOrder(sort.order)
...
...
@@ -876,6 +904,8 @@ const HistoryView = (props) => {
};
// 获取字段配置
const
getDefaultOptions
=
()
=>
{
// 非单曲线、单指标不执行
if
(
deviceParams
?.
length
!==
1
||
(
deviceParams
?.
length
===
1
&&
deviceParams
?.[
0
]?.
sensors
?.
split
(
','
)?.
length
>
1
))
return
;
getDictionaryInfoAll
({
level
:
'组件_ec_historyview'
}).
then
(
res
=>
{
...
...
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