Commit e533ec09 authored by Maofei94's avatar Maofei94

perf: 修改web配置

parent 3aedbcd1
Pipeline #23541 passed with stages
in 20 minutes 50 seconds
......@@ -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 getWebconfig(webTitle)
return getWebSite(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,
postAddWebSite,
addWebsite,
editWebsite,
};
const successMsg = isEdit ? '保存成功!' : '新增网站成功!';
const failMsg = isEdit ? '编辑失败!' : '新增网站失败!';
requestMap[isEdit ? 'postEditWebConfig' : 'postAddWebSite'](values)
requestMap[isEdit ? 'editWebsite' : 'addWebsite'](values)
.then(res => {
setSubmitting(false);
if (res.success) {
if (res.code === 0) {
setCurWeb({ ...curWeb, text: values.title });
notification.success({
message: successMsg,
......
......@@ -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 = [
// {
......
......@@ -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 =>
post(`${PUBLISH_SERVICE}/WebSite/DeleteWebsite`, params);
get(`${PUBLISH_SERVICE}/WebSite/DeleteWebsite`, params);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment