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
0a460799
Commit
0a460799
authored
Jul 31, 2023
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复数据返回异常导致的报错
parent
bb934b53
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
13 deletions
+35
-13
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+7
-2
index.js
packages/extend-components/EC_HistoryView/src/index.js
+2
-1
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+26
-10
No files found.
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
0a460799
...
...
@@ -9,7 +9,7 @@ const deviceParams = [
// deviceType: '二供泵房',
// pointAddressID: 4,
// },
{
/*
{
// deviceCode: 'EGBF00000002',
// deviceCode: 'EGBF00000018',
deviceCode: 'XMYL00000345',
...
...
@@ -19,13 +19,18 @@ const deviceParams = [
sensors: '进水压力',
deviceType: '熊猫压力表',
pointAddressID: 4,
},
},
*/
// {
// deviceCode: 'EGJZ00001113',
// sensors: '出水压力',
// deviceType: '二供机组',
// pointAddressID: 4,
// },
{
"deviceCode"
:
"EGJZ00000163"
,
"sensors"
:
"进水压力,是否在线"
,
"deviceType"
:
"二供机组"
}
];
const
Demo
=
()
=>
{
return
(
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
0a460799
...
...
@@ -739,6 +739,7 @@ const HistoryView = (props) => {
setLoading(true);
Promise.all(requestArr).then((results) => {
if (results.length) {
debugger
let data = [];
results.forEach((res, index) => {
const {dateFrom, dateTo} = dateRange?.[index] ?? {};
...
...
@@ -761,7 +762,7 @@ const HistoryView = (props) => {
} else {
return {};
}
});
})
.filter(item => item.sensorName)
;
data = data.concat(list);
});
}
...
...
packages/extend-components/EC_HistoryView/src/utils.js
View file @
0a460799
...
...
@@ -281,6 +281,29 @@ export const offlineArea = (dataItem) => {
data
:
datas
,
};
};
export
const
buildDefaultLegend
=
(
option
)
=>
{
const
{
title
}
=
option
;
let
paddingRight
=
0
;
if
(
title
&&
title
.
show
)
paddingRight
=
80
;
// 给标题留够空间
return
{
show
:
true
,
right
:
20
,
top
:
20
,
icon
:
'rect'
,
itemWidth
:
14
,
itemHeight
:
8
,
itemGap
:
20
,
padding
:
[
0
,
0
,
0
,
paddingRight
],
textStyle
:
{
padding
:
[
0
,
0
,
0
,
4
],
color
:
'#2d2d2d'
,
},
};
};
const
headTemplate
=
(
param
)
=>
{
if
(
!
param
)
return
''
;
const
{
name
,
axisValueLabel
,
axisType
,
axisValue
}
=
param
;
...
...
@@ -540,16 +563,7 @@ const assignOptions = (restOption, xAxis, legendData) => {
];
xAxis.minInterval = 3600 * (1 * 1000);
if (legendData) {
restOption.legend = {
// orient: 'vertical',
data: legendData,
itemGap: 10,
padding: [0, 0, 0, 200],
textStyle: {
width: 120,
overflow: 'truncate',
},
}
restOption.legend = {...buildDefaultLegend({}), ...{data: legendData}};
}
};
/**
...
...
@@ -615,6 +629,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
let unit = '';
series = series.map((item) => {
if (item.unit) unit = item.unit;
item.areaStyle = null;
return {...item, symbol: 'none'};
});
series.push({
...
...
@@ -653,6 +668,7 @@ const optionGenerator = (dataSource, cusOption, contrast, contrastOption, smooth
let _unit = '';
series = series.map((item) => {
_unit = item.unit;
item.areaStyle = null;
return {...item, symbol: 'none'};
});
[[..._minData], [..._maxData]].forEach((item, index) => {
...
...
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