Commit 0bd17b80 authored by 皮倩雯's avatar 皮倩雯

修复地图后端配置管网消失问题

parent c3c11d49
Pipeline #59790 passed with stages
...@@ -175,17 +175,17 @@ const Map = props => { ...@@ -175,17 +175,17 @@ const Map = props => {
console.log(setttings); console.log(setttings);
setTimeout(() => { setTimeout(() => {
form.setFieldsValue({ form.setFieldsValue({
areaName: [setttings.areaName], areaName: setttings.areaName ? [setttings.areaName] : ['上海市'],
backgroundColor: setttings.backgroundColor, backgroundColor: setttings.backgroundColor || '#000000',
backgroundOpacity: setttings.backgroundOpacity * 100, backgroundOpacity: setttings.backgroundOpacity * 100 || '60',
boundColor: setttings.boundColor || '#86C8F8', boundColor: setttings.boundColor || '#86C8F8',
boundWidth: parseInt(setttings.boundWidth), boundWidth: parseInt(setttings.boundWidth) || '10',
extent: setttings.extent, extent: setttings.extent,
schemename: setttings.schemename, schemename: setttings.schemename,
exportScheme: setttings.exportScheme || 'pandagis', exportScheme: setttings.exportScheme || 'pandagis',
}); });
setColorList(setttings.boundColor || '#86C8F8'); setColorList(setttings.boundColor || '#86C8F8');
setColor(setttings.backgroundColor); setColor(setttings.backgroundColor || '#000000');
setRadio(setttings.exportScheme || 'pandagis'); setRadio(setttings.exportScheme || 'pandagis');
if (setttings.id) { if (setttings.id) {
setKeep(setttings); setKeep(setttings);
...@@ -221,6 +221,7 @@ const Map = props => { ...@@ -221,6 +221,7 @@ const Map = props => {
setMap(viewObject); setMap(viewObject);
const { layer } = getPipenetLayer(viewObject?.map); const { layer } = getPipenetLayer(viewObject?.map);
if (layer) { if (layer) {
console.log(layer);
console.log(232324234); console.log(232324234);
layer.visible = false; layer.visible = false;
} }
...@@ -235,12 +236,13 @@ const Map = props => { ...@@ -235,12 +236,13 @@ const Map = props => {
}); });
console.log(88888); console.log(88888);
mapInfo.current = viewObject; mapInfo.current = viewObject;
console.log(radio);
// if (radio == 'pandagis') { console.log(form.getFieldsValue().exportScheme);
// console.log(999999); if (form.getFieldsValue().exportScheme == 'pandagis') {
// // 用户自定义创建的管网图 console.log(999999);
// viewObject.map.add(pandagis); // 用户自定义创建的管网图
// } viewObject.map.add(pandagis);
}
// gate(); // gate();
}; };
...@@ -325,36 +327,36 @@ const Map = props => { ...@@ -325,36 +327,36 @@ const Map = props => {
} }
}); });
form.setFieldsValue({ form.setFieldsValue({
areaName: [setttings.areaName], areaName: setttings.areaName ? [setttings.areaName] : ['上海市'],
backgroundColor: setttings.backgroundColor, backgroundColor: setttings.backgroundColor || '#000000',
backgroundOpacity: setttings.backgroundOpacity * 100, backgroundOpacity: setttings.backgroundOpacity * 100 || '60',
boundColor: setttings.boundColor || '#86C8F8', boundColor: setttings.boundColor || '#86C8F8',
boundWidth: parseInt(setttings.boundWidth), boundWidth: parseInt(setttings.boundWidth) || '10',
extent: setttings.extent, extent: setttings.extent,
exportScheme: setttings.exportScheme || 'pandagis', exportScheme: setttings.exportScheme || 'pandagis',
}); });
setColorList(setttings.boundColor || '#86C8F8'); setColorList(setttings.boundColor || '#86C8F8');
setColor(setttings.backgroundColor); setColor(setttings.backgroundColor || '#000000');
setRadio(setttings.exportScheme || 'pandagis'); setRadio(setttings.exportScheme || 'pandagis');
mapRef.current.mapchange(obj); mapRef.current.mapchange(obj);
// 清除原有接口返回后端绘制的管网图 // 清除原有接口返回后端绘制的管网图
const { layer } = getPipenetLayer(mapRef.current?.map); // const { layer } = getPipenetLayer(mapRef.current?.map);
if (layer) { // if (layer) {
console.log(6666666); // console.log(6666666);
layer.visible = false; // layer.visible = false;
} // }
// 若方案有管网且是后端绘制每次切换首先创建用户自定义的后端绘制管网 // // 若方案有管网且是后端绘制每次切换首先创建用户自定义的后端绘制管网
if (setttings.exportScheme == 'pandagis') { // if (setttings.exportScheme == 'pandagis') {
console.log(222222); // console.log(222222);
const pandagisaa = new MapImageLayer({ // const pandagisaa = new MapImageLayer({
id: setttings.id, // id: setttings.id,
url: `/PandaGIS/MapServer/${setttings.id}`, // url: `/PandaGIS/MapServer/${setttings.id}`,
layerType: 'PipenetLayertest', // layerType: 'PipenetLayertest',
title: setttings.id, // title: setttings.id,
}); // });
// 用户自定义创建的管网图 // // 用户自定义创建的管网图
mapInfo.current.map.add(pandagisaa); // mapInfo.current.map.add(pandagisaa);
} // }
setMapsettings(obj); setMapsettings(obj);
break; break;
...@@ -471,15 +473,14 @@ const Map = props => { ...@@ -471,15 +473,14 @@ const Map = props => {
const onChange = e => { const onChange = e => {
if (e.target.value == 'arcgis') { if (e.target.value == 'arcgis') {
// 选择前端绘制时,如果界面有自定义的管网图就隐藏 // 选择前端绘制时,如果界面有自定义的管网图就隐藏,打开组件自动生成前端管网图
mapInfo.current.map.layers.forEach(item => { mapInfo.current.map.layers.forEach(item => {
if (item.layerType && item.layerType == 'PipenetLayertest') { if (item.layerType && item.layerType == 'PipenetLayertest') {
console.log(444444444);
mapInfo.current.map.remove(item); mapInfo.current.map.remove(item);
} }
}); });
} else { } else {
// 选择后端绘制时创建自定义的管网图 // 选择后端绘制时创建自定义的管网图,前端管网被组件关闭自动销毁
mapInfo.current.map.add(pandagis); mapInfo.current.map.add(pandagis);
} }
setRadio(e.target.value); setRadio(e.target.value);
......
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