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
c2834042
Commit
c2834042
authored
May 20, 2024
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加关联模式
parent
9c697d1c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
16 deletions
+50
-16
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
+8
-0
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+4
-4
index.js
packages/extend-components/EC_HistoryView/src/index.js
+36
-10
No files found.
packages/extend-components/EC_HistoryView/src/EC_HistoryView.md
View file @
c2834042
...
...
@@ -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 @
c2834042
...
...
@@ -91,3 +91,11 @@ 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 @
c2834042
...
...
@@ -3,8 +3,8 @@ import HistoryView from '../index';
const
deviceParams
=
[
{
"deviceCode"
:
"EGBF0000002
2
"
,
"sensors"
:
"出水瞬时流量
,今日用电量,余氯
"
,
"deviceCode"
:
"EGBF0000002
3
"
,
"sensors"
:
"出水瞬时流量"
,
"deviceType"
:
"二供泵房"
}
]
...
...
@@ -13,8 +13,8 @@ const Demo = () => {
<>
<
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 @
c2834042
...
...
@@ -35,7 +35,7 @@ import {
getExportDeviceHistoryUrl
,
getDictionaryInfoAll
,
getPointAddress
,
getPointAddressEntry
,
getPredicateSensor
,
getPointAddressEntry
,
getPredicateSensor
,
getAccountList
,
}
from
'./apis'
;
import
SingleChart
from
'./SingleChart'
;
import
GridChart
from
'./GridChart'
;
...
...
@@ -327,13 +327,21 @@ const HistoryView = (props) => {
grid
,
defaultChecked
,
tableProps
,
deviceParams
,
defaultModel
,
showModels
,
needMarkLine
,
defaultDate
,
theme
=
"Normal"
}
=
props
;
// 关联指标
const
[
combineSensors
,
setCombineSensors
]
=
useState
([]);
const
deviceParams
=
useMemo
(()
=>
{
let
_deviceParams
=
_
.
cloneDeep
(
props
.
deviceParams
);
if
(
combineSensors
?.
length
&&
_deviceParams
.
length
===
1
)
{
_deviceParams
[
0
].
sensors
=
combineSensors
.
join
(
','
)
}
return
_deviceParams
;
},
[
combineSensors
]);
if
(
theme
===
'Normal'
)
import
(
'./index.less'
);
if
(
theme
===
'BI'
)
import
(
'./indexForBI.less'
);
const
isBoxPlots
=
...
...
@@ -881,7 +889,6 @@ const HistoryView = (props) => {
)}
至
${
moment
(
timeTo
).
format
(
dateFormat
)}
`
;
let
_quotas
=
i
.
sensors
.
split
(
','
)
.
filter
((
item
)
=>
item
!==
'是否在线'
)
.
join
(
','
);
getExportDeviceHistoryUrl
({
deviceType
:
i
.
deviceType
,
...
...
@@ -955,8 +962,6 @@ 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
;
...
...
@@ -1178,6 +1183,10 @@ 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
);
...
...
@@ -1219,11 +1228,11 @@ const HistoryView = (props) => {
});
});
// 加入预测
(
predicateDevice
?
deviceParams
.
concat
(
predicateDevice
)
:
deviceParams
).
forEach
((
p
)
=>
{
// (predicateDevice ? deviceParams.concat(predicateDevice) : deviceParams).forEach((p) => {
deviceParams
.
forEach
((
p
)
=>
{
// 返回数据按查询指标顺序排序
const
sensors
=
p
.
sensors
?.
split
(
','
)
??
[];
if
(
sensors
?.
length
)
{
sensors
.
push
(
'是否在线'
);
if
(
special1
)
{
sensors
.
push
(
special1
.
name
);
}
...
...
@@ -1460,16 +1469,27 @@ const HistoryView = (props) => {
// 以下请求为处理状态值、开关值的图表,只允许单曲线单指标情况下展示
let
_request1
=
getPointAddressEntry
(
_params
);
let
_request2
=
getSensorType
();
// 预测指标,暂时没有完善的方案
// let _request3 = getPredicateSensor({deviceCode, sensors});
await
Promise
.
all
([
_request0
,
_request1
,
_request2
]).
then
((
result
)
=>
{
// 邳州项目上,有定制需求:关联几个指标,选择后
let
_request4
=
getAccountList
({
accountName
:
'关联指标台账'
,
pageIndex
:
1
,
pageSize
:
100
,
info
:
deviceCode
,
siteFilter
:
false
,
siteLevel
:
true
,
sortFields
:
"录入时间"
})
await
Promise
.
all
([
_request0
,
_request1
,
_request2
,
_request4
]).
then
((
result
)
=>
{
if
(
result
)
{
let
_res0
=
result
[
0
];
let
_res1
=
result
[
1
];
let
_res2
=
result
[
2
];
// let _res3 = result[3];
let
_res3
=
result
[
3
];
// let _res4 = result[4];
let
_checkboxData
=
[...
checkboxData
];
// 单设备单曲线时,查询是否配置为预测点
/* if (_res
3.code === 0 && _res3
.data) {
/* if (_res
4.code === 0 && _res4
.data) {
// 1. 如果是单曲线,并且配置了预测,那么默认开启预测;
// 2024年3月11日 物联预测功能支撑后,再开发这部分
_checkboxData.push({
...
...
@@ -1524,6 +1544,12 @@ const HistoryView = (props) => {
let
_isStatusSensor
=
[
'状态值'
,
'开关值'
].
includes
(
_sensor
);
setIsSingleStatusSensor
(
_isStatusSensor
);
}
// 关联指标
if
(
_res3
.
code
===
0
)
{
let
_jsonData
=
JSON
.
parse
(
_res3
.
data
.
jsonData
);
let
allSensors
=
_jsonData
.
find
(
item
=>
item
[
'关键指标'
]
===
sensors
)?.[
'关联指标'
]?.
split
(
','
)
??
[];
setCombineSensors
([...
new
Set
([...
allSensors
,
sensors
])]);
}
}
});
setCompleteInit
(
true
);
...
...
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