diff --git a/src/api/index.js b/src/api/index.js index da666830..3abc434a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -95,6 +95,15 @@ export function updateLayer( params ) { }); } +// 基础地图修改点位 +export function updatePoint( data ) { + return request('/api/basicMap/updatePoint', { + method: 'POST', + data: data + }); +} + + // 基础地图删除涂层 export function deleteLayer( params ) { return request('/api/basicMap/deleteLayer', { diff --git a/src/pages/BaseMap/index.js b/src/pages/BaseMap/index.js index f7576697..b8cfa993 100644 --- a/src/pages/BaseMap/index.js +++ b/src/pages/BaseMap/index.js @@ -5,7 +5,7 @@ import LayerData from './LayerData'; // import LayerList from './LayerList'; import { AimOutlined } from '@ant-design/icons'; import Header from '../../components/Header/index.js'; -import { createPoint, getDetailByIdApi, queryUserLayers, getLayerPointsApi, getAllProvinceApi, getCityByProvinceApi, getDistrictByCityApi, getLayerShapesApi, getPointByAddressApi, deletePoint } from '../../api'; +import { createPoint, updatePoint, getDetailByIdApi, queryUserLayers, getLayerPointsApi, getAllProvinceApi, getCityByProvinceApi, getDistrictByCityApi, getLayerShapesApi, getPointByAddressApi, deletePoint } from '../../api'; import Pop from './pop' import { GaodeMap ,Scene, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup, MouseLocation, CanvasLayer } from '@antv/l7'; @@ -141,6 +141,7 @@ class BaseMap extends React.Component{ }); if (nodeType === 1) { // 在地图上添加点位 + console.log("layerPointsData",layerPointsData) this.setMarkers(layerPointsData, layerId); } else if (nodeType === 4) { // this.setHeatMap(layerPointsData, layerId); @@ -241,7 +242,7 @@ class BaseMap extends React.Component{ selectLayerList:selectLayerList, pointEdit: { - pointId: LabelsData[i].pointId.toString(), + pointId: LabelsData[i].pointId, layerId: LabelsData[i].belongLayerId, name: LabelsData[i].pointName, // note: LabelsData[i].note, @@ -295,7 +296,7 @@ class BaseMap extends React.Component{ self.refs.getLayerDataFun.getBasicLayerMenu(filter); this.getLayerPoints(layerId, true, 1); self.stopLoading(); - }, 500); + }, 1000); this.getLayerPoints(layerId, false, 1); }else{ @@ -774,24 +775,27 @@ class BaseMap extends React.Component{ this.startLoading(); self = this; self.state.pop.hide(); - let popParameter = { - "layerId": this.state.pointEdit.layerId, + let param = { + "id": this.state.pointEdit.pointId, "name": this.state.pointEdit.name, - // "note": this.state.pointEdit.note, + "note": this.state.pointEdit.note, "address": this.state.pointEdit.address, - "cityAdcode": this.state.cityAdcode, - "districtAdcode": this.state.districtAdcode, - "location": this.state.popParameter.location, - "provinceAdcode": this.state.provinceAdcode, }; - setTimeout(() => { - // 重新获取点位 - self.getLayerPoints(self.state.popParameter.layerId, true, 1); - self.getLayerPoints(self.state.pointEdit.layerId, true, 1); - self.stopLoading(); - }, 500); - self.getLayerPoints(self.state.popParameter.layerId, false, 1); - self.getLayerPoints(self.state.pointEdit.layerId, false, 1); + updatePoint(param).then((e) => { + if (e.success) { + setTimeout(() => { + // 重新获取点位 + // self.getLayerPoints(self.state.popParameter.layerId, true, 1); + self.getLayerPoints(self.state.pointEdit.layerId, true, 1); + self.stopLoading(); + }, 1000); + // self.getLayerPoints(self.state.popParameter.layerId, false, 1); + self.getLayerPoints(self.state.pointEdit.layerId, false, 1); + }else{ + message.error('点位更新失败!'); + console.log("点位更新失败!", e) + } + }) self.setState({ isEditModalOpen: false, pop : null, @@ -868,6 +872,7 @@ class BaseMap extends React.Component{ "name": this.state.pointEdit.name, "note": this.state.pointEdit.note, "address": this.state.pointEdit.address, + "pointId": this.state.pointEdit.pointId, }, }) } @@ -887,6 +892,7 @@ class BaseMap extends React.Component{ "layerId": this.state.pointEdit.layerId, "name": e.currentTarget.value, "note": this.state.pointEdit.note, + "pointId": this.state.pointEdit.pointId, "address": this.state.pointEdit.address, }, }) @@ -907,6 +913,7 @@ class BaseMap extends React.Component{ "layerId": this.state.pointEdit.layerId, "name": this.state.pointEdit.name, "note": this.state.pointEdit.note, + "pointId": this.state.pointEdit.pointId, "address": e.currentTarget.value, }, }) @@ -927,6 +934,7 @@ class BaseMap extends React.Component{ "layerId": this.state.pointEdit.layerId, "name": this.state.pointEdit.name, "note": e.currentTarget.value, + "pointId": this.state.pointEdit.pointId, "address": this.state.pointEdit.address, }, }) @@ -1049,7 +1057,7 @@ class BaseMap extends React.Component{ className='add-point-modal' >
- - + */}