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
48b6cc7e
Commit
48b6cc7e
authored
Mar 28, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '表字段字段配置界面新增切换表功能'
parent
0aba33fd
Pipeline
#46781
skipped with stages
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
6 deletions
+103
-6
BookConfig.jsx
src/pages/bsmanager/base/standingBook/BookConfig.jsx
+1
-1
fieldEditor.jsx
...s/bsmanager/base/tablemanager/filedConfig/fieldEditor.jsx
+3
-0
filedConfig.jsx
...s/bsmanager/base/tablemanager/filedConfig/filedConfig.jsx
+82
-5
index.jsx
src/pages/bsmanager/base/tablemanager/index.jsx
+17
-0
No files found.
src/pages/bsmanager/base/standingBook/BookConfig.jsx
View file @
48b6cc7e
...
@@ -254,7 +254,7 @@ const BookConfig = props => {
...
@@ -254,7 +254,7 @@ const BookConfig = props => {
<
Input
placeholder=
"台账名称不可重复"
allowClear
/>
<
Input
placeholder=
"台账名称不可重复"
allowClear
/>
</
Item
>
</
Item
>
<
Item
label=
"台账表"
name=
"TableName"
rules=
{
[{
required
:
true
,
message
:
'请选择台账表'
}]
}
>
<
Item
label=
"台账表"
name=
"TableName"
rules=
{
[{
required
:
true
,
message
:
'请选择台账表'
}]
}
>
<
Select
placeholder=
""
optionFilterProp=
"children"
onChange=
{
changTable
}
>
<
Select
placeholder=
""
optionFilterProp=
"children"
onChange=
{
changTable
}
showSearch
>
{
standingTable
.
map
((
item
,
index
)
=>
(
{
standingTable
.
map
((
item
,
index
)
=>
(
<
Option
key=
{
index
}
value=
{
item
.
value
}
>
<
Option
key=
{
index
}
value=
{
item
.
value
}
>
{
item
.
text
}
{
item
.
text
}
...
...
src/pages/bsmanager/base/tablemanager/filedConfig/fieldEditor.jsx
View file @
48b6cc7e
...
@@ -687,6 +687,9 @@ const AddModal = props => {
...
@@ -687,6 +687,9 @@ const AddModal = props => {
visible=
{
isVisible
}
visible=
{
isVisible
}
onClose=
{
onCancel
}
onClose=
{
onCancel
}
destroyOnClose
destroyOnClose
afterClose=
{
()
=>
{
form
.
resetFields
();
}
}
footer=
{
footer=
{
<
Space
>
<
Space
>
<
Button
onClick=
{
onSubmit
}
type=
"primary"
>
<
Button
onClick=
{
onSubmit
}
type=
"primary"
>
...
...
src/pages/bsmanager/base/tablemanager/filedConfig/filedConfig.jsx
View file @
48b6cc7e
/* eslint-disable react/jsx-boolean-value */
/* eslint-disable react/jsx-boolean-value */
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Space
,
Table
,
Button
,
Popconfirm
,
Spin
,
notification
,
Tooltip
}
from
'antd'
;
import
{
Form
,
Modal
,
Space
,
Table
,
Button
,
Popconfirm
,
Spin
,
notification
,
Tooltip
,
TreeSelect
,
Empty
,
}
from
'antd'
;
import
{
import
{
EditOutlined
,
EditOutlined
,
DeleteOutlined
,
DeleteOutlined
,
...
@@ -37,6 +49,10 @@ const AddModal = props => {
...
@@ -37,6 +49,10 @@ const AddModal = props => {
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
visible
,
setVisible
]
=
useState
(
false
);
// 弹窗
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
type
,
setType
]
=
useState
(
''
);
// 弹窗类型
const
[
chooseLine
,
setChooseLine
]
=
useState
(
''
);
const
[
chooseLine
,
setChooseLine
]
=
useState
(
''
);
const
{
TreeNode
}
=
TreeSelect
;
const
[
treeSelectValue
,
setTreeSelectValue
]
=
useState
(
undefined
);
const
[
selectTreeData
,
setSelectTreeData
]
=
useState
([]);
const
[
selectDataFirst
,
setSelectDataFirst
]
=
useState
([]);
const
editor
=
record
=>
{
const
editor
=
record
=>
{
setIsType
(
'edit'
);
setIsType
(
'edit'
);
setIsVisible
(
true
);
setIsVisible
(
true
);
...
@@ -253,11 +269,15 @@ const AddModal = props => {
...
@@ -253,11 +269,15 @@ const AddModal = props => {
];
];
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
props
);
console
.
log
(
props
);
console
.
log
(
treeSelectValue
);
console
.
log
(
props
.
match
.
params
.
id
);
if
(
props
.
match
.
params
.
id
)
{
if
(
props
.
match
.
params
.
id
)
{
setFormObj
(
props
.
match
.
params
.
id
);
setSelectTreeData
(
props
.
location
.
state
.
keepTreeSelect
);
setSelectDataFirst
(
props
.
location
.
state
.
keepTreeFirst
);
setFormObj
(
treeSelectValue
||
props
.
match
.
params
.
id
);
setTreeLoading
(
true
);
setTreeLoading
(
true
);
reloadTableFields
({
reloadTableFields
({
tableName
:
props
.
match
.
params
.
id
,
tableName
:
treeSelectValue
||
props
.
match
.
params
.
id
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
setTreeLoading
(
false
);
setTreeLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
if
(
res
.
msg
===
'Ok'
)
{
...
@@ -267,14 +287,12 @@ const AddModal = props => {
...
@@ -267,14 +287,12 @@ const AddModal = props => {
newArr
.
push
({
type
:
item
,
key
:
index
,
id
:
index
});
newArr
.
push
({
type
:
item
,
key
:
index
,
id
:
index
});
});
});
setAllData
(
arr
);
setAllData
(
arr
);
console
.
log
(
arr
);
let
aa
=
[];
let
aa
=
[];
let
bb
=
[];
let
bb
=
[];
Object
.
keys
(
arr
).
forEach
((
item
,
index
)
=>
{
Object
.
keys
(
arr
).
forEach
((
item
,
index
)
=>
{
aa
.
push
({
name
:
item
,
key
:
index
,
ID
:
index
,
children
:
arr
[
item
]
});
aa
.
push
({
name
:
item
,
key
:
index
,
ID
:
index
,
children
:
arr
[
item
]
});
bb
.
push
(
item
);
bb
.
push
(
item
);
});
});
console
.
log
(
bb
);
setKeepTreeFirst
(
bb
);
setKeepTreeFirst
(
bb
);
setTreeData
(
aa
);
setTreeData
(
aa
);
setTableData
(
newArr
);
setTableData
(
newArr
);
...
@@ -388,12 +406,70 @@ const AddModal = props => {
...
@@ -388,12 +406,70 @@ const AddModal = props => {
setVisible
(
false
);
setVisible
(
false
);
setFlag
(
flag
+
1
);
setFlag
(
flag
+
1
);
};
};
const
treeSelectOnchange
=
e
=>
{
setTreeSelectValue
(
e
);
setFormObj
(
e
);
reloadTableFields
({
tableName
:
e
,
}).
then
(
res
=>
{
setTreeLoading
(
false
);
if
(
res
.
msg
===
'Ok'
)
{
let
arr
=
formateArrDataA
(
res
.
data
.
root
,
'group'
);
let
newArr
=
[];
Object
.
keys
(
arr
).
map
((
item
,
index
)
=>
{
newArr
.
push
({
type
:
item
,
key
:
index
,
id
:
index
});
});
setAllData
(
arr
);
setTableData
(
newArr
);
let
aa
=
[];
let
bb
=
[];
Object
.
keys
(
arr
).
forEach
((
item
,
index
)
=>
{
aa
.
push
({
name
:
item
,
key
:
index
,
ID
:
index
,
children
:
arr
[
item
]
});
bb
.
push
(
item
);
});
setKeepTreeFirst
(
bb
);
setTreeData
(
aa
);
setSelect
(
newArr
);
}
});
};
const
mapTree
=
org
=>
{
const
haveChildren
=
Array
.
isArray
(
org
.
children
)
&&
org
.
children
.
length
>
0
;
return
haveChildren
?
(
<
TreeNode
value=
{
org
.
name
}
title=
{
org
.
name
}
disabled
>
{
org
.
children
.
map
(
item
=>
mapTree
(
item
))
}
</
TreeNode
>
)
:
(
<
TreeNode
value=
{
org
.
tableName
}
title=
{
org
.
tableName
}
/>
);
};
return
(
return
(
<>
<>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
Spin
tip=
"loading..."
spinning=
{
treeLoading
}
>
<
div
className=
{
styles
.
containerBox
}
>
<
div
className=
{
styles
.
containerBox
}
>
<
div
className=
{
styles
.
config
}
>
<
div
className=
{
styles
.
config
}
>
<
div
className=
{
styles
.
title
}
>
{
formObj
}
</
div
>
<
div
className=
{
styles
.
title
}
>
{
formObj
}
</
div
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'flex-end'
}
}
>
<
div
style=
{
{
lineHeight
:
'32px'
,
marginRight
:
'5px'
}
}
>
快速切换表:
</
div
>
<
div
style=
{
{
width
:
'350px'
,
marginRight
:
'10px'
}
}
>
<
TreeSelect
showSearch
style=
{
{
width
:
'100%'
}
}
value=
{
treeSelectValue
}
dropdownStyle=
{
{
maxHeight
:
400
,
overflow
:
'auto'
}
}
placeholder=
"请选择表名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
onChange=
{
treeSelectOnchange
}
>
{
selectTreeData
?
(
selectTreeData
.
map
(
i
=>
mapTree
(
i
))
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
}
</
TreeSelect
>
</
div
>
<
div
className=
{
styles
.
btn
}
>
<
div
className=
{
styles
.
btn
}
>
<
Button
type=
"primary"
icon=
{
<
PlusSquareOutlined
/>
}
onClick=
{
add
}
>
<
Button
type=
"primary"
icon=
{
<
PlusSquareOutlined
/>
}
onClick=
{
add
}
>
附加
附加
...
@@ -406,6 +482,7 @@ const AddModal = props => {
...
@@ -406,6 +482,7 @@ const AddModal = props => {
</
Button
>
</
Button
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
Table
<
Table
columns=
{
columns
}
columns=
{
columns
}
...
...
src/pages/bsmanager/base/tablemanager/index.jsx
View file @
48b6cc7e
/* eslint-disable object-shorthand */
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
import
{
import
{
...
@@ -58,6 +59,8 @@ const TableManager = props => {
...
@@ -58,6 +59,8 @@ const TableManager = props => {
const
[
showSearchStyle
,
setShowSearchStyle
]
=
useState
(
false
);
// 是否显示模糊查询样式
const
[
showSearchStyle
,
setShowSearchStyle
]
=
useState
(
false
);
// 是否显示模糊查询样式
const
[
chooseLine
,
setChooseLine
]
=
useState
([
0
]);
const
[
chooseLine
,
setChooseLine
]
=
useState
([
0
]);
const
[
keepValue
,
setKeepValue
]
=
useState
([
0
]);
const
[
keepValue
,
setKeepValue
]
=
useState
([
0
]);
const
[
keepTreeSelect
,
setKeepTreeSelect
]
=
useState
([]);
const
[
keepTreeFirst
,
setKeepTreeFirst
]
=
useState
([]);
useEffect
(
useEffect
(
record
=>
{
record
=>
{
loadTable
(
searchValue
);
loadTable
(
searchValue
);
...
@@ -144,6 +147,8 @@ const TableManager = props => {
...
@@ -144,6 +147,8 @@ const TableManager = props => {
template
:
record
,
template
:
record
,
tableScroll
:
document
.
querySelector
(
'.ant-table-body'
).
scrollTop
,
tableScroll
:
document
.
querySelector
(
'.ant-table-body'
).
scrollTop
,
keepValue
:
keepValue
,
keepValue
:
keepValue
,
keepTreeSelect
:
keepTreeSelect
,
keepTreeFirst
:
keepTreeFirst
,
},
},
});
});
// setType('config');
// setType('config');
...
@@ -191,6 +196,16 @@ const TableManager = props => {
...
@@ -191,6 +196,16 @@ const TableManager = props => {
});
});
console
.
log
(
newArr
);
console
.
log
(
newArr
);
setAllData
(
groupData
);
setAllData
(
groupData
);
console
.
log
(
groupData
);
let
aa
=
[];
let
bb
=
[];
Object
.
keys
(
groupData
).
forEach
((
item
,
index
)
=>
{
aa
.
push
({
name
:
item
,
key
:
index
,
ID
:
index
,
children
:
groupData
[
item
]
});
bb
.
push
(
item
);
});
console
.
log
(
bb
);
setKeepTreeFirst
(
bb
);
setKeepTreeSelect
(
aa
);
setGroupArr
(
newArr
);
setGroupArr
(
newArr
);
setSelect
(
newArr
);
setSelect
(
newArr
);
}
}
...
@@ -375,6 +390,8 @@ const TableManager = props => {
...
@@ -375,6 +390,8 @@ const TableManager = props => {
template
:
record
,
template
:
record
,
tableScroll
:
document
.
querySelector
(
'.ant-table-body'
).
scrollTop
,
tableScroll
:
document
.
querySelector
(
'.ant-table-body'
).
scrollTop
,
keepValue
:
keepValue
,
keepValue
:
keepValue
,
keepTreeSelect
:
keepTreeSelect
,
keepTreeFirst
:
keepTreeFirst
,
},
},
});
});
},
},
...
...
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