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
3f662052
Commit
3f662052
authored
Jul 19, 2023
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完善移动端适配
parent
6a5da773
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
115 additions
and
55 deletions
+115
-55
package.json
package.json
+2
-1
package.json
packages/extend-components/EC_HistoryView/package.json
+2
-1
EC_HistoryView.md
...es/extend-components/EC_HistoryView/src/EC_HistoryView.md
+5
-1
SingleChart.js
packages/extend-components/EC_HistoryView/src/SingleChart.js
+1
-1
index.js
packages/extend-components/EC_HistoryView/src/demos/index.js
+1
-3
mobile.js
...ages/extend-components/EC_HistoryView/src/demos/mobile.js
+29
-0
index.less
packages/extend-components/EC_HistoryView/src/index.less
+6
-0
mobile.js
packages/extend-components/EC_HistoryView/src/mobile.js
+69
-48
utils.js
packages/extend-components/EC_HistoryView/src/utils.js
+0
-0
No files found.
package.json
View file @
3f662052
...
@@ -146,6 +146,7 @@
...
@@ -146,6 +146,7 @@
},
},
"dependencies"
:
{
"dependencies"
:
{
"
@babel/plugin-proposal-private-methods
"
:
"^7.18.6"
,
"
@babel/plugin-proposal-private-methods
"
:
"^7.18.6"
,
"
@wisdom-components/VmsVideo
"
:
"1.1.13"
,
"
@wisdom-components/basictable
"
:
"^1.5.14"
,
"
@wisdom-components/basictable
"
:
"^1.5.14"
,
"
@wisdom-components/ec_historyview
"
:
"^1.4.3"
,
"
@wisdom-components/ec_historyview
"
:
"^1.4.3"
,
"
@wisdom-components/empty
"
:
"^1.3.9"
,
"
@wisdom-components/empty
"
:
"^1.3.9"
,
...
@@ -153,8 +154,8 @@
...
@@ -153,8 +154,8 @@
"
@wisdom-components/loadbox
"
:
"1.1.4"
,
"
@wisdom-components/loadbox
"
:
"1.1.4"
,
"
@wisdom-components/timerangepicker
"
:
"^1.3.4"
,
"
@wisdom-components/timerangepicker
"
:
"^1.3.4"
,
"
@wisdom-components/videoslidermodal
"
:
"1.1.2"
,
"
@wisdom-components/videoslidermodal
"
:
"1.1.2"
,
"
@wisdom-components/VmsVideo
"
:
"1.1.13"
,
"
@wisdom-utils/utils
"
:
"0.0.46"
,
"
@wisdom-utils/utils
"
:
"0.0.46"
,
"
antd-mobile
"
:
"5.10.4"
,
"
classnames
"
:
"^2.2.6"
,
"
classnames
"
:
"^2.2.6"
,
"
cross-spawn
"
:
"^7.0.3"
,
"
cross-spawn
"
:
"^7.0.3"
,
"
echarts
"
:
"^5.4.0"
,
"
echarts
"
:
"^5.4.0"
,
...
...
packages/extend-components/EC_HistoryView/package.json
View file @
3f662052
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
"test"
:
"echo
\"
Error: run tests from root
\"
&& exit 1"
"test"
:
"echo
\"
Error: run tests from root
\"
&& exit 1"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@babel/runtime"
:
"^7.17.9"
"@babel/runtime"
:
"^7.17.9"
,
"antd-mobile"
:
"5.10.4"
}
}
}
}
packages/extend-components/EC_HistoryView/src/EC_HistoryView.md
View file @
3f662052
...
@@ -24,9 +24,13 @@ path: /
...
@@ -24,9 +24,13 @@ path: /
<code
src=
"./demos/index.js"
>
<code
src=
"./demos/index.js"
>
## 移动端
<code
src=
"./demos/mobile.js"
>
## 多图表
## 多图表
<code
src=
"./demos/GridDemo.js"
>
[
//
]:
#
(<code src="./demos/GridDemo.js">)
## API
## API
...
...
packages/extend-components/EC_HistoryView/src/SingleChart.js
View file @
3f662052
...
@@ -32,7 +32,7 @@ const SimgleChart = memo((props) => {
...
@@ -32,7 +32,7 @@ const SimgleChart = memo((props) => {
showBoxOption
,
showBoxOption
,
};
};
return
optionGenerator
(
dataSource
,
null
,
contrast
,
contrastOption
,
smooth
,
config
);
return
optionGenerator
(
dataSource
,
null
,
contrast
,
contrastOption
,
smooth
,
config
);
},
[
dataSource
,
smooth
,
curveCenter
]);
},
[
dataSource
,
smooth
,
curveCenter
,
chartType
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
chartRef
.
current
?.
resize
?.();
chartRef
.
current
?.
resize
?.();
...
...
packages/extend-components/EC_HistoryView/src/demos/index.js
View file @
3f662052
...
@@ -13,6 +13,7 @@ const deviceParams = [
...
@@ -13,6 +13,7 @@ const deviceParams = [
// deviceCode: 'EGBF00000002',
// deviceCode: 'EGBF00000002',
// deviceCode: 'EGBF00000018',
// deviceCode: 'EGBF00000018',
deviceCode
:
'XMYL00000345'
,
deviceCode
:
'XMYL00000345'
,
// deviceCode: 'XMYL00000000',
// deviceCode: 'EGBF00000014',
// deviceCode: 'EGBF00000014',
// sensors: '今日供水量,今日用电量,1#水箱液位,是否在线',
// sensors: '今日供水量,今日用电量,1#水箱液位,是否在线',
sensors
:
'进水压力'
,
sensors
:
'进水压力'
,
...
@@ -32,9 +33,6 @@ const Demo = () => {
...
@@ -32,9 +33,6 @@ const Demo = () => {
<
div
style
=
{{
height
:
700
}}
>
<
div
style
=
{{
height
:
700
}}
>
<
HistoryView
deviceParams
=
{
deviceParams
}
defaultModel
=
"curve"
/>
<
HistoryView
deviceParams
=
{
deviceParams
}
defaultModel
=
"curve"
/>
<
/div
>
<
/div
>
<
div
style
=
{{
height
:
300
}}
>
<
MobileHistoryChart
deviceParams
=
{
deviceParams
}
chartType
=
{
'boxChart'
}
/
>
<
/div
>
<
/div
>
<
/div
>
);
);
...
...
packages/extend-components/EC_HistoryView/src/demos/mobile.js
0 → 100644
View file @
3f662052
import
React
from
'react'
;
import
{
MobileHistoryChart
}
from
"../mobile"
;
const
deviceParams
=
[
/* {
deviceCode: 'EGBF00000141',
sensors: '今日供水量,今日用电量',
deviceType: '二供泵房',
pointAddressID: 208,
}, */
{
deviceCode
:
'EGBF00000141'
,
sensors
:
'今日供水量'
,
deviceType
:
'二供泵房'
,
pointAddressID
:
208
,
},
];
const
Demo
=
()
=>
{
return
(
<
div
>
<
div
style
=
{{
height
:
400
}}
>
<
MobileHistoryChart
deviceParams
=
{
deviceParams
}
/
>
<
/div
>
<
/div
>
);
};
export
default
Demo
;
packages/extend-components/EC_HistoryView/src/index.less
View file @
3f662052
...
@@ -199,3 +199,9 @@
...
@@ -199,3 +199,9 @@
opacity: 1;
opacity: 1;
}
}
}
}
.@{history-view}-item {
display: flex;
align-items: center;
margin-bottom: 10px;
}
packages/extend-components/EC_HistoryView/src/mobile.js
View file @
3f662052
import
React
,
{
useEffect
,
useMemo
,
useState
,
useContext
}
from
'react'
;
import
React
,
{
useEffect
,
useMemo
,
useState
,
useContext
}
from
'react'
;
import
GridChart
from
"./GridChart"
;
import
{
ConfigProvider
}
from
"antd"
;
import
{
ConfigProvider
}
from
"antd"
;
import
{
Selector
,
Checkbox
,
Space
}
from
'antd-mobile/es'
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
import
{
getDeviceAlarmScheme
,
getHistoryInfo
}
from
"./apis"
;
import
{
getDeviceAlarmScheme
,
getHistoryInfo
}
from
"./apis"
;
import
SimgleChart
from
"./SingleChart"
;
import
SimgleChart
from
"./SingleChart"
;
import
{
handlePx
}
from
"./utils"
;
import
styles
from
'./index.less'
;
// deviceAlarmSchemes 用来获取对应的 方案的最大值/最小值 标记状态
const
DATE_FORMAT
=
'YYYY-MM-DD HH:mm:ss'
;
// dataSource 获取的报警信息
// deviceParams,
// defaultDate,
// {
// deviceCode: 'XMYL00000345',
// sensors: '进水压力',
// deviceType: '熊猫压力表',
// pointAddressID: 4,
// },
//{
// "isDilute": true, // 抽稀
// "zoom": "30",// 抽稀
// "unit": "min",// 抽稀
// "ignoreOutliers": false, // 滤波
// "dateFrom": "2023-07-09 16:38:32",
// "dateTo": "2023-07-10 16:38:32",
// "acrossTables": [
// {
// "deviceCode": "XMYL00000297",
// "sensors": "进水压力,是否在线",
// "deviceType": "熊猫压力表"
// }
// ],
// "isBoxPlots": true // 箱线图
// }
const
DATE_FORMAT
=
'YYYY-MM-DD'
;
const
MobileHistoryChart
=
(
const
MobileHistoryChart
=
(
{
{
date
=
{
date
=
{
dateFrom
:
moment
().
format
(
`
${
DATE_FORMAT
}
00:00:00
`
),
dateFrom
:
moment
().
subtract
(
1
,
'days'
).
format
(
`
${
DATE_FORMAT
}
`
),
dateTo
:
moment
().
format
(
`
${
DATE_FORMAT
}
23:59:59
`
)
dateTo
:
moment
().
format
(
`
${
DATE_FORMAT
}
`
)
},
// 默认当天
},
// 默认当天
deviceParams
=
[],
// 设备参数,必传
deviceParams
=
[],
// 设备参数,必传
chartType
=
'lineChart'
,
// lineChart boxChart
chartType
=
'lineChart'
,
// lineChart boxChart
ignoreOutliers
=
true
,
// 滤波
//
ignoreOutliers = true, // 滤波
isDilute
=
true
,
// 抽稀去重
isDilute
=
true
,
// 抽稀去重
needMarkLine
=
true
,
needMarkLine
=
true
,
showBoxOption
=
true
,
// 开启箱线图配置,默认开启
showBoxOption
=
true
,
// 开启箱线图配置,默认开启
chartGrid
=
true
,
// 开启网格
chartGrid
=
true
,
// 开启网格
...
rest
}
}
)
=>
{
)
=>
{
const
[
deviceAlarmSchemes
,
setDeviceAlarmSchemes
]
=
useState
(
null
);
const
[
deviceAlarmSchemes
,
setDeviceAlarmSchemes
]
=
useState
(
null
);
const
[
chartDataSource
,
setChartDataSource
]
=
useState
(
null
);
const
[
chartDataSource
,
setChartDataSource
]
=
useState
(
null
);
const
[
options
,
setOptions
]
=
useState
({
curveCenter
:
true
,
ignoreOutliers
:
true
});
const
checkBoxOptions
=
useMemo
(()
=>
{
return
Object
.
keys
(
options
).
reduce
((
final
,
cur
)
=>
{
if
(
options
[
cur
])
final
.
push
(
cur
);
return
final
},
[]);
},
[
options
]);
const
[
lineType
,
setLineType
]
=
useState
([
chartType
]);
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
{
getPrefixCls
}
=
useContext
(
ConfigProvider
.
ConfigContext
);
const
prefixCls
=
getPrefixCls
(
'history-view'
);
const
prefixCls
=
getPrefixCls
(
'history-view'
);
const
isBoxPlots
=
const
isBoxPlots
=
...
@@ -87,7 +72,7 @@ const MobileHistoryChart = (
...
@@ -87,7 +72,7 @@ const MobileHistoryChart = (
let
_params
=
{
let
_params
=
{
...
date
,
...
date
,
isBoxPlots
,
isBoxPlots
,
ignoreOutliers
,
ignoreOutliers
:
options
.
ignoreOutliers
,
isDilute
,
isDilute
,
...
thinKey
,
...
thinKey
,
acrossTables
acrossTables
...
@@ -139,20 +124,57 @@ const MobileHistoryChart = (
...
@@ -139,20 +124,57 @@ const MobileHistoryChart = (
});
});
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
getDataSource
();
getScheme
();
getScheme
();
},
[])
},
[])
return
deviceAlarmSchemes
&&
chartDataSource
?
<
SimgleChart
useEffect
(()
=>
{
showBoxOption
=
{
showBoxOption
}
getDataSource
();
curveCenter
=
{
true
}
},
[
options
.
ignoreOutliers
])
chartGrid
=
{
chartGrid
}
return
deviceAlarmSchemes
&&
chartDataSource
?
<
div
style
=
{{}}
>
prefixCls
=
{
prefixCls
}
{
dataSource
=
{
chartDataSource
}
chartDataSource
.
length
===
1
?
<
div
className
=
{
styles
[
`
${
prefixCls
}
-item`
]}
>
chartType
=
{
isBoxPlots
?
chartType
:
null
}
<
span
style
=
{{
fontSize
:
handlePx
(
16
)}}
>
曲线形态:
<
/span
>
deviceAlarmSchemes
=
{
deviceAlarmSchemes
}
<
Selector
/> : nul
l
options
=
{[
{
label
:
'线形图'
,
value
:
'lineChart'
},
{
label
:
'箱线图'
,
value
:
'boxChart'
}
]}
defaultValue
=
{
lineType
}
onChange
=
{(
arr
,
extend
)
=>
setLineType
(
arr
)}
/
>
<
/div> : '
'
}
<
div
className
=
{
styles
[
`
${
prefixCls
}
-item`
]}
>
<
span
style
=
{{
fontSize
:
handlePx
(
16
)}}
>
曲线设置:
<
/span
>
<
Checkbox
.
Group
value
=
{
checkBoxOptions
}
onChange
=
{
val
=>
{
let
_arr
=
Object
.
keys
(
options
);
let
_options
=
_arr
.
reduce
((
final
,
cur
)
=>
{
final
[
cur
]
=
!!
val
.
includes
(
cur
);
return
final
;
},
{})
setOptions
(
_options
);
}}
>
<
Space
direction
=
'horizontal'
>
<
Checkbox
value
=
'curveCenter'
>
曲线居中
<
/Checkbox
>
<
Checkbox
value
=
'ignoreOutliers'
>
滤波
<
/Checkbox
>
<
/Space
>
<
/Checkbox.Group
>
<
/div
>
<
div
style
=
{{
height
:
rest
.
height
||
'10rem'
,
width
:
rest
.
width
||
'100%'
}}
>
<
SimgleChart
showBoxOption
=
{
showBoxOption
}
curveCenter
=
{
options
.
curveCenter
}
showGridLine
=
{
chartGrid
}
prefixCls
=
{
prefixCls
}
dataSource
=
{
chartDataSource
}
chartType
=
{
isBoxPlots
?
lineType
[
0
]
:
null
}
deviceAlarmSchemes
=
{
deviceAlarmSchemes
}
/
>
<
/div
>
<
/div> : nul
l
}
}
export
{
export
{
MobileHistoryChart
MobileHistoryChart
}
}
\ No newline at end of file
packages/extend-components/EC_HistoryView/src/utils.js
View file @
3f662052
This diff is collapsed.
Click to expand it.
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