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
730a995b
Commit
730a995b
authored
Apr 03, 2023
by
徐乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改
parent
276fe2e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
index.js
packages/extend-components/EC_QuotaSelect/src/index.js
+19
-13
No files found.
packages/extend-components/EC_QuotaSelect/src/index.js
View file @
730a995b
...
...
@@ -56,8 +56,9 @@ const QuotaSelect = ({
const
[
selectDevice
,
setSelectDevice
]
=
useState
({});
// 选中的设备
const
[
selectData
,
setSelectData
]
=
useState
([]);
// 选中的指标数据
const
[
confParams
,
setConfParams
]
=
useState
({});
const
[
search
,
setSearch
]
=
useState
(
''
);
const
fetchData
=
(
item
=
{})
=>
{
console
.
log
(
1221
,
item
)
// 请求指标列表
getQuataList
({
accountName
:
item
.
deviceType
,
...
...
@@ -67,12 +68,14 @@ const QuotaSelect = ({
const
data
=
res
.
data
.
length
>
0
?
res
.
data
.
map
((
child
)
=>
({
...
child
,
checked
:
item
.
confList
.
includes
(
child
.
sensorName
),
title
:
child
.
sensorName
,
key
:
child
.
sensorName
,
}))
...
child
,
checked
:
item
.
confList
.
includes
(
child
.
sensorName
),
title
:
child
.
sensorName
,
key
:
child
.
sensorName
,
}))
:
[];
let
k
=
data
.
find
(
function
(
a
)
{
return
a
.
isShow
==
1
});
setTargetValue
(
k
?
'emphasis'
:
'all'
);
setAllQuotaList
(
data
);
setSelectData
(
data
.
filter
((
child
)
=>
child
.
checked
));
}
else
{
...
...
@@ -132,7 +135,8 @@ const QuotaSelect = ({
if
(
targetValue
===
'emphasis'
)
{
filterEmphasisQuota
();
}
else
{
setQuotaList
(
allQuotaList
);
let
newQuotaList
=
allQuotaList
.
filter
((
item
)
=>
item
.
sensorName
.
indexOf
(
search
)
>=
0
);
setQuotaList
(
newQuotaList
);
}
},
[
allQuotaList
]);
...
...
@@ -154,7 +158,7 @@ const QuotaSelect = ({
// 过滤重点指标
const
filterEmphasisQuota
=
()
=>
{
let
newQuotaList
=
[...
allQuotaList
];
newQuotaList
=
newQuotaList
.
filter
((
item
)
=>
item
.
isShow
===
1
);
newQuotaList
=
newQuotaList
.
filter
((
item
)
=>
item
.
isShow
===
1
&&
item
.
sensorName
.
indexOf
(
search
)
>=
0
);
setQuotaList
(
newQuotaList
);
};
...
...
@@ -204,7 +208,8 @@ const QuotaSelect = ({
// 切换重点与全部
const
onRadioChange
=
(
e
)
=>
{
if
(
e
.
target
.
value
===
'all'
)
{
setQuotaList
(
allQuotaList
);
let
newQuotaList
=
allQuotaList
.
filter
((
item
)
=>
item
.
sensorName
.
indexOf
(
search
)
>=
0
);
setQuotaList
(
newQuotaList
);
}
else
{
filterEmphasisQuota
();
}
...
...
@@ -214,6 +219,7 @@ const QuotaSelect = ({
// 搜索指标
const
onSearch
=
(
e
)
=>
{
if
(
e
.
type
===
'keydown'
||
e
.
target
.
value
===
''
)
{
setSearch
(
e
.
target
.
value
);
if
(
e
.
target
.
value
!==
''
)
{
let
newQuotaList
=
[];
quotaList
.
forEach
((
item
)
=>
{
...
...
@@ -462,10 +468,10 @@ QuotaSelect.defaultProps = {
deviceList
:
[],
confList
:
[],
treeProps
:
{},
onSelect
:
()
=>
{},
onModalCancel
:
()
=>
{},
onModalOk
:
()
=>
{},
onModalClose
:
()
=>
{},
onSelect
:
()
=>
{
},
onModalCancel
:
()
=>
{
},
onModalOk
:
()
=>
{
},
onModalClose
:
()
=>
{
},
defaultSelect
:
'emphasis'
,
};
...
...
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