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
ce35398c
Commit
ce35398c
authored
May 21, 2024
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert: 关联指标需求取消,回退版本
parent
0e3c2614
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
177 deletions
+104
-177
CHANGELOG.md
packages/extend-components/EC_HistoryView/CHANGELOG.md
+0
-30
package.json
packages/extend-components/EC_HistoryView/package.json
+1
-1
EC_HistoryView.md
...es/extend-components/EC_HistoryView/src/EC_HistoryView.md
+2
-2
index.js
packages/extend-components/EC_HistoryView/src/apis/index.js
+0
-8
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+5
-10
index.js
packages/extend-components/EC_HistoryView/src/index.js
+96
-126
No files found.
packages/extend-components/EC_HistoryView/CHANGELOG.md
View file @
ce35398c
...
...
@@ -2,36 +2,6 @@
All notable changes to this project will be documented in this file. See
[
Conventional Commits
](
https://conventionalcommits.org
)
for commit guidelines.
## [1.71.2](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.71.1...@wisdom-components/ec_historyview@1.71.2) (2024-05-20)
### Bug Fixes
-
修复 (
[
f41fea8
](
https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/f41fea858c41387ca90e204b03b9c125ee1291cd
)
)
## [1.71.1](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.71.0...@wisdom-components/ec_historyview@1.71.1) (2024-05-20)
### Bug Fixes
-
修复重复调用的问题 (
[
41370d8
](
https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/41370d8414d0fe4b362916be149b9e102a3a25dd
)
)
# [1.71.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.70.0...@wisdom-components/ec_historyview@1.71.0) (2024-05-20)
### Features
-
优化历史曲线关联指标流程 (
[
e3f2027
](
https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/e3f202730841a82b72b2c5df55a8738967482761
)
)
# [1.70.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.69.0...@wisdom-components/ec_historyview@1.70.0) (2024-05-20)
### Features
-
增加参数监听 (
[
7cd38cd
](
https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/7cd38cdded1e182062cc7c0b45f0d81e2b321c41
)
)
# [1.69.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.68.0...@wisdom-components/ec_historyview@1.69.0) (2024-05-20)
### Features
-
增加关联模式 (
[
c283404
](
https://g.civnet.cn:8443/ReactWeb5/wisdom-components/commits/c2834042ff50ec9023b82bbe92cacb4924dc961a
)
)
# [1.68.0](https://g.civnet.cn:8443/ReactWeb5/wisdom-components/compare/@wisdom-components/ec_historyview@1.67.0...@wisdom-components/ec_historyview@1.68.0) (2024-05-10)
### Features
...
...
packages/extend-components/EC_HistoryView/package.json
View file @
ce35398c
{
"name"
:
"@wisdom-components/ec_historyview"
,
"version"
:
"1.
71.2
"
,
"version"
:
"1.
68.0
"
,
"description"
:
"> TODO: description"
,
"author"
:
"cuijiahao <15927252954@163.com>"
,
"homepage"
:
""
,
...
...
packages/extend-components/EC_HistoryView/src/EC_HistoryView.md
View file @
ce35398c
...
...
@@ -26,11 +26,11 @@ path: /
## 单图表-状态
[
//
]:
#
(<code src="./demos/indexForStatus.js"></code>)
<code
src=
"./demos/indexForStatus.js"
></code>
## 单图表-频率
[
//
]:
#
(<code src="./demos/indexForFrequency.js"></code>)
<code
src=
"./demos/indexForFrequency.js"
></code>
[
//
]:
#
'## 移动端'
[
//
]:
#
'<code src="./demos/mobile.js"></code>'
...
...
packages/extend-components/EC_HistoryView/src/apis/index.js
View file @
ce35398c
...
...
@@ -91,11 +91,3 @@ export function getSensorsRealName(data) {
data
,
})
}
export
function
getAccountList
(
data
)
{
return
request
({
url
:
`
${
baseUrl
}
/PandaWorkFlow/WorkFlow/AccountManage/GetAccountPageList`
,
method
:
REQUEST_METHOD_POST
,
data
,
})
}
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
ce35398c
...
...
@@ -3,23 +3,18 @@ import HistoryView from '../index';
const
deviceParams
=
[
{
"deviceCode"
:
"EGBF0000002
3
"
,
"sensors"
:
"出水
压力
"
,
"deviceCode"
:
"EGBF0000002
2
"
,
"sensors"
:
"出水
瞬时流量,今日用电量,余氯
"
,
"deviceType"
:
"二供泵房"
},
/* {
"deviceCode": "EGBF00000023",
"sensors": "出水瞬时流量,出水压力",
"deviceType": "二供泵房"
} */
}
]
const
Demo
=
()
=>
{
return
(
<>
<
div
>
<
div
style
=
{{
height
:
700
}}
>
<
HistoryView
deviceParams
=
{
deviceParams
}
defaultModel
=
"curve"
/>
{
/*<HistoryView theme={'BI'} deviceParams={deviceParams} defaultModel="curve"/>*/
}
{
/*<HistoryView deviceParams={deviceParams} defaultModel="curve" />*/
}
<
HistoryView
theme
=
{
'BI'
}
deviceParams
=
{
deviceParams
}
defaultModel
=
"curve"
/>
<
/div
>
<
/div
>
<
/
>
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
ce35398c
...
...
@@ -3,7 +3,7 @@
* 非influxdb版本的接口,使用isDilute=false实现;
* 建议:不抽稀的时候,传isDilute=false&zoom=''&unit=''
* */
import
React
,
{
useContext
,
useEffect
,
useMemo
,
useState
,
useCallback
,
useRef
}
from
'react'
;
import
React
,
{
useContext
,
useEffect
,
useMemo
,
useState
,
useCallback
,
useRef
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
classNames
from
'classnames'
;
import
{
...
...
@@ -35,19 +35,19 @@ import {
getExportDeviceHistoryUrl
,
getDictionaryInfoAll
,
getPointAddress
,
getPointAddressEntry
,
getPredicateSensor
,
getAccountList
,
getPointAddressEntry
,
getPredicateSensor
,
}
from
'./apis'
;
import
SingleChart
from
'./SingleChart'
;
import
GridChart
from
'./GridChart'
;
import
BIStyles
from
'./indexForBI.less'
;
import
{
globalConfig
}
from
'antd/lib/config-provider'
;
import
{
getSensorType
}
from
'./apis/index'
;
import
{
ExportExcel
}
from
'@wisdom-components/exportexcel'
;
import
{
globalConfig
}
from
'antd/lib/config-provider'
;
import
{
getSensorType
}
from
'./apis/index'
;
import
{
ExportExcel
}
from
'@wisdom-components/exportexcel'
;
import
VirtualTable
from
'./VirtualTable'
;
const
{
RangePicker
}
=
DatePicker
;
const
{
Option
}
=
Select
;
const
{
RangePicker
}
=
DatePicker
;
const
{
Option
}
=
Select
;
const
startFormat
=
'YYYY-MM-DD 00:00:00'
;
const
endFormat
=
'YYYY-MM-DD 23:59:59'
;
...
...
@@ -291,8 +291,8 @@ const handleFakeData = (dateRange, deviceParams) => {
_arr
.
forEach
(
sensor
=>
{
final
.
push
({
dataModel
:
[
{
pt
:
dateFrom
,
pv
:
null
},
{
pt
:
dateTo
,
pv
:
null
}
{
pt
:
dateFrom
,
pv
:
null
},
{
pt
:
dateTo
,
pv
:
null
}
],
dateFrom
,
dateTo
,
...
...
@@ -319,33 +319,23 @@ const timeColumn = {
const
OriginMaxDays
=
31
;
// 原始曲线请求数据的最大天数
const
CharacteristicMaxDays
=
null
;
// 特征曲线或者其他曲线的最大天数
const
HistoryView
=
(
props
)
=>
{
if
(
props
.
deviceParams
.
length
===
0
)
return
''
;
const
[
completeInit
,
setCompleteInit
]
=
useState
(
false
);
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
prefixCls
=
getPrefixCls
(
'history-view'
);
const
{
title
,
grid
,
defaultChecked
,
tableProps
,
deviceParams
,
defaultModel
,
showModels
,
needMarkLine
,
defaultDate
,
theme
=
"Normal"
,
// deviceParams
theme
=
"Normal"
}
=
props
;
// 关联指标
const
[
combineSensors
,
setCombineSensors
]
=
useState
([]);
if
(
theme
===
'Normal'
)
import
(
'./index.less'
);
if
(
theme
===
'BI'
)
import
(
'./indexForBI.less'
);
const
deviceParams
=
useMemo
(()
=>
{
let
_deviceParams
=
_
.
cloneDeep
(
props
.
deviceParams
);
if
(
combineSensors
.
length
&&
_deviceParams
.
length
===
1
)
{
_deviceParams
[
0
].
sensors
=
combineSensors
.
join
(
','
);
}
return
_deviceParams
;
},[
combineSensors
,
props
.
deviceParams
])
const
isBoxPlots
=
deviceParams
?.
length
===
1
&&
deviceParams
?.[
0
]?.
sensors
?.
split
(
','
).
length
===
1
;
const
[
loading
,
setLoading
]
=
useState
(
null
);
...
...
@@ -547,13 +537,13 @@ const HistoryView = (props) => {
onContrastChange
(
contrastOption
);
setShowBoxOption
(
false
);
setChartType
(
'lineChart'
);
onCheckboxChange
({
target
:
{
value
:
false
}
},
'chartType'
);
onCheckboxChange
({
target
:
{
value
:
false
}
},
'ignoreOutliers'
);
onCheckboxChange
({
target
:
{
value
:
false
}
},
'chartType'
);
onCheckboxChange
({
target
:
{
value
:
false
}
},
'ignoreOutliers'
);
}
else
{
// 自定义
// 不需要处理
setShowBoxOption
(
true
);
onCheckboxChange
({
target
:
{
value
:
true
}
},
'chartType'
);
onCheckboxChange
({
target
:
{
value
:
true
}
},
'chartType'
);
}
};
const
onShortcutsChange
=
(
e
)
=>
{
...
...
@@ -563,37 +553,37 @@ const HistoryView = (props) => {
switch
(
_val
)
{
case
'近3天'
:
_arr
=
[
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'days'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'days'
)
},
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'days'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'days'
)
},
];
break
;
case
'近7天'
:
_arr
=
[
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'days'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'days'
)
},
{
key
:
4
,
value
:
moment
().
subtract
(
3
,
'days'
)
},
{
key
:
5
,
value
:
moment
().
subtract
(
4
,
'days'
)
},
{
key
:
6
,
value
:
moment
().
subtract
(
5
,
'days'
)
},
{
key
:
7
,
value
:
moment
().
subtract
(
6
,
'days'
)
},
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'days'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'days'
)
},
{
key
:
4
,
value
:
moment
().
subtract
(
3
,
'days'
)
},
{
key
:
5
,
value
:
moment
().
subtract
(
4
,
'days'
)
},
{
key
:
6
,
value
:
moment
().
subtract
(
5
,
'days'
)
},
{
key
:
7
,
value
:
moment
().
subtract
(
6
,
'days'
)
},
];
break
;
case
'近3月'
:
_arr
=
[
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'months'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'months'
)
},
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'months'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'months'
)
},
];
break
;
case
'近6月'
:
_arr
=
[
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'months'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'months'
)
},
{
key
:
4
,
value
:
moment
().
subtract
(
3
,
'months'
)
},
{
key
:
5
,
value
:
moment
().
subtract
(
4
,
'months'
)
},
{
key
:
6
,
value
:
moment
().
subtract
(
5
,
'months'
)
},
{
key
:
1
,
value
:
moment
()
},
{
key
:
2
,
value
:
moment
().
subtract
(
1
,
'months'
)
},
{
key
:
3
,
value
:
moment
().
subtract
(
2
,
'months'
)
},
{
key
:
4
,
value
:
moment
().
subtract
(
3
,
'months'
)
},
{
key
:
5
,
value
:
moment
().
subtract
(
4
,
'months'
)
},
{
key
:
6
,
value
:
moment
().
subtract
(
5
,
'months'
)
},
];
break
;
}
...
...
@@ -652,7 +642,7 @@ const HistoryView = (props) => {
{
timeValue
===
'contrast'
&&
(
// 同期对比
<>
<
Select
value
=
{
contrastOption
}
getPopupContainer
=
{
trigger
=>
trigger
.
parentElement
}
style
=
{{
width
:
60
}}
onChange
=
{
onContrastChange
}
>
style
=
{{
width
:
60
}}
onChange
=
{
onContrastChange
}
>
<
Option
value
=
"day"
>
日
<
/Option
>
<
Option
value
=
"month"
disabled
=
{
lineDataType
===
'原始曲线'
}
>
月
...
...
@@ -677,14 +667,14 @@ const HistoryView = (props) => {
picker
=
{
contrastOption
===
'day'
?
undefined
:
contrastOption
}
value
=
{
child
.
value
}
onChange
=
{(
date
,
dateString
)
=>
onContrastPickerChange
(
date
,
dateString
,
child
)}
style
=
{{
width
:
130
,
border
:
!
shortcutsValue
?
'1px solid #1890ff'
:
''
}}
style
=
{{
width
:
130
,
border
:
!
shortcutsValue
?
'1px solid #1890ff'
:
''
}}
/
>
{
datePickerArr
.
length
>
2
&&
(
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-contrast-delete`
)}
onClick
=
{()
=>
handleDeleteDatePicker
(
index
)}
>
<
CloseCircleFilled
/>
<
CloseCircleFilled
/>
<
/div
>
)}
<
/div
>
...
...
@@ -693,7 +683,7 @@ const HistoryView = (props) => {
)}
<
/div
>
))}
{
datePickerArr
.
length
<
4
&&
<
PlusCircleOutlined
onClick
=
{
handleAddDatePicker
}
/>
}
{
datePickerArr
.
length
<
4
&&
<
PlusCircleOutlined
onClick
=
{
handleAddDatePicker
}
/>
}
<
/
>
)}
<
/div
>
...
...
@@ -764,12 +754,12 @@ const HistoryView = (props) => {
<
/Checkbox
>
{
child
.
tooltip
&&
(
<
Tooltip
title
=
{
child
.
tooltip
}
>
<
QuestionCircleFilled
className
=
{
`
${
prefixCls
}
-question`
}
/
>
<
QuestionCircleFilled
className
=
{
`
${
prefixCls
}
-question`
}
/
>
<
/Tooltip
>
)}
{
child
.
hasSub
&&
child
.
checked
&&
false
?
(
<
Select
style
=
{{
width
:
80
,
marginLeft
:
10
}}
style
=
{{
width
:
80
,
marginLeft
:
10
}}
value
=
{
algorithmValue
}
onChange
=
{(
e
)
=>
setAlgorithmValue
(
e
)}
>
...
...
@@ -789,7 +779,7 @@ const HistoryView = (props) => {
return
(
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-cover`
)}
style
=
{
isChart
&&
isSingle
?
{
width
:
'100%'
}
:
{}}
style
=
{
isChart
&&
isSingle
?
{
width
:
'100%'
}
:
{}}
>
{
isChart
&&
!
isStatus
?
(
<>
...
...
@@ -801,7 +791,7 @@ const HistoryView = (props) => {
<
/Radio.Group
>
<
Tooltip
title
=
{
'原始曲线数据量较大,单次查询最多展示1万条数据'
}
>
<
QuestionCircleFilled
style
=
{{
marginLeft
:
6
}}
style
=
{{
marginLeft
:
6
}}
className
=
{
`
${
prefixCls
}
-question`
}
/
>
<
/Tooltip
>
...
...
@@ -814,16 +804,16 @@ const HistoryView = (props) => {
<>
{
lineDataType
!==
'原始曲线'
?
(
<>
<
div
style
=
{{
marginLeft
:
7
}}
className
=
{
classNames
(
`
${
prefixCls
}
-label`
)}
>
<
div
style
=
{{
marginLeft
:
7
}}
className
=
{
classNames
(
`
${
prefixCls
}
-label`
)}
>
曲线形态
<
/div
>
<
Radio
.
Group
value
=
{
chartType
}
style
=
{{
marginRight
:
16
}}
style
=
{{
marginRight
:
16
}}
onChange
=
{(
e
)
=>
{
let
_value
=
e
.
target
.
value
;
setChartType
(
_value
);
onCheckboxChange
({
target
:
{
value
:
_value
!==
'boxChart'
}
},
'chartType'
);
onCheckboxChange
({
target
:
{
value
:
_value
!==
'boxChart'
}
},
'chartType'
);
}}
>
<
Radio
.
Button
value
=
{
'lineChart'
}
>
线形图
<
/Radio.Button
>
...
...
@@ -854,7 +844,7 @@ const HistoryView = (props) => {
{
activeTabKey
===
'table'
&&
(
<
Select
value
=
{
dataThinKey
}
style
=
{{
width
:
90
}}
style
=
{{
width
:
90
}}
onChange
=
{
onTimeIntervalChange
}
disabled
=
{
!
dataConfig
.
dataThin
}
getPopupContainer
=
{
trigger
=>
trigger
.
parentElement
}
...
...
@@ -891,6 +881,7 @@ const HistoryView = (props) => {
)}
至
${
moment
(
timeTo
).
format
(
dateFormat
)}
`
;
let
_quotas
=
i
.
sensors
.
split
(
','
)
.
filter
((
item
)
=>
item
!==
'是否在线'
)
.
join
(
','
);
getExportDeviceHistoryUrl
({
deviceType
:
i
.
deviceType
,
...
...
@@ -964,9 +955,11 @@ const HistoryView = (props) => {
};
const
handleTableData
=
useCallback
(
(
data
)
=>
{
// eslint-disable-next-line no-param-reassign
// data = data.filter(item => item.sensorName !== '是否在线');
const
ignoreOutliers
=
checkboxData
.
find
((
item
)
=>
item
.
key
===
'ignoreOutliers'
).
checked
;
const
dataIndexAccess
=
(
dataItem
,
index
)
=>
{
const
{
stationCode
,
sensorName
}
=
dataItem
;
const
{
stationCode
,
sensorName
}
=
dataItem
;
return
`
${
stationCode
}
-
${
sensorName
}
-
${
index
}
`
;
};
...
...
@@ -977,7 +970,7 @@ const HistoryView = (props) => {
// 判断是否是单设备,单设备则不显示设备名称
// 处理表头数据
const
columnsData
=
data
.
map
((
item
,
index
)
=>
{
const
{
stationCode
,
equipmentName
,
sensorName
,
unit
,
dataModel
}
=
item
;
const
{
stationCode
,
equipmentName
,
sensorName
,
unit
,
dataModel
}
=
item
;
const
dataIndex
=
dataIndexAccess
(
item
,
index
);
let
_title
=
''
;
if
(
deviceConfig
.
current
.
oneDevice
)
{
...
...
@@ -1007,7 +1000,7 @@ const HistoryView = (props) => {
// 格式化时间对齐数据, 生成行数
const
timeData
=
{};
const
buildDefaultData
=
(
time
)
=>
{
const
obj
=
{
key
:
time
,
time
:
time
};
const
obj
=
{
key
:
time
,
time
:
time
};
data
.
forEach
((
item
,
index
)
=>
{
const
dataIndex
=
dataIndexAccess
(
item
,
index
);
obj
[
dataIndex
]
=
''
;
...
...
@@ -1016,7 +1009,7 @@ const HistoryView = (props) => {
return
obj
;
};
data
.
forEach
((
item
,
index
)
=>
{
const
{
stationCode
,
sensorName
,
dataModel
}
=
item
;
const
{
stationCode
,
sensorName
,
dataModel
}
=
item
;
dataModel
&&
dataModel
.
forEach
((
data
)
=>
{
const
formatTime
=
moment
(
data
.
pt
).
format
(
format
);
...
...
@@ -1031,7 +1024,7 @@ const HistoryView = (props) => {
});
// 处理表格数据
data
.
forEach
((
child
,
index
)
=>
{
const
{
dataModel
}
=
child
;
const
{
dataModel
}
=
child
;
const
dataIndex
=
dataIndexAccess
(
child
,
index
);
dataModel
&&
dataModel
.
forEach
((
value
,
j
)
=>
{
...
...
@@ -1087,34 +1080,34 @@ const HistoryView = (props) => {
};
const
handleDataThinKey
=
(
diffYears
,
diffDays
,
diffHours
,
lineDataType
)
=>
{
if
(
lineDataType
===
'原始曲线'
)
{
return
{
unit
:
''
,
zoom
:
''
};
return
{
unit
:
''
,
zoom
:
''
};
}
// edit by zy 根据选择的时长控制抽稀频度
if
(
diffYears
>
0
)
{
if
(
diffYears
===
1
)
return
{
unit
:
'h'
,
zoom
:
'24'
};
return
{
unit
:
'h'
,
zoom
:
'48'
};
if
(
diffYears
===
1
)
return
{
unit
:
'h'
,
zoom
:
'24'
};
return
{
unit
:
'h'
,
zoom
:
'48'
};
}
else
if
(
diffYears
===
0
&&
diffDays
>
0
)
{
if
(
diffDays
>
90
)
return
{
unit
:
'h'
,
zoom
:
'24'
};
if
(
diffDays
>
30
)
return
{
unit
:
'h'
,
zoom
:
'4'
};
if
(
diffDays
>
15
)
return
{
unit
:
'h'
,
zoom
:
'2'
};
if
(
diffDays
>
7
)
return
{
unit
:
'h'
,
zoom
:
'1'
};
if
(
diffDays
>
3
)
return
{
unit
:
'min'
,
zoom
:
'20'
};
if
(
diffDays
>
1
)
return
{
unit
:
'min'
,
zoom
:
'15'
};
if
(
diffDays
===
1
)
return
{
unit
:
'min'
,
zoom
:
'5'
};
if
(
diffDays
>
90
)
return
{
unit
:
'h'
,
zoom
:
'24'
};
if
(
diffDays
>
30
)
return
{
unit
:
'h'
,
zoom
:
'4'
};
if
(
diffDays
>
15
)
return
{
unit
:
'h'
,
zoom
:
'2'
};
if
(
diffDays
>
7
)
return
{
unit
:
'h'
,
zoom
:
'1'
};
if
(
diffDays
>
3
)
return
{
unit
:
'min'
,
zoom
:
'20'
};
if
(
diffDays
>
1
)
return
{
unit
:
'min'
,
zoom
:
'15'
};
if
(
diffDays
===
1
)
return
{
unit
:
'min'
,
zoom
:
'5'
};
}
else
if
(
diffYears
===
0
&&
diffDays
===
0
&&
diffHours
>
0
)
{
if
(
diffHours
>
12
)
return
{
unit
:
'min'
,
zoom
:
'5'
};
if
(
diffHours
>
4
)
return
{
unit
:
'min'
,
zoom
:
'1'
};
if
(
diffHours
>
1
)
return
{
unit
:
's'
,
zoom
:
'30'
};
if
(
diffHours
>
0
)
return
{
unit
:
's'
,
zoom
:
'5'
};
return
{
unit
:
's'
,
zoom
:
'5'
};
if
(
diffHours
>
12
)
return
{
unit
:
'min'
,
zoom
:
'5'
};
if
(
diffHours
>
4
)
return
{
unit
:
'min'
,
zoom
:
'1'
};
if
(
diffHours
>
1
)
return
{
unit
:
's'
,
zoom
:
'30'
};
if
(
diffHours
>
0
)
return
{
unit
:
's'
,
zoom
:
'5'
};
return
{
unit
:
's'
,
zoom
:
'5'
};
}
else
{
return
{
unit
:
''
,
zoom
:
''
};
return
{
unit
:
''
,
zoom
:
''
};
}
};
// 处理接口服务参数的变化
const
onChangeParams
=
(
value
=
{})
=>
{
const
{
dateRange
,
isDilute
,
ignoreOutliers
,
zoom
,
unit
}
=
value
;
const
{
dateRange
,
isDilute
,
ignoreOutliers
,
zoom
,
unit
}
=
value
;
let
_diffDays
=
moment
(
dateRange
[
0
].
dateTo
).
diff
(
dateRange
[
0
].
dateFrom
,
'days'
);
// 查询时段大于7天时,不提供1分钟的抽稀选项。
if
(
_diffDays
>
7
&&
zoom
===
'1'
&&
unit
===
'min'
)
{
...
...
@@ -1127,7 +1120,7 @@ const HistoryView = (props) => {
let
hasDiscreteDeviceType
=
false
;
deviceParams
.
map
((
item
)
=>
{
let
_item
=
{
...
item
};
let
_item
=
{
...
item
};
_item
.
sensors
=
item
.
sensors
;
// special 业务
if
(
special1
)
{
...
...
@@ -1166,9 +1159,9 @@ const HistoryView = (props) => {
activeTabKey
===
'curve'
?
handleDataThinKey
(
diffYears
,
diffDays
,
diffHours
,
lineDataType
)
:
!
isDilute
?
{
zoom
:
''
,
unit
:
''
}
?
{
zoom
:
''
,
unit
:
''
}
:
{};
// 表格也支持全数据模式;
let
_finalParams
=
{
...
param
,
...
zoomParam
};
let
_finalParams
=
{
...
param
,
...
zoomParam
};
// 2024年1月8日 抽稀间隔大于等于12小时时,会存在线性插值导致抽稀间隔内数据条数大于预期的问题。需要增加一个额外参数处理该情况。
if
(
_finalParams
.
zoom
)
{
let
_num
=
Number
(
_finalParams
.
zoom
);
...
...
@@ -1185,10 +1178,6 @@ const HistoryView = (props) => {
if
(
hasDiscreteDeviceType
&&
ignoreOutliers
)
{
_finalParams
.
algorithmName
=
"derivative"
;
}
// 指标关联有值,表明是有关联指标的环境
if
(
combineSensors
?.
length
&&
_finalParams
?.
acrossTables
?.
length
===
1
)
{
_finalParams
.
acrossTables
[
0
].
sensors
=
combineSensors
.
join
(
','
)
}
requestArr
.
push
(
getHistoryInfo
(
_finalParams
));
});
setLoading
(
true
);
...
...
@@ -1199,7 +1188,7 @@ const HistoryView = (props) => {
if
(
results
.
length
)
{
let
data
=
[];
results
.
forEach
((
res
,
index
)
=>
{
const
{
dateFrom
,
dateTo
}
=
dateRange
?.[
index
]
??
{};
const
{
dateFrom
,
dateTo
}
=
dateRange
?.[
index
]
??
{};
if
(
res
.
code
===
0
&&
res
.
data
.
length
)
{
res
.
data
.
forEach
((
d
)
=>
{
d
.
dateFrom
=
dateFrom
||
''
;
...
...
@@ -1213,7 +1202,7 @@ const HistoryView = (props) => {
*/
// d.dataModel=[];
d
.
dataModel
=
d
.
dataModel
.
map
((
item
)
=>
{
let
{
firstPV
,
lastPV
,
maxPV
,
minPV
,
pv
}
=
item
;
let
{
firstPV
,
lastPV
,
maxPV
,
minPV
,
pv
}
=
item
;
if
(
pv
!==
null
&&
firstPV
===
null
&&
lastPV
===
null
&&
maxPV
===
null
&&
minPV
===
null
)
{
firstPV
=
pv
;
lastPV
=
pv
;
...
...
@@ -1229,10 +1218,12 @@ const HistoryView = (props) => {
};
});
});
deviceParams
.
forEach
((
p
)
=>
{
// 加入预测
(
predicateDevice
?
deviceParams
.
concat
(
predicateDevice
)
:
deviceParams
).
forEach
((
p
)
=>
{
// 返回数据按查询指标顺序排序
const
sensors
=
p
.
sensors
?.
split
(
','
)
??
[];
if
(
sensors
?.
length
)
{
sensors
.
push
(
'是否在线'
);
if
(
special1
)
{
sensors
.
push
(
special1
.
name
);
}
...
...
@@ -1278,7 +1269,7 @@ const HistoryView = (props) => {
useEffect
(()
=>
{
if
(
!
completeInit
)
return
;
const
{
dataThin
,
ignoreOutliers
,
zoom
,
unit
}
=
dataConfig
;
const
{
dataThin
,
ignoreOutliers
,
zoom
,
unit
}
=
dataConfig
;
beforChangeParams
().
finally
(()
=>
{
onChangeParams
({
isDilute
:
dataThin
,
...
...
@@ -1334,7 +1325,7 @@ const HistoryView = (props) => {
}}
/
>
)
:
(
<
PandaEmpty
/>
<
PandaEmpty
/>
)}
<
/div
>
<
/
>
...
...
@@ -1382,7 +1373,7 @@ const HistoryView = (props) => {
)}
<
/div
>
{
lineDataType
===
'原始曲线'
&&
false
?
(
<
div
style
=
{{
marginTop
:
10
}}
>
展示区间:
{
returnLongestPeriod
(
chartDataSource
)}
<
/div
>
<
div
style
=
{{
marginTop
:
10
}}
>
展示区间:
{
returnLongestPeriod
(
chartDataSource
)}
<
/div
>
)
:
(
''
)}
...
...
@@ -1404,7 +1395,7 @@ const HistoryView = (props) => {
/
>
)
:
(
<
SingleChart
exportCanvas
=
{{
exportFlag
,
setExportFlag
}}
exportCanvas
=
{{
exportFlag
,
setExportFlag
}}
emptyOrError
=
{
emptyOrError
.
current
}
dateRange
=
{
dateRange
}
showBoxOption
=
{
showBoxOption
}
...
...
@@ -1451,14 +1442,10 @@ const HistoryView = (props) => {
if
(
deviceParams
?.
length
!==
1
||
(
deviceParams
?.
length
===
1
&&
deviceParams
?.[
0
]?.
sensors
?.
split
(
','
)?.
length
>
1
)
)
{
setCompleteInit
(
true
);
setCombineSensors
([]);
return
}
)
return
setCompleteInit
(
true
);
setLoading
(
true
);
const
{
deviceCode
,
deviceType
,
sensors
}
=
deviceParams
[
0
];
const
{
deviceCode
,
deviceType
,
sensors
}
=
deviceParams
[
0
];
let
_id
=
(
await
getPointAddress
({
code
:
deviceCode
,
...
...
@@ -1473,27 +1460,16 @@ const HistoryView = (props) => {
// 以下请求为处理状态值、开关值的图表,只允许单曲线单指标情况下展示
let
_request1
=
getPointAddressEntry
(
_params
);
let
_request2
=
getSensorType
();
// 预测指标,暂时没有完善的方案
// let _request3 = getPredicateSensor({deviceCode, sensors});
// 邳州项目上,有定制需求:关联几个指标,选择后
let
_request4
=
getAccountList
({
accountName
:
'关联指标台账'
,
pageIndex
:
1
,
pageSize
:
100
,
info
:
deviceCode
,
siteFilter
:
false
,
siteLevel
:
true
,
sortFields
:
"录入时间"
})
await
Promise
.
all
([
_request0
,
_request1
,
_request2
,
_request4
]).
then
((
result
)
=>
{
await
Promise
.
all
([
_request0
,
_request1
,
_request2
]).
then
((
result
)
=>
{
if
(
result
)
{
let
_res0
=
result
[
0
];
let
_res1
=
result
[
1
];
let
_res2
=
result
[
2
];
let
_res3
=
result
[
3
];
// let _res4 = result[4];
// let _res3 = result[3];
let
_checkboxData
=
[...
checkboxData
];
// 单设备单曲线时,查询是否配置为预测点
/* if (_res
4.code === 0 && _res4
.data) {
/* if (_res
3.code === 0 && _res3
.data) {
// 1. 如果是单曲线,并且配置了预测,那么默认开启预测;
// 2024年3月11日 物联预测功能支撑后,再开发这部分
_checkboxData.push({
...
...
@@ -1514,7 +1490,7 @@ const HistoryView = (props) => {
return
final
;
},
{});
_checkboxData
=
_checkboxData
.
map
((
item
)
=>
{
let
_item
=
{
...
item
};
let
_item
=
{
...
item
};
if
(
_opt
[
item
.
label
]
!==
undefined
)
{
_item
.
checked
=
_opt
[
item
.
label
]
===
'true'
;
}
...
...
@@ -1548,19 +1524,13 @@ const HistoryView = (props) => {
let
_isStatusSensor
=
[
'状态值'
,
'开关值'
].
includes
(
_sensor
);
setIsSingleStatusSensor
(
_isStatusSensor
);
}
// 关联指标
if
(
_res3
.
code
===
0
&&
_res3
.
data
.
jsonData
)
{
let
_jsonData
=
JSON
.
parse
(
_res3
.
data
.
jsonData
);
let
allSensors
=
_jsonData
.
find
(
item
=>
item
[
'关键指标'
]
===
sensors
)?.[
'关联指标'
]?.
split
(
','
)
??
[];
setCombineSensors
([...
new
Set
([...
allSensors
,
sensors
])]);
}
}
});
setCompleteInit
(
true
);
};
useEffect
(()
=>
{
getDefaultOptions
();
},
[
props
.
deviceParams
]);
},
[
deviceParams
]);
let
percentTimer
=
useRef
({
timer
:
null
,
});
...
...
@@ -1588,8 +1558,8 @@ const HistoryView = (props) => {
return
(
<
div
className
=
{
classNames
(
prefixCls
,
theme
===
'BI'
?
BIStyles
[
`
${
prefixCls
}
-historyViewComponents`
]
:
''
,
'wkt-scroll-light'
)}
style
=
{{
background
:
theme
===
'BI'
?
'#282b34'
:
'#ffffff'
}}
>
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-spin`
)}
style
=
{{
position
:
'relative'
}}
>
style
=
{{
background
:
theme
===
'BI'
?
'#282b34'
:
'#ffffff'
}}
>
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-spin`
)}
style
=
{{
position
:
'relative'
}}
>
{
loading
||
percent
!==
0
?
(
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-progressWrapper`
)}
>
{
lineDataType
===
'原始曲线'
||
...
...
@@ -1606,7 +1576,7 @@ const HistoryView = (props) => {
<
div
className
=
{
classNames
(
`
${
prefixCls
}
-tip`
)}
>
加载中
...
<
/div
>
<
/div>
:
<
Spin
spinning
=
{
loading
||
false
}
tip
=
{
'数据加载中...'
}
delay
=
{
1000
}
style
=
{{
background
:
'transparent'
}}
/
>
style
=
{{
background
:
'transparent'
}}
/
>
}
<
/div
>
)
:
(
...
...
@@ -1627,7 +1597,7 @@ const HistoryView = (props) => {
{
activeTabKey
===
'table'
&&
(
<>
<
Button
type
=
"link"
onClick
=
{
exportFeatureBtn
}
>
<
DownloadOutlined
/>
<
DownloadOutlined
/>
下载
<
/Button
>
<
/
>
...
...
@@ -1635,7 +1605,7 @@ const HistoryView = (props) => {
{
activeTabKey
===
'curve'
&&
(
<>
<
Button
type
=
"link"
onClick
=
{
exportCanvas
}
>
<
DownloadOutlined
/>
<
DownloadOutlined
/>
下载
<
/Button
>
<
/
>
...
...
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