feat:修改点位

This commit is contained in:
SmileXin 2024-06-21 11:52:18 +08:00
parent 79f38bf628
commit ffe9a87243
2 changed files with 37 additions and 20 deletions

View File

@ -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 ) { export function deleteLayer( params ) {
return request('/api/basicMap/deleteLayer', { return request('/api/basicMap/deleteLayer', {

View File

@ -5,7 +5,7 @@ import LayerData from './LayerData';
// import LayerList from './LayerList'; // import LayerList from './LayerList';
import { AimOutlined } from '@ant-design/icons'; import { AimOutlined } from '@ant-design/icons';
import Header from '../../components/Header/index.js'; 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 Pop from './pop'
import { GaodeMap ,Scene, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup, MouseLocation, CanvasLayer } from '@antv/l7'; 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) { if (nodeType === 1) {
// 在地图上添加点位 // 在地图上添加点位
console.log("layerPointsData",layerPointsData)
this.setMarkers(layerPointsData, layerId); this.setMarkers(layerPointsData, layerId);
} else if (nodeType === 4) { } else if (nodeType === 4) {
// this.setHeatMap(layerPointsData, layerId); // this.setHeatMap(layerPointsData, layerId);
@ -241,7 +242,7 @@ class BaseMap extends React.Component{
selectLayerList:selectLayerList, selectLayerList:selectLayerList,
pointEdit: pointEdit:
{ {
pointId: LabelsData[i].pointId.toString(), pointId: LabelsData[i].pointId,
layerId: LabelsData[i].belongLayerId, layerId: LabelsData[i].belongLayerId,
name: LabelsData[i].pointName, name: LabelsData[i].pointName,
// note: LabelsData[i].note, // note: LabelsData[i].note,
@ -295,7 +296,7 @@ class BaseMap extends React.Component{
self.refs.getLayerDataFun.getBasicLayerMenu(filter); self.refs.getLayerDataFun.getBasicLayerMenu(filter);
this.getLayerPoints(layerId, true, 1); this.getLayerPoints(layerId, true, 1);
self.stopLoading(); self.stopLoading();
}, 500); }, 1000);
this.getLayerPoints(layerId, false, 1); this.getLayerPoints(layerId, false, 1);
}else{ }else{
@ -774,24 +775,27 @@ class BaseMap extends React.Component{
this.startLoading(); this.startLoading();
self = this; self = this;
self.state.pop.hide(); self.state.pop.hide();
let popParameter = { let param = {
"layerId": this.state.pointEdit.layerId, "id": this.state.pointEdit.pointId,
"name": this.state.pointEdit.name, "name": this.state.pointEdit.name,
// "note": this.state.pointEdit.note, "note": this.state.pointEdit.note,
"address": this.state.pointEdit.address, "address": this.state.pointEdit.address,
"cityAdcode": this.state.cityAdcode,
"districtAdcode": this.state.districtAdcode,
"location": this.state.popParameter.location,
"provinceAdcode": this.state.provinceAdcode,
}; };
setTimeout(() => { updatePoint(param).then((e) => {
// 重新获取点位 if (e.success) {
self.getLayerPoints(self.state.popParameter.layerId, true, 1); setTimeout(() => {
self.getLayerPoints(self.state.pointEdit.layerId, true, 1); // 重新获取点位
self.stopLoading(); // self.getLayerPoints(self.state.popParameter.layerId, true, 1);
}, 500); self.getLayerPoints(self.state.pointEdit.layerId, true, 1);
self.getLayerPoints(self.state.popParameter.layerId, false, 1); self.stopLoading();
self.getLayerPoints(self.state.pointEdit.layerId, false, 1); }, 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({ self.setState({
isEditModalOpen: false, isEditModalOpen: false,
pop : null, pop : null,
@ -868,6 +872,7 @@ class BaseMap extends React.Component{
"name": this.state.pointEdit.name, "name": this.state.pointEdit.name,
"note": this.state.pointEdit.note, "note": this.state.pointEdit.note,
"address": this.state.pointEdit.address, "address": this.state.pointEdit.address,
"pointId": this.state.pointEdit.pointId,
}, },
}) })
} }
@ -887,6 +892,7 @@ class BaseMap extends React.Component{
"layerId": this.state.pointEdit.layerId, "layerId": this.state.pointEdit.layerId,
"name": e.currentTarget.value, "name": e.currentTarget.value,
"note": this.state.pointEdit.note, "note": this.state.pointEdit.note,
"pointId": this.state.pointEdit.pointId,
"address": this.state.pointEdit.address, "address": this.state.pointEdit.address,
}, },
}) })
@ -907,6 +913,7 @@ class BaseMap extends React.Component{
"layerId": this.state.pointEdit.layerId, "layerId": this.state.pointEdit.layerId,
"name": this.state.pointEdit.name, "name": this.state.pointEdit.name,
"note": this.state.pointEdit.note, "note": this.state.pointEdit.note,
"pointId": this.state.pointEdit.pointId,
"address": e.currentTarget.value, "address": e.currentTarget.value,
}, },
}) })
@ -927,6 +934,7 @@ class BaseMap extends React.Component{
"layerId": this.state.pointEdit.layerId, "layerId": this.state.pointEdit.layerId,
"name": this.state.pointEdit.name, "name": this.state.pointEdit.name,
"note": e.currentTarget.value, "note": e.currentTarget.value,
"pointId": this.state.pointEdit.pointId,
"address": this.state.pointEdit.address, "address": this.state.pointEdit.address,
}, },
}) })
@ -1049,7 +1057,7 @@ class BaseMap extends React.Component{
className='add-point-modal' className='add-point-modal'
> >
<Form name='base' id='add-point-form' onFinish={this.editChannel} onFinishFailed={this.onFinishFailed}> <Form name='base' id='add-point-form' onFinish={this.editChannel} onFinishFailed={this.onFinishFailed}>
<Form.Item label="选择自定义图层" {/* <Form.Item label=""
rules={[ rules={[
{ {
required: true, required: true,
@ -1069,7 +1077,7 @@ class BaseMap extends React.Component{
onChange={this.onEditLayerNameChange} onChange={this.onEditLayerNameChange}
allowClear> allowClear>
</Select> </Select>
</Form.Item> </Form.Item> */}
<Form.Item label="点位名称" <Form.Item label="点位名称"
rules={[ rules={[
{ {