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
1d09a3e8
Commit
1d09a3e8
authored
Nov 27, 2020
by
张烨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 网站配置
parent
c557eab0
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
274 additions
and
84 deletions
+274
-84
siteConfigDrawer.js
src/pages/webConfig/components/siteConfigDrawer.js
+4
-1
index.js
src/pages/webConfig/index.js
+40
-14
index.less
src/pages/webConfig/index.less
+4
-0
AddForm.jsx
src/pages/webConfig/menuconfig/AddForm.jsx
+29
-5
MenuConfig.jsx
src/pages/webConfig/menuconfig/MenuConfig.jsx
+4
-1
checkBox.jsx
src/pages/webConfig/menuconfig/checkBox.jsx
+1
-1
editConfigFileWrapper.js
src/pages/webConfig/menuconfig/editConfigFileWrapper.js
+80
-0
editForm.jsx
src/pages/webConfig/menuconfig/editForm.jsx
+22
-3
webMenu.jsx
src/pages/webConfig/menuconfig/webMenu.jsx
+38
-58
webMenu.less
src/pages/webConfig/menuconfig/webMenu.less
+1
-1
utils.js
src/pages/webConfig/utils.js
+13
-0
api.js
src/services/webConfig/api.js
+38
-0
No files found.
src/pages/webConfig/components/siteConfigDrawer.js
View file @
1d09a3e8
...
@@ -37,7 +37,10 @@ export default props => {
...
@@ -37,7 +37,10 @@ export default props => {
});
});
return
;
return
;
}
}
values
.
alarmWays
=
values
.
alarmWays
?.
join
(
','
)
||
''
;
values
.
alarmWays
=
typeof
values
.
alarmWays
===
'string'
?
values
.
alarmWays
:
values
.
alarmWays
.
join
(
','
)
||
''
;
// eslint-disable-next-line no-unused-expressions
// eslint-disable-next-line no-unused-expressions
onOk
&&
onOk
(
values
);
onOk
&&
onOk
(
values
);
}}
}}
...
...
src/pages/webConfig/index.js
View file @
1d09a3e8
...
@@ -7,6 +7,7 @@ import {
...
@@ -7,6 +7,7 @@ import {
postEditWebConfig
,
postEditWebConfig
,
postAddWebSite
,
postAddWebSite
,
deleteWebsite
,
deleteWebsite
,
getAllConfigName
,
}
from
'@/services/webConfig/api'
;
}
from
'@/services/webConfig/api'
;
import
{
ExclamationCircleOutlined
}
from
'@ant-design/icons'
;
import
{
ExclamationCircleOutlined
}
from
'@ant-design/icons'
;
import
Modal
from
'antd/lib/modal/Modal'
;
import
Modal
from
'antd/lib/modal/Modal'
;
...
@@ -28,6 +29,7 @@ const WebConfigPage = props => {
...
@@ -28,6 +29,7 @@ const WebConfigPage = props => {
const
[
toEdit
,
setToEdit
]
=
useState
(
null
);
// 编辑展示用的配置
const
[
toEdit
,
setToEdit
]
=
useState
(
null
);
// 编辑展示用的配置
const
[
isEdit
,
setIsEdit
]
=
useState
(
true
);
const
[
isEdit
,
setIsEdit
]
=
useState
(
true
);
const
[
submitting
,
setSubmitting
]
=
useState
(
false
);
const
[
submitting
,
setSubmitting
]
=
useState
(
false
);
const
[
configFiles
,
setConfigFiles
]
=
useState
([]);
const
hasIntegerate
=
()
=>
const
hasIntegerate
=
()
=>
webs
.
some
(
w
=>
w
.
id
.
startsWith
(
webMode
.
integration
));
webs
.
some
(
w
=>
w
.
id
.
startsWith
(
webMode
.
integration
));
...
@@ -36,6 +38,9 @@ const WebConfigPage = props => {
...
@@ -36,6 +38,9 @@ const WebConfigPage = props => {
let
canceled
=
{
cancel
:
false
};
let
canceled
=
{
cancel
:
false
};
setLoading
(
true
);
setLoading
(
true
);
updateModuleTree
(
userMode
||
'super'
,
canceled
);
updateModuleTree
(
userMode
||
'super'
,
canceled
);
getAllConfigName
().
then
(
res
=>
{
if
(
!
canceled
.
cancel
)
setConfigFiles
(
res
);
});
return
()
=>
{
return
()
=>
{
canceled
.
cancel
=
true
;
canceled
.
cancel
=
true
;
};
};
...
@@ -58,8 +63,20 @@ const WebConfigPage = props => {
...
@@ -58,8 +63,20 @@ const WebConfigPage = props => {
const
websArr
=
[
const
websArr
=
[
res
.
data
res
.
data
.
filter
(
d
=>
d
.
id
===
'Web4IntegrateStation'
)
.
filter
(
d
=>
d
.
id
===
'Web4IntegrateStation'
)
.
map
(
r
=>
r
.
children
),
.
map
(
r
=>
res
.
data
.
filter
(
d
=>
d
.
id
===
'Web4SingleStation'
).
map
(
r
=>
r
.
children
),
r
.
children
.
map
(
c
=>
({
...
c
,
subSystemValue
:
c
.
id
.
split
(
webMode
.
integration
)[
1
],
})),
),
res
.
data
.
filter
(
d
=>
d
.
id
===
'Web4SingleStation'
)
.
map
(
r
=>
r
.
children
.
map
(
c
=>
({
...
c
,
subSystemValue
:
c
.
id
.
split
(
webMode
.
single
)[
1
],
})),
),
].
flat
(
2
);
].
flat
(
2
);
if
(
!
canceled
.
cancel
)
{
if
(
!
canceled
.
cancel
)
{
setWebs
(
websArr
);
setWebs
(
websArr
);
...
@@ -202,23 +219,32 @@ const WebConfigPage = props => {
...
@@ -202,23 +219,32 @@ const WebConfigPage = props => {
updateModuleTree
(
userMode
||
'super'
);
updateModuleTree
(
userMode
||
'super'
);
};
};
const
updateMenuTree
=
(
type
,
menuNode
)
=>
{
updateModuleTree
(
userMode
||
'super'
);
};
const
renderTabPane
=
tabPaneItem
=>
(
const
renderTabPane
=
tabPaneItem
=>
(
<
TabPane
key
=
{
tabPaneItem
.
id
}
tab
=
{
tabPaneItem
.
text
}
>
<
TabPane
key
=
{
tabPaneItem
.
id
}
tab
=
{
tabPaneItem
.
text
}
>
<>
<>
<
span
<
ProCard
className
=
{
styles
.
webConfigTabcontent
}
>
className
=
{
styles
.
link
}
<
span
onClick
=
{()
=>
{
className
=
{
styles
.
link
}
setToEdit
({
...
configObj
});
onClick
=
{()
=>
{
setConfigVisible
(
true
);
setToEdit
({
...
configObj
}
);
setIsEdit
(
true
);
setConfigVisible
(
true
);
}}
setIsEdit
(
true
);
>
}}
查看
/
编辑网站配置
>
<
/span
>
查看
/
编辑网站配置
<
ProCard
>
<
/span
>
<
MenuConfig
<
MenuConfig
menu
=
{
curWeb
?.
children
.
find
(
w
=>
w
.
menuType
===
'Web4MenuRoot'
)}
menu
=
{
tabPaneItem
?.
children
.
find
(
w
=>
w
.
menuType
===
'Web4MenuRoot'
,
)}
onUpdate
=
{
handleUpdateOnMenuChange
}
onUpdate
=
{
handleUpdateOnMenuChange
}
configFiles
=
{
configFiles
}
updateMenuTree
=
{
updateMenuTree
}
subSystemValue
=
{
tabPaneItem
?.
subSystemValue
}
/
>
/
>
<
/ProCard
>
<
/ProCard
>
<
/
>
<
/
>
...
...
src/pages/webConfig/index.less
View file @
1d09a3e8
...
@@ -13,6 +13,10 @@
...
@@ -13,6 +13,10 @@
width: 100%;
width: 100%;
height: calc(100% - 40px);
height: calc(100% - 40px);
}
}
.webConfigTabcontent{
background: #fff;
height: calc(100vh - 128px) !important;
}
}
}
.webConfigContainer > .ant-tabs-card .ant-tabs-content {
.webConfigContainer > .ant-tabs-card .ant-tabs-content {
...
...
src/pages/webConfig/menuconfig/AddForm.jsx
View file @
1d09a3e8
import
React
,
{
useState
}
from
'react'
;
import
React
from
'react'
;
import
{
Form
,
Input
,
Button
,
Row
,
Col
}
from
'antd'
;
import
{
Form
,
Input
,
Button
,
Select
}
from
'antd'
;
import
styles
from
'./addForm.less'
;
import
styles
from
'./addForm.less'
;
import
PicturesWall
from
'@/components/Upload/index'
;
import
PicturesWall
from
'@/components/Upload/index'
;
import
EditeConfigWrapper
from
'./editConfigFileWrapper'
;
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
AddForm
=
props
=>
{
const
AddForm
=
props
=>
{
const
{
submitCallback
,
nodeType
,
nodeObj
,
addType
,
submitLoading
}
=
props
;
const
{
submitCallback
,
nodeObj
,
addType
,
submitLoading
,
configFiles
,
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
otherForm
]
=
Form
.
useForm
();
const
[
otherForm
]
=
Form
.
useForm
();
console
.
log
(
nodeObj
,
'nodeObj'
);
const
layout
=
{
const
layout
=
{
layout
:
'horizontal'
,
layout
:
'horizontal'
,
labelCol
:
{
span
:
4
,
offset
:
1
},
labelCol
:
{
span
:
4
,
offset
:
1
},
...
@@ -65,9 +71,27 @@ const AddForm = props => {
...
@@ -65,9 +71,27 @@ const AddForm = props => {
>
>
<
PicturesWall
/>
<
PicturesWall
/>
</
Item
>
</
Item
>
<
Item
label=
"功能
参数"
name=
"funParam
"
>
<
Item
label=
"功能
路径"
name=
"pageUrl
"
>
<
Input
/>
<
Input
/>
</
Item
>
</
Item
>
<
Item
label=
"配置文件"
name=
"config"
>
<
EditeConfigWrapper
>
<
Select
allowClear
showSearch
filterOption=
{
(
input
,
option
)
=>
option
.
children
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
}
>
{
configFiles
.
map
(
c
=>
(
<
Select
.
Option
key=
{
c
.
text
}
value=
{
c
.
value
}
>
{
c
.
text
}
</
Select
.
Option
>
))
}
</
Select
>
</
EditeConfigWrapper
>
</
Item
>
<
Item
wrapperCol=
{
{
offset
:
5
}
}
style=
{
{
marginTop
:
'40px'
}
}
>
<
Item
wrapperCol=
{
{
offset
:
5
}
}
style=
{
{
marginTop
:
'40px'
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
submitLoading
}
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
submitLoading
}
>
提交
提交
...
...
src/pages/webConfig/menuconfig/MenuConfig.jsx
View file @
1d09a3e8
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
ProCard
from
'@ant-design/pro-card'
;
import
ProCard
from
'@ant-design/pro-card'
;
import
{
Empty
}
from
'antd'
;
import
WebMenu
from
'./webMenu'
;
import
WebMenu
from
'./webMenu'
;
const
MenuConfig
=
props
=>
{
const
MenuConfig
=
props
=>
{
const
{
menu
}
=
props
;
const
{
menu
}
=
props
;
return
(
return
(
<>
<>
{
menu
&&
(
{
menu
?
(
<
div
split=
"vertical"
>
<
div
split=
"vertical"
>
<
WebMenu
{
...
props
}
/>
<
WebMenu
{
...
props
}
/>
</
div
>
</
div
>
)
:
(
<
Empty
image=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/>
)
}
)
}
</>
</>
);
);
...
...
src/pages/webConfig/menuconfig/checkBox.jsx
View file @
1d09a3e8
...
@@ -42,7 +42,7 @@ const CheckList = props => {
...
@@ -42,7 +42,7 @@ const CheckList = props => {
};
};
return
(
return
(
<
div
>
<
div
>
{
nodeType
===
3
||
nodeType
===
4
?
(
{
nodeType
===
1
?
(
<
div
className=
{
styles
.
box
}
>
<
div
className=
{
styles
.
box
}
>
{
/* <Checkbox>全选/反选</Checkbox> */
}
{
/* <Checkbox>全选/反选</Checkbox> */
}
...
...
src/pages/webConfig/menuconfig/editConfigFileWrapper.js
0 → 100644
View file @
1d09a3e8
import
{
getConfigContent
,
saveConfigContent
}
from
'@/services/webConfig/api'
;
import
{
Button
,
Input
,
Modal
,
notification
}
from
'antd'
;
import
React
,
{
Children
,
useState
}
from
'react'
;
const
ConfigWrapper
=
props
=>
{
const
{
value
,
children
,
...
rest
}
=
props
;
const
[
text
,
setText
]
=
useState
(
''
);
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
showModal
=
()
=>
{
if
(
!
value
)
{
notification
.
warning
({
message
:
'请先填写配置文件名称'
,
duration
:
3
,
});
return
;
}
getConfigContent
(
value
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
setText
(
res
.
message
);
}
})
.
catch
(
e
=>
{
console
.
error
(
e
);
});
setVisible
(
true
);
};
const
handleOk
=
()
=>
{
let
content
;
let
err
=
false
;
try
{
content
=
JSON
.
parse
(
text
);
}
catch
(
error
)
{
notification
.
error
({
message
:
'编辑内容必须是json格式'
,
duration
:
5
,
});
err
=
true
;
}
if
(
!
err
)
{
saveConfigContent
(
JSON
.
stringify
(
JSON
.
parse
(
text
),
null
,
4
))
.
then
(
res
=>
{
if
(
res
.
success
)
{
notification
.
success
({
message
:
'保存成功'
,
duration
:
3
,
});
}
})
.
catch
(
error
=>
{
console
.
error
(
error
);
});
}
};
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
{
Children
.
map
(
children
,
child
=>
React
.
cloneElement
(
child
,
{
...
rest
}))}
{
<
Button
onClick
=
{
showModal
}
>
编辑
<
/Button>
}
<
Modal
title
=
"编辑配置"
visible
=
{
visible
}
onOk
=
{
handleOk
}
maskClosable
=
{
false
}
onCancel
=
{()
=>
setVisible
(
false
)}
>
<
Input
.
TextArea
value
=
{
text
}
onChange
=
{
e
=>
{
setText
(
e
.
target
.
value
);
}}
rows
=
{
5
}
/
>
<
/Modal
>
<
/div
>
);
};
export
default
ConfigWrapper
;
src/pages/webConfig/menuconfig/editForm.jsx
View file @
1d09a3e8
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
Button
,
Row
,
Col
}
from
'antd'
;
import
{
Form
,
Input
,
Button
,
Row
,
Col
,
Select
}
from
'antd'
;
import
styles
from
'./addForm.less'
;
import
styles
from
'./addForm.less'
;
import
PicturesWall
from
'@/components/Upload/index'
;
import
PicturesWall
from
'@/components/Upload/index'
;
import
EditeConfigWrapper
from
'./editConfigFileWrapper'
;
const
{
Item
}
=
Form
;
const
{
Item
}
=
Form
;
const
EditForm
=
props
=>
{
const
EditForm
=
props
=>
{
const
{
submitCallback
,
nodeType
,
info
}
=
props
;
const
{
submitCallback
,
nodeType
,
info
,
configFiles
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
[
otherForm
]
=
Form
.
useForm
();
const
[
otherForm
]
=
Form
.
useForm
();
console
.
log
(
info
);
console
.
log
(
info
);
...
@@ -75,9 +76,27 @@ const EditForm = props => {
...
@@ -75,9 +76,27 @@ const EditForm = props => {
>
>
<
PicturesWall
/>
<
PicturesWall
/>
</
Item
>
</
Item
>
<
Item
label=
"功能路径"
name=
"
funParam
"
>
<
Item
label=
"功能路径"
name=
"
pageUrl
"
>
<
Input
/>
<
Input
/>
</
Item
>
</
Item
>
<
Item
label=
"配置文件"
name=
"config"
>
<
EditeConfigWrapper
>
<
Select
allowClear
showSearch
filterOption=
{
(
input
,
option
)
=>
option
.
children
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
}
>
{
configFiles
.
map
(
c
=>
(
<
Select
.
Option
key=
{
c
.
text
}
value=
{
c
.
value
}
>
{
c
.
text
}
</
Select
.
Option
>
))
}
</
Select
>
</
EditeConfigWrapper
>
</
Item
>
<
Item
wrapperCol=
{
{
offset
:
5
}
}
style=
{
{
marginTop
:
'40px'
}
}
>
<
Item
wrapperCol=
{
{
offset
:
5
}
}
style=
{
{
marginTop
:
'40px'
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
>
<
Button
type=
"primary"
htmlType=
"submit"
>
提交
提交
...
...
src/pages/webConfig/menuconfig/webMenu.jsx
View file @
1d09a3e8
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
import
{
notification
,
Tree
,
Tooltip
,
Modal
,
Spin
}
from
'antd'
;
message
,
notification
,
Popconfirm
,
Form
,
Tree
,
Tooltip
,
Modal
,
Input
,
Button
,
Spin
,
}
from
'antd'
;
import
{
import
{
FileAddTwoTone
,
FileAddTwoTone
,
FolderAddTwoTone
,
FolderAddTwoTone
,
...
@@ -18,28 +7,23 @@ import {
...
@@ -18,28 +7,23 @@ import {
FileOutlined
,
FileOutlined
,
DeleteTwoTone
,
DeleteTwoTone
,
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
import
PicturesWall
from
'@/components/Upload/index'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
import
{
import
styles
from
'./webMenu.less'
;
miniAppSiteTree
,
getMiniAppModuleTree
,
addMenu
,
getMenuInfo
,
deleteMenu
,
editMenu
,
}
from
'@/services/mobileConfig/api'
;
import
styles
from
'./miniMenu.less'
;
import
AddForm
from
'./AddForm'
;
import
AddForm
from
'./AddForm'
;
import
EditForm
from
'./editForm'
;
import
EditForm
from
'./editForm'
;
import
CheckList
from
'./checkBox'
;
import
CheckList
from
'./checkBox'
;
import
{
addWebMenu
,
// 增
deleteWebMenu
,
// 删
editWebMenu
,
// 改
getWebMenuInfo
,
// 查
}
from
'@/services/webConfig/api'
;
const
MiniMenu
=
props
=>
{
const
MiniMenu
=
props
=>
{
const
{
menu
}
=
props
;
const
{
menu
,
configFiles
,
subSystemValue
,
updateMenuTree
}
=
props
;
const
[
flag
,
setFlag
]
=
useState
(
1
);
// 刷新标志
const
[
flag
,
setFlag
]
=
useState
(
1
);
// 刷新标志
const
[
treeFlage
,
setTreeFlag
]
=
useState
(
true
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
// 加载
const
[
loading
,
setLoading
]
=
useState
(
false
);
// 加载
const
[
menuID
,
setMenuID
]
=
useState
(
''
);
// 选中的树ID
const
[
menuID
,
setMenuID
]
=
useState
(
''
);
// 选中的树ID
const
[
saveID
,
setSaveID
]
=
useState
(
''
);
// 保存选择的树id
const
[
nodeType
,
setNodeType
]
=
useState
(
''
);
// 选中的节点类型
const
[
nodeType
,
setNodeType
]
=
useState
(
''
);
// 选中的节点类型
const
[
info
,
setInfo
]
=
useState
({});
const
[
info
,
setInfo
]
=
useState
({});
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
// 新增弹窗
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
// 新增弹窗
...
@@ -69,19 +53,19 @@ const MiniMenu = props => {
...
@@ -69,19 +53,19 @@ const MiniMenu = props => {
<
div
className=
{
styles
.
title
}
>
<
div
className=
{
styles
.
title
}
>
<
div
>
{
obj
.
text
}
</
div
>
<
div
>
{
obj
.
text
}
</
div
>
<
div
className=
{
styles
.
tip
}
>
<
div
className=
{
styles
.
tip
}
>
{
obj
.
menuType
===
'
MiniApp
MenuGroup'
&&
(
{
obj
.
menuType
===
'
Web4
MenuGroup'
&&
(
<
Tooltip
title=
"新增菜单组"
className=
{
styles
.
fs
}
>
<
Tooltip
title=
"新增菜单组"
className=
{
styles
.
fs
}
>
<
FolderAddTwoTone
onClick=
{
()
=>
addMenuGroupTip
(
obj
)
}
/>
<
FolderAddTwoTone
onClick=
{
e
=>
addMenuGroupTip
(
obj
,
e
)
}
/>
</
Tooltip
>
</
Tooltip
>
)
}
)
}
{
obj
.
menuType
===
'
MiniAppMenuGroupTwo
'
&&
(
{
obj
.
menuType
===
'
Web4MenuGroup
'
&&
(
<
Tooltip
title=
"新增功能菜单"
className=
{
styles
.
fs
}
>
<
Tooltip
title=
"新增功能菜单"
className=
{
styles
.
fs
}
>
<
FileAddTwoTone
onClick=
{
()
=>
addMenuTip
(
obj
)
}
/>
<
FileAddTwoTone
onClick=
{
e
=>
addMenuTip
(
obj
,
e
)
}
/>
</
Tooltip
>
</
Tooltip
>
)
}
)
}
<
Tooltip
title=
"删除菜单"
className=
{
styles
.
fs
}
>
<
Tooltip
title=
"删除菜单"
className=
{
styles
.
fs
}
>
<
DeleteTwoTone
onClick=
{
()
=>
deleteMenuTip
(
obj
)
}
/>
<
DeleteTwoTone
onClick=
{
e
=>
deleteMenuTip
(
obj
,
e
)
}
/>
</
Tooltip
>
</
Tooltip
>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -116,9 +100,6 @@ const MiniMenu = props => {
...
@@ -116,9 +100,6 @@ const MiniMenu = props => {
}
}
if
(
prop
[
0
])
{
if
(
prop
[
0
])
{
setMenuID
(
prop
[
0
]);
setMenuID
(
prop
[
0
]);
setSaveID
(
prop
[
0
]);
}
else
{
setMenuID
(
saveID
);
}
}
};
};
...
@@ -127,9 +108,8 @@ const MiniMenu = props => {
...
@@ -127,9 +108,8 @@ const MiniMenu = props => {
return
;
return
;
}
}
setLoading
(
true
);
setLoading
(
true
);
getMenuInfo
({
get
Web
MenuInfo
({
menuID
,
menuID
,
_version
:
9999
,
_dc
:
Date
.
now
(),
_dc
:
Date
.
now
(),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
...
@@ -151,7 +131,8 @@ const MiniMenu = props => {
...
@@ -151,7 +131,8 @@ const MiniMenu = props => {
});
});
};
};
// 删除的回调
// 删除的回调
const
deleteMenuTip
=
val
=>
{
const
deleteMenuTip
=
(
val
,
e
)
=>
{
e
.
stopPropagation
();
console
.
log
(
val
,
'val'
);
console
.
log
(
val
,
'val'
);
setModalTitle
(
val
.
text
);
setModalTitle
(
val
.
text
);
setNodeObj
(
val
);
setNodeObj
(
val
);
...
@@ -159,10 +140,9 @@ const MiniMenu = props => {
...
@@ -159,10 +140,9 @@ const MiniMenu = props => {
};
};
const
delMenu
=
()
=>
{
const
delMenu
=
()
=>
{
setModalLoading
(
true
);
setModalLoading
(
true
);
deleteMenu
({
delete
Web
Menu
({
menuID
:
nodeObj
.
menuID
,
menuID
:
nodeObj
.
menuID
,
_dc
:
Date
.
now
(),
_dc
:
Date
.
now
(),
_version
:
9999
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setModalLoading
(
false
);
setModalLoading
(
false
);
...
@@ -171,6 +151,7 @@ const MiniMenu = props => {
...
@@ -171,6 +151,7 @@ const MiniMenu = props => {
setFlag
(
flag
+
1
);
setFlag
(
flag
+
1
);
setNodeType
(
''
);
setNodeType
(
''
);
setNodeObj
(
''
);
setNodeObj
(
''
);
updateMenuTree
(
'delete'
,
nodeObj
);
notification
.
success
({
notification
.
success
({
message
:
'提示'
,
message
:
'提示'
,
duration
:
3
,
duration
:
3
,
...
@@ -190,44 +171,42 @@ const MiniMenu = props => {
...
@@ -190,44 +171,42 @@ const MiniMenu = props => {
});
});
};
};
// 新增菜单组
// 新增菜单组
const
addMenuGroupTip
=
val
=>
{
const
addMenuGroupTip
=
(
val
,
e
)
=>
{
console
.
log
(
val
,
'addgroup'
);
e
.
stopPropagation
(
);
setModalTitle
(
val
.
text
);
setModalTitle
(
val
.
text
);
setNodeObj
(
val
);
setNodeObj
(
val
);
setAddType
(
2
);
setAddVisible
(
true
);
setAddVisible
(
true
);
};
};
const
rootAddGroup
=
()
=>
{
const
rootAddGroup
=
()
=>
{
setNodeObj
(
''
);
setNodeObj
(
''
);
setNodeType
(
1
);
setModalTitle
(
'最上级列表'
);
setModalTitle
(
'最上级列表'
);
setAddType
(
1
);
setAddType
(
2
);
setAddVisible
(
true
);
setAddVisible
(
true
);
};
};
// 新增功能菜单
// 新增功能菜单
const
addMenuTip
=
val
=>
{
const
addMenuTip
=
(
val
,
e
)
=>
{
console
.
log
(
val
,
'add'
);
e
.
stopPropagation
(
);
setNodeObj
(
val
);
setNodeObj
(
val
);
setModalTitle
(
val
.
text
);
setModalTitle
(
val
.
text
);
setAddType
(
1
);
setAddTwoVisible
(
true
);
setAddTwoVisible
(
true
);
};
};
const
rootAdd
=
()
=>
{
const
rootAdd
=
()
=>
{
setModalTitle
(
'最上级列表'
);
setModalTitle
(
'最上级列表'
);
setNodeObj
(
''
);
setNodeObj
(
''
);
setNodeType
(
3
);
setAddType
(
1
);
setAddType
(
3
);
setAddTwoVisible
(
true
);
setAddTwoVisible
(
true
);
};
};
// 新增提交的回调
// 新增提交的回调
const
submitCallback
=
(
prop
,
item
)
=>
{
const
submitCallback
=
(
prop
,
item
)
=>
{
setSubmitLoading
(
true
);
setSubmitLoading
(
true
);
console
.
log
(
prop
,
item
);
let
obj
=
{
...
prop
};
let
obj
=
{
...
prop
};
const
parentID
=
item
.
menuID
?
item
.
menuID
:
-
1
;
const
parentID
=
item
.
menuID
?
item
.
menuID
:
-
1
;
addMenu
({
add
Web
Menu
({
_dc
:
Date
.
now
(),
_dc
:
Date
.
now
(),
parentID
,
parentID
,
subSystemValue
:
'miniapp'
,
subSystemValue
,
_version
:
9999
,
...
obj
,
...
obj
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
...
@@ -236,6 +215,7 @@ const MiniMenu = props => {
...
@@ -236,6 +215,7 @@ const MiniMenu = props => {
setAddVisible
(
false
);
setAddVisible
(
false
);
setAddTwoVisible
(
false
);
setAddTwoVisible
(
false
);
setFlag
(
flag
+
1
);
setFlag
(
flag
+
1
);
updateMenuTree
(
'add'
,
item
);
notification
.
success
({
notification
.
success
({
message
:
'提示'
,
message
:
'提示'
,
description
:
'新增成功'
,
description
:
'新增成功'
,
...
@@ -258,16 +238,14 @@ const MiniMenu = props => {
...
@@ -258,16 +238,14 @@ const MiniMenu = props => {
// 编辑的回调
// 编辑的回调
const
editSubmitCallback
=
prop
=>
{
const
editSubmitCallback
=
prop
=>
{
setLoading
(
true
);
setLoading
(
true
);
console
.
log
(
prop
);
let
obj
=
{
...
prop
};
let
obj
=
{
...
prop
};
if
(
nodeType
===
3
||
nodeType
===
4
)
{
if
(
nodeType
===
1
)
{
obj
.
relatedRoleList
=
String
(
roleList
)
||
''
;
obj
.
relatedRoleList
=
String
(
roleList
)
||
''
;
}
}
editMenu
({
edit
Web
Menu
({
_dc
:
Date
.
now
(),
_dc
:
Date
.
now
(),
menuID
,
menuID
,
subSystemValue
:
'miniapp'
,
subSystemValue
,
_version
:
9999
,
...
obj
,
...
obj
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
...
@@ -275,6 +253,7 @@ const MiniMenu = props => {
...
@@ -275,6 +253,7 @@ const MiniMenu = props => {
if
(
res
.
success
)
{
if
(
res
.
success
)
{
setFlag
(
flag
+
1
);
setFlag
(
flag
+
1
);
updateMenuTree
(
'edit'
);
notification
.
success
({
notification
.
success
({
message
:
'提示'
,
message
:
'提示'
,
duration
:
3
,
duration
:
3
,
...
@@ -287,9 +266,9 @@ const MiniMenu = props => {
...
@@ -287,9 +266,9 @@ const MiniMenu = props => {
description
:
res
.
message
||
'编辑失败'
,
description
:
res
.
message
||
'编辑失败'
,
});
});
}
}
console
.
log
(
res
,
'resres'
);
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
// eslint-disable-next-line no-console
console
.
error
(
err
);
console
.
error
(
err
);
setLoading
(
false
);
setLoading
(
false
);
});
});
...
@@ -369,9 +348,9 @@ const MiniMenu = props => {
...
@@ -369,9 +348,9 @@ const MiniMenu = props => {
}
}
}
}
>
>
<
AddForm
<
AddForm
nodeType=
{
nodeType
}
nodeObj=
{
nodeObj
}
nodeObj=
{
nodeObj
}
addType=
{
addType
}
addType=
{
addType
}
configFiles=
{
configFiles
}
submitCallback=
{
submitCallback
}
submitCallback=
{
submitCallback
}
submitLoading=
{
submitLoading
}
submitLoading=
{
submitLoading
}
/>
/>
...
@@ -390,8 +369,8 @@ const MiniMenu = props => {
...
@@ -390,8 +369,8 @@ const MiniMenu = props => {
>
>
<
AddForm
<
AddForm
submitLoading=
{
submitLoading
}
submitLoading=
{
submitLoading
}
nodeType=
{
nodeType
}
nodeObj=
{
nodeObj
}
nodeObj=
{
nodeObj
}
configFiles=
{
configFiles
}
addType=
{
addType
}
addType=
{
addType
}
submitCallback=
{
submitCallback
}
submitCallback=
{
submitCallback
}
/>
/>
...
@@ -420,6 +399,7 @@ const MiniMenu = props => {
...
@@ -420,6 +399,7 @@ const MiniMenu = props => {
<
EditForm
<
EditForm
nodeType=
{
nodeType
}
nodeType=
{
nodeType
}
info=
{
info
}
info=
{
info
}
configFiles=
{
configFiles
}
submitCallback=
{
editSubmitCallback
}
submitCallback=
{
editSubmitCallback
}
/>
/>
)
}
)
}
...
...
src/pages/webConfig/menuconfig/
mini
Menu.less
→
src/pages/webConfig/menuconfig/
web
Menu.less
View file @
1d09a3e8
.box{
.box{
min-height: calc( 100vh - 1
72
px);
min-height: calc( 100vh - 1
98
px);
display: flex;
display: flex;
}
}
.left{
.left{
...
...
src/pages/webConfig/utils.js
View file @
1d09a3e8
...
@@ -276,6 +276,19 @@ export const getDefaultGetWebconfig = ({
...
@@ -276,6 +276,19 @@ export const getDefaultGetWebconfig = ({
if
(
k
===
'alarmWays'
)
{
if
(
k
===
'alarmWays'
)
{
config
[
k
].
initialValue
=
config
[
k
].
initialValue
.
split
(
','
);
config
[
k
].
initialValue
=
config
[
k
].
initialValue
.
split
(
','
);
}
}
if
(
k
===
'mode'
&&
initialValues
.
mode
)
{
config
[
k
].
options
=
[
{
value
:
webMode
.
single
,
children
:
'一般网站'
,
},
{
value
:
webMode
.
integration
,
children
:
'集成网站'
,
},
];
config
[
k
].
initialValue
=
initialValues
.
mode
;
}
});
});
}
}
return
config
;
return
config
;
...
...
src/services/webConfig/api.js
View file @
1d09a3e8
...
@@ -69,3 +69,41 @@ export const postAddWebSite = config => postEditWebConfig(config, true);
...
@@ -69,3 +69,41 @@ export const postAddWebSite = config => postEditWebConfig(config, true);
export
const
deleteWebsite
=
client
=>
export
const
deleteWebsite
=
client
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_DeleteWebsite?_version=9999`
,
{
client
});
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_DeleteWebsite?_version=9999`
,
{
client
});
/**
* 获取配置文件下拉选项
*/
export
const
getAllConfigName
=
()
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_GetAllConfigName?_version=9999`
);
export
const
addWebMenu
=
param
=>
{
const
defaultConfig
=
{
pageUrl
:
''
};
// eslint-disable-next-line no-return-assign
Object
.
keys
(
param
).
forEach
(
k
=>
(
defaultConfig
[
k
]
=
param
[
k
]));
return
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_AddMenu?_version=9999`
,
defaultConfig
);
};
export
const
editWebMenu
=
param
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_EditMenu?_version=9999`
,
param
);
export
const
deleteWebMenu
=
param
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_DeleteMenu?_version=9999`
,
param
);
export
const
getWebMenuInfo
=
param
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/P_GetMenuInfo?_version=9999`
,
param
);
export
const
saveConfigContent
=
content
=>
post
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_SaveConfigContent?_version=9999`
,
qs
.
stringify
({
web4ConfigContent
:
content
}),
{
headers
:
{
'content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
},
},
);
export
const
getConfigContent
=
name
=>
get
(
`
${
CITY_SERVICE
}
/OMS.svc/W4_GetConfigContent?_version=9999`
,
{
fileName
:
name
,
});
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