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
ad4583e4
Commit
ad4583e4
authored
Nov 09, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '表字段关联表单字段映射支持下拉选择,机构管理不允许删除和冻结panda和admin'
parent
1e9cbff9
Pipeline
#63506
passed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
325 additions
and
73 deletions
+325
-73
fieldEditor.jsx
...s/bsmanager/base/tablemanager/filedConfig/fieldEditor.jsx
+273
-71
filedConfig.jsx
...s/bsmanager/base/tablemanager/filedConfig/filedConfig.jsx
+10
-1
UserManage.jsx
src/pages/userCenter/userManage/UserManage.jsx
+42
-1
No files found.
src/pages/bsmanager/base/tablemanager/filedConfig/fieldEditor.jsx
View file @
ad4583e4
...
...
@@ -41,6 +41,7 @@ import {
LoadEventFields
,
LoadEventType
,
UpdateFields
,
reloadTableFields
,
}
from
'@/services/tablemanager/tablemanager'
;
import
{
PlusSquareOutlined
,
...
...
@@ -50,13 +51,16 @@ import {
MinusCircleOutlined
,
PlusOutlined
,
SwapOutlined
,
CodeSandboxCircleFilled
,
}
from
'@ant-design/icons'
;
import
styles
from
'./index.less'
;
import
VerifyModal
from
'./VerifyModal'
;
import
Tree
from
'@/components/ExpendableTree'
;
import
RuleConfig
from
'@/components/RuleConfig'
;
import
Things
from
'../../../../../assets/images/icons/时间.svg'
;
import
logo
from
'@/assets/images/icons/值映射.png'
;
import
AddForm
from
'../../../../productCenter/webConfig/menuconfig/AddForm'
;
const
AddModal
=
props
=>
{
const
{
callBackSubmit
=
()
=>
{},
...
...
@@ -69,6 +73,7 @@ const AddModal = props => {
keepTreeFirst
,
keepStandingBook
,
keepTreeData
,
keepTree
,
}
=
props
;
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
fieldName
,
setFieldName
]
=
useState
([]);
// 弹窗
...
...
@@ -195,6 +200,8 @@ const AddModal = props => {
const
[
formAdd
]
=
Form
.
useForm
();
const
[
showRule
,
setShowRule
]
=
useState
(
false
);
const
[
fieldList
,
setFieldList
]
=
useState
([]);
const
[
fieldValue
,
setFeildValue
]
=
useState
([]);
// 保存关联表单形态,字段名下拉框数据
const
[
mapFieldValue
,
setMapFeildValue
]
=
useState
([]);
// 保存关联表单形态,映射字段名下拉框数据
const
change
=
e
=>
{
console
.
log
(
e
);
...
...
@@ -345,11 +352,11 @@ const AddModal = props => {
arrlist
.
toField
=
obj
.
eventOrder
;
aalist
.
默认显示
=
visibleChecked
||
false
;
aalist
.
控制规则
=
obj
.
configName
;
console
.
log
(
formAdd
.
getFieldValue
(
'parmars'
))
console
.
log
(
formAdd
.
getFieldValue
(
'parmars'
))
;
let
lii
=
[];
if
(
formAdd
.
getFieldValue
(
'parmars'
))
{
lii
=
[...
formAdd
.
getFieldValue
(
'parmars'
)]
if
(
formAdd
.
getFieldValue
(
'parmars'
))
{
lii
=
[...
formAdd
.
getFieldValue
(
'parmars'
)];
}
console
.
log
(
lii
);
lii
.
push
(
arrlist
);
...
...
@@ -461,12 +468,42 @@ const AddModal = props => {
});
}
});
}
};
const
getData
=
()
=>
{
let
last
=
[];
let
aa
=
[];
// 固定分组数据
keepTree
.
map
((
i
,
j
)
=>
{
if
(
i
==
'工单编号'
||
i
==
'事件编号'
){
aa
.
push
(
i
)
}
else
{
let
kk
=
{}
kk
.
name
=
i
kk
.
ID
=
j
+
1
last
.
push
(
kk
)
}
})
let
bb
=
{}
// 固定分组对象
bb
.
name
=
'固定分组'
;
bb
.
ID
=
0
;
bb
.
children
=
aa
;
console
.
log
(
bb
);
let
cc
=
[];
cc
.
push
(
bb
)
console
.
log
(
cc
.
concat
(
last
))
if
(
aa
.
length
>
0
){
setFeildValue
(
cc
.
concat
(
last
));
}
else
{
setFeildValue
(
last
);
}
// 编辑时过滤下拉框初始数据
}
useEffect
(()
=>
{
if
(
isVisible
)
{
getData
();
setFieldList
(
keepTreeData
);
// 用于判断分组名与字段名重复时提示当前未选中字段
if
(
keepTreeFirst
.
indexOf
(
itemData
.
name
)
!=
-
1
&&
itemData
.
children
)
{
...
...
@@ -780,20 +817,25 @@ const AddModal = props => {
}
break
;
case
'关联表单'
:
console
.
log
(
keepStandingBook
);
let
data11
=
JSON
.
parse
(
res
[
0
].
data
.
root
.
Config
);
let
rueslt
=
keepStandingBook
.
find
(
i
=>
i
.
name
==
data11
.
台账名称
);
console
.
log
(
rueslt
.
tableName
);
getMapFelidValue
(
rueslt
.
tableName
);
form
.
setFieldsValue
({
standingBook
:
data11
.
台账名称
,
workOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
fromField
,
eventOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
toField
,
workOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
fromField
,
eventOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
toField
,
configName
:
data11
.
控制规则
,
});
let
gg
=
[...
data11
.
映射字段
];
let
a11
=
[]
gg
.
length
>
0
&&
gg
.
map
((
i
,
j
)
=>
{
if
(
j
!==
gg
.
length
-
1
){
a11
.
push
(
i
)
let
a11
=
[];
gg
.
length
>
0
&&
gg
.
map
((
i
,
j
)
=>
{
if
(
j
!==
gg
.
length
-
1
)
{
a11
.
push
(
i
);
}
})
});
formAdd
.
setFieldsValue
({
parmars
:
a11
});
setVisibleChecked
(
data11
.
默认显示
);
break
;
...
...
@@ -1051,6 +1093,27 @@ const AddModal = props => {
}
},
[
isVisible
]);
// 获取关联表单形态字段映射下拉框数据
const
getMapFelidValue
=
e
=>
{
console
.
log
(
e
);
reloadTableFields
({
tableName
:
e
,
}).
then
(
res
=>
{
if
(
res
.
msg
===
'Ok'
)
{
console
.
log
(
res
.
data
.
root
);
// 编辑时过滤下l拉框初始数据
setMapFeildValue
(
res
.
data
.
root
);
}
});
};
const
seach
=
e
=>
{
let
rueslt
=
keepStandingBook
.
find
(
i
=>
i
.
name
==
e
);
getMapFelidValue
(
rueslt
.
tableName
);
formAdd
.
resetFields
();
form
.
setFieldsValue
({
workOrder
:
''
,
eventOrder
:
''
})
}
const
handleChange
=
value
=>
{
form
.
setFieldsValue
({
schemename
:
value
});
};
...
...
@@ -1201,7 +1264,7 @@ const AddModal = props => {
configName
:
''
,
});
}
formAdd
.
resetFields
()
formAdd
.
resetFields
()
;
setVisibleChecked
(
true
);
setView
(
true
);
setPreView
(
true
);
...
...
@@ -1250,7 +1313,7 @@ const AddModal = props => {
value
==
'图片'
||
value
==
'可预览图片'
||
value
==
'录音'
||
value
==
'视频'
||
value
==
'视频'
||
value
==
'关联表单'
)
{
form
.
setFieldsValue
({
RowSpan
:
6
});
...
...
@@ -1375,6 +1438,7 @@ const AddModal = props => {
const
onSelect
=
(
i
,
e
)
=>
{
console
.
log
(
i
);
console
.
log
(
e
);
setMapFeildValue
([])
if
(
e
.
node
.
org
.
storeType
&&
e
.
node
.
org
.
storeType
==
'datetime'
)
{
setCharacteristics1
([
{
...
...
@@ -1701,19 +1765,23 @@ const AddModal = props => {
break
;
case
'关联表单'
:
let
data11
=
JSON
.
parse
(
aa
.
Config
);
let
rueslt
=
keepStandingBook
.
find
(
i
=>
i
.
name
==
data11
.
台账名称
);
console
.
log
(
rueslt
.
tableName
);
getMapFelidValue
(
rueslt
.
tableName
);
form
.
setFieldsValue
({
standingBook
:
data11
.
台账名称
,
workOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
fromField
,
eventOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
toField
,
workOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
fromField
,
eventOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
toField
,
configName
:
data11
.
控制规则
,
});
let
gg
=
[...
data11
.
映射字段
];
let
a11
=
[]
gg
.
length
>
0
&&
gg
.
map
((
i
,
j
)
=>
{
if
(
j
!==
gg
.
length
-
1
){
a11
.
push
(
i
)
let
a11
=
[];
gg
.
length
>
0
&&
gg
.
map
((
i
,
j
)
=>
{
if
(
j
!==
gg
.
length
-
1
)
{
a11
.
push
(
i
);
}
})
});
formAdd
.
setFieldsValue
({
parmars
:
a11
});
setVisibleChecked
(
data11
.
默认显示
);
break
;
...
...
@@ -2129,19 +2197,23 @@ const AddModal = props => {
case
'关联表单'
:
let
data11
=
JSON
.
parse
(
res
[
0
].
data
.
root
.
Config
);
let
rueslt
=
keepStandingBook
.
find
(
i
=>
i
.
name
==
data11
.
台账名称
);
console
.
log
(
rueslt
.
tableName
);
getMapFelidValue
(
rueslt
.
tableName
);
form
.
setFieldsValue
({
standingBook
:
data11
.
台账名称
,
workOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
fromField
,
eventOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
toField
,
workOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
fromField
,
eventOrder
:
data11
.
映射字段
[
data11
.
映射字段
.
length
-
1
].
toField
,
configName
:
data11
.
控制规则
,
});
let
gg
=
[...
data11
.
映射字段
];
let
a11
=
[]
gg
.
length
>
0
&&
gg
.
map
((
i
,
j
)
=>
{
if
(
j
!==
gg
.
length
-
1
){
a11
.
push
(
i
)
let
a11
=
[];
gg
.
length
>
0
&&
gg
.
map
((
i
,
j
)
=>
{
if
(
j
!==
gg
.
length
-
1
)
{
a11
.
push
(
i
);
}
})
});
formAdd
.
setFieldsValue
({
parmars
:
a11
});
setVisibleChecked
(
data11
.
默认显示
);
break
;
...
...
@@ -2476,21 +2548,22 @@ const AddModal = props => {
aalist
.
默认显示
=
visibleChecked
||
false
;
aalist
.
控制规则
=
obj
.
configName
;
let
lii
=
[];
if
(
formAdd
.
getFieldValue
(
'parmars'
))
{
lii
=
[...
formAdd
.
getFieldValue
(
'parmars'
)]
if
(
formAdd
.
getFieldValue
(
'parmars'
))
{
lii
=
[...
formAdd
.
getFieldValue
(
'parmars'
)];
}
console
.
log
(
lii
);
lii
.
push
(
arrlist
);
let
lia
=
[];
lii
.
length
>
0
&&
lii
.
map
(
i
=>
{
if
(
i
){
if
(
i
.
fromField
&&
i
.
toField
){
lia
.
push
(
i
)
lii
.
length
>
0
&&
lii
.
map
(
i
=>
{
if
(
i
)
{
if
(
i
.
fromField
&&
i
.
toField
)
{
lia
.
push
(
i
);
}
}
})
console
.
log
(
lia
)
});
console
.
log
(
lia
);
aalist
.
映射字段
=
lia
;
console
.
log
(
aalist
);
data
[
0
].
Config
=
JSON
.
stringify
(
aalist
);
...
...
@@ -2643,9 +2716,20 @@ const AddModal = props => {
});
// }
// });
};
const
mapTree1
=
org
=>
{
if
(
org
.
children
)
{
return
(
<
TreeNode
value=
{
org
.
name
}
title=
{
org
.
name
}
disabled
>
{
org
.
children
.
map
(
item
=>
mapTreeSelect
(
item
))
}
</
TreeNode
>
);
}
if
(
org
.
name
)
{
return
<
TreeNode
value=
{
org
.
name
}
title=
{
org
.
name
}
/>;
}
return
<
TreeNode
value=
{
org
}
title=
{
org
}
key=
{
org
}
/>;
};
const
onChange2
=
e
=>
{
...
...
@@ -2858,15 +2942,15 @@ const AddModal = props => {
setCse
(
e
.
target
.
checked
);
};
const
editRule
=
()
=>
{
const
editRule
=
()
=>
{
setShowRule
(
true
);
}
}
;
const
saveRule
=
e
=>
{
form
.
setFieldsValue
({
configName
:
e
})
const
saveRule
=
e
=>
{
form
.
setFieldsValue
({
configName
:
e
});
setShowRule
(
false
);
console
.
log
(
e
);
}
}
;
return
(
<>
...
...
@@ -3323,43 +3407,104 @@ const AddModal = props => {
labelCol=
{
{
span
:
4
}
}
rules=
{
[{
required
:
true
,
message
:
'请选择台账名'
}]
}
>
<
Select
showSearch
>
<
Select
showSearch
onChange=
{
e
=>
seach
(
e
)
}
>
{
keepStandingBook
?
keepStandingBook
.
map
((
item
,
index
)
=>
(
<
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
<
Option
key=
{
index
}
value=
{
item
.
name
}
>
{
item
.
name
}
</
Option
>
))
:
''
}
</
Select
>
</
Item
>
{
/* <Item
label="映射字段"
name="workOrder"
rules={[{ required: true, message: '请填写映射字段' }]}
<
Item
style=
{
{
marginBottom
:
'10px'
}
}
label=
{
<>
<
span
style=
{
{
color
:
'red'
,
fontSize
:
'17px'
,
marginRight
:
'5px'
,
marginTop
:
'3px'
,
}
}
>
*
</
span
>
<
span
>
映射字段
</
span
>
</>
}
labelCol=
{
{
span
:
4
}
}
>
<Input placeholder="示例:工单编号:工单编号,事件编号:事件编号" />
</Item> */
}
<
Item
style=
{
{
marginBottom
:
'10px'
}
}
label=
{
<><
span
style=
{
{
color
:
'red'
,
fontSize
:
'17px'
,
marginRight
:
'5px'
,
marginTop
:
'3px'
}
}
>
*
</
span
><
span
>
映射字段
</
span
></>
}
labelCol=
{
{
span
:
4
}
}
>
<
Row
>
<
Col
span=
{
11
}
>
<
Item
name=
"workOrder"
rules=
{
[{
required
:
true
,
message
:
'请输入字段名'
}]
}
style=
{
{
marginBottom
:
0
}
}
style=
{
{
marginBottom
:
0
}
}
>
{
/* <Input placeholder="请输入字段名" style={{width:'208px'}}/> */
}
{
/* <Select
placeholder="选择字段名"
showSearch
style={{ width: '208px' }}
>
<
Input
placeholder=
"请输入字段名"
style=
{
{
width
:
'208px'
}
}
/>
{fieldValue
? fieldValue.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
: ''}
</Select> */
}
<
TreeSelect
showSearch
style=
{
{
width
:
'208px'
}
}
// value=
{
treeSelectValue
}
dropdownStyle=
{
{
maxHeight
:
400
,
overflow
:
'auto'
}
}
placeholder=
"请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
// onChange=
{
treeSelectOnchange
}
>
{
fieldValue
?
(
fieldValue
.
map
(
i
=>
mapTree1
(
i
))
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
}
</
TreeSelect
>
</
Item
>
</
Col
>
<
Col
span=
{
1
}
style=
{
{
paddingTop
:
'3px'
}
}
>
<
img
src=
{
logo
}
style=
{
{
height
:
'24px'
,
marginLeft
:
'-10px'
}
}
alt=
""
/></
Col
>
<
Col
span=
{
1
}
style=
{
{
paddingTop
:
'3px'
}
}
>
{
' '
}
<
img
src=
{
logo
}
style=
{
{
height
:
'24px'
,
marginLeft
:
'-10px'
}
}
alt=
""
/>
</
Col
>
<
Col
span=
{
11
}
>
<
Item
name=
"eventOrder"
rules=
{
[{
required
:
true
,
message
:
'请输入映射字段名'
}]
}
style=
{
{
marginBottom
:
0
}
}
style=
{
{
marginBottom
:
0
}
}
>
<
Select
placeholder=
"选择映射字段名"
showSearch
style=
{
{
width
:
'208px'
}
}
>
<
Input
placeholder=
"请输入映射字段名"
style=
{
{
width
:
'208px'
}
}
/>
{
mapFieldValue
.
length
>
0
?
mapFieldValue
.
map
((
item
,
index
)
=>
(
<>
<
Option
key=
{
item
.
name
}
value=
{
item
.
name
}
>
{
item
.
name
}
</
Option
>
</>
))
:
''
}
</
Select
>
</
Item
>
</
Col
>
</
Row
>
...
...
@@ -3388,16 +3533,20 @@ const AddModal = props => {
{
required
:
true
,
message
:
'请填写字段名'
},
{
validator
:
()
=>
{
let
aa
=
formAdd
.
getFieldsValue
().
parmars
let
data
=
[];
aa
.
length
>
0
&&
aa
.
map
(
i
=>
{
if
(
i
){
data
.
push
(
i
.
fromField
)
let
aa
=
formAdd
.
getFieldsValue
().
parmars
;
let
data
=
[];
aa
.
length
>
0
&&
aa
.
map
(
i
=>
{
if
(
i
)
{
data
.
push
(
i
.
fromField
);
}
})
});
let
list
=
new
Set
(
data
);
let
ee
=
form
.
getFieldsValue
().
workOrder
;
if
(
list
.
size
!==
data
.
length
||
data
.
indexOf
(
ee
)
!=
-
1
)
{
if
(
list
.
size
!==
data
.
length
||
data
.
indexOf
(
ee
)
!=
-
1
)
{
return
Promise
.
reject
(
new
Error
(
'字段名重复'
));
}
return
Promise
.
resolve
();
...
...
@@ -3405,7 +3554,36 @@ const AddModal = props => {
},
]
}
>
<
Input
placeholder=
"请填写字段名"
style=
{
{
width
:
'208px'
,
marginLeft
:
'98px'
}
}
/>
{
/* <Select
placeholder="选择字段名"
showSearch
style={{ width: '208px', marginLeft: '98px' }}
>
{fieldValue
? fieldValue.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
: ''}
</Select> */
}
<
TreeSelect
showSearch
style=
{
{
width
:
'208px'
,
marginLeft
:
'98px'
}
}
// value=
{
treeSelectValue
}
dropdownStyle=
{
{
maxHeight
:
400
,
overflow
:
'auto'
}
}
placeholder=
"请选择字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
// onChange=
{
treeSelectOnchange
}
>
{
fieldValue
?
(
fieldValue
.
map
(
i
=>
mapTree1
(
i
))
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
}
</
TreeSelect
>
</
Form
.
Item
>
{
/* <SwapOutlined style={{marginLeft:'4px'}}/> */
}
<
img
src=
{
logo
}
style=
{
{
height
:
'24px'
}
}
alt=
""
/>
...
...
@@ -3414,9 +3592,23 @@ const AddModal = props => {
style=
{
{
marginBottom
:
'5px'
}
}
name=
{
[
name
,
'toField'
]
}
fieldKey=
{
[
fieldKey
,
'key'
]
}
rules=
{
[{
required
:
true
,
message
:
'请填写映射字段名'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请填写映射字段名'
}]
}
>
<
Input
placeholder=
"请填写映射字段名"
style=
{
{
width
:
'208px'
}
}
/>
<
Select
placeholder=
"选择映射字段名"
showSearch
style=
{
{
width
:
'208px'
}
}
>
{
mapFieldValue
.
length
>
0
?
mapFieldValue
.
map
((
item
,
index
)
=>
(
<>
<
Option
key=
{
item
.
name
}
value=
{
item
.
name
}
>
{
item
.
name
}
</
Option
>
</>
))
:
''
}
</
Select
>
</
Form
.
Item
>
<
MinusCircleOutlined
onClick=
{
()
=>
remove
(
name
)
}
...
...
@@ -3452,10 +3644,20 @@ const AddModal = props => {
label=
"控制规则"
name=
"configName"
labelCol=
{
{
span
:
4
}
}
rules=
{
[{
required
:
true
,
message
:
'请输入控制规则'
}]
}
//
rules=
{[{
required
:
true
,
message
:
'请输入控制规则'
}]}
>
{
/* <TextArea placeholder="示例:{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000" /> */
}
<
div
style=
{
{
border
:
'2px solid #6A98FA'
,
minHeight
:
'34px'
,
lineHeight
:
'34px'
,
textAlign
:
'center'
}
}
onClick=
{
editRule
}
><
span
>
{
form
.
getFieldsValue
().
configName
}
</
span
></
div
>
<
div
style=
{
{
border
:
'2px solid #6A98FA'
,
minHeight
:
'34px'
,
lineHeight
:
'34px'
,
textAlign
:
'center'
,
}
}
onClick=
{
editRule
}
>
<
span
>
{
form
.
getFieldsValue
().
configName
}
</
span
>
</
div
>
</
Item
>
</>
);
...
...
@@ -3474,8 +3676,8 @@ const AddModal = props => {
<
Select
showSearch
style=
{
{
width
:
'95%'
}
}
>
{
keepStandingBook
?
keepStandingBook
.
map
((
item
,
index
)
=>
(
<
Option
key=
{
index
}
value=
{
item
}
>
{
item
}
<
Option
key=
{
index
}
value=
{
item
.
name
}
>
{
item
.
name
}
</
Option
>
))
:
''
}
...
...
src/pages/bsmanager/base/tablemanager/filedConfig/filedConfig.jsx
View file @
ad4583e4
...
...
@@ -22,6 +22,7 @@ import {
SortDescendingOutlined
,
PlusSquareOutlined
,
RollbackOutlined
,
ConsoleSqlOutlined
,
}
from
'@ant-design/icons'
;
import
{
reloadTableFields
,
...
...
@@ -64,6 +65,7 @@ const AddModal = props => {
const
[
selectGroup
,
setSelectGroup
]
=
useState
([]);
const
[
keepStandingBook
,
setKeepStandingBook
]
=
useState
([]);
const
[
keepTreeData
,
setKeepTreeData
]
=
useState
([]);
const
[
keepTree
,
setKeepTree
]
=
useState
([]);
// 保存树字段名称
const
editor
=
record
=>
{
console
.
log
(
record
);
...
...
@@ -310,7 +312,7 @@ const AddModal = props => {
res
.
data
.
root
.
map
(
i
=>
{
data
.
push
(
i
.
name
);
});
setKeepStandingBook
(
data
);
setKeepStandingBook
(
res
.
data
.
root
);
}
});
},
[]);
...
...
@@ -335,6 +337,8 @@ const AddModal = props => {
res
.
data
.
root
.
map
(
i
=>
{
arrlist
.
push
(
i
.
name
);
});
console
.
log
(
arrlist
);
setKeepTree
(
arrlist
);
data
.
TableFieldNames
=
arrlist
;
data
.
TableName
=
treeSelectValue
.
substring
(
0
,
treeSelectValue
.
lastIndexOf
(
'@'
));
listArr
.
push
(
data
);
...
...
@@ -374,6 +378,8 @@ const AddModal = props => {
res
.
data
.
root
.
map
(
i
=>
{
arrlist
.
push
(
i
.
name
);
});
console
.
log
(
arrlist
);
setKeepTree
(
arrlist
);
data
.
TableFieldNames
=
arrlist
;
data
.
TableName
=
props
.
location
.
state
.
id
;
listArr
.
push
(
data
);
...
...
@@ -590,6 +596,8 @@ const AddModal = props => {
res
.
data
.
root
.
map
(
i
=>
{
arrlist
.
push
(
i
.
name
);
});
console
.
log
(
arrlist
);
setKeepTree
(
arrlist
);
data
.
TableFieldNames
=
arrlist
;
data
.
TableName
=
e
.
substring
(
0
,
e
.
lastIndexOf
(
'@'
));
listArr
.
push
(
data
);
...
...
@@ -761,6 +769,7 @@ const AddModal = props => {
</
Modal
>
<
FieldEditor
isVisible=
{
isVisible
}
keepTree=
{
keepTree
}
keepTreeData=
{
keepTreeData
}
isType=
{
isType
}
itemData=
{
itemData
}
...
...
src/pages/userCenter/userManage/UserManage.jsx
View file @
ad4583e4
/* eslint-disable no-unused-expressions */
/* eslint-disable eqeqeq */
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
...
...
@@ -169,6 +170,7 @@ const UserManage = () => {
const
flagRef
=
useRef
(
1
);
const
[
searchWordOrg
,
setSearchWordOrg
]
=
useState
(
''
);
const
[
keepDataList
,
setKeepDataList
]
=
useState
([]);
const
setRowClassName
=
record
=>
record
.
userID
===
selectColor
.
userID
?
styles
.
clickRowStyle
:
''
;
// 用户表列名
...
...
@@ -274,7 +276,9 @@ const UserManage = () => {
</
Tooltip
>
{
(
record
.
state
==
0
||
record
.
state
==
null
)
&&
(
<>
{
/* { console.log(record.state,'record.state')} */
}
{
record
.
loginName
==
'panda'
||
record
.
loginName
==
'admin'
?
(
<
StopOutlined
style=
{
{
fontSize
:
'16px'
}
}
/>
)
:
(
<
Tooltip
title=
"冻结用户"
>
<
Popconfirm
placement=
"bottomRight"
...
...
@@ -292,6 +296,7 @@ const UserManage = () => {
<
StopOutlined
style=
{
{
fontSize
:
'16px'
,
color
:
'#e86060'
}
}
/>
</
Popconfirm
>
</
Tooltip
>
)
}
</>
)
}
{
record
.
state
==
1
&&
(
...
...
@@ -345,6 +350,9 @@ const UserManage = () => {
/>
</Popconfirm>
</Tooltip> */
}
{
record
.
loginName
==
'panda'
||
record
.
loginName
==
'admin'
?
(
<
DeleteOutlined
style=
{
{
fontSize
:
'16px'
}
}
/>
)
:
(
<
Tooltip
title=
"删除用户"
>
<
Popconfirm
placement=
"bottomRight"
...
...
@@ -363,6 +371,7 @@ const UserManage = () => {
<
DeleteOutlined
style=
{
{
fontSize
:
'16px'
,
color
:
'#e86060'
}
}
/>
</
Popconfirm
>
</
Tooltip
>
)
}
</
Space
>
),
},
...
...
@@ -706,16 +715,27 @@ const UserManage = () => {
setOrgTitle
(
res
.
data
.
GroupName
);
setDescription
(
res
.
data
.
Description
);
// 返回用户表数据结构处理,扁平化
console
.
log
(
res
.
data
);
const
temp
=
flatten
(
getUsers
(
res
.
data
));
console
.
log
(
temp
);
// 设置过滤字段
let
arr
=
temp
.
map
(
item
=>
item
.
OUName
);
console
.
log
(
arr
);
arr
=
arr
.
filter
((
value
,
index
)
=>
arr
.
indexOf
(
value
)
===
index
);
console
.
log
(
arr
);
setOrgFilters
(
arr
.
map
(
item
=>
({
text
:
item
,
value
:
item
})));
setTableLength
(
temp
.
length
);
let
datalist
=
[];
const
table
=
temp
.
map
((
item
,
index
)
=>
{
console
.
log
(
item
);
if
(
item
.
loginName
==
'panda'
||
item
.
loginName
==
'admin'
)
{
datalist
.
push
(
item
.
userID
);
}
item
.
key
=
index
;
return
item
;
});
console
.
log
(
datalist
);
setKeepDataList
(
datalist
);
setShowSearchStyle
(
false
);
setTableData
(
table
);
}
else
{
...
...
@@ -901,6 +921,7 @@ const UserManage = () => {
};
// 冻结用户
const
freezeUser
=
record
=>
{
console
.
log
(
currentUser
);
// setFreezeUserVisible(true);
setCurrentUser
(
record
);
setSelectColor
(
record
);
...
...
@@ -1265,6 +1286,25 @@ const UserManage = () => {
};
// 提交-批量删除用户
const
submitDeleteUsers
=
()
=>
{
console
.
log
(
userIDs
);
console
.
log
(
keepDataList
);
console
.
log
(
userIDs
.
split
(
','
));
let
data
=
[];
keepDataList
.
length
>
0
&&
keepDataList
.
map
(
i
=>
{
let
aa
=
userIDs
.
split
(
','
).
indexOf
(
i
);
console
.
log
(
aa
);
if
(
aa
!==
-
1
)
{
data
.
push
(
aa
);
}
});
console
.
log
(
data
);
if
(
data
.
length
>
0
)
{
notification
.
error
({
message
:
'操作失败'
,
description
:
'选中项包含不可删除的用户panda或admin'
,
});
}
else
{
multiDeleteUsers
(
userIDs
)
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
...
...
@@ -1287,6 +1327,7 @@ const UserManage = () => {
setTableLoading
(
false
);
message
.
error
(
err
);
});
}
};
// 重置默认第一个
const
handleReset
=
()
=>
{
...
...
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