diff --git a/src/api/index.js b/src/api/index.js index fd18b398..8702007b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -87,12 +87,36 @@ export function deleteLayer( params ) { } // 基础地图删除点位 -export function deletePoint( params ) {debugger +export function deletePoint( params ) { return request('/api/basicMap/deletePoint', { method: 'get', params: params }); } +// 基础地图点位新增 +export function createPoint( params ) { + return request('/api/basicMap/createPoint', { + method: 'get', + params: params + }); +} + +// 获取基础图层菜单栏 +export function getBasicLayerMenu( params ) { + return request('/api/basicMap/createPoint', { + method: 'get', + params: params + }); +} + +// 通过用户名获取自定义图层列表 +export function queryUserLayers() { + return request('/api/user/queryUserLayers', { + method: 'get', + }); +} + + diff --git a/src/index.less b/src/index.less index 6544fa6b..eb5bc40e 100644 --- a/src/index.less +++ b/src/index.less @@ -142,6 +142,9 @@ body { padding-inline: 0; } /* LayerData */ +:where(.css-dev-only-do-not-override-9ntgx0).ant-form-horizontal .ant-form-item-label { + width: 120px; +} .layer-data-wrap { position: fixed; top: 190px; @@ -161,7 +164,7 @@ body { background: url(./assets/images/modal_bg.png) no-repeat; background-size: cover; } - .edit-layer-modal .ant-modal-header { + .ant-modal-root .ant-modal-header { background: none; } #edit-layer-form { diff --git a/src/pages/BaseMap/index.js b/src/pages/BaseMap/index.js index af791ca2..7ae7ed57 100644 --- a/src/pages/BaseMap/index.js +++ b/src/pages/BaseMap/index.js @@ -1,9 +1,10 @@ import React from 'react'; -import { Select, Input, Card, Col, Row, Button, message, Modal, Spin } from 'antd'; +import { Select, Input, Card, Col, Row, Button, message, Modal, Spin, Form } from 'antd'; import axios from 'axios'; import LayerData from './LayerData'; import { AimOutlined } from '@ant-design/icons'; import Header from '../../components/Header/index.js'; +import { createPoint, queryUserLayers } from '../../api'; import { GaodeMap ,Scene, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup } from '@antv/l7'; @@ -47,7 +48,12 @@ class BaseMap extends React.Component{ inputContent: '', heatMapList: [], loading: false, - markerLayerList: [] + markerLayerList: [], + isModalOpen: false, + selectLayerList: [], + pointAdd: { + + }, } } startLoading = () => { @@ -518,6 +524,92 @@ class BaseMap extends React.Component{ } } } + //弹出框事件 + showModal = () => { + queryUserLayers().then((e) => {debugger + let data = e.data; + let selectLayerList = []; + for (var i in data) { + selectLayerList.push({ + 'value': data[i].id, + 'label': data[i].name, + }) + } + this.setState({ + isModalOpen: true, + selectLayerList: selectLayerList, + }); + }); + }; + handleOk = (values) => { + createPoint({ //创建图层 + "layerId": this.state.pointAdd.layerId, + "name": this.state.pointAdd.name, + "note": this.state.pointAdd.note, + "address": this.state.pointAdd.address, + "cityAdcode": this.state.cityAdcode, + // "cityName": "string", + "districtAdcode": this.state.districtAdcode, + // "districtName": "string", + // "location": "string", + "provinceAdcode": this.state.provinceAdcode, + // "provinceName": "string", + }).then((e) => { + if (e.success) { + message.success(e.message || '成功!'); + this.setState({ + isModalOpen: false + }); + } else { + message.error(e.message || '失败!'); + } + }) + }; + handleCancel = () => { + this.setState({ + isModalOpen: false + }); + }; + onLayerNameChange = (e) => { + this.setState({ + pointAdd: { + "layerId": this.state.pointAdd.layerId, + "name": this.state.pointAdd.name, + "note": this.state.pointAdd.note, + "address": this.state.pointAdd.address, + }, + }) + } + onPointAddNameChange = (e) => { + this.setState({ + pointAdd: { + "layerId": this.state.pointAdd.layerId, + "name": this.state.pointAdd.name, + "note": this.state.pointAdd.note, + "address": this.state.pointAdd.address, + }, + }) + } + onPointAddAddressChange = (e) => { + this.setState({ + pointAdd: { + "layerId": this.state.pointAdd.layerId, + "name": this.state.pointAdd.name, + "note": this.state.pointAdd.note, + "address": this.state.pointAdd.address, + }, + }) + } + onLayerNoteChange = (e) => { + this.setState({ + pointAdd: { + "layerId": this.state.pointAdd.layerId, + "name": this.state.pointAdd.name, + "note": this.state.pointAdd.note, + "address": this.state.pointAdd.address, + }, + }) + } render(){ return ( @@ -562,7 +654,30 @@ class BaseMap extends React.Component{ {/* 图层数据显示 */}
- + + +
+ + + + + + + + + + + + +
+
{/* 地图 */}