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
e533ec09
Commit
e533ec09
authored
Feb 07, 2021
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 修改web配置
parent
3aedbcd1
Pipeline
#23541
passed with stages
in 20 minutes 50 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
98 deletions
+124
-98
index.js
src/pages/webConfig/index.js
+16
-7
utils.js
src/pages/webConfig/utils.js
+84
-84
api.js
src/services/webConfig/api.js
+24
-7
No files found.
src/pages/webConfig/index.js
View file @
e533ec09
...
...
@@ -8,6 +8,10 @@ import {
postAddWebSite
,
deleteWebsite
,
getAllConfigName
,
getWebSite
,
addWebsite
,
editWebsite
,
omsDeleteWebsite
,
}
from
'@/services/webConfig/api'
;
import
{
EditTwoTone
,
ExclamationCircleOutlined
}
from
'@ant-design/icons'
;
import
Modal
from
'antd/lib/modal/Modal'
;
...
...
@@ -97,11 +101,12 @@ const WebConfigPage = props => {
const
updateWebconfig
=
(
webTitle
,
canceled
=
{
cancel
:
false
})
=>
{
setLoading
(
true
);
return
getWeb
config
(
webTitle
)
return
getWeb
Site
(
webTitle
)
.
then
(
res
=>
{
setLoading
(
false
);
if
(
!
canceled
.
cancel
)
{
setConfigObj
(
res
);
// setConfigObj(res);
setConfigObj
(
res
.
data
);
if
(
webTitle
===
curWeb
.
text
)
{
setToEdit
(
res
);
}
...
...
@@ -124,7 +129,7 @@ const WebConfigPage = props => {
if
(
client
)
{
deleteWebsite
(
client
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
if
(
res
.
code
===
0
||
res
.
success
)
{
notification
.
success
({
message
:
`删除网站
${
webToOperate
.
text
}
成功!`
,
duration
:
3
,
...
...
@@ -222,17 +227,21 @@ const WebConfigPage = props => {
baseLogoUrl
,
};
setSubmitting
(
true
);
// const requestMap = {
// postEditWebConfig,
// postAddWebSite,
// };
const
requestMap
=
{
postEditWebConfig
,
postAddWebS
ite
,
addWebsite
,
editWebs
ite
,
};
const
successMsg
=
isEdit
?
'保存成功!'
:
'新增网站成功!'
;
const
failMsg
=
isEdit
?
'编辑失败!'
:
'新增网站失败!'
;
requestMap
[
isEdit
?
'
postEditWebConfig'
:
'postAddWebS
ite'
](
values
)
requestMap
[
isEdit
?
'
editWebsite'
:
'addWebs
ite'
](
values
)
.
then
(
res
=>
{
setSubmitting
(
false
);
if
(
res
.
success
)
{
if
(
res
.
code
===
0
)
{
setCurWeb
({
...
curWeb
,
text
:
values
.
title
});
notification
.
success
({
message
:
successMsg
,
...
...
src/pages/webConfig/utils.js
View file @
e533ec09
...
...
@@ -205,35 +205,35 @@ export const getDefaultGetWebconfig = ({
// },
// ],
// },
theme
:
{
label
:
'系统皮肤'
,
formType
:
ITEM_TYPE
.
SELECT
,
initialValue
:
''
,
showSearch
:
true
,
filterOption
:
(
input
,
option
)
=>
option
.
children
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
,
options
:
webThemes
.
map
(
t
=>
({
value
:
t
.
value
,
children
:
t
.
text
,
key
:
t
.
value
,
}))
||
[],
onDropdownVisibleChange
:
onGetThemes
,
},
style
:
{
label
:
'系统风格'
,
formType
:
ITEM_TYPE
.
SELECT
,
initialValue
:
''
,
options
:
Object
.
keys
(
isIntegerate
(
initialValues
.
mode
,
hasIntegerate
)
?
integrateStyleData
:
singleStyleData
,
).
map
(
k
=>
({
value
:
k
,
key
:
k
,
children
:
integrateStyleData
[
k
]
||
singleStyleData
[
k
],
})),
},
//
theme: {
//
label: '系统皮肤',
//
formType: ITEM_TYPE.SELECT,
//
initialValue: '',
//
showSearch: true,
//
filterOption: (input, option) =>
//
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
//
options:
//
webThemes.map(t => ({
//
value: t.value,
//
children: t.text,
//
key: t.value,
//
})) || [],
//
onDropdownVisibleChange: onGetThemes,
//
},
//
style: {
//
label: '系统风格',
//
formType: ITEM_TYPE.SELECT,
//
initialValue: '',
//
options: Object.keys(
//
isIntegerate(initialValues.mode, hasIntegerate)
//
? integrateStyleData
//
: singleStyleData,
//
).map(k => ({
//
value: k,
//
key: k,
//
children: integrateStyleData[k] || singleStyleData[k],
//
})),
//
},
menu
:
{
label
:
'菜单类型'
,
formType
:
ITEM_TYPE
.
SINGLE_RADIO
,
...
...
@@ -243,15 +243,15 @@ export const getDefaultGetWebconfig = ({
children
:
menuStyle
[
k
],
})),
},
mdi
:
{
label
:
'功能标签'
,
formType
:
ITEM_TYPE
.
SINGLE_RADIO
,
options
:
Object
.
keys
(
MDILabel
).
map
(
k
=>
({
value
:
k
,
key
:
k
,
children
:
MDILabel
[
k
],
})),
},
//
mdi: {
//
label: '功能标签',
//
formType: ITEM_TYPE.SINGLE_RADIO,
//
options: Object.keys(MDILabel).map(k => ({
//
value: k,
//
key: k,
//
children: MDILabel[k],
//
})),
//
},
qrcode
:
{
label
:
'二维码地址'
,
formType
:
ITEM_TYPE
.
INPUT
,
...
...
@@ -266,57 +266,57 @@ export const getDefaultGetWebconfig = ({
children
:
notificationTypes
[
k
],
})),
},
mapPlan
:
{
label
:
'地图方案'
,
formType
:
ITEM_TYPE
.
SELECT
,
options
:
mapConfigs
.
map
(
m
=>
({
value
:
m
.
value
,
children
:
m
.
text
,
key
:
m
.
value
,
})),
onDropdownVisibleChange
:
onGetMapConfig
,
},
hideMap
:
{
label
:
'按需加载地图'
,
formType
:
ITEM_TYPE
.
SINGLE_RADIO
,
optionType
:
'button'
,
options
:
[
{
value
:
true
,
key
:
'1'
,
children
:
'是'
,
},
{
value
:
false
,
key
:
'2'
,
children
:
'否'
,
},
],
},
waterMark
:
{
label
:
'地图水印'
,
formType
:
ITEM_TYPE
.
SINGLE_RADIO
,
options
:
[
{
value
:
true
,
key
:
'1'
,
children
:
'显示'
,
},
{
value
:
false
,
key
:
'2'
,
children
:
'不显示'
,
},
],
},
//
mapPlan: {
//
label: '地图方案',
//
formType: ITEM_TYPE.SELECT,
//
options: mapConfigs.map(m => ({
//
value: m.value,
//
children: m.text,
//
key: m.value,
//
})),
//
onDropdownVisibleChange: onGetMapConfig,
//
},
//
hideMap: {
//
label: '按需加载地图',
//
formType: ITEM_TYPE.SINGLE_RADIO,
//
optionType: 'button',
//
options: [
//
{
//
value: true,
//
key: '1',
//
children: '是',
//
},
//
{
//
value: false,
//
key: '2',
//
children: '否',
//
},
//
],
//
},
//
waterMark: {
//
label: '地图水印',
//
formType: ITEM_TYPE.SINGLE_RADIO,
//
options: [
//
{
//
value: true,
//
key: '1',
//
children: '显示',
//
},
//
{
//
value: false,
//
key: '2',
//
children: '不显示',
//
},
//
],
//
},
};
if
(
initialValues
)
{
Object
.
keys
(
config
).
forEach
(
k
=>
{
config
[
k
].
initialValue
=
typeof
initialValues
[
k
]
!==
'undefined'
?
initialValues
[
k
]
:
''
;
if
(
k
===
'alarmWays'
)
{
config
[
k
].
initialValue
=
config
[
k
].
initialValue
.
split
(
','
);
}
//
if (k === 'alarmWays') {
//
config[k].initialValue = config[k].initialValue.split(',');
//
}
// if (k === 'mode' && initialValues.mode) {
// config[k].options = [
// {
...
...
src/services/webConfig/api.js
View file @
e533ec09
...
...
@@ -131,12 +131,29 @@ export const delProductList = params =>
* @新接口
*/
// 根据title获取网站配置
export
const
getWebSite
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/WebSite/GetWebsite`
,
params
);
export
const
getWebSite
=
title
=>
get
(
`
${
PUBLISH_SERVICE
}
/WebSite/GetWebsite`
,
{
title
}
);
// 添加网站配置
export
const
addWebsite
=
params
=>
post
(
`
${
PUBLISH_SERVICE
}
/WebSite/AddWebsite`
,
params
);
export
const
editWebsite
=
params
=>
post
(
`
${
PUBLISH_SERVICE
}
/WebSite/EditWebsite`
,
params
);
export
const
addWebsite
=
params
=>
{
const
obj
=
{
...
params
};
Object
.
keys
(
obj
).
forEach
(
k
=>
{
if
(
typeof
obj
[
k
]
===
'string'
)
{
obj
[
k
]
=
obj
[
k
].
trim
();
}
});
return
post
(
`
${
PUBLISH_SERVICE
}
/WebSite/AddWebsite`
,
obj
);
};
export
const
editWebsite
=
params
=>
{
const
obj
=
{
...
params
};
Object
.
keys
(
obj
).
forEach
(
k
=>
{
if
(
typeof
obj
[
k
]
===
'string'
)
{
obj
[
k
]
=
obj
[
k
].
trim
();
}
});
return
post
(
`
${
PUBLISH_SERVICE
}
/WebSite/EditWebsite`
,
obj
);
};
// 删除网站
export
const
omsDeleteWebsite
=
params
=>
pos
t
(
`
${
PUBLISH_SERVICE
}
/WebSite/DeleteWebsite`
,
params
);
ge
t
(
`
${
PUBLISH_SERVICE
}
/WebSite/DeleteWebsite`
,
params
);
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