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

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

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