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

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

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