25.02.09
This commit is contained in:
parent
64896b4fcf
commit
71fcf04ff3
@ -160,7 +160,7 @@ class LayerData extends React.Component {
|
||||
// 选中图层
|
||||
selectLayer = (e) => {
|
||||
// 修改选中状态
|
||||
console.log('selectLayer✈····· ',e);
|
||||
console.log('selectLayer✈····· ', parseInt(e.key.split('(')[2].split(')')[0]));
|
||||
let menuData = this.state.menuData;
|
||||
this.setState({ menuData: [] }) // 将图层列表的数据清空(不清空组件不更新数据)
|
||||
for (let i in menuData) { // 将选中图层的小眼睛改为打开状态(重新写入数据)
|
||||
@ -174,14 +174,19 @@ class LayerData extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
// 改变选择状态并改变地图上的图层
|
||||
let layerId = e.key.split('-')[1];
|
||||
if (e.item.props.typee === 1 || e.item.props.typee === 4) {
|
||||
this.props.getLayerPoints(layerId, true, e.item.props.typee);
|
||||
} else if (e.item.props.typee === 2) {
|
||||
this.props.getLayerShapes(layerId, true);
|
||||
// 从e.key中获取图层的点位数量,并判断是否大于零
|
||||
if (parseInt(e.key.split('(')[2].split(')')[0]) > 0) {
|
||||
// 改变选择状态并改变地图上的图层(API请求,加载动画)
|
||||
if (e.item.props.typee === 1 || e.item.props.typee === 4) {
|
||||
this.props.getLayerPoints(layerId, true, e.item.props.typee);
|
||||
} else if (e.item.props.typee === 2) {
|
||||
this.props.getLayerShapes(layerId, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 将选中图层写入选中图层列表
|
||||
let selectLayerList = [];
|
||||
let selectLayerIdList = [];
|
||||
|
@ -182,11 +182,13 @@ class BaseMap extends React.Component {
|
||||
// 获取图层明细点位数据/热力图数据
|
||||
getLayerPoints = (layerId, selected, nodeType) => {
|
||||
if (selected) {
|
||||
this.startLoading();
|
||||
this.startLoading(); // 开启加载动画
|
||||
getLayerPointsApi({
|
||||
adcode: this.state.districtAdcode || this.state.cityAdcode || this.state.provinceAdcode,
|
||||
layerId: layerId
|
||||
}).then((e) => {
|
||||
console.log("网络请求完成")
|
||||
// 获取点位数据
|
||||
let layerPointsData = e.data || [];
|
||||
layerPointsData = layerPointsData.map((item) => {
|
||||
item.lng = item.location.split(',')[0];
|
||||
@ -196,7 +198,6 @@ class BaseMap extends React.Component {
|
||||
});
|
||||
if (nodeType === 1) {
|
||||
// 在地图上添加点位
|
||||
console.log("layerPointsData", layerPointsData)
|
||||
this.setMarkers(layerPointsData, layerId);
|
||||
} else if (nodeType === 4) {
|
||||
// this.setHeatMap(layerPointsData, layerId);
|
||||
|
Loading…
Reference in New Issue
Block a user