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
be2cfc13
Commit
be2cfc13
authored
Oct 10, 2023
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 历史曲线提供源数据下载和特征数据下载
parent
690358c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
13 deletions
+60
-13
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+3
-3
index.js
packages/extend-components/EC_HistoryView/src/index.js
+55
-8
index.less
packages/extend-components/EC_HistoryView/src/index.less
+2
-2
No files found.
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
be2cfc13
...
...
@@ -4,12 +4,12 @@ import { MobileHistoryChart } from "../mobile";
const
deviceParams
=
[
/*10.182*/
/*
{
{
"deviceCode"
:
"EGBF00000136"
,
"sensors": "进水压力,出水瞬时流量,今日供水量,1#水箱液位,视频报警",
"sensors"
:
"进水压力,出水
压力,出水
瞬时流量,今日供水量,1#水箱液位,视频报警"
,
// "sensors": "视频报警",
"deviceType"
:
"二供泵房"
},
*/
},
{
"deviceCode"
:
"EGJZ00000158"
,
// "sensors": "进水压力,出水压力,泵1状态",
...
...
packages/extend-components/EC_HistoryView/src/index.js
View file @
be2cfc13
...
...
@@ -35,7 +35,8 @@ import SingleChart from './SingleChart';
import
GridChart
from
'./GridChart'
;
import
'./index.less'
;
import
{
globalConfig
}
from
'antd/lib/config-provider'
;
import
{
getSensorType
}
from
"@wisdom-components/ec_realtimeinfo/es/apis"
;
import
{
getSensorType
}
from
"./apis/index"
;
import
{
ExportExcel
}
from
'@wisdom-components/exportexcel'
;
const
{
RangePicker
}
=
DatePicker
;
const
{
Option
}
=
Select
;
...
...
@@ -777,6 +778,7 @@ const HistoryView = (props) => {
};
const
exportExcelBtn
=
()
=>
{
message
.
info
(
'报表生成中,请稍后~'
);
deviceParams
.
forEach
((
i
,
r
)
=>
{
let
timeFrom
=
dateRange
[
r
]?.
dateFrom
||
moment
().
format
(
startFormat
);
let
timeTo
=
dateRange
[
r
]?.
dateTo
||
moment
().
format
(
timeFormat
);
...
...
@@ -804,7 +806,46 @@ const HistoryView = (props) => {
});
});
};
const exportFeatureBtn = () => {
message.info('报表生成中,请稍后~');
let _dataSource = tableData.sort((a, b) => {
let _a = a.time;
let _b = b.time
if (timeValue === 'contrast') {
if (contrastOption === 'day') {
_a = `
2000
-
01
-
01
$
{
a
.
time
}:
00
`;
_b = `
2000
-
01
-
01
$
{
b
.
time
}:
00
`;
}
if (contrastOption === 'month') {
_a = `
2000
-
01
-
$
{
a
.
time
}
:00`
;
_b
=
`2000-01-
${
b
.
time
}
:00`
;
}
}
return
timeOrder
===
'ascend'
?
moment
(
_a
)
-
moment
(
_b
)
:
moment
(
_b
)
-
moment
(
_a
);
})
let
_columns
=
columns
;
let
timeFrom
=
dateRange
?.[
0
]?.
dateFrom
||
moment
().
format
(
startFormat
);
let
timeTo
=
dateRange
?.[
0
]?.
dateTo
||
moment
().
format
(
timeFormat
);
let
fileName
=
`特征数据-
${
moment
(
timeFrom
).
format
(
dateFormat
,
)}
至
${
moment
(
timeTo
).
format
(
dateFormat
)}
`
;
let
_dataIndex
=
[];
let
_titleWidth
=
[];
let
_title
=
_columns
.
map
(
item
=>
{
_dataIndex
.
push
(
item
.
dataIndex
);
_titleWidth
.
push
(
item
.
title
.
length
*
1
);
return
item
.
title
;
});
ExportExcel
({
name
:
fileName
,
content
:
[{
sheetData
:
_dataSource
,
sheetFilter
:
_dataIndex
,
sheetHeader
:
_title
,
columnWidths
:
_titleWidth
}]
})
};
const
handleTableData
=
useCallback
((
data
)
=>
{
// eslint-disable-next-line no-param-reassign
// data = data.filter(item => item.sensorName !== '是否在线');
...
...
@@ -1236,7 +1277,7 @@ const HistoryView = (props) => {
// 标记sensor是什么类型的
if
(
_res2
.
code
===
0
)
{
setAllSensorType
(
_res2
.
data
);
let
_sensorID
=
_res1
.
data
?.
find
(
item
=>
item
.
name
===
sensors
)?.
sensorTypeID
;
let
_sensor
=
_res2
.
data
?.
find
(
item
=>
item
.
id
===
_sensorID
)?.
type
;
let
_isStatusSensor
=
[
'状态值'
,
'开关值'
].
includes
(
_sensor
);
...
...
@@ -1248,7 +1289,7 @@ const HistoryView = (props) => {
};
useEffect
(()
=>
{
getDefaultOptions
();
},
[])
},
[
deviceParams
])
let
percentTimer
=
useRef
({
timer
:
null
});
...
...
@@ -1301,10 +1342,16 @@ const HistoryView = (props) => {
right
:
(
<
div
className
=
{
`
${
prefixCls
}
-extra-right`
}
>
{
activeTabKey
===
'table'
&&
(
<
Button
type
=
"link"
onClick
=
{
exportExcelBtn
}
>
<
DownloadOutlined
/>
下载
<
/Button
>
<>
<
Button
type
=
"link"
onClick
=
{
exportFeatureBtn
}
>
<
DownloadOutlined
/>
特征数据
<
/Button
>
<
Button
type
=
"link"
onClick
=
{
exportExcelBtn
}
>
<
DownloadOutlined
/>
原始数据
<
/Button
>
<
/
>
)}
<
/div
>
),
...
...
packages/extend-components/EC_HistoryView/src/index.less
View file @
be2cfc13
...
...
@@ -26,8 +26,8 @@
&-extra-right {
position: absolute;
top: 10px;
right:
4
0px;
width: 82px;
right:
2
0px;
//
width: 82px;
}
.@{history-view}-spin,
...
...
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