Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
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
CivManage
Commits
52c711ef
Commit
52c711ef
authored
Nov 17, 2021
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加数据字典模糊查询高亮
parent
c132f305
Pipeline
#38083
passed with stages
in 26 minutes 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
WebDic.js
src/pages/dataCenter/dictionary1/WebDic.js
+20
-0
No files found.
src/pages/dataCenter/dictionary1/WebDic.js
View file @
52c711ef
...
...
@@ -50,6 +50,7 @@ const WebDic = () => {
const
[
flag1
,
setFlag1
]
=
useState
(
0
);
//搜索框数据是否刷新
const
[
isloading
,
setIsloading
]
=
useState
(
false
)
const
history
=
useHistory
();
const
[
showSearchStyle
,
setShowSearchStyle
]
=
useState
(
false
);
// 是否显示模糊查询样式
const
[
InPutVisible
,
setInPutVisible
]
=
useState
(
false
);
...
...
@@ -70,6 +71,7 @@ const WebDic = () => {
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
名称
<
/span>
)
,
dataIndex
:
'nodeName'
,
key
:
'nodeName'
,
render
:
item
=>
searchStyle
(
item
),
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
操作
<
/span>
)
,
...
...
@@ -281,6 +283,21 @@ const WebDic = () => {
}
]
// 模糊查询匹配的样式
const
searchStyle
=
val
=>
{
let
n
;
if
(
showSearchStyle
)
{
n
=
val
.
replace
(
new
RegExp
(
searchWord
,
'g'
),
`<span style='color:red'>
${
searchWord
}
</span>`
,
);
}
else
{
n
=
val
;
}
console
.
log
(
n
)
return
<
div
dangerouslySetInnerHTML
=
{{
__html
:
n
}}
/>
;
};
const
setRowClassName
=
record
=>
{
return
record
.
nodeID
===
selectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
}
...
...
@@ -633,6 +650,7 @@ const WebDic = () => {
const
submitSearchUser
=
()
=>
{
SearchDataDictionaryList
({
key
:
searchWord
,
type
:
1
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setShowSearchStyle
(
true
);
if
(
res
.
data
.
length
==
0
)
{
setData
(
res
.
data
)
setSubData
([])
...
...
@@ -670,9 +688,11 @@ const WebDic = () => {
setSelectColor
(
res
[
0
]);
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
getData
(
res
[
0
].
nodeID
);
//拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
setShowSearchStyle
(
false
);
}
setLoading
(
false
)
setIsloading
(
false
)
});
}
...
...
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