去掉点位编辑删除按钮

This commit is contained in:
licuizhu 2023-11-21 21:43:29 +08:00
parent 3879af0080
commit 1d07c8cc44
2 changed files with 28 additions and 35 deletions

View File

@ -86,5 +86,13 @@ export function deleteLayer( params ) {
}); });
} }
// 基础地图删除点位
export function deletePoint( params ) {debugger
return request('/api/basicMap/deletePoint', {
method: 'get',
params: params
});
}

View File

@ -3,19 +3,13 @@ import { Select, Input, Card, Col, Row, Button, message, Modal, Spin } from 'ant
import axios from 'axios'; import axios from 'axios';
import LayerData from './LayerData'; import LayerData from './LayerData';
import { AimOutlined } from '@ant-design/icons'; import { AimOutlined } from '@ant-design/icons';
import Guide from '../../components/Guide/index.ts';
import icon1 from '../../assets/icon/position_icon1.png';
import icon2 from '../../assets/icon/position_icon2.png';
import icon3 from '../../assets/icon/position_icon3.png';
import Header from '../../components/Header/index.js'; import Header from '../../components/Header/index.js';
import { GaodeMap ,Scene, PointLayer, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup } from '@antv/l7'; import { GaodeMap ,Scene, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup } from '@antv/l7';
import styles from './index.less'; import styles from './index.less';
const { Option } = Select; const { Option } = Select;
const AMap = window.AMap;
let infoWindow = new AMap.InfoWindow({offset: new AMap.Pixel(0, -30)});
const nullSearchAddress = () => { const nullSearchAddress = () => {
message.error('地址信息为空'); message.error('地址信息为空');
@ -149,25 +143,13 @@ class BaseMap extends React.Component{
} }
} }
} }
// 点击点显示详细信息
markerEdit = (e) => {
console.log('edit');
}
markderDel = (e) => {debugger
console.log('del');
return (function () {
console.log('del2')
})
}
// 在地图上设置点位 【经度,纬度】 // 在地图上设置点位 【经度,纬度】
setMarkers = (data, layerId) => { setMarkers = (data, layerId) => {
let self = this; let self = this;
let map = this.state.map; let map = this.state.map;
let LabelsData = data || []; let LabelsData = data || [];
let markerLayer = new MarkerLayer({name: layerId}); let markerLayer = new MarkerLayer({name: layerId});
let el, popup, marker, icon;debugger let el, popup, marker, icon;
for (let i = 0; i < LabelsData.length; i++) { for (let i = 0; i < LabelsData.length; i++) {
icon = LabelsData[0].logoImage; icon = LabelsData[0].logoImage;
el = document.createElement('label'); el = document.createElement('label');
@ -175,25 +157,28 @@ class BaseMap extends React.Component{
el.style.height = '22px'; el.style.height = '22px';
el.style.background = 'url("' + icon + '") no-repeat'; el.style.background = 'url("' + icon + '") no-repeat';
el.style.backgroundSize = 'contain'; el.style.backgroundSize = 'contain';
popup = new Popup({
offsets: [0, 30]
}).setHTML(`<div>
<div class="popup-title"><span class="popup-title-border"></span></div>
<div class="popup-name">名称${LabelsData[i].pointName}</div>
<div class="popup-address">地址${LabelsData[i].address || ''}</div>
<div class="popup-memo">备注${LabelsData[i].memo || ''}</div>
<div class="popup-btn-wrap">
<span class="popup-edit">编辑</span>
<span class="popup-del" onclick="${self.markderDel(LabelsData[i].pointId)}">删除</span>
</div>
</div>`);
marker = new Marker({ marker = new Marker({
element: el element: el
}).setLnglat({lng: LabelsData[i].lng, lat: LabelsData[i].lat}) }).setLnglat({lng: LabelsData[i].lng, lat: LabelsData[i].lat})
.setPopup(popup);
marker.on('click', (e) => {
popup = new Popup({
offsets: [0, 30]
})
.setLnglat(e.lngLat)
.setHTML(`
<div>
<div class="popup-title"><span class="popup-title-border"></span></div>
<div class="popup-name">名称${LabelsData[i].pointName}</div>
<div class="popup-address">地址${LabelsData[i].address || ''}</div>
<div class="popup-memo">备注${LabelsData[i].memo || ''}</div>
</div>`);
this.state.map.addPopup(popup)
});
markerLayer.addMarker(marker); markerLayer.addMarker(marker);
} }
this.setState({ this.setState({
markerLayerList: [...this.state.markerLayerList, markerLayer], markerLayerList: [...this.state.markerLayerList, markerLayer],
}) })
@ -578,7 +563,7 @@ class BaseMap extends React.Component{
<LayerData ref="getLayerDataFun" getLayerPoints = {this.getLayerPoints} getLayerShapes = {this.getLayerShapes}/> <LayerData ref="getLayerDataFun" getLayerPoints = {this.getLayerPoints} getLayerShapes = {this.getLayerShapes}/>
<div className={styles.btnRightWrap}> <div className={styles.btnRightWrap}>
<Button type="primary" className={styles.btnRight}>点位创建</Button> <Button type="primary" className={styles.btnRight}>点位创建</Button>
<Button type="primary" className={styles.btnRight}>点位导入</Button> <Button disabled className={styles.btnRight}>点位导入</Button>
</div> </div>
{/* 地图 */} {/* 地图 */}
<div className={styles.mapWrap}> <div className={styles.mapWrap}>