Commit 5315885b authored by 皮倩雯's avatar 皮倩雯

fix: '修改web配置'

parent cfc39de9
Pipeline #48795 passed with stages
in 9 minutes 31 seconds
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2022-04-06 11:38:46 * @Date: 2022-04-06 11:38:46
* @LastEditTime: 2022-04-19 17:16:39 * @LastEditTime: 2022-04-22 18:25:48
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -615,7 +615,8 @@ const DrawBoardManage = () => { ...@@ -615,7 +615,8 @@ const DrawBoardManage = () => {
const choose = () => { const choose = () => {
setPickItem(''); setPickItem('');
updateTableDataAll('', searchWord); setSearchWord('');
updateTableDataAll('', '');
}; };
return ( return (
...@@ -674,6 +675,7 @@ const DrawBoardManage = () => { ...@@ -674,6 +675,7 @@ const DrawBoardManage = () => {
onClick={e => { onClick={e => {
setPickItem(item); setPickItem(item);
setRember1(item); setRember1(item);
setSearchWord('');
}} }}
onMouseEnter={() => { onMouseEnter={() => {
setHoverItemIndex(item); setHoverItemIndex(item);
......
...@@ -50,10 +50,7 @@ const AddModal = props => { ...@@ -50,10 +50,7 @@ const AddModal = props => {
const [pickItem, setPickItem] = useState(''); const [pickItem, setPickItem] = useState('');
const [o, setO] = useState(''); const [o, setO] = useState('');
const [r, setR] = useState(''); const [r, setR] = useState('');
const [aa, setAa] = useState(0); const [current, setCurrent] = useState(false);
const [bb, setBb] = useState(0);
const [cc, setCc] = useState(0);
const [dd, setDd] = useState(0);
const [form] = Form.useForm(); const [form] = Form.useForm();
const arr = [ const arr = [
'assets/images/thumbnail/thumbnail_1.jpg', 'assets/images/thumbnail/thumbnail_1.jpg',
...@@ -68,70 +65,78 @@ const AddModal = props => { ...@@ -68,70 +65,78 @@ const AddModal = props => {
if (validate) { if (validate) {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let arr = {}; let arr = {};
if (mapType == 1) { if (obj.servicename) {
arr = { if (mapType == 1) {
servicename: obj.servicename, arr = {
terminalType: 'base', servicename: obj.servicename,
isBaseMap: true, terminalType: 'base',
jsonCfg: JSON.stringify({ isBaseMap: true,
alpha: alpha, jsonCfg: JSON.stringify({
label: obj.label, alpha: alpha,
url: obj.url, label: obj.label,
icon: obj.icon, url: obj.url,
type: obj.type, icon: obj.icon,
extent: obj.range, type: obj.type,
baseLayer: obj.layer, extent: obj.range,
proxyUrl: obj.proxy, baseLayer: obj.layer,
levelStart: obj.levelStart, proxyUrl: obj.proxy,
origin: obj.origin || o, levelStart: obj.levelStart,
resolution: obj.resolution || r, origin: obj.origin || o,
tileMatrix: obj.coordinate, resolution: obj.resolution || r,
levelEnd: obj.levelEnd, tileMatrix: obj.coordinate,
levelEndEnlarge: obj.levelEndEnlarge, levelEnd: obj.levelEnd,
m_Ip: obj.IP, levelEndEnlarge: obj.levelEndEnlarge,
m_Port: obj.Port || '8080', m_Ip: obj.IP,
m_User: obj.User || 'admin', m_Port: obj.Port || '8080',
m_Pwd: obj.Pwd || 'geoserver', m_User: obj.User || 'admin',
gsAppName: obj.gis, m_Pwd: obj.Pwd || 'geoserver',
}), gsAppName: obj.gis,
}; }),
} else { };
arr = { } else {
servicename: obj.servicename, arr = {
terminalType: 'base', servicename: obj.servicename,
isBaseMap: true, terminalType: 'base',
jsonCfg: JSON.stringify({ isBaseMap: true,
alpha: alpha, jsonCfg: JSON.stringify({
label: obj.label, alpha: alpha,
url: obj.url, label: obj.label,
icon: obj.icon, url: obj.url,
type: obj.type, icon: obj.icon,
}), type: obj.type,
}; }),
} };
}
SetServiceConfig(arr) SetServiceConfig(arr)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || type == 'add' ? '新增成功' : '编辑成功', description: res.message || type == 'add' ? '新增成功' : '编辑成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || type == 'add' ? '新增失败' : '编辑失败', description: res.message || type == 'add' ? '新增失败' : '编辑失败',
}); });
} }
}) })
.catch(err => { .catch(err => {
setLoading(false); setLoading(false);
});
} else {
notification.warning({
message: '提示',
duration: 3,
description: '服务名称必填',
}); });
}
} }
}); });
}; };
...@@ -140,6 +145,7 @@ const AddModal = props => { ...@@ -140,6 +145,7 @@ const AddModal = props => {
useEffect(() => { useEffect(() => {
setMapType(0); setMapType(0);
setAdvanced(0); setAdvanced(0);
setCurrent(false);
setPickItem(''); setPickItem('');
setAlpha(1); setAlpha(1);
console.log(baseMap); console.log(baseMap);
...@@ -197,7 +203,7 @@ const AddModal = props => { ...@@ -197,7 +203,7 @@ const AddModal = props => {
setAlpha(silderData); setAlpha(silderData);
}; };
const tipFormatter = value => { const tipFormatter = value => {
return value / 100; return `${value}%`;
}; };
const imgURL = [ const imgURL = [
...@@ -219,6 +225,9 @@ const AddModal = props => { ...@@ -219,6 +225,9 @@ const AddModal = props => {
setRadio(e.target.value); setRadio(e.target.value);
}; };
const handleChange = value => { const handleChange = value => {
console.log(value);
setAdvanced(0);
setCurrent(false);
form.setFieldsValue({ form.setFieldsValue({
label: servicenameToType(value), label: servicenameToType(value),
servicename: servicenameToType(value), servicename: servicenameToType(value),
...@@ -410,8 +419,10 @@ const AddModal = props => { ...@@ -410,8 +419,10 @@ const AddModal = props => {
const change = (e, event) => { const change = (e, event) => {
if (e) { if (e) {
setAdvanced(1); setAdvanced(1);
setCurrent(true);
} else { } else {
setAdvanced(0); setAdvanced(0);
setCurrent(false);
} }
console.log(e); console.log(e);
console.log(event); console.log(event);
...@@ -468,10 +479,15 @@ const AddModal = props => { ...@@ -468,10 +479,15 @@ const AddModal = props => {
透明度<span style={{ fontWeight: 'bold', color: 'rgb(24, 144, 255)' }}>{alpha}</span> 透明度<span style={{ fontWeight: 'bold', color: 'rgb(24, 144, 255)' }}>{alpha}</span>
</span> </span>
); );
const marks = {
0: '0%',
100: '100%',
};
return ( return (
<Modal <Modal
title="添加底图" title="添加底图"
bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll' }} bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll', minHeight: '360px' }}
style={{ top: '150px' }} style={{ top: '150px' }}
width="700px" width="700px"
destroyOnClose destroyOnClose
...@@ -492,8 +508,8 @@ const AddModal = props => { ...@@ -492,8 +508,8 @@ const AddModal = props => {
<Option value="amap-i">amap-i(高德影像)</Option> <Option value="amap-i">amap-i(高德影像)</Option>
<Option value="tianditu-v-va">tianditu-v-va(天地图地形)</Option> <Option value="tianditu-v-va">tianditu-v-va(天地图地形)</Option>
<Option value="tianditu-i-ia">tianditu-i-ia(天地图影像)</Option> <Option value="tianditu-i-ia">tianditu-i-ia(天地图影像)</Option>
<Option value="pipenet-tile">pipenet-tile(矢量底图切片)</Option>
<Option value="google-user">google-user(自定义底图)</Option> <Option value="google-user">google-user(自定义底图)</Option>
<Option value="pipenet-tile">pipenet-tile(地形图)</Option>
</Select> </Select>
</Item> </Item>
<Item <Item
...@@ -521,20 +537,21 @@ const AddModal = props => { ...@@ -521,20 +537,21 @@ const AddModal = props => {
{/* <Item label="URL" name="url"> {/* <Item label="URL" name="url">
<Input placeholder="请输入URL" allowClear /> <Input placeholder="请输入URL" allowClear />
</Item> */} </Item> */}
<Item label={title} name="alpha"> <Item label="透明度" name="alpha">
<Slider <Slider
marks={marks}
min={0} min={0}
max={100} max={100}
onChange={onChange} onChange={onChange}
// step={0.1} // step={0.1}
tipFormatter={tipFormatter} tipFormatter={tipFormatter}
// tooltipVisible={true} // tooltipVisible
defaultValue={100} defaultValue={100}
/> />
</Item> </Item>
<Item <Item
label="选择缩略图" label="选择缩略图"
// name="icon" name="icon"
rules={[{ required: true, message: '请选择缩略图' }]} rules={[{ required: true, message: '请选择缩略图' }]}
> >
<div style={{ display: 'flex', justifyContent: 'space-around' }}> <div style={{ display: 'flex', justifyContent: 'space-around' }}>
...@@ -564,9 +581,9 @@ const AddModal = props => { ...@@ -564,9 +581,9 @@ const AddModal = props => {
})} })}
</div> </div>
</Item> </Item>
<Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}> {/* <Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
<Input placeholder="请输入URL" disabled /> <Input placeholder="请输入URL" disabled />
</Item> </Item> */}
{mapType === 1 ? ( {mapType === 1 ? (
<> <>
<Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}> <Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}>
...@@ -686,6 +703,7 @@ const AddModal = props => { ...@@ -686,6 +703,7 @@ const AddModal = props => {
checkedChildren="高级设置" checkedChildren="高级设置"
unCheckedChildren="高级设置" unCheckedChildren="高级设置"
onChange={change} onChange={change}
checked={current}
style={{ marginLeft: '40px', marginBottom: '15px' }} style={{ marginLeft: '40px', marginBottom: '15px' }}
/> />
{advanced === 1 ? ( {advanced === 1 ? (
......
...@@ -48,6 +48,7 @@ const NewEditModal = props => { ...@@ -48,6 +48,7 @@ const NewEditModal = props => {
const [data, setData] = useState([]); const [data, setData] = useState([]);
const [areaData, setAreaData] = useState([]); const [areaData, setAreaData] = useState([]);
const [pickItem, setPickItem] = useState(''); const [pickItem, setPickItem] = useState('');
const [current, setCurrent] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
const arr = [ const arr = [
'assets/images/thumbnail/thumbnail_1.jpg', 'assets/images/thumbnail/thumbnail_1.jpg',
...@@ -100,6 +101,20 @@ const NewEditModal = props => { ...@@ -100,6 +101,20 @@ const NewEditModal = props => {
url: obj.url, url: obj.url,
icon: obj.icon, icon: obj.icon,
type: obj.type, type: obj.type,
extent: '',
baseLayer: '',
proxyUrl: '',
levelStart: '',
origin: '',
resolution: '',
tileMatrix: '',
levelEnd: '',
levelEndEnlarge: '',
m_Ip: '',
m_Port: '',
m_User: '',
m_Pwd: '',
gsAppName: '',
}), }),
}; };
} }
...@@ -142,16 +157,16 @@ const NewEditModal = props => { ...@@ -142,16 +157,16 @@ const NewEditModal = props => {
} }
console.log(formObj.baseLayer); console.log(formObj.baseLayer);
if (formObj.baseLayer) { if (formObj.baseLayer) {
console.log(111);
setMapType(1); setMapType(1);
} else { } else {
console.log(1212);
setMapType(0); setMapType(0);
} }
if (formObj.m_User) { if (formObj.m_User) {
setAdvanced(1); setAdvanced(1);
setCurrent(true);
} else { } else {
setAdvanced(0); setAdvanced(0);
setCurrent(false);
} }
switch (type) { switch (type) {
...@@ -209,7 +224,7 @@ const NewEditModal = props => { ...@@ -209,7 +224,7 @@ const NewEditModal = props => {
setAlpha(silderData); setAlpha(silderData);
}; };
const tipFormatter = value => { const tipFormatter = value => {
return value / 100; return `${value}%`;
}; };
const imgURL = [ const imgURL = [
...@@ -232,10 +247,10 @@ const NewEditModal = props => { ...@@ -232,10 +247,10 @@ const NewEditModal = props => {
setRadio(e.target.value); setRadio(e.target.value);
}; };
const handleChange = value => { const handleChange = value => {
form.setFieldsValue({ // form.setFieldsValue({
label: servicenameToType(value), // label: servicenameToType(value),
servicename: servicenameToType(value), // servicename: servicenameToType(value),
}); // });
console.log(value); console.log(value);
if (value == 'google-user' || value == 'pipenet-tile') { if (value == 'google-user' || value == 'pipenet-tile') {
setMapType(1); setMapType(1);
...@@ -252,92 +267,12 @@ const NewEditModal = props => { ...@@ -252,92 +267,12 @@ const NewEditModal = props => {
Pwd: 'geoserver', Pwd: 'geoserver',
}); });
} }
// else if (form.getFieldsValue().gis == undefined) {
// form.setFieldsValue({ gis: 'geoserver217' });
// } else if (!form.getFieldsValue().proxy) {
// form.setFieldsValue({ proxy: 'javasvc.panda-water.cn/geoserver' });
// } else if (!form.getFieldsValue().levelEndEnlarge) {
// form.setFieldsValue({ levelEndEnlarge: false });
// } else if (!form.getFieldsValue().Port) {
// form.setFieldsValue({ Port: '8080' });
// } else if (!form.getFieldsValue().User) {
// form.setFieldsValue({ User: 'admin' });
// } else if (!form.getFieldsValue().Pwd) {
// form.setFieldsValue({ Pwd: 'geoserver' });
// }
} else { } else {
setMapType(0); setMapType(0);
} }
}; };
// 添加地图类型 // 添加地图类型
const servicenameToType = type => { const servicenameToType = type => {
// console.log(name);
// let random = Math.floor(Math.random() * 100) + 1;
// if (type == 'google-v') {
// let aa = `谷歌地形${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `谷歌地形${random}`;
// }
// } else if (type == 'google-i-a') {
// let aa = `谷歌影像(注记)${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `谷歌影像(注记)${random}`;
// }
// } else if (type == 'google-i') {
// let aa = `谷歌影像${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `谷歌影像${random}`;
// }
// } else if (type == 'amap-i') {
// let aa = `高德影像${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `高德影像${random}`;
// }
// } else if (type == 'amap-v') {
// let aa = `高德地形${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `高德地形${random}`;
// }
// } else if (type == 'tianditu-i-ia') {
// let aa = `天地图影像${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `天地图影像${random}`;
// }
// } else if (type == 'tianditu-v-va') {
// let aa = `天地图地形${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `天地图地形${random}`;
// }
// } else if (type == 'google-user') {
// let aa = `自定义底图${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `自定义底图${random}`;
// }
// } else if (type == 'pipenet-tile') {
// let aa = `地形图${random}`;
// if (name.indexOf(aa) != -1) {
// servicenameToType(type);
// } else {
// return `地形图${random}`;
// }
// }
switch (type) { switch (type) {
case 'google-v': case 'google-v':
return '谷歌地形'; return '谷歌地形';
...@@ -447,8 +382,10 @@ const NewEditModal = props => { ...@@ -447,8 +382,10 @@ const NewEditModal = props => {
}; };
const change = (e, event) => { const change = (e, event) => {
if (e) { if (e) {
setCurrent(true);
setAdvanced(1); setAdvanced(1);
} else { } else {
setCurrent(false);
setAdvanced(0); setAdvanced(0);
} }
console.log(e); console.log(e);
...@@ -505,6 +442,11 @@ const NewEditModal = props => { ...@@ -505,6 +442,11 @@ const NewEditModal = props => {
透明度<span style={{ fontWeight: 'bold', color: 'rgb(24, 144, 255)' }}>{alpha}</span> 透明度<span style={{ fontWeight: 'bold', color: 'rgb(24, 144, 255)' }}>{alpha}</span>
</span> </span>
); );
const marks = {
0: '0%',
100: '100%',
};
return ( return (
<Modal <Modal
title="编辑底图" title="编辑底图"
...@@ -524,13 +466,13 @@ const NewEditModal = props => { ...@@ -524,13 +466,13 @@ const NewEditModal = props => {
{visible && ( {visible && (
<Form form={form} {...layout} onFinish={onFinish}> <Form form={form} {...layout} onFinish={onFinish}>
<Item label="类型" name="type" rules={[{ required: true, message: '请选择服务名' }]}> <Item label="类型" name="type" rules={[{ required: true, message: '请选择服务名' }]}>
<Select onChange={handleChange} disabled> <Select onChange={handleChange}>
<Option value="amap-v">amap-v(高德地形)</Option> <Option value="amap-v">amap-v(高德地形)</Option>
<Option value="amap-i">amap-i(高德影像)</Option> <Option value="amap-i">amap-i(高德影像)</Option>
<Option value="tianditu-v-va">tianditu-v-va(天地图地形)</Option> <Option value="tianditu-v-va">tianditu-v-va(天地图地形)</Option>
<Option value="tianditu-i-ia">tianditu-i-ia(天地图影像)</Option> <Option value="tianditu-i-ia">tianditu-i-ia(天地图影像)</Option>
<Option value="pipenet-tile">pipenet-tile(矢量底图切片)</Option>
<Option value="google-user">google-user(自定义底图)</Option> <Option value="google-user">google-user(自定义底图)</Option>
<Option value="pipenet-tile">pipenet-tile(地形图)</Option>
</Select> </Select>
</Item> </Item>
<Item <Item
...@@ -550,10 +492,11 @@ const NewEditModal = props => { ...@@ -550,10 +492,11 @@ const NewEditModal = props => {
{/* <Item label="URL" name="url"> {/* <Item label="URL" name="url">
<Input placeholder="请输入URL" allowClear /> <Input placeholder="请输入URL" allowClear />
</Item> */} </Item> */}
<Item label={title} name="alpha"> <Item label="透明度" name="alpha">
{console.log(formObj.alpha)} {console.log(formObj.alpha)}
<Slider <Slider
min={1} marks={marks}
min={0}
max={100} max={100}
onChange={onChange} onChange={onChange}
tipFormatter={tipFormatter} tipFormatter={tipFormatter}
...@@ -563,7 +506,7 @@ const NewEditModal = props => { ...@@ -563,7 +506,7 @@ const NewEditModal = props => {
</Item> </Item>
<Item <Item
label="选择缩略图" label="选择缩略图"
// name="icon" name="icon"
rules={[{ required: true, message: '请选择缩略图' }]} rules={[{ required: true, message: '请选择缩略图' }]}
> >
<div style={{ display: 'flex', justifyContent: 'space-around' }}> <div style={{ display: 'flex', justifyContent: 'space-around' }}>
...@@ -593,9 +536,9 @@ const NewEditModal = props => { ...@@ -593,9 +536,9 @@ const NewEditModal = props => {
})} })}
</div> </div>
</Item> </Item>
<Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}> {/* <Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
<Input placeholder="请输入URL" disabled /> <Input placeholder="请输入URL" disabled />
</Item> </Item> */}
{mapType === 1 ? ( {mapType === 1 ? (
<> <>
<Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}> <Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}>
...@@ -715,6 +658,7 @@ const NewEditModal = props => { ...@@ -715,6 +658,7 @@ const NewEditModal = props => {
checkedChildren="高级设置" checkedChildren="高级设置"
unCheckedChildren="高级设置" unCheckedChildren="高级设置"
onChange={change} onChange={change}
checked={current}
style={{ marginLeft: '40px', marginBottom: '15px' }} style={{ marginLeft: '40px', marginBottom: '15px' }}
/> />
{advanced === 1 ? ( {advanced === 1 ? (
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Select, Input, Button, Popconfirm, Spin } from 'antd'; import { Form, Select, Input, Button, Popconfirm, Spin } from 'antd';
import { modifyProduct } from '@/services/webConfig/api'; import { modifyProduct, getProductList } from '@/services/webConfig/api';
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const { TextArea } = Input; const { TextArea } = Input;
...@@ -28,19 +28,54 @@ const EditForm = props => { ...@@ -28,19 +28,54 @@ const EditForm = props => {
}, },
]; ];
useEffect(() => { useEffect(() => {
console.log(productObj.ProductName); getProductList().then(res => {
console.log(productObj.IsUsed, 'productObj.IsUsed'); const { code } = res;
let aa = userProductsList.find(i => i.ProductName == productObj.ProductName); if (code === 0) {
console.log(aa); const {
data: { AllProducts, UserProducts },
} = res;
console.log(UserProducts);
console.log(productObj);
let aa = UserProducts.find(i => i.ProductName == productObj.ProductName);
getData(aa);
}
});
}, [productObj]);
const getData = aa => {
if (!productObj.IsUsed) { if (!productObj.IsUsed) {
console.log(12);
setBut(true); setBut(true);
form.setFieldsValue({ ...productObj }); form.setFieldsValue({ ...productObj });
if (aa) {
form.setFieldsValue({ DefaultSetting: aa.DefaultSetting });
}
} else { } else {
console.log(34);
setBut(false); setBut(false);
form.setFieldsValue({ ...aa }); form.setFieldsValue({ ...productObj });
if (aa) {
form.setFieldsValue({ DefaultSetting: aa.DefaultSetting });
}
} }
}, [productObj]); };
// useEffect(() => {
// if (!productObj.IsUsed) {
// console.log(12);
// setBut(true);
// form.setFieldsValue({ ...productObj });
// // if (aa) {
// // form.setFieldsValue({ DefaultSetting: aa.DefaultSetting });
// // }
// } else {
// console.log(34);
// setBut(false);
// form.setFieldsValue({ ...productObj });
// // if (aa) {
// // form.setFieldsValue({ DefaultSetting: aa.DefaultSetting });
// // }
// }
// }, [productObj]);
// 提交选择 // 提交选择
const submit = value => {}; const submit = value => {};
// 提交 // 提交
......
...@@ -61,6 +61,8 @@ const ProductConfig = props => { ...@@ -61,6 +61,8 @@ const ProductConfig = props => {
} = res; } = res;
// setProductList(AllProducts); // setProductList(AllProducts);
setUserProductsList(UserProducts); setUserProductsList(UserProducts);
console.log(UserProducts);
console.log(userProductsList);
if (!productObj && AllProducts.length > 0) { if (!productObj && AllProducts.length > 0) {
setProductObj(AllProducts[0]); setProductObj(AllProducts[0]);
} }
...@@ -126,12 +128,12 @@ const ProductConfig = props => { ...@@ -126,12 +128,12 @@ const ProductConfig = props => {
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code === 0) {
setFlag(flag + 1);
notification.success({ notification.success({
message: '提示', message: '提示',
description: '编辑成功', description: '编辑成功',
duration: 3, duration: 3,
}); });
setFlag(flag + 1);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -146,12 +148,14 @@ const ProductConfig = props => { ...@@ -146,12 +148,14 @@ const ProductConfig = props => {
}); });
}; };
const handleSwitchClick = (e, item, userlist) => { const handleSwitchClick = (e, item, userlist) => {
console.log(userlist);
if (e) { if (e) {
setLoading(true); setLoading(true);
modifyProduct({ ...item }) modifyProduct({ ...item })
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code === 0) {
setFlag(flag + 1);
notification.success({ notification.success({
message: '提示', message: '提示',
description: '启用成功', description: '启用成功',
...@@ -159,7 +163,6 @@ const ProductConfig = props => { ...@@ -159,7 +163,6 @@ const ProductConfig = props => {
}); });
item.IsUsed = true; item.IsUsed = true;
setProductObj({ ...item }); setProductObj({ ...item });
setFlag(flag + 1);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -179,6 +182,7 @@ const ProductConfig = props => { ...@@ -179,6 +182,7 @@ const ProductConfig = props => {
} }
}; };
const handleClickItem = value => { const handleClickItem = value => {
console.log(value);
setProductObj({ ...value }); setProductObj({ ...value });
}; };
const renderListItem = arr => ( const renderListItem = arr => (
......
...@@ -20,8 +20,8 @@ import WebConfigForm from './webConfigForm'; ...@@ -20,8 +20,8 @@ import WebConfigForm from './webConfigForm';
import Upload from '@/components/Upload'; import Upload from '@/components/Upload';
import styles from './siteConfigDrawer.less'; import styles from './siteConfigDrawer.less';
const { Option } = Select; const { Option } = Select;
const plainOptions = ['搜索', '首页', '常用', '工单', '消息']; const plainOptions = ['搜索', '首页', '反馈', '消息'];
const defaultCheckedList = ['搜索', '首页', '常用', '工单', '消息']; const defaultCheckedList = ['搜索', '首页', '反馈', '消息'];
export default props => { export default props => {
const { visible, onClose, config, hasIntegerate, isEdit, onOk, submitting, productList } = props; const { visible, onClose, config, hasIntegerate, isEdit, onOk, submitting, productList } = props;
...@@ -35,7 +35,9 @@ export default props => { ...@@ -35,7 +35,9 @@ export default props => {
onGetLoginPages(); onGetLoginPages();
console.log(isEdit); console.log(isEdit);
if (isEdit) { if (isEdit) {
if (config) { console.log(config);
if (config != null && config.topMenu) {
console.log(config);
setCheckedList(config.topMenu.split(',')); setCheckedList(config.topMenu.split(','));
if (config.topMenu.split(',').length == 1 && config.topMenu.split(',')[0] == '') { if (config.topMenu.split(',').length == 1 && config.topMenu.split(',')[0] == '') {
setIndeterminate(false); setIndeterminate(false);
...@@ -89,7 +91,14 @@ export default props => { ...@@ -89,7 +91,14 @@ export default props => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
console.log(validate); console.log(validate);
console.log(checkedList); console.log(checkedList);
console.log(checkedList.toString()); // if (checkedList.find(i => i == '首页') && !validate.homePage) {
// notification.warning({
// message: '提示',
// duration: 3,
// description: '功能配置勾选首页时主页Url必填',
// });
// return;
// }
validate.topMenu = checkedList.toString(); validate.topMenu = checkedList.toString();
console.log(validate); console.log(validate);
if (validate) { if (validate) {
......
...@@ -155,9 +155,9 @@ const WebConfigPage = props => { ...@@ -155,9 +155,9 @@ const WebConfigPage = props => {
if (webToOperate.id === curWeb.id) { if (webToOperate.id === curWeb.id) {
setCurWeb(webs[0].id); setCurWeb(webs[0].id);
} }
setTimeout(() => { // setTimeout(() => {
updateModuleTree(userMode || 'super'); updateModuleTree(userMode || 'super');
}, 500); // }, 500);
} else { } else {
notification.error({ notification.error({
message: res.message || `删除网站 ${webToOperate.text} 失败`, message: res.message || `删除网站 ${webToOperate.text} 失败`,
...@@ -250,22 +250,22 @@ const WebConfigPage = props => { ...@@ -250,22 +250,22 @@ const WebConfigPage = props => {
.then(res => { .then(res => {
setSubmitting(false); setSubmitting(false);
if (res.code === 0 || res.success) { if (res.code === 0 || res.success) {
setTimeout(() => { // setTimeout(() => {
if (isEdit) { if (isEdit) {
setCurWeb({ ...curWeb, text: values.title }); setCurWeb({ ...curWeb, text: values.title });
} else { } else {
setCurWeb({ ...curWeb, text: values.title, id: res.data }); setCurWeb({ ...curWeb, text: values.title, id: res.data });
} }
}, 200); // }, 200);
notification.success({ notification.success({
message: successMsg, message: successMsg,
duration: 3, duration: 3,
}); });
setConfigVisible(false); setConfigVisible(false);
setTimeout(() => { // setTimeout(() => {
updateModuleTree(userMode || 'super'); updateModuleTree(userMode || 'super');
}, 500); // }, 500);
} else { } else {
notification.warning({ notification.warning({
message: res.msg || failMsg, message: res.msg || failMsg,
......
...@@ -362,7 +362,7 @@ const MiniMenu = props => { ...@@ -362,7 +362,7 @@ const MiniMenu = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.mes || '编辑失败', description: res.msg || '编辑失败',
}); });
} }
}) })
......
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