Commit 73f784fb authored by 皮倩雯's avatar 皮倩雯

fix: '修复切换方案整图绘制管网不出来bug'

parent 9816e413
Pipeline #62830 passed with stages
......@@ -405,6 +405,12 @@ const Map = props => {
// 获取地图实例
const getMapInfo = viewObject => {
const pipenetLayers = viewObject.map.layers.filter(item => {
item.layerType && item.layerType == 'PipenetLayertest';
});
viewObject.map.removeMany(pipenetLayers);
console.log(viewObject.map);
console.log(123);
setMap(viewObject);
// const { layer } = getPipenetLayer(viewObject?.map);
// if (layer) {
......@@ -425,6 +431,7 @@ const Map = props => {
let data = mapInfo.current.map.layers.find(
item => item.layerType && item.layerType == 'PipenetLayertest',
);
console.log(data);
if (!data) {
// 用户自定义创建的管网图
let aa = '';
......@@ -433,7 +440,6 @@ const Map = props => {
aa = i.id;
}
});
console.log(aa);
const pandagis1 = new MapImageLayer({
id: aa,
url: `/PandaGIS/MapServer/${aa}`,
......@@ -444,23 +450,6 @@ const Map = props => {
}
}
setRadio1(form.getFieldsValue().customFlag);
// gate();
};
const gate = () => {
let aa = form.getFieldsValue().schemename;
GetWebSiteConfig({ client: 'sandbox' }).then(res => {
let data = res.data.find(i => i.schemename == aa);
console.log(data);
if (data.areaName == null) {
console.log(121212212);
mapRef.current.changeAreaName('上海市');
mapRef.current.changeBoundWidthValue('5');
mapRef.current.changeBoundColor('#86C8F8');
mapRef.current.updateAreaColor('#000000');
mapRef.current.changeBackgroundOpacity('0.6');
}
});
};
// 选择颜色
......@@ -482,12 +471,10 @@ const Map = props => {
switch (changedFields[0].name[0]) {
case 'backgroundOpacity':
obj[index].backgroundOpacity = changedFields[0].value / 100;
console.log(obj[index].backgroundOpacity);
mapRef.current.changeBackgroundOpacity(obj[index].backgroundOpacity);
break;
case 'boundWidth':
obj[index].boundWidth = changedFields[0].value;
console.log(obj[index].boundWidth);
mapRef.current.changeBoundWidthValue(obj[index].boundWidth);
break;
case 'areaName':
......@@ -495,7 +482,6 @@ const Map = props => {
Drawtool.deactivate(false);
setArea('');
obj[index].areaName = changedFields[0].value[changedFields[0].value.length - 1];
console.log(obj[index].areaName);
mapRef.current.changeAreaName(obj[index].areaName);
// form.setFieldsValue({ customPointExtent: '' });
setDraw(0);
......@@ -506,6 +492,7 @@ const Map = props => {
aa.layers.map(i => {
if (i.layerType == 'PipenetLayer') {
i.layerType = 'dynamic';
i.areaName = obj[index].areaName;
}
if (i.schemename == form.getFieldsValue().schemename) {
i.backgroundColor = color;
......@@ -521,13 +508,12 @@ const Map = props => {
case 'schemename':
setKeepDataDraw([]);
setRadio1('');
// const pipenetLayers = mapInfo.current.map.layers.filter(item => {
// item.layerType && item.layerType == 'PipenetLayertest';
// });
// mapInfo.current.map.removeMany(pipenetLayers);
// console.log(mapInfo.current.map);
mapInfo.current.map.layers.forEach(item => {
console.log(item.layerType);
if (item.layerType && item.layerType == 'PipenetLayertest') {
mapInfo.current.map.remove(item);
}
});
GetWebSiteConfig({ client: 'sandbox' }).then(res => {
setSchemeList(res.data);
setMapsettings(res.data);
......@@ -624,29 +610,30 @@ const Map = props => {
mapRef.current.mapchange(obj);
if (form.getFieldsValue().exportScheme == 'pandagis') {
let data = mapInfo.current.map.layers.find(
item => item.layerType && item.layerType == 'PipenetLayertest',
);
console.log(data);
if (!data) {
// 用户自定义创建的管网图
let aa = '';
mapsettings.map(i => {
if (i.schemename == form.getFieldsValue().schemename) {
aa = i.id;
}
});
console.log(aa);
const pandagis1 = new MapImageLayer({
id: aa,
url: `/PandaGIS/MapServer/${aa}`,
layerType: 'PipenetLayertest',
title: aa,
});
mapInfo.current.map.add(pandagis1);
}
}
// if (form.getFieldsValue().exportScheme === 'pandagis') {
// console.log(9999);
// let data = mapInfo.current.map.layers.find(
// item => item.layerType && item.layerType === 'PipenetLayertest',
// );
// console.log(data);
// if (!data) {
// // 用户自定义创建的管网图
// let aa = '';
// mapsettings.map(i => {
// if (i.schemename == form.getFieldsValue().schemename) {
// aa = i.id;
// }
// });
// console.log(aa);
// const pandagis1 = new MapImageLayer({
// id: aa,
// url: `/PandaGIS/MapServer/${aa}`,
// layerType: 'PipenetLayertest',
// title: aa,
// });
// mapInfo.current.map.add(pandagis1);
// }
// }
break;
default:
......@@ -857,7 +844,7 @@ const Map = props => {
setSetttingsSave(mapObj);
Drawtool.deactivate(false);
setArea('');
// setArea('');
setKeepSave('');
getData();
} else {
......@@ -885,9 +872,7 @@ const Map = props => {
if (e.target.value == 'arcgis') {
// 选择前端绘制时,如果界面有自定义的管网图就隐藏,打开组件自动生成前端管网图
mapInfo.current.map.layers.forEach(item => {
console.log(item.layerType);
if (item.layerType && item.layerType == 'PipenetLayertest') {
console.log(3333);
mapInfo.current.map.remove(item);
}
});
......
......@@ -101,26 +101,31 @@ const AddModal = props => {
const onFinish = value => {};
useEffect(() => {
switch (type) {
case 'add':
let gsIp = [];
let localStorageData = handlelocalStorage('get');
if (localStorageData) {
gsIp = localStorageData.map(item => ({
value: item.gsIp,
item: item.gsIp,
}));
}
setGsIp(gsIp);
let localIps = ['192.168.12.7', '192.168.19.100'];
let port = localIps.includes(gsIp) ? 8080 : 8088;
form.setFieldsValue({ servicename: serviceName[0].value, port, ...formObj });
break;
case 'edit':
form.setFieldsValue({ ...formObj });
break;
default:
break;
if (visible) {
switch (type) {
case 'add':
let gsIp = [];
let localStorageData = handlelocalStorage('get');
if (localStorageData) {
gsIp = localStorageData.map(item => ({
value: item.gsIp,
item: item.gsIp,
}));
}
setGsIp(gsIp);
let localIps = ['192.168.12.7', '192.168.19.100'];
let port = localIps.includes(gsIp) ? 8080 : 8088;
form.setFieldsValue({ servicename: serviceName[0].value, port, ...formObj });
break;
case 'edit':
form.setFieldsValue({ ...formObj });
break;
default:
break;
}
} else {
form.resetFields();
setWorkSpace('');
}
}, [visible]);
......@@ -274,7 +279,7 @@ const AddModal = props => {
<Select
onChange={handleWorkspace}
value={workSpace}
style={{ width: '365px' }}
style={{ width: '378px' }}
showSearch
>
{workList.length
......
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