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

fix: '修改web配置'

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