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
6868f417
Commit
6868f417
authored
Jul 26, 2021
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据字典功能优化完成
parent
884921f8
Pipeline
#32074
skipped with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
37 deletions
+92
-37
WebDic.js
src/pages/dataCenter/dictionary1/WebDic.js
+91
-35
WebDic.less
src/pages/dataCenter/dictionary1/WebDic.less
+1
-2
No files found.
src/pages/dataCenter/dictionary1/WebDic.js
View file @
6868f417
...
...
@@ -94,7 +94,7 @@ const WebDic = () => {
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Tooltip
title
=
"删除"
>
<
Popconfirm
title
=
"是否
删除该数据
?"
title
=
"是否
确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除
?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
...
...
@@ -218,16 +218,71 @@ const WebDic = () => {
}
return
record
;
},
},
{
title
:
()
=>
(
<
span
className
=
{
styles
.
font
}
>
操作
<
/span>
)
,
key
:
'action'
,
width
:
100
,
align
:
'center'
,
render
:
record
=>
(
<
Space
>
<
Tooltip
title
=
"编辑"
>
<
EditTwoTone
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
if
(
record
.
parentID
===
'-1'
||
record
.
parentID
===
null
){
setEditVisible1
(
true
);
}
else
{
setEditVisible
(
true
);
}
editForm
.
setFieldsValue
({
nodeName
:
record
.
nodeName
,
nodeValue
:
record
.
nodeValue
,
});
}}
style
=
{{
fontSize
:
'16px'
}}
/
>
<
/Tooltip
>
<
div
onClick
=
{
e
=>
e
.
stopPropagation
()}
>
<
Tooltip
title
=
"删除"
>
<
Popconfirm
title
=
"是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?"
okText
=
"确认"
cancelText
=
"取消"
onConfirm
=
{
submitDelete
}
>
<
DeleteOutlined
onClick
=
{()
=>
{
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelectColor
(
record
);
}
}
}
style
=
{{
fontSize
:
'16px'
,
margin
:
'0px 10px'
,
color
:
'#e86060'
,
}}
/
>
<
/Popconfirm
>
<
/Tooltip
>
<
/div
>
<
/Space
>
),
}
]
const
setRowClassName
=
record
=>
{
return
record
.
nodeID
===
selectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
}
const
setRowClassName1
=
record
=>
{
return
record
.
nodeID
===
twoSelectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
}
const
setRowClassName
=
record
=>
{
return
record
.
nodeID
===
selectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
}
const
setRowClassName1
=
record
=>
{
return
record
.
nodeID
===
twoSelectColor
.
nodeID
?
styles
.
clickRowStyle
:
''
;
}
// 获取搜索框的值
const
handleSearch
=
e
=>
{
...
...
@@ -239,10 +294,11 @@ const WebDic = () => {
},
[
flag
]);
// 根据父节点nodeID(即parentID)获取子节点数据,一级条目parentID = -1
const
getData
=
value
=>
{
console
.
log
(
value
);
isLoadingShow
(
value
,
true
)
GetDataDictionaryList
({
nodeID
:
value
}).
then
(
resnew
=>
{
if
(
resnew
.
code
===
0
)
{
if
(
resnew
.
data
.
length
>
0
)
{
//
if (resnew.data.length > 0) {
let
res
=
resnew
.
data
;
if
(
res
.
length
>
0
)
{
res
.
map
(
item
=>
{
...
...
@@ -262,12 +318,14 @@ const WebDic = () => {
getData
(
res
[
0
].
nodeID
);
//拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
}
}
else
if
(
value
)
{
console
.
log
(
res
);
setSubData
(
res
);
//设置二级条目,res为空[]时也要设置
}
isLoadingShow
(
value
,
false
)
}
else
{
isLoadingShow
(
value
,
false
)
}
// } else {
// console.log(3)
// isLoadingShow(value, false)
// }
}
else
{
isLoadingShow
(
value
,
false
)
notification
.
error
({
...
...
@@ -364,23 +422,19 @@ const WebDic = () => {
let
result
=
nodeName1
.
users
if
(
result
)
{
result
.
map
((
item
,
index
)
=>
{
arr
.
push
({
nodeName
:
item
.
nodeName
,
nodeValue
:
item
.
nodeValue
,
parentID
:
Number
(
value
)
})
if
(
item
===
undefined
){
}
else
{
arr
.
push
({
nodeName
:
item
.
nodeName
,
nodeValue
:
item
.
nodeValue
,
parentID
:
Number
(
value
)
})
}
})
}
arr
.
unshift
({
nodeName
,
nodeValue
,
parentID
:
Number
(
value
)
})
AddDataDictionaryList
([...
arr
]).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setAddVisible
(
false
);
if
(
level
===
1
)
{
getData
(
null
);
getData
(
res
.
msg
);
// res.message为添加成功返回的一级条目ID
// 设置添加二级条目的父级ID及父级ID选中状态
setSelect
({
nodeID
:
res
.
msg
,
parentID
:
'-1'
});
setSelectID
(
res
.
msg
);
setSelectColor
({
nodeID
:
res
.
msg
});
}
else
{
getData
(
value
);
}
notification
.
success
({
message
:
'提交成功'
,
});
...
...
@@ -391,6 +445,7 @@ const WebDic = () => {
});
}
})
}
}
//添加一级条目
...
...
@@ -401,18 +456,16 @@ const WebDic = () => {
nodeName
:
nodeName
,
nodeValue
:
'null'
,
}).
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
console
.
log
(
res
.
msg
)
if
(
res
.
code
===
0
)
{
setAddVisible1
(
false
);
if
(
level
===
1
)
{
getData
(
null
);
getData
(
res
.
msg
);
// res.message为添加成功返回的一级条目ID
// 设置添加二级条目的父级ID及父级ID选中状态
setSelect
({
nodeID
:
res
.
msg
,
parentID
:
'-1'
});
setSelectID
(
res
.
msg
);
setSelectColor
({
nodeID
:
res
.
msg
});
}
else
{
getData
(
value
);
}
getData
(
null
);
setSubData
(
res
.
msg
);
// res.message为添加成功返回的一级条目ID
// // 设置添加二级条目的父级ID及父级ID选中状态
setSelect
({
nodeID
:
res
.
msg
,
parentID
:
'-1'
});
setSelectID
(
res
.
msg
);
setSelectColor
({
nodeID
:
res
.
msg
});
notification
.
success
({
message
:
'提交成功'
,
});
...
...
@@ -441,6 +494,7 @@ const WebDic = () => {
notification
.
success
({
message
:
'提交成功'
,
});
sumbitSearch
()
}
else
{
notification
.
error
({
message
:
'提交失败'
,
...
...
@@ -469,6 +523,7 @@ const WebDic = () => {
notification
.
success
({
message
:
'提交成功'
,
});
sumbitSearch
()
}
else
{
notification
.
error
({
message
:
'提交失败'
,
...
...
@@ -489,6 +544,7 @@ const WebDic = () => {
nodeID
:
select
.
nodeID
,
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
sumbitSearch
()
getData
(
select
.
parentID
===
'-1'
?
null
:
select
.
parentID
);
if
(
select
.
parentID
===
'-1'
)
{
setSubData
([]);
...
...
@@ -555,7 +611,7 @@ const WebDic = () => {
<
SearchOutlined
onClick
=
{()
=>
onSearch
()}
/><span style={{ verticalAlign: 'middle', marginLeft: '6px', marginRight: "40px", cursor: "pointer" }} onClick={
()
=> onSearch
()
}>查找条目</
span
>
<
/span
>
<
span
>
<
DownloadOutlined
/><
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
"40px"
,
cursor
:
"pointer"
}}
><
a
style
=
{{
color
:
'rgba(0, 0, 0, 0.85)'
}}
href
=
"/PandaOMS/OMS/DataManger/ExportDataDictionary"
>
导出数据
<
/a></
span
>
<
DownloadOutlined
/><
span
style
=
{{
verticalAlign
:
'middle'
,
marginLeft
:
'6px'
,
marginRight
:
"40px"
,
cursor
:
"pointer"
}}
><
a
style
=
{{
color
:
'rgba(0, 0, 0, 0.85)'
}}
href
=
"/PandaOMS/OMS/DataManger/ExportDataDictionary"
>
导出数据
<
/a></
span
>
<
/span
>
<
span
>
...
...
@@ -607,7 +663,7 @@ const WebDic = () => {
<
Table
size
=
"small"
bordered
columns
=
{
columns1
}
className
=
{
styles
.
tab
}
dataSource
=
{
subData
}
...
...
src/pages/dataCenter/dictionary1/WebDic.less
View file @
6868f417
...
...
@@ -40,6 +40,6 @@
}
.ant-table-wrapper {
max-width: 98%;
margin-left: 2%;
}
}
\ No newline at end of file
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