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
ad47c71b
Commit
ad47c71b
authored
Apr 20, 2023
by
邓超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改主页配置bug
parent
1e44de27
Pipeline
#71225
passed with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
89 deletions
+100
-89
HomeConfigModal.jsx
...es/productCenter/webConfig/components/HomeConfigModal.jsx
+67
-77
HomeConfigModal.less
...s/productCenter/webConfig/components/HomeConfigModal.less
+12
-1
editConfigFileWrapper.js
...oductCenter/webConfig/menuconfig/editConfigFileWrapper.js
+2
-2
editForm.jsx
src/pages/productCenter/webConfig/menuconfig/editForm.jsx
+16
-6
api.js
src/services/webConfig/api.js
+3
-3
No files found.
src/pages/productCenter/webConfig/components/HomeConfigModal.jsx
View file @
ad47c71b
...
@@ -8,13 +8,13 @@ const HomeConfigModal = props => {
...
@@ -8,13 +8,13 @@ const HomeConfigModal = props => {
const
{
handleCancel
,
productList
,
visible
,
onFinish
,
currentPageConfig
,
client
}
=
props
;
const
{
handleCancel
,
productList
,
visible
,
onFinish
,
currentPageConfig
,
client
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
checkList
,
setCheckList
]
=
useState
(
[]
);
const
[
checkList
,
setCheckList
]
=
useState
(
null
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
visible
)
{
if
(
visible
)
{
form
.
setFieldsValue
(
currentPageConfig
);
form
.
setFieldsValue
(
currentPageConfig
);
getCheckList
();
getCheckList
();
}
else
{
}
else
{
setCheckList
(
[]
);
setCheckList
(
null
);
form
.
resetFields
();
form
.
resetFields
();
}
}
},
[
visible
]);
},
[
visible
]);
...
@@ -56,7 +56,6 @@ const HomeConfigModal = props => {
...
@@ -56,7 +56,6 @@ const HomeConfigModal = props => {
const
chekMap
=
new
Set
(
currentPageConfig
.
roleId
);
const
chekMap
=
new
Set
(
currentPageConfig
.
roleId
);
res
.
data
.
forEach
(
item
=>
{
res
.
data
.
forEach
(
item
=>
{
if
(
item
.
groupName
!==
'默认'
)
{
if
(
item
.
groupName
!==
'默认'
)
{
childList
.
push
(
item
);
let
checks
=
[];
let
checks
=
[];
item
.
roleGroups
.
forEach
(
ele
=>
{
item
.
roleGroups
.
forEach
(
ele
=>
{
if
(
chekMap
.
has
(
ele
.
roleId
))
{
if
(
chekMap
.
has
(
ele
.
roleId
))
{
...
@@ -73,6 +72,7 @@ const HomeConfigModal = props => {
...
@@ -73,6 +72,7 @@ const HomeConfigModal = props => {
item
.
indeterminate
=
true
;
item
.
indeterminate
=
true
;
item
.
isCheck
=
false
;
item
.
isCheck
=
false
;
}
}
childList
.
push
(
item
);
}
else
{
}
else
{
defaultList
=
item
.
roleGroups
;
defaultList
=
item
.
roleGroups
;
}
}
...
@@ -80,29 +80,26 @@ const HomeConfigModal = props => {
...
@@ -80,29 +80,26 @@ const HomeConfigModal = props => {
console
.
log
(
chekMap
,
currentPageConfig
,
'chekMap'
);
console
.
log
(
chekMap
,
currentPageConfig
,
'chekMap'
);
let
list
=
[
let
list
=
{
{
groupName
:
'关联角色'
,
groupName
:
'关联角色'
,
isCheck
:
false
,
isCheck
:
false
,
roleGroups
:
[...
defaultList
,
...
childList
].
map
((
item
,
index
)
=>
{
index
:
[
0
],
let
obj
=
{
roleGroups
:
[...
defaultList
,
...
childList
].
map
((
item
,
index
)
=>
{
groupName
:
item
.
groupName
,
let
obj
=
{
isCheck
:
item
.
isCheck
,
groupName
:
item
.
groupName
,
indeterminate
:
item
.
indeterminate
,
isCheck
:
item
.
isCheck
,
index
:
[
index
],
indeterminate
:
item
.
indeterminate
,
roleGroups
:
item
.
roleGroups
?.
map
((
ele
,
i
)
=>
({
index
:
[
0
,
index
],
...
ele
,
roleGroups
:
item
.
roleGroups
?.
map
((
ele
,
i
)
=>
({
isCheck
:
chekMap
.
has
(
ele
.
roleId
),
...
ele
,
index
:
[
index
,
i
],
isCheck
:
chekMap
.
has
(
ele
.
roleId
),
})),
index
:
[
0
,
index
,
i
],
};
})),
let
ojbChild
=
{
...
item
,
isCheck
:
chekMap
.
has
(
item
.
roleId
),
index
:
[
index
]
};
};
let
ojbChild
=
{
...
item
,
isCheck
:
chekMap
.
has
(
item
.
roleId
),
index
:
[
0
,
index
]
};
return
item
.
roleGroups
?
obj
:
ojbChild
;
return
item
.
roleGroups
?
obj
:
ojbChild
;
}),
}),
},
};
];
console
.
log
(
list
,
'list'
);
console
.
log
(
list
,
'list'
);
setCheckList
(
list
);
setCheckList
(
list
);
}
}
...
@@ -110,14 +107,11 @@ const HomeConfigModal = props => {
...
@@ -110,14 +107,11 @@ const HomeConfigModal = props => {
};
};
// 多选
// 多选
const
changeAll
=
(
e
,
item
)
=>
{
const
changeAll
=
(
e
,
item
)
=>
{
console
.
log
(
item
,
'itemasjdf'
);
let
list
=
lodash
.
cloneDeep
(
checkList
);
let
list
=
lodash
.
cloneDeep
(
checkList
);
let
current
=
item
.
index
.
reduce
(
let
current
=
item
.
index
(
acc
,
cur
)
=>
?
item
.
index
.
reduce
((
acc
,
cur
)
=>
(
acc
.
roleGroups
?
acc
.
roleGroups
[
cur
]
:
acc
),
list
)
acc
[
cur
].
roleGroups
&&
cur
!==
item
.
index
[
item
.
index
.
length
-
1
]
:
list
;
?
acc
[
cur
].
roleGroups
:
acc
[
cur
],
list
,
);
console
.
log
(
current
);
console
.
log
(
current
);
current
.
isCheck
=
e
.
target
.
checked
;
current
.
isCheck
=
e
.
target
.
checked
;
checkAll
(
e
.
target
.
checked
,
current
.
roleGroups
);
checkAll
(
e
.
target
.
checked
,
current
.
roleGroups
);
...
@@ -134,22 +128,21 @@ const HomeConfigModal = props => {
...
@@ -134,22 +128,21 @@ const HomeConfigModal = props => {
};
};
const
onChange
=
(
e
,
item
)
=>
{
const
onChange
=
(
e
,
item
)
=>
{
let
list
=
lodash
.
cloneDeep
(
checkList
);
let
list
=
lodash
.
cloneDeep
(
checkList
);
console
.
log
(
item
.
index
,
list
,
'asfd'
);
let
current
=
item
.
index
.
reduce
(
let
current
=
item
.
index
.
reduce
(
(
acc
,
cur
)
=>
(
acc
[
cur
].
roleGroups
?
acc
[
cur
].
roleGroups
:
acc
[
cur
]
),
(
acc
,
cur
)
=>
(
acc
.
roleGroups
?
acc
.
roleGroups
[
cur
]
:
acc
),
list
,
list
,
);
);
console
.
log
(
current
,
'current'
);
current
.
isCheck
=
e
.
target
.
checked
;
current
.
isCheck
=
e
.
target
.
checked
;
let
parentIndex
=
[...
item
.
index
];
let
parentIndex
=
[...
item
.
index
];
parentIndex
.
pop
();
parentIndex
.
pop
();
let
allCurrent
=
parentIndex
.
reduce
(
let
allCurrent
=
parentIndex
.
reduce
(
(
acc
,
cur
)
=>
(
acc
,
cur
)
=>
(
acc
.
roleGroups
?
acc
.
roleGroups
[
cur
]
:
acc
),
acc
[
cur
].
roleGroups
&&
cur
!==
parentIndex
[
parentIndex
.
length
-
1
]
?
acc
[
cur
].
roleGroups
:
acc
[
cur
],
list
,
list
,
);
);
console
.
log
(
allCurrent
,
'allCurrent'
);
let
num
=
allCurrent
?.
roleGroups
?.
filter
(
ele
=>
ele
.
isCheck
).
length
;
let
num
=
allCurrent
?.
roleGroups
?.
filter
(
ele
=>
ele
.
isCheck
).
length
;
if
(
num
===
allCurrent
.
roleGroups
.
length
)
{
if
(
num
===
allCurrent
.
roleGroups
.
length
)
{
...
@@ -164,47 +157,44 @@ const HomeConfigModal = props => {
...
@@ -164,47 +157,44 @@ const HomeConfigModal = props => {
setCheckList
(
list
);
setCheckList
(
list
);
};
};
const
checkRender
=
list
=>
(
const
checkRender
=
list
=>
{
<>
console
.
log
(
list
,
'fasldfjaslkdjf'
);
<
div
className=
{
styles
.
checkList
}
>
let
num
=
list
?.
roleGroups
?.
filter
(
ele
=>
ele
.
isCheck
||
ele
.
indeterminate
).
length
;
{
list
.
map
(
item
=>
{
return
(
let
num
=
item
.
roleGroups
?.
filter
(
ele
=>
ele
.
isCheck
||
ele
.
indeterminate
).
length
;
<>
<
div
className=
{
styles
.
checkList
}
>
return
(
{
list
?.
groupName
&&
(
<
div
className=
{
styles
.
checkBox
}
key=
{
item
.
groupName
}
>
<
div
className=
{
styles
.
title
}
>
{
item
.
groupName
&&
(
<
Checkbox
<
div
className=
{
styles
.
title
}
>
onChange=
{
e
=>
changeAll
(
e
,
list
)
}
checked=
{
num
===
list
?.
roleGroups
.
length
}
indeterminate=
{
num
>
0
&&
num
<
list
?.
roleGroups
.
length
}
>
{
list
?.
groupName
}
</
Checkbox
>
</
div
>
)
}
{
list
?.
roleGroups
.
map
(
item
=>
{
return
(
<>
{
item
.
roleGroups
?
(
checkRender
(
item
)
)
:
(
<
Checkbox
<
Checkbox
onChange=
{
e
=>
changeAll
(
e
,
item
)
}
onChange=
{
e
=>
onChange
(
e
,
item
)
}
checked=
{
num
===
item
.
roleGroups
.
length
}
style=
{
{
width
:
'150px'
,
marginLeft
:
'0px'
,
marginBottom
:
'10px'
}
}
indeterminate=
{
num
>
0
&&
num
<
item
.
roleGroups
.
length
}
checked=
{
item
.
isCheck
}
>
>
{
item
.
group
Name
}
{
item
.
role
Name
}
</
Checkbox
>
</
Checkbox
>
</
div
>
)
}
)
}
</>
{
item
.
roleGroups
&&
);
item
.
roleGroups
.
map
(
ele
=>
(
})
}
<>
</
div
>
{
ele
.
roleGroups
?
(
</>
checkRender
(
item
.
roleGroups
)
);
)
:
(
};
<
Checkbox
onChange=
{
e
=>
onChange
(
e
,
ele
)
}
style=
{
{
width
:
'150px'
,
marginLeft
:
'0px'
,
marginBottom
:
'10px'
}
}
checked=
{
ele
.
isCheck
}
>
{
ele
.
roleName
}
</
Checkbox
>
)
}
</>
))
}
</
div
>
);
})
}
</
div
>
</>
);
return
(
return
(
<
Modal
<
Modal
width=
{
800
}
width=
{
800
}
...
@@ -215,7 +205,7 @@ const HomeConfigModal = props => {
...
@@ -215,7 +205,7 @@ const HomeConfigModal = props => {
onOk=
{
onSubmit
}
onOk=
{
onSubmit
}
destroyOnClose
destroyOnClose
>
>
<
div
className=
{
styles
.
monitorC
ontent
}
>
<
div
className=
{
styles
.
c
ontent
}
>
<
Form
<
Form
form=
{
form
}
form=
{
form
}
labelCol=
{
{
span
:
3
}
}
labelCol=
{
{
span
:
3
}
}
...
...
src/pages/productCenter/webConfig/components/HomeConfigModal.less
View file @
ad47c71b
.content {
max-height: 600px;
overflow-y: scroll
}
.checkList {
.checkList {
display: flex;
display: flex;
flex-wrap: wrap;
flex-wrap: wrap;
width: 100%;
width: 100%;
border: 1px solid #c2cdfd;
border: 1px solid #c2cdfd;
padding: 20px 15px 1
5
px 15px;
padding: 20px 15px 1
0
px 15px;
position: relative;
position: relative;
margin-top: 15px;
margin-top: 15px;
align-items: center;
// margin-bottom: 10px;
border-radius: 5px;
border-radius: 5px;
.title {
.title {
position: absolute;
position: absolute;
top: -12px;
top: -12px;
background-color: #fff;
background-color: #fff;
}
}
}
}
\ No newline at end of file
src/pages/productCenter/webConfig/menuconfig/editConfigFileWrapper.js
View file @
ad47c71b
...
@@ -7,7 +7,7 @@ import 'ace-builds/src-noconflict/mode-json';
...
@@ -7,7 +7,7 @@ import 'ace-builds/src-noconflict/mode-json';
import
'ace-builds/src-noconflict/theme-solarized_light'
;
import
'ace-builds/src-noconflict/theme-solarized_light'
;
const
ConfigWrapper
=
props
=>
{
const
ConfigWrapper
=
props
=>
{
const
{
value
,
children
,
onChange
,
...
rest
}
=
props
;
const
{
value
,
children
,
onChange
,
id
,
...
rest
}
=
props
;
const
[
text
,
setText
]
=
useState
(
''
);
const
[
text
,
setText
]
=
useState
(
''
);
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
visible
,
setVisible
]
=
useState
(
false
);
...
@@ -44,7 +44,7 @@ const ConfigWrapper = props => {
...
@@ -44,7 +44,7 @@ const ConfigWrapper = props => {
err
=
true
;
err
=
true
;
}
}
if
(
!
err
)
{
if
(
!
err
)
{
saveConfigContent
(
value
,
JSON
.
stringify
(
JSON
.
parse
(
text
),
null
,
4
))
saveConfigContent
(
value
,
JSON
.
stringify
(
JSON
.
parse
(
text
),
null
,
4
)
,
id
)
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
notification
.
success
({
notification
.
success
({
...
...
src/pages/productCenter/webConfig/menuconfig/editForm.jsx
View file @
ad47c71b
...
@@ -49,8 +49,8 @@ const EditForm = props => {
...
@@ -49,8 +49,8 @@ const EditForm = props => {
};
};
// 回显表单
// 回显表单
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
info
);
console
.
log
(
info
,
'info'
);
console
.
log
(
infoAll
);
console
.
log
(
infoAll
,
'infoalll'
);
form
.
resetFields
();
form
.
resetFields
();
otherForm
.
resetFields
();
otherForm
.
resetFields
();
setPlainOptions
(
info
);
setPlainOptions
(
info
);
...
@@ -111,7 +111,6 @@ const EditForm = props => {
...
@@ -111,7 +111,6 @@ const EditForm = props => {
const
submit
=
()
=>
{
const
submit
=
()
=>
{
const
targetForm
=
nodeType
===
1
?
form
:
otherForm
;
const
targetForm
=
nodeType
===
1
?
form
:
otherForm
;
let
obj
=
targetForm
.
getFieldsValue
();
let
obj
=
targetForm
.
getFieldsValue
();
console
.
log
(
obj
);
console
.
log
(
plainOptions
);
console
.
log
(
plainOptions
);
let
data
=
[];
let
data
=
[];
if
(
nodeType
==
1
)
{
if
(
nodeType
==
1
)
{
...
@@ -125,7 +124,18 @@ const EditForm = props => {
...
@@ -125,7 +124,18 @@ const EditForm = props => {
}
else
{
}
else
{
obj
.
relatedRoleList
=
''
;
obj
.
relatedRoleList
=
''
;
}
}
console
.
log
(
productList
,
'productlIST'
);
let
arr
=
obj
.
pageUrl
.
split
(
'/'
);
// 用const声明常量
const
product
=
productList
.
find
(
item
=>
item
.
PackageName
.
includes
(
arr
[
0
]));
if
(
product
)
{
arr
.
shift
();
obj
.
pageUrl
=
arr
.
join
(
'/'
);
}
console
.
log
(
product
,
'product'
);
obj
.
product
=
product
?.
PackageName
||
'civweb4'
;
}
}
console
.
log
(
obj
,
'fadas'
);
submitCallback
(
obj
);
submitCallback
(
obj
);
};
};
...
@@ -301,7 +311,7 @@ const EditForm = props => {
...
@@ -301,7 +311,7 @@ const EditForm = props => {
<
Item
label=
"菜单别名"
name=
"shortName"
style=
{
{
marginLeft
:
'11px'
}
}
>
<
Item
label=
"菜单别名"
name=
"shortName"
style=
{
{
marginLeft
:
'11px'
}
}
>
<
Input
placeholder=
"请输入菜单别名"
style=
{
{
width
:
'100%'
}
}
/>
<
Input
placeholder=
"请输入菜单别名"
style=
{
{
width
:
'100%'
}
}
/>
</
Item
>
</
Item
>
<
Item
label=
"产品类型"
name=
"product"
style=
{
{
marginLeft
:
'11px'
}
}
>
{
/*
<Item label="产品类型" name="product" style={{ marginLeft: '11px' }}>
<Select placeholder="请选择产品类型" allowClear style={{ width: '100%' }}>
<Select placeholder="请选择产品类型" allowClear style={{ width: '100%' }}>
{productList &&
{productList &&
productList.length > 0 &&
productList.length > 0 &&
...
@@ -311,7 +321,7 @@ const EditForm = props => {
...
@@ -311,7 +321,7 @@ const EditForm = props => {
</Option>
</Option>
))}
))}
</Select>
</Select>
</
Item
>
</Item>
*/
}
<
Item
<
Item
label=
"菜单图标"
label=
"菜单图标"
name=
"imageUrl"
name=
"imageUrl"
...
@@ -359,7 +369,7 @@ const EditForm = props => {
...
@@ -359,7 +369,7 @@ const EditForm = props => {
</
div
>
</
div
>
</
Item
>
</
Item
>
<
Item
label=
"配置文件"
name=
"config"
style=
{
{
marginLeft
:
'11px'
}
}
>
<
Item
label=
"配置文件"
name=
"config"
style=
{
{
marginLeft
:
'11px'
}
}
>
<
EditeConfigWrapper
>
<
EditeConfigWrapper
id=
{
infoAll
.
menuID
}
>
<
Select
<
Select
allowClear
allowClear
showSearch
showSearch
...
...
src/services/webConfig/api.js
View file @
ad47c71b
...
@@ -95,8 +95,9 @@ export const getWebMenuInfo = param =>
...
@@ -95,8 +95,9 @@ export const getWebMenuInfo = param =>
// },
// },
// );
// );
export
const
saveConfigContent
=
(
fileName
,
content
)
=>
export
const
saveConfigContent
=
(
fileName
,
content
,
id
)
=>
post
(
`
${
PUBLISH_SERVICE
}
/PlatformCenter/SaveConfigContent`
,
{
post
(
`
${
PUBLISH_SERVICE
}
/PlatformCenter/SaveConfigContent`
,
{
id
,
fileName
,
fileName
,
web4ConfigContent
:
content
,
web4ConfigContent
:
content
,
});
});
...
@@ -333,4 +334,4 @@ export const QueryBaseMapItems = param => get(`${PANDA_GIS}/MapLayer/QueryBaseMa
...
@@ -333,4 +334,4 @@ export const QueryBaseMapItems = param => get(`${PANDA_GIS}/MapLayer/QueryBaseMa
// 通过client获取角色
// 通过client获取角色
export
const
GetRoleGroups
=
param
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/GetRoleGroups`
,
param
);
export
const
GetRoleGroups
=
param
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/GetRoleGroups`
,
param
);
export
const
SortScheme
=
param
=>
get
(
`
${
PANDA_GIS
}
/MapLayer/SortScheme`
,
param
);
export
const
SortScheme
=
param
=>
get
(
`
${
PANDA_GIS
}
/MapLayer/SortScheme`
,
param
);
\ 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