Commit b80b33b7 authored by 皮倩雯's avatar 皮倩雯

fix: '更新地图版本,区域解决搜索问题'

parent 7664f7eb
Pipeline #63292 passed with stages
......@@ -92,8 +92,8 @@
"@esri/calcite-colors": "6.0.3",
"@wisdom-cesium/cesium": "^1.0.78",
"@wisdom-map/amap": "1.1.0-beta.40",
"@wisdom-map/arcgismap": "1.4.0-67",
"@wisdom-map/basemap": "1.1.0-13",
"@wisdom-map/arcgismap": "1.4.0-76",
"@wisdom-map/basemap": "1.1.0-16",
"ace-builds": "^1.4.12",
"antd-img-crop": "^3.13.2",
"bizcharts": "^4.0.15",
......@@ -220,7 +220,6 @@
"less": "3.12.0",
"less-loader": "5.0.0",
"lint-staged": "8.1.5",
"ngrok": "3.1.1",
"lodash": "^4.17.11",
"moment": "^2.25.3",
"node-plop": "0.18.0",
......
......@@ -191,6 +191,9 @@ const Map = props => {
const [butState, setButState] = useState(false); // 绘制按钮状态
const [load, setLoad] = useState(false);
const [keepDataDraw, setKeepDataDraw] = useState([]);
const [areaFlag, setAreaFlag] = useState(0); // 地区改变标识
const [keepNameArea, setKeepNameArea] = useState(''); // 保存方案初始地区
const [keepNameCustomPointExtent, setKeepNameCustomPointExtent] = useState(''); // 保存方案初始自定义区域
useEffect(() => {
GetWebSiteConfig({ client: 'sandbox' }).then(res => {
......@@ -234,6 +237,8 @@ const Map = props => {
exportScheme: setttings.exportScheme || 'pandagis',
customFlag: setttings.customFlag,
});
setKeepNameArea(setttings.areaName);
setKeepBorderArea(setttings.customPointExtent);
if (setttings.customPointExtent) {
let aa = JSON.parse(setttings.customPointExtent);
......@@ -241,6 +246,7 @@ const Map = props => {
console.log(aa);
if (aa && aa.type) {
setKeepDraw(aa.geometry);
setKeepNameCustomPointExtent(aa.geometry);
setKeepType(aa.type);
data.type = aa.type;
let rings = [];
......@@ -254,6 +260,7 @@ const Map = props => {
setResultData({ ...data });
}
} else {
setKeepNameCustomPointExtent(setttings.customPointExtent);
setKeepDraw(setttings.customPointExtent);
}
......@@ -340,6 +347,8 @@ const Map = props => {
exportScheme: setttings.exportScheme || 'pandagis',
customFlag: setttings.customFlag,
});
setKeepNameArea(setttings.areaName);
setKeepBorderArea(setttings.customPointExtent);
if (setttings.customPointExtent) {
let aa = JSON.parse(setttings.customPointExtent);
......@@ -347,6 +356,7 @@ const Map = props => {
console.log(aa);
if (aa && aa.type) {
setKeepDraw(aa.geometry);
setKeepNameCustomPointExtent(aa.geometry);
setKeepType(aa.type);
data.type = aa.type;
let rings = [];
......@@ -361,6 +371,7 @@ const Map = props => {
}
} else {
setKeepDraw(setttings.customPointExtent);
setKeepNameCustomPointExtent(setttings.customPointExtent);
}
if (setttings.customPointExtent) {
......@@ -405,18 +416,22 @@ const Map = props => {
// 获取地图实例
const getMapInfo = viewObject => {
const pipenetLayers = viewObject.map.layers.filter(item => {
item.layerType && item.layerType == 'PipenetLayertest';
console.log(areaFlag);
// 切换方案清除自定义绘制管网;
// const pipenetLayers = viewObject.map.layers.filter(item => {
// item.layerType && item.layerType == 'PipenetLayertest';
// });
// viewObject.map.removeMany(pipenetLayers);
// 切换范围类型清除自定义绘制管网
viewObject.map.layers.forEach(item => {
if (item.layerType && item.layerType == 'PipenetLayertest') {
viewObject.map.remove(item);
}
});
viewObject.map.removeMany(pipenetLayers);
console.log(viewObject.map);
console.log(123);
setMap(viewObject);
// const { layer } = getPipenetLayer(viewObject?.map);
// if (layer) {
// console.log(923423);
// layer.visible = false;
// }
watchUtils.watch(viewObject, ['zoom'], newzoom => {
// 鼠标滚动隐藏管网图
viewObject.map.layers.find(layer => {
......@@ -450,6 +465,7 @@ const Map = props => {
}
}
setRadio1(form.getFieldsValue().customFlag);
setAreaFlag(0);
};
// 选择颜色
......@@ -478,13 +494,27 @@ const Map = props => {
mapRef.current.changeBoundWidthValue(obj[index].boundWidth);
break;
case 'areaName':
setFlag(0);
Drawtool.deactivate(false);
setArea('');
obj[index].areaName = changedFields[0].value[changedFields[0].value.length - 1];
setButState(false);
// 如果地区与范围初始值相等则范围已绘制
if (keepNameArea === changedFields[0].value[changedFields[0].value.length - 1]) {
if (keepNameArea !== '') {
mapRef.current.changeAreaName(keepNameArea, keepDraw);
setDraw(1);
} else {
setDraw(0);
mapRef.current.changeAreaName(obj[index].areaName);
// form.setFieldsValue({ customPointExtent: '' });
}
} else {
setDraw(0);
mapRef.current.changeAreaName(obj[index].areaName);
}
setAreaFlag(1);
setFlag(0);
Drawtool.deactivate(false);
setArea('');
setNewDraw(0);
setResultData(null);
......@@ -503,16 +533,11 @@ const Map = props => {
}
});
console.log(aa);
setFirstList({ ...aa });
// setFirstList({ ...aa });
break;
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);
GetWebSiteConfig({ client: 'sandbox' }).then(res => {
setSchemeList(res.data);
......@@ -573,10 +598,13 @@ const Map = props => {
exportScheme: setttings.exportScheme || 'pandagis',
customFlag: setttings.customFlag,
});
setKeepNameArea(setttings.areaName);
if (setttings.customPointExtent) {
let aa = JSON.parse(setttings.customPointExtent);
if (aa && aa.type) {
setKeepDraw(aa.geometry);
setKeepNameCustomPointExtent(aa.geometry);
setKeepType(aa.type);
let data = {};
data.type = aa.type;
......@@ -591,6 +619,7 @@ const Map = props => {
}
} else {
setKeepDraw(setttings.customPointExtent);
setKeepNameCustomPointExtent(setttings.customPointExtent);
}
setKeepBorderArea(setttings.customPointExtent);
......@@ -609,31 +638,6 @@ const Map = props => {
setRadio1(setttings.customFlag);
mapRef.current.mapchange(obj);
// 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:
......@@ -686,6 +690,7 @@ const Map = props => {
form.setFieldsValue({
customPointExtent: geom1,
});
setKeepNameArea(area1[area1.length - 1]);
setKeepDraw(geom1);
setKeepDataDraw(geom1);
setButState(false);
......@@ -708,19 +713,6 @@ const Map = props => {
form.setFieldsValue({ customPointExtent: aa.geometry });
console.log(form.getFieldsValue().customPointExtent.geometry);
}
// else {
// let geom = [];
// geom.push({ x: e.geometry.xmin, y: e.geometry.ymax });
// geom.push({ x: e.geometry.xmin, y: e.geometry.ymin });
// geom.push({ x: e.geometry.xmax, y: e.geometry.ymin });
// geom.push({ x: e.geometry.xmax, y: e.geometry.ymax });
// let area1 = form.getFieldsValue().areaName;
// mapRef.current.changeAreaName(area1[0], geom);
// form.setFieldsValue({
// customPointExtent: geom,
// });
// }
Drawtool.deactivate(false);
};
......@@ -887,15 +879,10 @@ const Map = props => {
setResultData(null);
if (e.target.value == 0) {
let data = form.getFieldsValue().areaName;
let aa = form.getFieldsValue().schemename;
let list = mapsettings.find(i => i.schemename == aa);
mapRef.current.changeAreaName(data[data.length - 1]);
setButState(false);
// setDraw(0);
Drawtool.deactivate();
setRadio1(e.target.value);
console.log(firstList);
} else {
console.log(keepDraw);
if (keepDraw) {
......@@ -933,7 +920,7 @@ const Map = props => {
}
});
console.log(aa);
setFirstList({ ...aa });
// setFirstList({ ...aa });
};
const onSave = e => {
......@@ -1259,11 +1246,10 @@ const Map = props => {
view={mapInfo.current}
editType={['POLYGON', 'EXTENT', 'CIRCLE']}
defaultGraphic={resultData}
areaName={() => {
if (form.getFieldsValue().areaName) {
return form.getFieldsValue().areaName[form.getFieldsValue().areaName.length - 1];
areaName={
form.getFieldsValue().areaName &&
form.getFieldsValue().areaName[form.getFieldsValue().areaName.length - 1]
}
}}
useActivePanel
colorConfigBtnShow
handleBtnShow
......
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