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
61e4e69a
Commit
61e4e69a
authored
Nov 30, 2020
by
陈前坚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: dictionary
parent
056df20a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
100 deletions
+116
-100
index.less
src/pages/log/serviceLog/index.less
+1
-1
WebDic.js
src/pages/platformCenter/dictionary/WebDic.js
+112
-93
WebDic.less
src/pages/platformCenter/dictionary/WebDic.less
+2
-5
index.js
src/pages/platformCenter/dictionary/index.js
+1
-1
No files found.
src/pages/log/serviceLog/index.less
View file @
61e4e69a
...
...
@@ -17,7 +17,7 @@
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh - 5
0
0px);
height:calc(100vh - 5
2
0px);
border-right: white;
overflow: auto !important;
}
...
...
src/pages/platformCenter/dictionary/WebDic.js
View file @
61e4e69a
...
...
@@ -10,19 +10,23 @@ import {
Popconfirm
,
notification
,
message
,
Row
,
Col
,
}
from
'antd'
;
import
{
get
}
from
'@/services/index'
;
import
styles
from
'./WebDic.less'
;
const
WebDic
=
()
=>
{
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
level
,
setLevel
]
=
useState
(
1
);
const
[
level
,
setLevel
]
=
useState
(
0
);
// 设置基本,一级1,二级2
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
const
[
editVisible
,
setEditVisible
]
=
useState
(
false
);
const
[
data
,
setData
]
=
useState
([]);
// 一级条目
const
[
subData
,
setSubData
]
=
useState
([]);
// 二级条目
const
[
select
,
setSelect
]
=
useState
({});
// 当前选中条目,可以是一级/二级条目,修改/删除时设置
const
[
selectID
,
setSelectID
]
=
useState
(
'-1'
);
// 当前选中一级条目的ID,添加条目时使用
const
[
select
,
setSelect
]
=
useState
({});
// 当前选中一级条目,修改/删除时设置
const
[
subSelect
,
setSubSelect
]
=
useState
({});
// 当前选中二级条目,修改/删除时设置
const
[
selectID
,
setSelectID
]
=
useState
(
'-1'
);
// 当前选中一级条目的ID,添加二级条目时使用
const
[
first
,
setFirst
]
=
useState
(
true
);
// 是否第一次加载
const
[
addForm
]
=
Form
.
useForm
();
const
[
editForm
]
=
Form
.
useForm
();
...
...
@@ -31,7 +35,7 @@ const WebDic = () => {
title
:
'名称'
,
dataIndex
:
'nodeName'
,
key
:
'nodeName'
,
width
:
30
0
,
width
:
22
0
,
},
{
title
:
'值'
,
...
...
@@ -47,7 +51,7 @@ const WebDic = () => {
{
title
:
'操作'
,
key
:
'action'
,
width
:
20
0
,
width
:
13
0
,
render
:
record
=>
(
<
Space
>
<
Button
...
...
@@ -55,10 +59,14 @@ const WebDic = () => {
size
=
"small"
onClick
=
{
e
=>
{
e
.
stopPropagation
();
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelect
(
record
);
}
else
{
setSubSelect
(
record
);
}
setEditVisible
(
true
);
editForm
.
setFieldsValue
({
nodeName
:
record
.
nodeName
,
nodeName
1
:
record
.
nodeName
,
nodeValue
:
record
.
nodeValue
,
});
}}
...
...
@@ -76,7 +84,11 @@ const WebDic = () => {
danger
onClick
=
{
e
=>
{
e
.
stopPropagation
();
setSelect
(
record
);
if
(
record
.
parentID
===
'-1'
)
{
setSelect
(
record
);
}
else
{
setSubSelect
(
record
);
}
}}
>
删除
...
...
@@ -109,16 +121,26 @@ const WebDic = () => {
}
// value为 -1 时获取一级条目数据,否则获取二级条目数据
if
(
value
===
'-1'
)
{
setData
(
res
);
// 设置一级条目
setSelect
(
res
[
0
]);
// 默认当前选中一级条目第一条
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
setData
(
res
);
// 设置一级条目数据
if
(
first
)
{
setSelect
(
res
[
0
]);
// 默认当前选中一级条目第一条
setSelectID
(
res
[
0
].
nodeID
);
// 设置选中的一级条目ID,用于添加二级条目
// setSelectColor(res[0]);
setFirst
(
false
);
// 获取二级条目数据,默认一级条目第一条,递归一次(条件parentID === '-1')
if
(
res
[
0
]
&&
res
[
0
].
parentID
===
'-1'
)
{
getData
(
res
[
0
].
nodeID
);
}
}
// if (level === 0) {
// setSelect(res[0]); // 默认当前选中一级条目第一条
// setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
// } else if (level === 1) {
// setSelect({ nodeID: value2 });
// }
}
else
if
(
value
)
{
setSubData
(
res
);
// 设置二级条目,res为空[]时也要设置
}
// 获取二级条目数据,默认一级条目第一条,递归一次(条件parentID === '-1')
if
(
res
&&
res
[
0
]
&&
res
[
0
].
parentID
===
'-1'
)
{
getData
(
res
[
0
].
nodeID
);
}
}
else
{
notification
.
error
({
message
:
'获取失败'
,
...
...
@@ -137,14 +159,14 @@ const WebDic = () => {
// 提交-添加
const
submitAdd
=
value
=>
{
const
nodeName
=
addForm
.
getFieldValue
(
'nodeName
'
);
const
nodeName
1
=
addForm
.
getFieldValue
(
'nodeName1
'
);
const
nodeValue
=
addForm
.
getFieldValue
(
'nodeValue'
);
if
(
nodeName
)
{
if
(
nodeName
1
)
{
get
(
`/Cityinterface/rest/services/OMS.svc/D_AddDataDictionary`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
nodeID
:
value
,
nodeName
,
nodeName
:
nodeName1
,
nodeValue
,
})
.
then
(
res
=>
{
...
...
@@ -175,16 +197,22 @@ const WebDic = () => {
});
}
};
// 提交-
编辑
// 提交-
修改
const
submitEdit
=
()
=>
{
const
nodeName
=
editForm
.
getFieldValue
(
'nodeName
'
);
const
nodeName
1
=
editForm
.
getFieldValue
(
'nodeName1
'
);
const
nodeValue
=
editForm
.
getFieldValue
(
'nodeValue'
);
if
(
nodeName
)
{
let
nodeID
=
''
;
if
(
select
.
parentID
===
'-1'
)
{
nodeID
=
{
...
select
};
}
else
{
nodeID
=
{
...
subSelect
};
}
if
(
nodeName1
)
{
get
(
`/Cityinterface/rest/services/OMS.svc/D_EditDataDictionary`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
nodeID
:
select
.
nodeID
,
nodeName
,
nodeID
,
nodeName
:
nodeName1
,
nodeValue
,
})
.
then
(
res
=>
{
...
...
@@ -211,7 +239,7 @@ const WebDic = () => {
});
}
};
// 提交-删除
const
submitDelete
=
()
=>
{
get
(
`/Cityinterface/rest/services/OMS.svc/D_DeleteDataDictionary`
,
{
_version
:
9999
,
...
...
@@ -235,77 +263,68 @@ const WebDic = () => {
message
.
error
(
err
);
});
};
const
setItem
=
value
=>
{
setLevel
(
value
);
setAddVisible
(
true
);
addForm
.
resetFields
();
// addForm.setFieldsValue({ nodeName1: '', nodeValue: '' });
};
const
pagenation
=
{
showTotal
:
(
total
,
range
)
=>
`第
${
range
[
0
]}
-
${
range
[
1
]}
条/共
${
total
}
条`
,
pageSizeOptions
:
[
10
,
20
,
50
,
100
],
defaultPageSize
:
'20'
,
showQuickJumper
:
true
,
showSizeChanger
:
true
,
};
return
(
<
div
className
=
{
styles
.
WebDic
}
>
<
Spin
spinning
=
{
loading
}
tip
=
"loading..."
>
<
div
style
=
{{
marginBottom
:
'10px'
,
fontSize
:
'16px'
}}
>
<
span
style
=
{{
padding
:
'0 10px'
}}
>
一级条目
<
/span
>
<
Button
type
=
"primary"
size
=
"small"
onClick
=
{()
=>
{
setLevel
(
1
);
setAddVisible
(
true
);
addForm
.
resetFields
();
}}
>
添加
<
/Button
>
<
/div
>
{
/* 一级条目 表格 */
}
<
Table
size
=
"small"
bordered
columns
=
{
columns
}
dataSource
=
{
data
}
scroll
=
{{
x
:
'max-content'
}}
rowClassName
=
{
setRowClassName
}
onRow
=
{
record
=>
({
onClick
:
()
=>
{
getData
(
record
.
nodeID
);
setSelect
(
record
);
setSelectID
(
record
.
nodeID
);
},
})}
pagination
=
{{
showTotal
:
(
total
,
range
)
=>
`第
${
range
[
0
]}
-
${
range
[
1
]}
条/共
${
total
}
条`
,
pageSizeOptions
:
[
10
,
20
,
50
,
100
],
showQuickJumper
:
true
,
showSizeChanger
:
true
,
}}
/
>
<
hr
color
=
"#cfe7fd"
/>
<
div
style
=
{{
marginBottom
:
'10px'
,
fontSize
:
'16px'
}}
>
<
span
style
=
{{
padding
:
'0 10px'
}}
>
二级条目
<
/span
>
<
Button
type
=
"primary"
size
=
"small"
onClick
=
{()
=>
{
setLevel
(
2
);
setAddVisible
(
true
);
addForm
.
resetFields
();
}}
>
添加
<
/Button
>
<
/div
>
{
/* 二级条目 表格 */
}
<
Table
size
=
"small"
bordered
columns
=
{
columns
}
dataSource
=
{
subData
}
scroll
=
{{
x
:
'max-content'
}}
pagination
=
{{
showTotal
:
(
total
,
range
)
=>
`第
${
range
[
0
]}
-
${
range
[
1
]}
条/共
${
total
}
条`
,
pageSizeOptions
:
[
10
,
20
,
50
,
100
],
showQuickJumper
:
true
,
showSizeChanger
:
true
,
}}
/
>
<
Row
style
=
{{
background
:
'white'
}}
>
<
Col
span
=
{
12
}
>
<
div
style
=
{{
marginBottom
:
'10px'
,
fontSize
:
'16px'
}}
>
<
span
style
=
{{
padding
:
'0 10px'
}}
>
一级条目
<
/span
>
<
Button
type
=
"primary"
size
=
"small"
onClick
=
{()
=>
setItem
(
1
)}
>
添加
<
/Button
>
<
/div
>
{
/* 一级条目 表格 */
}
<
Table
size
=
"small"
bordered
columns
=
{
columns
}
dataSource
=
{
data
}
scroll
=
{{
x
:
'max-content'
}}
rowClassName
=
{
setRowClassName
}
onRow
=
{
record
=>
({
onClick
:
()
=>
{
getData
(
record
.
nodeID
);
setSelect
(
record
);
// setSelectColor(record);
setSelectID
(
record
.
nodeID
);
},
})}
pagination
=
{
pagenation
}
/
>
<
/Col
>
<
Col
span
=
{
12
}
>
<
div
style
=
{{
marginBottom
:
'10px'
,
fontSize
:
'16px'
}}
>
<
span
style
=
{{
padding
:
'0 10px'
}}
>
二级条目
<
/span
>
<
Button
type
=
"primary"
size
=
"small"
onClick
=
{()
=>
setItem
(
2
)}
>
添加
<
/Button
>
<
/div
>
{
/* 二级条目 表格 */
}
<
Table
size
=
"small"
bordered
columns
=
{
columns
}
dataSource
=
{
subData
}
scroll
=
{{
x
:
'max-content'
}}
pagination
=
{
pagenation
}
/
>
<
/Col
>
<
/Row
>
<
/Spin
>
{
/* 添加 */
}
...
...
@@ -327,7 +346,7 @@ const WebDic = () => {
>
<
Form
form
=
{
addForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
name
=
"nodeName
1
"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
...
...
@@ -351,7 +370,7 @@ const WebDic = () => {
>
<
Form
form
=
{
editForm
}
labelCol
=
{{
span
:
3
}}
>
<
Form
.
Item
name
=
"nodeName"
name
=
"nodeName
1
"
label
=
"名称"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
...
...
src/pages/platformCenter/dictionary/WebDic.less
View file @
61e4e69a
...
...
@@ -26,7 +26,7 @@
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh -
48
8px);
height:calc(100vh -
26
8px);
border-right: white;
overflow: auto !important;
}
...
...
@@ -35,10 +35,8 @@
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-
right: 12
px;
padding-
top: 10
px;
background: white;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
\ No newline at end of file
src/pages/platformCenter/dictionary/index.js
View file @
61e4e69a
...
...
@@ -11,7 +11,7 @@ const dictionary = () => {
<
PageContainer
>
<
Card
>
<
Tabs
defaultActiveKey
=
"1"
type
=
"card"
>
<
TabPane
tab
=
"
web
数据字典"
key
=
"1"
>
<
TabPane
tab
=
"
通用
数据字典"
key
=
"1"
>
<
WebDic
/>
<
/TabPane
>
<
TabPane
tab
=
"app数据字典"
key
=
"2"
type
=
"card"
>
...
...
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