Commit db8295c6 authored by shaoan123's avatar shaoan123

优化GIS平台下方案管理页面

parent 1b1c261d
Pipeline #26556 skipped with stages
...@@ -10,13 +10,13 @@ import { number } from 'prop-types'; ...@@ -10,13 +10,13 @@ import { number } from 'prop-types';
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible } = props; const { callBackSubmit = () => { }, type, formObj, visible,serviceList } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [mapType, setMapType] = useState(0); const [mapType, setMapType] = useState(0);
const [ImgIndex, setImgIndex] = useState(''); const [ImgIndex, setImgIndex] = useState('');
const [baseMap, setBaseMap] = useState([]); const [baseMap, setBaseMap] = useState([]);
const [pipeArr, setPipeArr] = useState([]); const [pipeArr, setPipeArr] = useState([]);
const [serviceList, setServiceList] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
// 提交 // 提交
...@@ -28,16 +28,16 @@ const AddModal = props => { ...@@ -28,16 +28,16 @@ const AddModal = props => {
if (type === 'add') { if (type === 'add') {
bindSchemeBaseMap({ bindSchemeBaseMap({
schemename: formObj.schemename, schemename: formObj.schemename,
basemapName:obj.serverName basemapName: obj.serverName
}).then(res=>{ }).then(res => {
setLoading(false); setLoading(false);
if(res.IsSuccess){ if (res.IsSuccess) {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success','瓦片新增成功') prompt('success', '瓦片新增成功')
} }
else{ else {
prompt('fail','瓦片新增失败') prompt('fail', '瓦片新增失败')
} }
}) })
} else { } else {
...@@ -46,15 +46,15 @@ const AddModal = props => { ...@@ -46,15 +46,15 @@ const AddModal = props => {
} }
}); });
}; };
const prompt =(type,content)=>{ const prompt = (type, content) => {
if(type=='success'){ if (type == 'success') {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: content, description: content,
}); });
} }
else{ else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -82,9 +82,9 @@ const AddModal = props => { ...@@ -82,9 +82,9 @@ const AddModal = props => {
if (res.IsSuccess) { if (res.IsSuccess) {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success','方案新增成功') prompt('success', '方案新增成功')
} else { } else {
prompt('fail','方案新增失败') prompt('fail', '方案新增失败')
} }
}) })
.catch(err => { .catch(err => {
...@@ -92,7 +92,9 @@ const AddModal = props => { ...@@ -92,7 +92,9 @@ const AddModal = props => {
}); });
}; };
const onFinish = value => { }; const onFinish = value => {
};
useEffect(() => { useEffect(() => {
switch (type) { switch (type) {
case 'add': case 'add':
...@@ -108,23 +110,9 @@ const AddModal = props => { ...@@ -108,23 +110,9 @@ const AddModal = props => {
//添加瓦片 //添加瓦片
const addTile = () => { const addTile = () => {
let serverList = [] form.setFieldsValue({
if (JSON.stringify(formObj) != "{}") { serverName: serviceList[0]
GetAllConfig({ terminalType: 'base', isBaseMap: true }).then(res => { })
console.log('res', res)
if (res.Result && res.Result.length) {
res.Result.map(item => {
if (formObj.baseMap.indexOf(item.servicename) == -1) {
serverList.push(item.servicename)
}
})
setServiceList(serverList)
form.setFieldsValue({
serverName: serverList[0]
})
}
})
}
} }
//获取管网及默认底图 //获取管网及默认底图
const pipeNetwork = () => { const pipeNetwork = () => {
...@@ -169,6 +157,7 @@ const AddModal = props => { ...@@ -169,6 +157,7 @@ const AddModal = props => {
url: `http://{IP}/CityInterface/rest/services/MapServer.svc/${value}` url: `http://{IP}/CityInterface/rest/services/MapServer.svc/${value}`
}) })
} }
//选择底图 //选择底图
const handleBaseMap = () => { } const handleBaseMap = () => { }
return ( return (
......
...@@ -3,7 +3,7 @@ import classnames from 'classnames' ...@@ -3,7 +3,7 @@ import classnames from 'classnames'
import styles from '../../SchemeConfig.less' import styles from '../../SchemeConfig.less'
import { Popconfirm, notification, Card, Button } from 'antd'; import { Popconfirm, notification, Card, Button } from 'antd';
import { import {
unbindSchemeBaseMap unbindSchemeBaseMap,GetAllConfig
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import { import {
CloseOutlined, PlusOutlined CloseOutlined, PlusOutlined
...@@ -15,6 +15,7 @@ const CardData = props => { ...@@ -15,6 +15,7 @@ const CardData = props => {
const [flag, setFlag] = useState(0); // 状态更新 const [flag, setFlag] = useState(0); // 状态更新
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({}); const [formObj, setFormObj] = useState({});
const [serviceList, setServiceList] = useState([]);
//删除瓦片 //删除瓦片
const deletebaseMap = (item, baseMapItem) => { const deletebaseMap = (item, baseMapItem) => {
unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => { unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => {
...@@ -65,11 +66,34 @@ const CardData = props => { ...@@ -65,11 +66,34 @@ const CardData = props => {
deletebaseMaps() deletebaseMaps()
}; };
//增加瓦片 //增加瓦片
const addTile = (item) => { const addTile = (value) => {
setFormObj(item); let serverList = []
setType('add'); setFormObj(value);
setVisible(true); if (JSON.stringify(value) != "{}") {
GetAllConfig({ terminalType: 'base', isBaseMap: true }).then(res => {
if (res.Result && res.Result.length) {
res.Result.map(item => {
if (value.baseMap.indexOf(item.servicename) == -1) {
serverList.push(item.servicename)
}
})
}
if(serverList.length){
setServiceList(serverList)
setType('add');
setVisible(true);
}
else{
notification.warning({
message: '提示',
duration: 3,
description: '请先在基础配置-配置底图',
});
}
})
}
} }
return ( return (
<> <>
...@@ -116,6 +140,7 @@ const CardData = props => { ...@@ -116,6 +140,7 @@ const CardData = props => {
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
callBackSubmit={onSubmit} callBackSubmit={onSubmit}
type={type} type={type}
serviceList={serviceList}
formObj={formObj} formObj={formObj}
/> />
</> </>
......
...@@ -46,8 +46,6 @@ const VectorData = props => { ...@@ -46,8 +46,6 @@ const VectorData = props => {
} }
) )
}; };
return ( return (
<> <>
<div style={{ width: 'calc(100vw - 265px)' }}> <div style={{ width: 'calc(100vw - 265px)' }}>
......
...@@ -176,8 +176,8 @@ export const GetGISServerMapList = query => ...@@ -176,8 +176,8 @@ export const GetGISServerMapList = query =>
//发布原数据 //发布原数据
export const publisService = (query) => export const publisService = (query,timeout) =>
get(`${CITY_SERVICE}/OMS.svc/D_Publish_GS_Service`, query,{timeout:120000}); get(`${CITY_SERVICE}/OMS.svc/D_Publish_GS_Service`, query,timeout);
//解决方案名称 //解决方案名称
export const getSolutionList = (query) => export const getSolutionList = (query) =>
......
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