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
c8ad5a21
Commit
c8ad5a21
authored
Aug 11, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 'web配置功能路径选择参数保留'
parent
5d37fff3
Pipeline
#77424
passed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
8 deletions
+51
-8
ParmarsModal.jsx
...pages/productCenter/webConfig/menuconfig/ParmarsModal.jsx
+14
-2
TreeSelect.jsx
src/pages/productCenter/webConfig/menuconfig/TreeSelect.jsx
+10
-2
editForm.jsx
src/pages/productCenter/webConfig/menuconfig/editForm.jsx
+27
-4
No files found.
src/pages/productCenter/webConfig/menuconfig/ParmarsModal.jsx
View file @
c8ad5a21
import
React
,
{
useState
,
useRef
,
useContext
,
useEffect
}
from
'react'
;
import
{
Modal
,
Form
,
Table
,
Input
,
Button
,
message
,
Select
}
from
'antd'
;
import
{
Modal
,
Form
,
Table
,
Input
,
Button
,
message
,
Select
,
Tag
}
from
'antd'
;
import
{
DeleteOutlined
}
from
'@ant-design/icons'
;
import
styles
from
'./ParmarsModal.less'
;
const
EditableContext
=
React
.
createContext
(
null
);
...
...
@@ -171,6 +171,7 @@ const ParmarsModal = props => {
});
setCount
(
finalArray
.
length
);
setDataSource
(
newList
);
debugger
;
setSelectedRowKeys
(
select
);
}
else
{
setDataSource
([]);
...
...
@@ -221,6 +222,17 @@ const ParmarsModal = props => {
width
:
50
,
render
:
(
text
,
record
,
index
)
=>
<
span
>
{
index
+
1
}
</
span
>,
},
{
title
:
'类型'
,
align
:
'center'
,
width
:
70
,
render
:
(
text
,
record
)
=>
{
if
(
record
.
releaseDate
)
{
return
<
Tag
color=
"cyan"
>
内置
</
Tag
>;
}
return
<
Tag
color=
"purple"
>
自定义
</
Tag
>;
},
},
{
title
:
'配置项'
,
dataIndex
:
'name'
,
...
...
@@ -251,7 +263,7 @@ const ParmarsModal = props => {
{
title
:
'操作'
,
dataIndex
:
''
,
width
:
8
0
,
width
:
5
0
,
align
:
'center'
,
render
:
(
_
,
record
)
=>
dataSource
.
length
>=
1
?
(
...
...
src/pages/productCenter/webConfig/menuconfig/TreeSelect.jsx
View file @
c8ad5a21
...
...
@@ -5,7 +5,7 @@ import lodash from 'lodash';
import
{
FolderFilled
,
FileOutlined
,
InfoCircleOutlined
,
HomeOutlined
}
from
'@ant-design/icons'
;
import
styles
from
'./TreeSelect.less'
;
const
TreeSelect
=
(
props
,
ref
)
=>
{
const
{
value
,
onChange
,
menuChange
,
code
,
initCurrentMenu
}
=
props
;
const
{
value
,
onChange
,
menuChange
,
code
,
initCurrentMenu
,
keepParams
}
=
props
;
const
[
menuWebList
,
setMenuWebList
]
=
useState
({});
const
[
treeList
,
setTreeList
]
=
useState
({});
const
[
visible
,
setVisible
]
=
useState
(
false
);
...
...
@@ -123,6 +123,9 @@ const TreeSelect = (props, ref) => {
setExpandedKeys
([...
keys
]);
// 调用函数,传入数组
let
tree
=
arrayToTree
(
list
,
'model'
,
'moduleName'
);
console
.
log
(
menuWebList
);
console
.
log
(
tree
);
debugger
;
setTreeList
(
tree
);
};
const
changeValue
=
e
=>
{
...
...
@@ -132,8 +135,13 @@ const TreeSelect = (props, ref) => {
setVisible
(
true
);
};
const
onSelect
=
(
selectedKeysValue
,
info
)
=>
{
console
.
log
(
info
);
debugger
;
menuChange
(
info
.
selectedNodes
[
0
].
param
);
onChange
(
info
.
selectedNodes
[
0
].
param
.
path
);
let
str
=
info
.
selectedNodes
[
0
].
param
.
path
.
split
(
'|'
)[
0
];
let
newStr
=
`
${
str
}
|
${
keepParams
}
`
;
let
data
=
keepParams
?
newStr
:
info
.
selectedNodes
[
0
].
param
.
path
;
onChange
(
data
);
setCurrentMenuParmar
(
info
.
selectedNodes
[
0
].
param
);
setVisible
(
false
);
};
...
...
src/pages/productCenter/webConfig/menuconfig/editForm.jsx
View file @
c8ad5a21
...
...
@@ -62,6 +62,7 @@ const EditForm = props => {
const
[
curretnMenu
,
setCurrentMenu
]
=
useState
({});
// 当前选中菜单数据
const
[
configContent
,
setConfigContent
]
=
useState
(
''
);
// 配置文件内容
const
treeSelectRef
=
useRef
();
const
[
keepParams
,
setKeepParams
]
=
useState
(
''
);
const
layout
=
{
layout
:
'horizontal'
,
labelCol
:
{
span
:
2
},
...
...
@@ -72,6 +73,8 @@ const EditForm = props => {
useEffect
(()
=>
{
console
.
log
(
info
,
'info'
);
console
.
log
(
infoAll
,
'infoalll'
);
let
str
=
infoAll
.
pageUrl
?.
split
(
'|'
)[
1
];
setKeepParams
(
str
);
if
(
!
infoAll
.
code
)
{
setMenuParmar
([]);
}
...
...
@@ -89,7 +92,6 @@ const EditForm = props => {
arr
.
map
(
i
=>
{
obj
[
i
]
=
infoAll
[
i
];
});
setVisibleChecked
(
infoAll
.
hideInMenu
);
targetForm
.
setFieldsValue
({
...
obj
,
shortName
:
infoAll
.
menuShortName
});
if
(
info
.
length
>
0
)
{
...
...
@@ -333,6 +335,8 @@ const EditForm = props => {
};
const
menuChange
=
val
=>
{
console
.
log
(
keepParams
);
debugger
;
if
(
!
val
)
{
return
;
}
...
...
@@ -340,16 +344,21 @@ const EditForm = props => {
setCodeParmar
([]);
// form.resetFields();
console
.
log
(
form
,
'form'
);
console
.
log
(
val
);
let
str
=
val
.
path
?.
split
(
'|'
)[
0
];
let
newStr
=
`
${
str
}
|
${
keepParams
}
`
;
form
.
setFieldsValue
({
menuName
:
val
?.
function
,
shortName
:
val
?.
shortName
,
imageUrl
:
val
?.
icon
,
configName
:
val
?.
configName
,
pageUrl
:
val
?.
pageUrl
,
pageUrl
:
newStr
||
val
?.
path
,
});
console
.
log
(
newStr
);
setConfigContent
(
val
.
configContent
);
setCurrentMenu
(
val
);
setMenuParmar
(
val
?.
param
);
debugger
;
};
// 编辑完配置文件后回调
const
wrapperFinish
=
val
=>
{
...
...
@@ -368,10 +377,21 @@ const EditForm = props => {
console
.
error
(
e
);
});
};
// 表单参数监听
const
onValuesChange
=
values
=>
{
let
keys
=
Object
.
keys
(
values
);
if
(
keys
.
includes
(
'pageUrl'
))
{
let
str
=
values
.
pageUrl
.
split
(
'|'
)[
1
];
setKeepParams
(
str
);
debugger
;
}
};
return
(
<
div
style=
{
{
marginTop
:
'10px'
}
}
>
{
nodeType
===
1
&&
(
<
Form
form=
{
form
}
name=
"editGroup"
onFinish=
{
onFinish
}
>
<
Form
form=
{
form
}
name=
"editGroup"
onFinish=
{
onFinish
}
onValuesChange=
{
onValuesChange
}
>
<
Item
label=
"菜单名称"
name=
"menuName"
...
...
@@ -444,8 +464,8 @@ const EditForm = props => {
menuChange=
{
val
=>
menuChange
(
val
)
}
code=
{
infoAll
?.
code
}
codeParam=
{
infoAll
?.
codeParam
}
keepParams=
{
keepParams
}
initCurrentMenu=
{
value
=>
{
console
.
log
(
value
,
'value'
);
setCurrentMenu
(
value
);
setMenuParmar
(
value
.
param
);
}
}
...
...
@@ -617,11 +637,14 @@ const EditForm = props => {
pageUrl=
{
form
.
getFieldValue
(
'pageUrl'
)
}
handleCancel=
{
()
=>
setShowParmarModal
(
false
)
}
visible=
{
showParmarModal
}
keepParams=
{
keepParams
}
parmarCallBack=
{
(
url
,
params
)
=>
{
form
.
setFieldsValue
({
pageUrl
:
url
});
setCurrentMenu
({
...
curretnMenu
,
param
:
params
});
setCodeParmar
(
params
);
setShowParmarModal
(
false
);
let
str
=
url
?.
split
(
'|'
)[
1
];
setKeepParams
(
str
);
}
}
/>
</
div
>
...
...
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