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
9a81636f
Commit
9a81636f
authored
Dec 20, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改指标选择器服务
parent
44d5d6c8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
18 deletions
+47
-18
index.js
packages/extend-components/EC_QuotaSelect/src/apis/index.js
+35
-0
Basic.tsx
...ages/extend-components/EC_QuotaSelect/src/demos/Basic.tsx
+3
-5
index.js
packages/extend-components/EC_QuotaSelect/src/index.js
+9
-13
No files found.
packages/extend-components/EC_QuotaSelect/src/apis/index.js
0 → 100644
View file @
9a81636f
import
{
request
}
from
'@wisdom-utils/utils'
;
const
REQUEST_METHOD_GET
=
'get'
;
const
REQUEST_METHOD_POST
=
'post'
;
// eslint-disable-next-line no-undef
const
baseUrl
=
typeof
DUMI_TYPE
!==
'undefined'
&&
DUMI_TYPE
===
'dumi'
?
'/api'
:
''
;
const
MonitorUrl
=
`/PandaMonitor/Monitor`
;
// 查询设备指标
export
function
getQuataList
(
params
)
{
return
request
({
url
:
`
${
MonitorUrl
}
/Device/GetQutaList`
,
method
:
REQUEST_METHOD_GET
,
params
,
});
}
// 设备监控展示
export
function
getMonitorConf
(
params
)
{
return
request
({
url
:
`
${
MonitorUrl
}
/MonitorConfig/GetMonitorConf`
,
method
:
REQUEST_METHOD_GET
,
params
,
});
}
// 设备监控展示
export
function
updateMonitorConf
(
data
)
{
return
request
({
url
:
`
${
MonitorUrl
}
/MonitorConfig/AddOrUpdateMonitorConf`
,
method
:
REQUEST_METHOD_POST
,
data
,
});
}
packages/extend-components/EC_QuotaSelect/src/demos/Basic.tsx
View file @
9a81636f
...
...
@@ -4,6 +4,7 @@ import request from 'umi-request';
import
{
UnorderedListOutlined
,
SearchOutlined
}
from
'@ant-design/icons'
;
import
PandaQuotaSelect
from
'../index'
;
import
{
service
}
from
'@wisdom-utils/utils'
;
import
{
getMonitorConf
}
from
'../apis'
;
const
REQUEST_HTTP
=
'http'
;
const
REQUEST_METHOD_GET
=
'get'
;
...
...
@@ -42,7 +43,7 @@ const quotaSelectService = {
const
qsService
=
service
(
quotaSelectService
);
const
getQuotaList
=
qsService
.
getQuotaList
;
const
getDeviceConf
=
qsService
.
getDevice
Conf
;
const
getDeviceConf
=
getMonitor
Conf
;
const
updateDeviceConfService
=
qsService
.
updateDeviceConfService
;
const
pointType
=
'cardPoints'
;
...
...
@@ -107,7 +108,6 @@ const Demo = () => {
buttonProps=
{
{}
}
// defaultSelect={'all'}
deviceList=
{
deviceList
}
quotaListService=
{
getQuotaList
}
pointType=
{
pointType
}
onSelect=
{
onSelect
}
// onModalCancel={onModalCancel}
...
...
@@ -120,8 +120,6 @@ const Demo = () => {
<
PandaQuotaSelect
buttonProps=
{
{}
}
deviceList=
{
deviceList
}
quotaListService=
{
getQuotaList
}
updateDeviceConfService=
{
updateDeviceConfService
}
confList=
{
confList
}
pointType=
{
pointType
}
onSelect=
{
onSelect
}
...
...
@@ -129,7 +127,7 @@ const Demo = () => {
onModalOk=
{
onModalOk
}
onModalClose=
{
onModalClose
}
maximum=
{
5
}
user=
{
'
user
'
}
user=
{
'
admin
'
}
/>
</>
);
...
...
packages/extend-components/EC_QuotaSelect/src/index.js
View file @
9a81636f
...
...
@@ -21,14 +21,13 @@ import {
CloseOutlined
,
}
from
'@ant-design/icons'
;
import
'./index.less'
;
import
{
getQuataList
,
updateMonitorConf
}
from
'./apis'
;
const
{
TreeNode
}
=
Tree
;
const
QuotaSelect
=
({
buttonProps
,
deviceList
,
quotaListService
,
updateDeviceConfService
,
confList
,
onSelect
,
pointType
,
...
...
@@ -60,7 +59,7 @@ const QuotaSelect = ({
const
fetchData
=
(
item
=
{})
=>
{
// 请求指标列表
quotaListService
({
getQuataList
({
accountName
:
item
.
deviceType
,
addrSchemeID
:
item
.
pointAddressID
,
}).
then
((
res
)
=>
{
...
...
@@ -69,9 +68,9 @@ const QuotaSelect = ({
res
.
data
.
length
>
0
?
res
.
data
.
map
((
child
)
=>
({
...
child
,
checked
:
item
.
confList
.
includes
(
child
.
n
ame
),
title
:
child
.
n
ame
,
key
:
child
.
n
ame
,
checked
:
item
.
confList
.
includes
(
child
.
sensorN
ame
),
title
:
child
.
sensorN
ame
,
key
:
child
.
sensorN
ame
,
}))
:
[];
setAllQuotaList
(
data
);
...
...
@@ -92,7 +91,8 @@ const QuotaSelect = ({
const
curSelectList
=
JSON
.
parse
(
JSON
.
stringify
(
selectData
));
const
curSelectKey
=
curSelectList
.
map
((
child
)
=>
child
.
key
);
params
[
pointType
]
=
curSelectKey
.
join
(
','
);
updateDeviceConfService
(
params
).
then
((
response
)
=>
{
console
.
log
(
params
);
updateMonitorConf
(
params
).
then
((
response
)
=>
{
if
(
response
.
code
===
0
)
{
message
.
success
(
'保存成功'
);
}
else
{
...
...
@@ -218,8 +218,8 @@ const QuotaSelect = ({
if
(
e
.
target
.
value
!==
''
)
{
let
newQuotaList
=
[];
quotaList
.
forEach
((
item
)
=>
{
if
(
!
item
.
n
ame
)
return
;
if
(
item
.
n
ame
.
indexOf
(
e
.
target
.
value
)
>
-
1
)
newQuotaList
.
push
(
item
);
if
(
!
item
.
sensorN
ame
)
return
;
if
(
item
.
sensorN
ame
.
indexOf
(
e
.
target
.
value
)
>
-
1
)
newQuotaList
.
push
(
item
);
});
setQuotaList
(
newQuotaList
);
}
else
{
...
...
@@ -463,8 +463,6 @@ QuotaSelect.defaultProps = {
deviceList
:
[],
confList
:
[],
treeProps
:
{},
quotaListService
:
()
=>
{},
updateDeviceConfService
:
()
=>
{},
onSelect
:
()
=>
{},
onModalCancel
:
()
=>
{},
onModalOk
:
()
=>
{},
...
...
@@ -486,8 +484,6 @@ QuotaSelect.propTypes = {
deviceList
:
PropTypes
.
array
,
confList
:
PropTypes
.
array
,
treeProps
:
PropTypes
.
object
,
quotaListService
:
PropTypes
.
func
,
updateDeviceConfService
:
PropTypes
.
func
,
onSelect
:
PropTypes
.
func
,
onModalCancel
:
PropTypes
.
func
,
onModalOk
:
PropTypes
.
func
,
...
...
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