Compare commits
12 Commits
281de0492e
...
34ef7c42a6
Author | SHA1 | Date | |
---|---|---|---|
34ef7c42a6 | |||
![]() |
4697f77226 | ||
798c0c3565 | |||
1772c14f47 | |||
![]() |
a10cb62000 | ||
ffe9a87243 | |||
79f38bf628 | |||
4abe7c1ae5 | |||
![]() |
28b6e6941f | ||
![]() |
11d846c8cb | ||
![]() |
15fd8e623c | ||
![]() |
7ebef9625f |
16
package-lock.json
generated
16
package-lock.json
generated
@ -6350,22 +6350,6 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
|
||||||
"version": "1.0.30001441",
|
|
||||||
"resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz",
|
|
||||||
"integrity": "sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/browserslist"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "tidelift",
|
|
||||||
"url": "https://tidelift.com/funding/github/npm/caniuse-lite"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "CC-BY-4.0"
|
|
||||||
},
|
|
||||||
"node_modules/chalk": {
|
"node_modules/chalk": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
|
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
|
||||||
|
@ -51,5 +51,9 @@
|
|||||||
"post-merge": "post-npm-install",
|
"post-merge": "post-npm-install",
|
||||||
"post-rebase": "post-npm-install"
|
"post-rebase": "post-npm-install"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"name": "bmw",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { request } from '@umijs/max';
|
import { request } from '@umijs/max';
|
||||||
import loginStore from '../store/login.store';
|
// import loginStore from '../store/login.store';
|
||||||
|
|
||||||
// 获取登陆人
|
// 获取登陆人
|
||||||
export function getCurrentUser() {
|
export function getCurrentUser() {
|
||||||
let token = loginStore.token
|
// let token = loginStore.token
|
||||||
return request('/api/user/getCurrentUser', {
|
return request('/api/user/getCurrentUser', {
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
@ -49,13 +49,21 @@ export function queryUserMenu() {
|
|||||||
|
|
||||||
// 基本图层
|
// 基本图层
|
||||||
// 获取图层明细点位数据/热力图数据
|
// 获取图层明细点位数据/热力图数据
|
||||||
export function getLayerPoints( params ) {
|
export function getLayerPointsApi( params ) {
|
||||||
return request('/api/basicMap/getLayerPoints', {
|
return request('/api/basicMap/getLayerPoints', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: params
|
params: params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取地图单位的数据详细
|
||||||
|
export function getDetailByIdApi( params ) {
|
||||||
|
return request('/api/basicMap/getDetailById', {
|
||||||
|
method: 'GET',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 获取大盘统计数据
|
// 获取大盘统计数据
|
||||||
export function getDashboardData() {
|
export function getDashboardData() {
|
||||||
return request('/api/dashboard/getDashboardData', {
|
return request('/api/dashboard/getDashboardData', {
|
||||||
@ -87,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', {
|
||||||
@ -112,8 +129,8 @@ export function createPoint( data ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取基础图层菜单栏
|
// 获取基础图层菜单栏
|
||||||
export function getBasicLayerMenu( params ) {
|
export function getBasicLayerMenuApi( params ) {
|
||||||
return request('/api/basicMap/createPoint', {
|
return request('/api/basicMap/getBasicLayerMenu', {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: params
|
params: params
|
||||||
});
|
});
|
||||||
@ -126,6 +143,48 @@ export function queryUserLayers() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取省
|
||||||
|
export function getAllProvinceApi() {
|
||||||
|
return request('/api/mapCommon/getAllProvince', {
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取市
|
||||||
|
export function getCityByProvinceApi( params ) {
|
||||||
|
return request('/api/mapCommon/getCityByProvince', {
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取区
|
||||||
|
export function getDistrictByCityApi( params ) {
|
||||||
|
return request('/api/mapCommon/getDistrictByCity', {
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取围栏图层数据
|
||||||
|
export function getLayerShapesApi( params ) {
|
||||||
|
return request('/api/basicMap/getLayerShapes', {
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取围栏图层数据
|
||||||
|
export function getPointByAddressApi( params ) {
|
||||||
|
return request('/api/mapCommon/getPointByAddress', {
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import { RequestConfig } from '@umijs/max';
|
|||||||
export const request: RequestConfig = {
|
export const request: RequestConfig = {
|
||||||
requestInterceptors: [
|
requestInterceptors: [
|
||||||
(url, options) => {
|
(url, options) => {
|
||||||
const token = localStorage.getItem('authToken'); // 从某处获取你的认证token,例如localStorage
|
const token = localStorage.getItem('pc-key'); // 从某处获取你的认证token,例如localStorage
|
||||||
if (token) {
|
if (token) {
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `${token}`,
|
Authorization: `${token}`,
|
||||||
|
@ -172,7 +172,7 @@ const Guide: React.FC<Props> = (props) => {
|
|||||||
|
|
||||||
{/* 下拉框 全国自定义点位数目图 */}
|
{/* 下拉框 全国自定义点位数目图 */}
|
||||||
<Row className={styles.filterWrap}>
|
<Row className={styles.filterWrap}>
|
||||||
<Col span={5} className={styles.filterLabel}>全国自定义点位数目图</Col>
|
<Col span={5} className={styles.filterLabel}>请选择需统计数目的图层</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Select allowClear
|
<Select allowClear
|
||||||
style = {{width: 310, color: '#2F66F2'}}
|
style = {{width: 310, color: '#2F66F2'}}
|
||||||
|
211
src/index.less
211
src/index.less
@ -147,39 +147,152 @@ body {
|
|||||||
}
|
}
|
||||||
.layer-data-title{
|
.layer-data-title{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px 0;
|
padding: 25px 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
|
font-size: 21px;
|
||||||
// 内容不被选中
|
// 内容不被选中
|
||||||
-webkit-user-select:none;/*谷歌 /Chrome*/
|
-webkit-user-select:none;/*谷歌 /Chrome*/
|
||||||
-moz-user-select:none; /*火狐/Firefox*/
|
-moz-user-select:none; /*火狐/Firefox*/
|
||||||
-ms-user-select:none; /*IE 10+*/
|
-ms-user-select:none; /*IE 10+*/
|
||||||
user-select:none;
|
user-select:none;
|
||||||
|
}
|
||||||
|
// 重新加载按钮样式
|
||||||
|
.layer-data-wrap .reload{
|
||||||
|
margin-left: 15px;
|
||||||
|
font-size: 15px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.layer-data-title span {
|
.layer-data-title span {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
.layer-data-wrap {
|
.hiddenBtn{
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: fixed;
|
position: absolute;
|
||||||
top: 190px;
|
height: 40px;
|
||||||
width: 270px;
|
width: 40px;
|
||||||
max-height: 450px;
|
margin: 20% 21.4%;
|
||||||
margin: 2% 4.2%;
|
background: rgb(255, 255, 255);
|
||||||
background: rgba(239,240,248,1);
|
|
||||||
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
|
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
z-index: 999;
|
z-index: 99;
|
||||||
|
text-align: center;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
|
||||||
|
// 动画
|
||||||
|
animation-name: moveBtn;
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
animation-play-state: paused;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-direction: alternate;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
}
|
}
|
||||||
|
@keyframes moveBtn{
|
||||||
|
from {
|
||||||
|
// margin-left: 0;
|
||||||
|
}
|
||||||
|
99%{
|
||||||
|
// margin-left: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
margin: 20% 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.layer-data-wrap {
|
||||||
|
// overflow: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
position: absolute;
|
||||||
|
// top: 190px;
|
||||||
|
width: 16.4%;
|
||||||
|
// width: 270px;
|
||||||
|
max-height: 450px;
|
||||||
|
// min-height: 100px;
|
||||||
|
margin: 20% 5%;
|
||||||
|
background: rgba(239,240,248,1);
|
||||||
|
// background: rgba(239,240,248,0);
|
||||||
|
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
|
||||||
|
border-radius: 10px;
|
||||||
|
opacity: 1;
|
||||||
|
// 禁止换行
|
||||||
|
white-space:nowrap;
|
||||||
|
|
||||||
|
z-index: 99;
|
||||||
|
// 动画
|
||||||
|
animation-name: hiddenLayer;
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
animation-play-state: paused;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-direction: alternate;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
}
|
||||||
|
@keyframes hiddenLayer{
|
||||||
|
from {
|
||||||
|
}
|
||||||
|
99%{
|
||||||
|
width: 0px;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
box-shadow: none;
|
||||||
|
width: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.anticon-double-left {
|
||||||
|
// 动画
|
||||||
|
animation-name: turn;
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
animation-play-state: paused;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-direction: alternate;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
}
|
||||||
|
@keyframes turn{
|
||||||
|
from {
|
||||||
|
// transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
99%{
|
||||||
|
// transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.layer-data-wrap .menu-list{
|
||||||
|
// width: 100%;
|
||||||
|
width: 270px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 隐藏滚轮条
|
||||||
.layer-data-wrap:hover{
|
.layer-data-wrap:hover{
|
||||||
overflow-y: auto !important;
|
// overflow-y: auto !important;
|
||||||
scrollbar-width: none; /* Firefox */
|
// scrollbar-width: none; /* Firefox */
|
||||||
-ms-overflow-style: none; /* IE 10+ */
|
// -ms-overflow-style: none; /* IE 10+ */
|
||||||
}
|
}
|
||||||
.layer-data-wrap:hover::-webkit-scrollbar {
|
.layer-data-wrap:hover::-webkit-scrollbar {
|
||||||
display: none; /* Safari and Chrome */
|
// display: none; /* Safari and Chrome */
|
||||||
}
|
}
|
||||||
|
.layer-name{
|
||||||
|
// margin-right: 50%;
|
||||||
|
}
|
||||||
|
.add-layer-btn{
|
||||||
|
float: right;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
.add-layer-btn-disable{
|
||||||
|
cursor: not-allowed;
|
||||||
|
float: right;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
#add-layer{
|
#add-layer{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -680,6 +793,12 @@ body {
|
|||||||
.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper {
|
.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
.cursor-crosshair{
|
||||||
|
cursor: crosshair !important;
|
||||||
|
}
|
||||||
|
.pointer-events-none{
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
#root .ant-select-selector {
|
#root .ant-select-selector {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border: none;
|
border: none;
|
||||||
@ -732,6 +851,47 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// marker popup
|
// marker popup
|
||||||
|
.popup-x{
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding-right: 12.5%;
|
||||||
|
font-size: 30px;
|
||||||
|
border: 0;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
// background-color: red;
|
||||||
|
position: absolute;
|
||||||
|
top: 1%;
|
||||||
|
left: 87%;
|
||||||
|
}
|
||||||
|
.popup-coat{
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
// 弹框样式
|
||||||
|
.l7-popup .l7-popup-content{
|
||||||
|
pointer-events: auto;
|
||||||
|
min-width: 300px;
|
||||||
|
min-height: 210px;
|
||||||
|
}
|
||||||
|
.l7-popup.l7-popup-anchor-bottom{
|
||||||
|
min-width: 300px;
|
||||||
|
min-height: 210px;
|
||||||
|
}
|
||||||
|
// 弹框右上的关闭按钮
|
||||||
|
.l7-popup .l7-popup-content .l7-popup-close-button{
|
||||||
|
position: static !important;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
// 右下角的两个按钮外的div
|
||||||
|
.button-div{
|
||||||
|
width: 110px;
|
||||||
|
// display: flex;
|
||||||
|
// justify-content: space-between;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 16px;
|
||||||
|
right: 16px;
|
||||||
|
margin-left: 100%;
|
||||||
|
}
|
||||||
.popup-title {
|
.popup-title {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -742,7 +902,7 @@ body {
|
|||||||
}
|
}
|
||||||
.popup-title-border{
|
.popup-title-border{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 5px;
|
width: 2px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
background: #2F66F2;
|
background: #2F66F2;
|
||||||
border-radius: 0px 0px 0px 0px;
|
border-radius: 0px 0px 0px 0px;
|
||||||
@ -785,3 +945,26 @@ body {
|
|||||||
.popup-del:hover {
|
.popup-del:hover {
|
||||||
color: #f57272;
|
color: #f57272;
|
||||||
}
|
}
|
||||||
|
// 删除警告框
|
||||||
|
.delete-alert{
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
}
|
||||||
|
#custom-pop{
|
||||||
|
// display: none !important;
|
||||||
|
}
|
||||||
|
.l7-marker-container2 .l7-popup{
|
||||||
|
pointer-events: all !important;
|
||||||
|
}
|
||||||
|
// 图层列表中横线样式
|
||||||
|
.layer-data-wrap .ant-menu-item-divider{
|
||||||
|
// display:none;
|
||||||
|
height: 0.1px !important;
|
||||||
|
border: none;
|
||||||
|
margin: auto;
|
||||||
|
width: 90%;
|
||||||
|
background-color: #b2bec3 ;
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Tree, Button, Modal, Form, Input, Radio, message, Menu } from 'antd';
|
import { Tree, Button, Modal, Form, Input, Radio, message, Menu, Divider, Tooltip } from 'antd';
|
||||||
import axios from 'axios';
|
|
||||||
import {
|
import {
|
||||||
DownOutlined,
|
DownOutlined,
|
||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
EyeInvisibleOutlined,
|
EyeInvisibleOutlined,
|
||||||
UnderlineOutlined,
|
|
||||||
UnorderedListOutlined,
|
UnorderedListOutlined,
|
||||||
|
SyncOutlined,
|
||||||
|
DoubleLeftOutlined,
|
||||||
|
PlusOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import SetLogoImagePath from './SetLogoImagePath'
|
import SetLogoImagePath from './SetLogoImagePath'
|
||||||
import { createLayer } from '../../../api';
|
import { createLayer, getBasicLayerMenuApi } from '../../../api';
|
||||||
import '../../../index.less';
|
import '../../../index.less';
|
||||||
import { label } from 'three/examples/jsm/nodes/Nodes.js';
|
|
||||||
|
|
||||||
class LayerData extends React.Component {
|
class LayerData extends React.Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -29,34 +29,100 @@ class LayerData extends React.Component {
|
|||||||
note: '',
|
note: '',
|
||||||
},
|
},
|
||||||
selectLayerList: [],
|
selectLayerList: [],
|
||||||
|
selectLayerIdList: [],
|
||||||
|
layer: null,
|
||||||
|
btn: null,
|
||||||
|
icon: null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 钩子函数
|
||||||
|
componentDidMount = () => {
|
||||||
|
let layer = document.querySelector('.layer-data-wrap');
|
||||||
|
let btn = document.querySelector('.hiddenBtn');
|
||||||
|
let icon = document.querySelector('.anticon-double-left');
|
||||||
|
|
||||||
|
// 添加监听事件让其在动画结束后停止(paused状态)
|
||||||
|
// layer.onanimationiteration = this.paused(layer);
|
||||||
|
layer.addEventListener('animationiteration', () => { layer.style.animationPlayState = 'paused' });
|
||||||
|
btn.addEventListener('animationiteration', () => { btn.style.animationPlayState = 'paused' });
|
||||||
|
icon.addEventListener('animationiteration', () => { icon.style.animationPlayState = 'paused' });
|
||||||
|
// layer.addEventListener('animationstart',paused(layer));
|
||||||
|
// btn.addEventListener('animationstart',paused(btn));
|
||||||
|
// icon.addEventListener('animationstart',paused(icon));
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
layer: layer,
|
||||||
|
btn: btn,
|
||||||
|
icon: icon,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 获取基础图层菜单栏,获取列表数据
|
// 获取基础图层菜单栏,获取列表数据
|
||||||
getBasicLayerMenu = (adcode) => {
|
getBasicLayerMenu = (adcode) => {
|
||||||
return axios.get('/api/basicMap/getBasicLayerMenu', {
|
if (adcode === undefined || adcode === null || adcode === "" || adcode === 'undefined') {
|
||||||
params: {
|
this.setState({
|
||||||
adcode: adcode
|
menuData: [],
|
||||||
|
})
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}).then((e) => {
|
return getBasicLayerMenuApi({ adcode: adcode }).then((e) => {
|
||||||
let basicLayeData = e.data.data;
|
let basicLayeData = e.data;
|
||||||
|
console.log('basicLayeData', e);
|
||||||
// MenuData
|
// MenuData
|
||||||
let menuDataList = [];
|
let menuDataList = [];
|
||||||
for (var m in basicLayeData) {
|
for (var m in basicLayeData) {
|
||||||
|
let lab = null;
|
||||||
|
// if (basicLayeData[m].esIndex == "personal_point_layer")
|
||||||
|
if (m == 0){
|
||||||
|
lab = <>
|
||||||
|
<div>
|
||||||
|
<span className='layer-name'>
|
||||||
|
{basicLayeData[m].name}
|
||||||
|
</span>
|
||||||
|
<span className={basicLayeData[m].layerList.length >= 5 ? 'hideItem' : 'add-layer-btn' }>
|
||||||
|
<Tooltip title='点击可创建新图层'>
|
||||||
|
<span onClick={this.addLayerHandle}><PlusOutlined /></span>
|
||||||
|
</Tooltip>
|
||||||
|
</span>
|
||||||
|
<span className={basicLayeData[m].layerList.length < 5 ? 'hideItem' : 'add-layer-btn-disable' }>
|
||||||
|
<Tooltip title='个人图层创建数量已达上限'>
|
||||||
|
<span onClick={this.disableBtn}><PlusOutlined /></span>
|
||||||
|
</Tooltip>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</>;
|
||||||
|
}else{
|
||||||
|
lab = basicLayeData[m].name;
|
||||||
|
}
|
||||||
|
|
||||||
menuDataList.push({
|
menuDataList.push({
|
||||||
|
type: 'divider',
|
||||||
|
}, {
|
||||||
key: basicLayeData[m].id,
|
key: basicLayeData[m].id,
|
||||||
label: basicLayeData[m].name,
|
// label: basicLayeData[m].name,
|
||||||
|
label: lab,
|
||||||
icon: <UnorderedListOutlined />,
|
icon: <UnorderedListOutlined />,
|
||||||
children: this.getLayerList(basicLayeData[m].layerList),
|
children: this.getLayerList(basicLayeData[m].layerList),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
menuData: menuDataList,
|
menuData: menuDataList,
|
||||||
})
|
})
|
||||||
|
this.changeSelectStatus(menuDataList);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addLayerHandle = (e) => {
|
||||||
|
// 阻止冒泡
|
||||||
|
e.stopPropagation();
|
||||||
|
console.log('addLayerHandle', e);
|
||||||
|
this.showModal();
|
||||||
|
}
|
||||||
|
disableBtn = (e) => {
|
||||||
|
// 阻止冒泡
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
// 获取图层列表
|
// 获取图层列表
|
||||||
getLayerList = (layerList, i) => {
|
getLayerList = (layerList, i) => {
|
||||||
@ -92,27 +158,6 @@ class LayerData extends React.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 选中图层
|
// 选中图层
|
||||||
onLayerSelect = (selectedKeys, info) => {
|
|
||||||
let selectLayerList = [];
|
|
||||||
let layerId = info.node.key.split('-')[1];
|
|
||||||
for (let i in info.selectedNodes) {
|
|
||||||
selectLayerList.push({
|
|
||||||
'value': info.selectedNodes[i].key.split('-')[1],
|
|
||||||
'label': info.selectedNodes[i].title,
|
|
||||||
'isCustomize': info.selectedNodes[i].isCustomize,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
layerId: layerId,
|
|
||||||
selectLayerList: selectLayerList,
|
|
||||||
})
|
|
||||||
if (info.node.type === 1 || info.node.type === 4) {
|
|
||||||
this.props.getLayerPoints(layerId, info.selected, info.node.type);
|
|
||||||
} else if (info.node.type === 2) {
|
|
||||||
this.props.getLayerShapes(layerId, info.selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 选中图层
|
|
||||||
selectLayer = (e) => {
|
selectLayer = (e) => {
|
||||||
// 修改选中状态
|
// 修改选中状态
|
||||||
let menuData = this.state.menuData;
|
let menuData = this.state.menuData;
|
||||||
@ -138,6 +183,7 @@ class LayerData extends React.Component {
|
|||||||
|
|
||||||
// 将选中图层写入选中图层列表
|
// 将选中图层写入选中图层列表
|
||||||
let selectLayerList = [];
|
let selectLayerList = [];
|
||||||
|
let selectLayerIdList = [];
|
||||||
for (let m in e.selectedKeys) {
|
for (let m in e.selectedKeys) {
|
||||||
selectLayerList.push({
|
selectLayerList.push({
|
||||||
// key: 0:顺序 ,1:图层id , 2:时间 , 3:名称 , 4:是否为自创图层
|
// key: 0:顺序 ,1:图层id , 2:时间 , 3:名称 , 4:是否为自创图层
|
||||||
@ -145,10 +191,12 @@ class LayerData extends React.Component {
|
|||||||
'label': e.selectedKeys[m].split('-')[3],
|
'label': e.selectedKeys[m].split('-')[3],
|
||||||
'isCustomize': e.selectedKeys[m].split('-')[4],
|
'isCustomize': e.selectedKeys[m].split('-')[4],
|
||||||
})
|
})
|
||||||
|
selectLayerIdList.push(e.selectedKeys[m])
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
layerId: layerId,
|
layerId: layerId,
|
||||||
selectLayerList: selectLayerList,
|
selectLayerList: selectLayerList,
|
||||||
|
selectLayerIdList: selectLayerIdList,
|
||||||
menuData: [...menuData]
|
menuData: [...menuData]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -177,6 +225,7 @@ class LayerData extends React.Component {
|
|||||||
|
|
||||||
// 将选中图层写入选中图层列表
|
// 将选中图层写入选中图层列表
|
||||||
let selectLayerList = [];
|
let selectLayerList = [];
|
||||||
|
let selectLayerIdList = [];
|
||||||
for (let m in e.selectedKeys) {
|
for (let m in e.selectedKeys) {
|
||||||
selectLayerList.push({
|
selectLayerList.push({
|
||||||
// key: 0:顺序 ,1:图层id , 2:时间 , 3:名称 , 4:是否为自创图层
|
// key: 0:顺序 ,1:图层id , 2:时间 , 3:名称 , 4:是否为自创图层
|
||||||
@ -184,10 +233,12 @@ class LayerData extends React.Component {
|
|||||||
'label': e.selectedKeys[m].split('-')[3],
|
'label': e.selectedKeys[m].split('-')[3],
|
||||||
'isCustomize': e.selectedKeys[m].split('-')[4],
|
'isCustomize': e.selectedKeys[m].split('-')[4],
|
||||||
})
|
})
|
||||||
|
selectLayerIdList.push(e.selectedKeys[m])
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
layerId: layerId,
|
layerId: layerId,
|
||||||
selectLayerList: selectLayerList,
|
selectLayerList: selectLayerList,
|
||||||
|
selectLayerIdList: selectLayerIdList,
|
||||||
menuData: [...menuData],
|
menuData: [...menuData],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -283,33 +334,92 @@ class LayerData extends React.Component {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
// 根据已选列表变化
|
// 根据已选列表变化
|
||||||
changeSelectStatus = () => {
|
changeSelectStatus = (menuData) => {
|
||||||
for (let n in this.state.selectLayerList) {
|
let selectLayerIdList = this.state.selectLayerIdList;
|
||||||
|
this.setState({
|
||||||
|
selectLayerIdList: []
|
||||||
|
})
|
||||||
|
if (selectLayerIdList.length <= 0) return;
|
||||||
// 修改选中状态
|
// 修改选中状态
|
||||||
let menuData = this.state.menuData;
|
|
||||||
this.setState({menuData:[]})
|
|
||||||
for (let i in menuData) {
|
for (let i in menuData) {
|
||||||
for (let j in menuData[i].children) {
|
for (let j in menuData[i].children) {
|
||||||
if (this.state.selectLayerList[n].value === menuData[i].children[j].key.split('-')[1]) {
|
for (let m in selectLayerIdList) {
|
||||||
let iconList = menuData[i].children[j].icon[0];
|
if (selectLayerIdList[m].split('-')[1] === menuData[i].children[j].key.split('-')[1]) {
|
||||||
menuData[i].children[j].icon = [];
|
selectLayerIdList[m] = menuData[i].children[j].key;
|
||||||
menuData[i].children[j].icon.push(iconList);
|
}
|
||||||
menuData[i].children[j].icon.push(<EyeOutlined className='eye' key={new Date().getTime()} />);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
menuData: [...menuData]
|
selectLayerIdList: selectLayerIdList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 点击按钮重新加载
|
||||||
|
reload = () => {
|
||||||
|
console.log('reload');
|
||||||
|
// 重新加载业务
|
||||||
|
|
||||||
|
// loading效果
|
||||||
|
this.props.startLoading();
|
||||||
|
setTimeout(() => {
|
||||||
|
this.props.stopLoading();
|
||||||
|
// 提示框
|
||||||
|
message.success('图层数据已刷新!');
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
};
|
||||||
|
// 根据情况改变隐藏按钮
|
||||||
|
hiddenButtonHandle = () => {
|
||||||
|
let self = this;
|
||||||
|
if (this.state.isHidden) {
|
||||||
|
// 隐藏
|
||||||
|
this.setState({
|
||||||
|
hiddenButton: (
|
||||||
|
<Button onClick={() => {
|
||||||
|
self.isHidden = !self.isHidden;
|
||||||
|
}}>
|
||||||
|
<span>>></span>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 显示
|
||||||
|
this.setState({
|
||||||
|
hiddenButton: (
|
||||||
|
<Button onClick={() => {
|
||||||
|
self.isHidden = !self.isHidden;
|
||||||
|
}}>
|
||||||
|
<span><<</span>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
paused = (item) => {
|
||||||
|
item.style.animationPlayState = 'paused';
|
||||||
|
};
|
||||||
|
running = (item) => {
|
||||||
|
item.style.animationPlayState = 'running';
|
||||||
|
};
|
||||||
|
hiddenLayer = () => {
|
||||||
|
console.log("hidden layer", this.state.layer);
|
||||||
|
this.running(this.state.layer);
|
||||||
|
this.running(this.state.btn);
|
||||||
|
this.running(this.state.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<div className='layer-data-wrap'>
|
<div className='layer-data-wrap'>
|
||||||
<div className='menu-list'>
|
<div className='menu-list'>
|
||||||
<div className={this.state.menuData.length > 0 ? 'showItem layer-data-title' : 'hideItem layer-data-title'}>
|
<div className={this.state.menuData.length > 0 ? 'showItem layer-data-title' : 'hideItem layer-data-title'}>
|
||||||
<span>图层数据</span>
|
<span>图层数据</span>
|
||||||
|
<span className='reload'>
|
||||||
|
<Tooltip title='点击可刷新图层信息数据'>
|
||||||
|
<span onClick={this.reload}><SyncOutlined /></span>
|
||||||
|
</Tooltip>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<Menu
|
<Menu
|
||||||
multiple
|
multiple
|
||||||
@ -318,11 +428,12 @@ class LayerData extends React.Component {
|
|||||||
onSelect={this.selectLayer}
|
onSelect={this.selectLayer}
|
||||||
items={this.state.menuData}
|
items={this.state.menuData}
|
||||||
mode='inline'
|
mode='inline'
|
||||||
|
selectedKeys={this.state.selectLayerIdList}
|
||||||
/>
|
/>
|
||||||
<div id='add-layer'>
|
{/* <div id='add-layer'>
|
||||||
<Button type='primary' id='add-layer-button' className={this.state.menuData.length > 0 ? 'showItem' : 'hideItem'}
|
<Button type='primary' id='add-layer-button' className={this.state.menuData.length > 0 ? 'showItem' : 'hideItem'}
|
||||||
onClick={this.showModal}>新建图层</Button>
|
onClick={this.showModal}>新建图层</Button>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
<Modal title="新建图层" open={this.state.isModalOpen} onOk={this.handleOk} onCancel={this.handleCancel} className='edit-layer-modal'>
|
<Modal title="新建图层" open={this.state.isModalOpen} onOk={this.handleOk} onCancel={this.handleCancel} className='edit-layer-modal'>
|
||||||
<Form name='base' id='edit-layer-form' onFinish={this.handleOk}>
|
<Form name='base' id='edit-layer-form' onFinish={this.handleOk}>
|
||||||
@ -372,6 +483,9 @@ class LayerData extends React.Component {
|
|||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div >
|
</div >
|
||||||
|
<Button onClick={this.hiddenLayer} className={this.state.menuData.length > 0 ? 'hiddenBtn showItem' : 'hiddenBtn hideItem'}><DoubleLeftOutlined /></Button>
|
||||||
|
{/* <Button onClick={this.hiddenLayer} className='hiddenBtn'><DoubleLeftOutlined/></Button> */}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Select, Input, Card, Col, Row, Button, message, Modal, Spin, Form } from 'antd';
|
import { Select, Input, Card, Col, Row, Button, message, Modal, Spin, Form, Alert, Space } from 'antd';
|
||||||
import axios from 'axios';
|
import { DoubleLeftOutlined, ExclamationCircleFilled } from '@ant-design/icons';
|
||||||
import LayerData from './LayerData';
|
import LayerData from './LayerData';
|
||||||
// import LayerList from './LayerList';
|
// import LayerList from './LayerList';
|
||||||
import { AimOutlined } from '@ant-design/icons';
|
import { AimOutlined, DoubleRightOutlined } from '@ant-design/icons';
|
||||||
import Header from '../../components/Header/index.js';
|
import Header from '../../components/Header/index.js';
|
||||||
import { createPoint, queryUserLayers } 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 } from '@antv/l7';
|
import { GaodeMap, Scene, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup, MouseLocation, CanvasLayer } from '@antv/l7';
|
||||||
|
const { confirm } = Modal;
|
||||||
// import { DrawPoint, DrawEvent } from '@antv/l7-draw';
|
// import { DrawPoint, DrawEvent } from '@antv/l7-draw';
|
||||||
import icon04 from '../../assets/icon/icon04.svg'
|
import icon04 from '../../assets/icon/icon04.svg'
|
||||||
|
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
import pop from './pop';
|
||||||
|
import { remove } from 'react-cookies';
|
||||||
|
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
@ -56,11 +60,20 @@ class BaseMap extends React.Component{
|
|||||||
loading: false,
|
loading: false,
|
||||||
markerLayerList: [], // 点位图层
|
markerLayerList: [], // 点位图层
|
||||||
isModalOpen: false,
|
isModalOpen: false,
|
||||||
|
isEditModalOpen: false,
|
||||||
|
editPointId: '',
|
||||||
selectLayerList: [],
|
selectLayerList: [],
|
||||||
pointAdd: {},
|
pointAdd: {},
|
||||||
|
pointEdit: {},
|
||||||
pointDrawer: null,
|
pointDrawer: null,
|
||||||
newPointLocation: '',
|
newPointLocation: '',
|
||||||
mouseLocation: {},
|
mouseLocation: {},
|
||||||
|
disabled: false,
|
||||||
|
popParameter: {},
|
||||||
|
isAlertOpen: false,
|
||||||
|
deletePointId: '',
|
||||||
|
pop: null,
|
||||||
|
removeMarker: null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
startLoading = () => {
|
startLoading = () => {
|
||||||
@ -92,6 +105,29 @@ class BaseMap extends React.Component{
|
|||||||
this.setState({
|
this.setState({
|
||||||
map: scene,
|
map: scene,
|
||||||
});
|
});
|
||||||
|
// 地图搜索提示功能
|
||||||
|
// scene.on('loaded', () => {
|
||||||
|
// // AutoComplete 插件
|
||||||
|
// window.AMap.plugin(['AMap.Autocomplete'], () => {
|
||||||
|
// // Autocomplete 实例配置
|
||||||
|
// const autoOptions = {
|
||||||
|
// city: '全国', //城市,默认全国
|
||||||
|
// input: 'tipinput' //使用联想输入的input的id
|
||||||
|
// };
|
||||||
|
// // 创建Autocomplete对象
|
||||||
|
// const autoComplete = new AMap.AutoComplete(autoOptions);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // scene.map.plugin(['AMap.Autocomplete'], () => {
|
||||||
|
// // // Autocomplete 实例配置
|
||||||
|
// // const autoOptions = {
|
||||||
|
// // city: '全国', //城市,默认全国
|
||||||
|
// // input: 'tipinput' //使用联想输入的input的id
|
||||||
|
// // };
|
||||||
|
// // // 创建Autocomplete对象
|
||||||
|
// // const autoComplete = new AMap.autoComplete(autoOptions);
|
||||||
|
// // });
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置地图省份级别位置
|
//设置地图省份级别位置
|
||||||
@ -115,14 +151,11 @@ class BaseMap extends React.Component{
|
|||||||
getLayerPoints = (layerId, selected, nodeType) => {
|
getLayerPoints = (layerId, selected, nodeType) => {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
this.startLoading();
|
this.startLoading();
|
||||||
return axios.get('/api/basicMap/getLayerPoints', {
|
getLayerPointsApi({
|
||||||
params: {
|
|
||||||
adcode: this.state.districtAdcode || this.state.cityAdcode || this.state.provinceAdcode,
|
adcode: this.state.districtAdcode || this.state.cityAdcode || this.state.provinceAdcode,
|
||||||
layerId: layerId
|
layerId: layerId
|
||||||
}
|
|
||||||
}).then((e) => {
|
}).then((e) => {
|
||||||
let layerPointsData = e.data.data || [];
|
let layerPointsData = e.data || [];
|
||||||
// 处理返回的数据
|
|
||||||
layerPointsData = layerPointsData.map((item) => {
|
layerPointsData = layerPointsData.map((item) => {
|
||||||
item.lng = item.location.split(',')[0];
|
item.lng = item.location.split(',')[0];
|
||||||
item.lat = item.location.split(',')[1];
|
item.lat = item.location.split(',')[1];
|
||||||
@ -131,6 +164,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);
|
||||||
@ -164,11 +198,13 @@ class BaseMap extends React.Component{
|
|||||||
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;
|
let el, popup, marker, icon, popHtml;
|
||||||
|
// 设置地图上的点位(图标)
|
||||||
for (let i = 0; i < LabelsData.length; i++) {
|
for (let i = 0; i < LabelsData.length; i++) {
|
||||||
el = document.createElement('label');
|
el = document.createElement('label');
|
||||||
el.style.width = '26px';
|
el.style.width = '26px';
|
||||||
el.style.height = '26px';
|
el.style.height = '26px';
|
||||||
|
el.id = 'marker' + i;
|
||||||
icon = LabelsData[0].logoImage;
|
icon = LabelsData[0].logoImage;
|
||||||
if (icon && (icon.substr(0, 7) == "http://" || icon.substr(0, 6) == "https:" || icon.substr(0, 7) == "http:\\\\")) {
|
if (icon && (icon.substr(0, 7) == "http://" || icon.substr(0, 6) == "https:" || icon.substr(0, 7) == "http:\\\\")) {
|
||||||
el.style.background = 'url("' + icon + '") no-repeat';
|
el.style.background = 'url("' + icon + '") no-repeat';
|
||||||
@ -176,34 +212,130 @@ class BaseMap extends React.Component{
|
|||||||
} else {
|
} else {
|
||||||
el.className = icon;
|
el.className = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 })
|
||||||
|
|
||||||
|
// 设置弹框(点击事件)
|
||||||
marker.on('click', (e) => {
|
marker.on('click', (e) => {
|
||||||
|
// 获取弹框内的html
|
||||||
|
this.setState({ popParameter: LabelsData[i] }, () => {
|
||||||
|
popHtml = document.getElementById('custom-pop');
|
||||||
popup = new Popup({
|
popup = new Popup({
|
||||||
offsets: [0, 30]
|
offsets: [0, 30],
|
||||||
|
closeOnClick: true,
|
||||||
|
autoClose: true,
|
||||||
})
|
})
|
||||||
.setLnglat(e.lngLat)
|
.setLnglat(e.lngLat)
|
||||||
.setHTML(`
|
.setHTML(popHtml.innerHTML)
|
||||||
<div>
|
document.getElementById('marker' + i).style.width = '32px';
|
||||||
<div class="popup-title"><span class="popup-title-border"></span>详情信息</div>
|
document.getElementById('marker' + i).style.height = '32px';
|
||||||
<div class="popup-name">名称:${LabelsData[i].pointName}</div>
|
// 给弹框添加事件
|
||||||
<div class="popup-address">地址:${LabelsData[i].address || ''}</div>
|
popup.on('hide', () => {
|
||||||
<div class="popup-memo">备注:${LabelsData[i].memo || ''}</div>
|
document.getElementById('marker' + i).style.width = '26px';
|
||||||
</div>`);
|
document.getElementById('marker' + i).style.height = '26px';
|
||||||
this.state.map.addPopup(popup)
|
});
|
||||||
|
this.setState({ pop: popup })
|
||||||
|
popup.on('open', () => {
|
||||||
|
// 编辑按钮
|
||||||
|
document.getElementsByClassName('edit-button')[0].onclick = () => {
|
||||||
|
// getDetailByIdApi({id:LabelsData[i].pointId,layerId:LabelsData[i].belongLayerId}).then((e) => {
|
||||||
|
// if (e.success) {
|
||||||
|
// console.log('获取点位详情成功',e);
|
||||||
|
// }else{
|
||||||
|
// alert('获取点位详情失败');
|
||||||
|
// console.log('获取点位详情失败',e);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
if (this.state.cityAdcode == '' && this.state.districtAdcode == '') {
|
||||||
|
message.error('请至少选择行政区域至城市再进行点位创建');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let selectLayerList = this.refs.getLayerDataFun.state.selectLayerList;
|
||||||
|
selectLayerList = selectLayerList.filter((item) => {
|
||||||
|
if (item.isCustomize == 1) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (selectLayerList.length == 0) {
|
||||||
|
message.error('请至少选中一个个人图层');
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
this.setState({
|
||||||
|
selectLayerList: selectLayerList,
|
||||||
|
pointEdit:
|
||||||
|
{
|
||||||
|
pointId: LabelsData[i].pointId,
|
||||||
|
layerId: LabelsData[i].belongLayerId,
|
||||||
|
name: LabelsData[i].pointName,
|
||||||
|
// note: LabelsData[i].note,
|
||||||
|
address: LabelsData[i].address,
|
||||||
|
},
|
||||||
|
isEditModalOpen: true
|
||||||
|
})
|
||||||
|
};
|
||||||
|
// 删除按钮
|
||||||
|
document.getElementsByClassName('delete-button')[0].onclick = () => {
|
||||||
|
confirm({
|
||||||
|
icon: <ExclamationCircleFilled />,
|
||||||
|
title: '警告',
|
||||||
|
content: '是否确定删除点位,删除后信息将无法恢复',
|
||||||
|
onCancel() {
|
||||||
|
},
|
||||||
|
// 确定删除
|
||||||
|
onOk() {
|
||||||
|
self.deleteChannel();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
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],
|
||||||
|
removeMarker: marker,
|
||||||
})
|
})
|
||||||
this.state.map.addMarkerLayer(markerLayer);
|
this.state.map.addMarkerLayer(markerLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 删除按钮
|
||||||
|
deleteChannel = () => {
|
||||||
|
this.startLoading();
|
||||||
|
this.state.pop.hide();
|
||||||
|
self = this;
|
||||||
|
let layerId = this.state.popParameter.belongLayerId;
|
||||||
|
deletePoint({ id: this.state.popParameter.pointId }).then((e) => {
|
||||||
|
if (e.success) {
|
||||||
|
message.success('点位删除成功!');
|
||||||
|
setTimeout(() => {
|
||||||
|
// 重新获取点位
|
||||||
|
self.refs.getLayerDataFun.changeUnitAmount(layerId);
|
||||||
|
let filter = this.state.districtAdcode || this.state.cityAdcode;
|
||||||
|
self.refs.getLayerDataFun.getBasicLayerMenu(filter);
|
||||||
|
this.getLayerPoints(layerId, true, 1);
|
||||||
|
self.stopLoading();
|
||||||
|
}, 1000);
|
||||||
|
this.getLayerPoints(layerId, false, 1);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
message.error('点位删除失败!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
pop: null,
|
||||||
|
popParameter: {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 在地图上设置热力图 【经度,纬度】
|
// 在地图上设置热力图 【经度,纬度】
|
||||||
// setHeatMap = (data, layerId) => {
|
// setHeatMap = (data, layerId) => {
|
||||||
// let self = this;
|
// let self = this;
|
||||||
@ -266,13 +398,11 @@ class BaseMap extends React.Component{
|
|||||||
// 获取围栏图层数据
|
// 获取围栏图层数据
|
||||||
getLayerShapes = (layerId, selected, adcode) => {
|
getLayerShapes = (layerId, selected, adcode) => {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
return axios.get('/api/basicMap/getLayerShapes', {
|
return getLayerShapesApi({
|
||||||
params: {
|
|
||||||
adcode: adcode || this.state.districtAdcode || this.state.cityAdcode || this.state.provinceAdcode,
|
adcode: adcode || this.state.districtAdcode || this.state.cityAdcode || this.state.provinceAdcode,
|
||||||
layerId: layerId
|
layerId: layerId
|
||||||
}
|
|
||||||
}).then((e) => {
|
}).then((e) => {
|
||||||
let positionBorderData = e.data.data;
|
let positionBorderData = e.data;
|
||||||
this.setPolygon(positionBorderData, layerId);
|
this.setPolygon(positionBorderData, layerId);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -341,8 +471,8 @@ class BaseMap extends React.Component{
|
|||||||
|
|
||||||
// 获取省
|
// 获取省
|
||||||
getAllProvince = () => {
|
getAllProvince = () => {
|
||||||
return axios.get('/api/mapCommon/getAllProvince').then((e) => {
|
return getAllProvinceApi().then((e) => {
|
||||||
let provinceData = e.data.data;
|
let provinceData = e.data;
|
||||||
let provinceList = [];
|
let provinceList = [];
|
||||||
for (var i in provinceData) {
|
for (var i in provinceData) {
|
||||||
provinceList.push({
|
provinceList.push({
|
||||||
@ -360,7 +490,6 @@ class BaseMap extends React.Component{
|
|||||||
}
|
}
|
||||||
// 选择省 provinceAdcode:省编码 data:省数据
|
// 选择省 provinceAdcode:省编码 data:省数据
|
||||||
onProvinceChange = (provinceAdcode, data) => {
|
onProvinceChange = (provinceAdcode, data) => {
|
||||||
console.log("provinceAdcode, data:", provinceAdcode, data)
|
|
||||||
var self = this;
|
var self = this;
|
||||||
// 清除点位图层
|
// 清除点位图层
|
||||||
let getLayers = self.state.markerLayerList;
|
let getLayers = self.state.markerLayerList;
|
||||||
@ -369,6 +498,7 @@ class BaseMap extends React.Component{
|
|||||||
}
|
}
|
||||||
// 清除子组件的已选图层
|
// 清除子组件的已选图层
|
||||||
this.refs.getLayerDataFun.state.selectLayerList = [];
|
this.refs.getLayerDataFun.state.selectLayerList = [];
|
||||||
|
this.refs.getLayerDataFun.state.selectLayerIdList = [];
|
||||||
// 清除所选市
|
// 清除所选市
|
||||||
this.onCityChange();
|
this.onCityChange();
|
||||||
|
|
||||||
@ -389,13 +519,14 @@ class BaseMap extends React.Component{
|
|||||||
}
|
}
|
||||||
// 获取市
|
// 获取市
|
||||||
getCityByProvince = (provinceAdcode) => {
|
getCityByProvince = (provinceAdcode) => {
|
||||||
return axios.get('/api/mapCommon/getCityByProvince', {
|
if (provinceAdcode === undefined || provinceAdcode === null || provinceAdcode === "" || provinceAdcode === 'undefined') {
|
||||||
params: {
|
this.setState({
|
||||||
provinceAdcode: provinceAdcode
|
cityList: []
|
||||||
|
})
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}).then((e) => {
|
return getCityByProvinceApi({ provinceAdcode: provinceAdcode }).then((e) => {
|
||||||
console.log("e:", e)
|
let cityData = e.data;
|
||||||
let cityData = e.data.data;
|
|
||||||
let cityList = [];
|
let cityList = [];
|
||||||
for (var i in cityData) {
|
for (var i in cityData) {
|
||||||
cityList.push({
|
cityList.push({
|
||||||
@ -407,7 +538,6 @@ class BaseMap extends React.Component{
|
|||||||
'lat': cityData[i].centerCoordinate && cityData[i].centerCoordinate.split(',')[1],
|
'lat': cityData[i].centerCoordinate && cityData[i].centerCoordinate.split(',')[1],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// console.log("cityList:", cityList)
|
|
||||||
this.setState({
|
this.setState({
|
||||||
cityList: cityList
|
cityList: cityList
|
||||||
})
|
})
|
||||||
@ -416,12 +546,22 @@ class BaseMap extends React.Component{
|
|||||||
//选择市 cityAdcode:市编码 data:市数据
|
//选择市 cityAdcode:市编码 data:市数据
|
||||||
onCityChange = (cityAdcode, data) => {
|
onCityChange = (cityAdcode, data) => {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
console.log("cityAdcode", cityAdcode)
|
||||||
|
if (cityAdcode === undefined || cityAdcode === null || cityAdcode === "" || cityAdcode === 'undefined') {
|
||||||
|
this.setState({
|
||||||
|
cityAdcode: '',
|
||||||
|
cityLabel: '',
|
||||||
|
districtAdcode: ''
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
self.startLoading();
|
self.startLoading();
|
||||||
// 清除点位图层
|
// 清除点位图层
|
||||||
let getLayers = self.state.markerLayerList;
|
let getLayers = self.state.markerLayerList;
|
||||||
for (let i = 0; i < getLayers.length; i++) {
|
for (let i = 0; i < getLayers.length; i++) {
|
||||||
self.state.map.removeMarkerLayer(getLayers[i]);
|
self.state.map.removeMarkerLayer(getLayers[i]);
|
||||||
}
|
}
|
||||||
|
this.refs.getLayerDataFun.state.selectLayerIdList = [];
|
||||||
// 根据所选市获取区
|
// 根据所选市获取区
|
||||||
this.getDistrictByCity(`${cityAdcode}`);
|
this.getDistrictByCity(`${cityAdcode}`);
|
||||||
this.refs.getLayerDataFun.getBasicLayerMenu(`${cityAdcode}`).then(() => {
|
this.refs.getLayerDataFun.getBasicLayerMenu(`${cityAdcode}`).then(() => {
|
||||||
@ -439,12 +579,14 @@ class BaseMap extends React.Component{
|
|||||||
}
|
}
|
||||||
// 获取区
|
// 获取区
|
||||||
getDistrictByCity = (cityAdcode) => {
|
getDistrictByCity = (cityAdcode) => {
|
||||||
return axios.get('/api/mapCommon/getDistrictByCity', {
|
if (cityAdcode === undefined || cityAdcode === null || cityAdcode === "" || cityAdcode === 'undefined') {
|
||||||
params: {
|
this.setState({
|
||||||
cityAdcode: cityAdcode
|
districtList: []
|
||||||
|
})
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}).then((e) => {
|
return getDistrictByCityApi({ cityAdcode: cityAdcode }).then((e) => {
|
||||||
let districtData = e.data.data;
|
let districtData = e.data;
|
||||||
let districtList = [];
|
let districtList = [];
|
||||||
for (var i in districtData) {
|
for (var i in districtData) {
|
||||||
districtList.push({
|
districtList.push({
|
||||||
@ -463,11 +605,19 @@ class BaseMap extends React.Component{
|
|||||||
//选择区
|
//选择区
|
||||||
onDistrictChange = (provinceAdcode, data) => {
|
onDistrictChange = (provinceAdcode, data) => {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
if (provinceAdcode === undefined || provinceAdcode === null || provinceAdcode === "" || provinceAdcode === 'undefined') {
|
||||||
|
this.setState({
|
||||||
|
districtAdcode: '',
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
self.startLoading();
|
self.startLoading();
|
||||||
let getLayers = self.state.markerLayerList;
|
let getLayers = self.state.markerLayerList;
|
||||||
|
console.log("getLayers✈······", getLayers)
|
||||||
for (let i = 0; i < getLayers.length; i++) {
|
for (let i = 0; i < getLayers.length; i++) {
|
||||||
self.state.map.removeMarkerLayer(getLayers[i]);
|
self.state.map.removeMarkerLayer(getLayers[i]);
|
||||||
}
|
}
|
||||||
|
this.refs.getLayerDataFun.state.selectLayerIdList = [];
|
||||||
// this.state.map.remove(getOverlays);
|
// this.state.map.remove(getOverlays);
|
||||||
this.refs.getLayerDataFun.getBasicLayerMenu(`${provinceAdcode}`).then(() => {
|
this.refs.getLayerDataFun.getBasicLayerMenu(`${provinceAdcode}`).then(() => {
|
||||||
self.stopLoading();
|
self.stopLoading();
|
||||||
@ -524,14 +674,8 @@ class BaseMap extends React.Component{
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
address = this.state.provinceLabel + this.state.cityLabel + address;
|
address = this.state.provinceLabel + this.state.cityLabel + address;
|
||||||
console.log("address:", address)
|
return getPointByAddressApi({ address: address }).then((e) => {
|
||||||
return axios.get('/api/mapCommon/getPointByAddress', {
|
let coordinate = e.data;
|
||||||
params: {
|
|
||||||
address: address
|
|
||||||
}
|
|
||||||
}).then((e) => {
|
|
||||||
let coordinate = e.data.data;
|
|
||||||
console.log("coordinate:", coordinate.location)
|
|
||||||
if (coordinate === "" || coordinate === null) {
|
if (coordinate === "" || coordinate === null) {
|
||||||
errorSearchAddress();
|
errorSearchAddress();
|
||||||
} else {
|
} else {
|
||||||
@ -567,21 +711,24 @@ class BaseMap extends React.Component{
|
|||||||
message.error('请至少选中一个个人图层');
|
message.error('请至少选中一个个人图层');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 关闭地图双击放大
|
|
||||||
this.state.map.setMapStatus({
|
|
||||||
doubleClickZoom: false
|
|
||||||
})
|
|
||||||
|
|
||||||
// 鼠标变十字
|
// 鼠标变十字
|
||||||
// document.getElementsByClassName("l7-scene")[0].style.cursor = 'crosshair';
|
// this.state.map.map.setDefaultCursor('crosshair'); 将默认鼠标样式改为十字,地图内有元素会变为手指
|
||||||
// console.log('sence:', getElementsByClassName('l7-scene') );
|
document.getElementsByClassName('amap-layer')[0].className = 'amap-layer cursor-crosshair';
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭地图双击放大
|
||||||
|
this.state.map.setMapStatus({
|
||||||
|
doubleClickZoom: false,
|
||||||
|
})
|
||||||
|
|
||||||
// 获取点击时鼠标的地图坐标
|
// 获取点击时鼠标的地图坐标
|
||||||
const mouseLocation = new MouseLocation();
|
const mouseLocation = new MouseLocation();
|
||||||
this.state.map.addControl(mouseLocation);
|
this.state.map.addControl(mouseLocation);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
// pointDrawer: drawer,
|
// 按键不可用
|
||||||
|
disabled: !this.state.disabled,
|
||||||
selectLayerList: selectLayerList,
|
selectLayerList: selectLayerList,
|
||||||
mouseLocation: mouseLocation,
|
mouseLocation: mouseLocation,
|
||||||
});
|
});
|
||||||
@ -591,62 +738,52 @@ class BaseMap extends React.Component{
|
|||||||
this.state.map.on('dblclick', this.dblclickEvent);
|
this.state.map.on('dblclick', this.dblclickEvent);
|
||||||
// 右键事件
|
// 右键事件
|
||||||
this.state.map.on('contextmenu', this.contextmenuEvent);
|
this.state.map.on('contextmenu', this.contextmenuEvent);
|
||||||
|
// 键盘事件
|
||||||
|
const that = this;
|
||||||
|
document.onkeydown = function (event) {
|
||||||
// this.state.map.addImage(
|
if (event.key === 'Escape') {
|
||||||
// 'dingwei',
|
that.disableDrawPoint();
|
||||||
// 'https://gw.alipayobjects.com/mdn/rms_3bf4aa/afts/img/A*JL46TZ_iYB0AAAAAAAAAAAAAARQnAQ',
|
document.onkeydown = null;
|
||||||
// );
|
}
|
||||||
// const drawer = new DrawPoint(this.state.map, {
|
};
|
||||||
// style: {
|
|
||||||
// point: {
|
|
||||||
// normal: {
|
|
||||||
// shape: 'dingwei',
|
|
||||||
// size: 8,
|
|
||||||
// },
|
|
||||||
// hover: {
|
|
||||||
// shape: 'dingwei',
|
|
||||||
// size: 10,
|
|
||||||
// },
|
|
||||||
// active: {
|
|
||||||
// shape: 'dingwei',
|
|
||||||
// size: 10,
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// drawer.enable();
|
|
||||||
// drawer.on(DrawEvent.Add, (newPoint) => {
|
|
||||||
// console.log('newPoint:', newPoint.geometry.coordinates.toString());
|
|
||||||
// this.showModal(newPoint.geometry.coordinates.toString());
|
|
||||||
// });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 地图鼠标双击事件
|
// 地图鼠标双击事件
|
||||||
dblclickEvent = (e) => {
|
dblclickEvent = (e) => {
|
||||||
// 开启双击地图放大
|
// 开启双击地图放大 不能放在这,会导致弹框的同时放大地图,将开启放大放在弹框关闭事件中
|
||||||
this.state.map.setMapStatus({
|
|
||||||
doubleClickZoom: true
|
|
||||||
})
|
|
||||||
// 添加点位
|
// 添加点位
|
||||||
this.showModal(this.state.mouseLocation.location.toString());
|
this.showModal(this.state.mouseLocation.location.toString());
|
||||||
// 鼠标取消十字
|
// 鼠标取消十字
|
||||||
|
// this.state.map.map.setDefaultCursor('auto');
|
||||||
|
document.getElementsByClassName('amap-layer')[0].className = 'amap-layer';
|
||||||
// 删除右键事件监听
|
// 删除右键事件监听
|
||||||
this.state.map.off('contextmenu', this.contextmenuEvent);
|
this.state.map.off('contextmenu', this.contextmenuEvent);
|
||||||
// 删除鼠标经纬度组件
|
// 删除鼠标经纬度组件
|
||||||
this.state.map.removeControl(this.state.mouseLocation);
|
this.state.map.removeControl(this.state.mouseLocation);
|
||||||
this.state.mouseLocation = {};
|
this.state.mouseLocation = {};
|
||||||
|
// 按键可用
|
||||||
|
this.setState({
|
||||||
|
disabled: !this.state.disabled,
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 地图右键事件
|
// 地图右键事件
|
||||||
contextmenuEvent = (e) => {
|
contextmenuEvent = (e) => {
|
||||||
|
this.disableDrawPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消点位创建
|
||||||
|
disableDrawPoint = () => {
|
||||||
// 开启双击地图放大
|
// 开启双击地图放大
|
||||||
this.state.map.setMapStatus({
|
this.state.map.setMapStatus({
|
||||||
doubleClickZoom: true
|
doubleClickZoom: true
|
||||||
})
|
})
|
||||||
// 鼠标取消十字
|
// 鼠标取消十字
|
||||||
|
// this.state.map.map.setDefaultCursor('auto');
|
||||||
|
document.getElementsByClassName('amap-layer')[0].className = 'amap-layer';
|
||||||
// 删除鼠标经纬度组件
|
// 删除鼠标经纬度组件
|
||||||
this.state.map.removeControl(this.state.mouseLocation);
|
this.state.map.removeControl(this.state.mouseLocation);
|
||||||
this.state.mouseLocation = {};
|
this.state.mouseLocation = {};
|
||||||
@ -654,6 +791,10 @@ class BaseMap extends React.Component{
|
|||||||
this.state.map.off('dblclick', this.dblclickEvent);
|
this.state.map.off('dblclick', this.dblclickEvent);
|
||||||
// 删除右键事件监听
|
// 删除右键事件监听
|
||||||
this.state.map.off('contextmenu', this.contextmenuEvent);
|
this.state.map.off('contextmenu', this.contextmenuEvent);
|
||||||
|
// 按键可用
|
||||||
|
this.setState({
|
||||||
|
disabled: !this.state.disabled,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//弹出框事件
|
//弹出框事件
|
||||||
@ -673,7 +814,6 @@ class BaseMap extends React.Component{
|
|||||||
// newPointLocation: newPointLocation,
|
// newPointLocation: newPointLocation,
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// 关闭双击事件监听事件
|
// 关闭双击事件监听事件
|
||||||
this.state.map.off('dblclick', this.dblclickEvent);
|
this.state.map.off('dblclick', this.dblclickEvent);
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -681,7 +821,43 @@ class BaseMap extends React.Component{
|
|||||||
newPointLocation: newPointLocation,
|
newPointLocation: newPointLocation,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
// 修改按钮
|
||||||
|
editChannel = () => {
|
||||||
|
this.startLoading();
|
||||||
|
self = this;
|
||||||
|
self.state.pop.hide();
|
||||||
|
let param = {
|
||||||
|
"id": this.state.pointEdit.pointId,
|
||||||
|
"name": this.state.pointEdit.name,
|
||||||
|
"note": this.state.pointEdit.note,
|
||||||
|
"address": this.state.pointEdit.address,
|
||||||
|
};
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
handleOk = (values) => {
|
handleOk = (values) => {
|
||||||
|
this.startLoading();
|
||||||
|
// 开启双击地图放大
|
||||||
|
this.state.map.setMapStatus({
|
||||||
|
doubleClickZoom: true
|
||||||
|
})
|
||||||
createPoint({ //创建图层
|
createPoint({ //创建图层
|
||||||
"layerId": this.state.pointAdd.layerId,
|
"layerId": this.state.pointAdd.layerId,
|
||||||
"name": this.state.pointAdd.name,
|
"name": this.state.pointAdd.name,
|
||||||
@ -692,18 +868,17 @@ class BaseMap extends React.Component{
|
|||||||
"location": this.state.newPointLocation,
|
"location": this.state.newPointLocation,
|
||||||
"provinceAdcode": this.state.provinceAdcode,
|
"provinceAdcode": this.state.provinceAdcode,
|
||||||
}).then((e) => {
|
}).then((e) => {
|
||||||
// this.state.pointDrawer.removeActiveFeature();
|
|
||||||
// this.state.pointDrawer.disable();
|
|
||||||
let layerId = this.state.pointAdd.layerId;
|
let layerId = this.state.pointAdd.layerId;
|
||||||
if (e.success) {
|
if (e.success) {
|
||||||
message.success('点位创建成功!');
|
message.success('点位创建成功!');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getLayerPoints(layerId, true, 1);
|
this.getLayerPoints(layerId, true, 1);
|
||||||
this.refs.getLayerDataFun.changeUnitAmount(this.state.pointAdd.layerId);
|
this.stopLoading();
|
||||||
|
// this.refs.getLayerDataFun.changeUnitAmount(this.state.pointAdd.layerId);
|
||||||
}, 1000);//true新增,1点
|
}, 1000);//true新增,1点
|
||||||
let filter = this.state.districtAdcode || this.state.cityAdcode;
|
let filter = this.state.districtAdcode || this.state.cityAdcode;
|
||||||
this.refs.getLayerDataFun.getBasicLayerMenu(filter)
|
this.refs.getLayerDataFun.getBasicLayerMenu(filter)
|
||||||
this.refs.getLayerDataFun.changeSelectStatus();
|
// this.refs.getLayerDataFun.changeSelectStatus();
|
||||||
this.setState({
|
this.setState({
|
||||||
isModalOpen: false,
|
isModalOpen: false,
|
||||||
pointAdd: {},
|
pointAdd: {},
|
||||||
@ -714,6 +889,10 @@ class BaseMap extends React.Component{
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
handleCancel = () => {
|
handleCancel = () => {
|
||||||
|
// 开启双击地图放大
|
||||||
|
this.state.map.setMapStatus({
|
||||||
|
doubleClickZoom: true
|
||||||
|
})
|
||||||
// this.state.pointDrawer.removeActiveFeature();
|
// this.state.pointDrawer.removeActiveFeature();
|
||||||
// this.state.pointDrawer.disable();
|
// this.state.pointDrawer.disable();
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -721,6 +900,12 @@ class BaseMap extends React.Component{
|
|||||||
pointAdd: {},
|
pointAdd: {},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
handleEditCancel = () => {
|
||||||
|
this.setState({
|
||||||
|
isEditModalOpen: false,
|
||||||
|
pointEdit: {},
|
||||||
|
});
|
||||||
|
};
|
||||||
onLayerNameChange = (e) => {
|
onLayerNameChange = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
pointAdd: {
|
pointAdd: {
|
||||||
@ -731,6 +916,17 @@ class BaseMap extends React.Component{
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onEditLayerNameChange = (e) => {
|
||||||
|
this.setState({
|
||||||
|
pointEdit: {
|
||||||
|
"layerId": e,
|
||||||
|
"name": this.state.pointEdit.name,
|
||||||
|
"note": this.state.pointEdit.note,
|
||||||
|
"address": this.state.pointEdit.address,
|
||||||
|
"pointId": this.state.pointEdit.pointId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
onPointAddNameChange = (e) => {
|
onPointAddNameChange = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
pointAdd: {
|
pointAdd: {
|
||||||
@ -741,6 +937,17 @@ class BaseMap extends React.Component{
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onEditPointAddNameChange = (e) => {
|
||||||
|
this.setState({
|
||||||
|
pointEdit: {
|
||||||
|
"layerId": this.state.pointEdit.layerId,
|
||||||
|
"name": e.currentTarget.value,
|
||||||
|
"note": this.state.pointEdit.note,
|
||||||
|
"pointId": this.state.pointEdit.pointId,
|
||||||
|
"address": this.state.pointEdit.address,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
onPointAddAddressChange = (e) => {
|
onPointAddAddressChange = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
pointAdd: {
|
pointAdd: {
|
||||||
@ -751,6 +958,17 @@ class BaseMap extends React.Component{
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onEditPointAddAddressChange = (e) => {
|
||||||
|
this.setState({
|
||||||
|
pointEdit: {
|
||||||
|
"layerId": this.state.pointEdit.layerId,
|
||||||
|
"name": this.state.pointEdit.name,
|
||||||
|
"note": this.state.pointEdit.note,
|
||||||
|
"pointId": this.state.pointEdit.pointId,
|
||||||
|
"address": e.currentTarget.value,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
onLayerNoteChange = (e) => {
|
onLayerNoteChange = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
pointAdd: {
|
pointAdd: {
|
||||||
@ -761,14 +979,36 @@ class BaseMap extends React.Component{
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onEditLayerNoteChange = (e) => {
|
||||||
|
this.setState({
|
||||||
|
pointEdit: {
|
||||||
|
"layerId": this.state.pointEdit.layerId,
|
||||||
|
"name": this.state.pointEdit.name,
|
||||||
|
"note": e.currentTarget.value,
|
||||||
|
"pointId": this.state.pointEdit.pointId,
|
||||||
|
"address": this.state.pointEdit.address,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onFinishFailed = (errorInfo) => {
|
onFinishFailed = (errorInfo) => {
|
||||||
console.log('Failed:', errorInfo);
|
console.log('Failed:', errorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hiddenLayer = () => {
|
||||||
|
let layer = document.querySelector('.layer-data-wrap');
|
||||||
|
let btn = document.querySelector('.hiddenBtn');
|
||||||
|
let icon = document.querySelector('.anticon-double-left');
|
||||||
|
console.log("hidden layer", icon);
|
||||||
|
layer.style.animationPlayState = 'running';
|
||||||
|
btn.style.animationPlayState = 'running';
|
||||||
|
icon.style.animationPlayState = 'running';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className={styles.basseMap} id='base_map'>
|
<div id='base_map' className={styles.basseMap} >
|
||||||
<Spin id='spin-show' size='large' spinning={this.state.loading}></Spin>
|
<Spin id='spin-show' size='large' spinning={this.state.loading}></Spin>
|
||||||
<Header></Header>
|
<Header></Header>
|
||||||
{/* 筛选框 */}
|
{/* 筛选框 */}
|
||||||
@ -820,9 +1060,13 @@ class BaseMap extends React.Component{
|
|||||||
adcode={{ cityAdcode: this.state.cityAdcode, districtAdcode: this.state.districtAdcode }}
|
adcode={{ cityAdcode: this.state.cityAdcode, districtAdcode: this.state.districtAdcode }}
|
||||||
getLayerPoints={this.getLayerPoints}
|
getLayerPoints={this.getLayerPoints}
|
||||||
getLayerShapes={this.getLayerShapes}
|
getLayerShapes={this.getLayerShapes}
|
||||||
|
startLoading={this.startLoading}
|
||||||
|
stopLoading={this.stopLoading}
|
||||||
/>
|
/>
|
||||||
|
{/* <Button onClick={this.hiddenLayer} className='hiddenBtn'><DoubleLeftOutlined/></Button> */}
|
||||||
|
|
||||||
<div className={styles.btnRightWrap}>
|
<div className={styles.btnRightWrap}>
|
||||||
<Button type="primary" className={styles.btnRight} onClick={this.enableDrawPoint}>点位创建</Button>
|
<Button type="primary" className={styles.btnRight} onClick={this.enableDrawPoint} disabled={this.state.disabled}>点位创建</Button>
|
||||||
{/* <Button type='primary' danger className={styles.btnRight} onClick={() => this.state.pointDrawer?.disable()}>停止创建</Button> */}
|
{/* <Button type='primary' danger className={styles.btnRight} onClick={() => this.state.pointDrawer?.disable()}>停止创建</Button> */}
|
||||||
<Modal title="点位创建"
|
<Modal title="点位创建"
|
||||||
open={this.state.isModalOpen}
|
open={this.state.isModalOpen}
|
||||||
@ -871,12 +1115,70 @@ class BaseMap extends React.Component{
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
<Modal title="点位修改"
|
||||||
|
open={this.state.isEditModalOpen}
|
||||||
|
onOk={this.editChannel}
|
||||||
|
onCancel={this.handleEditCancel}
|
||||||
|
className='add-point-modal'
|
||||||
|
>
|
||||||
|
<Form name='base' id='add-point-form' onFinish={this.editChannel} onFinishFailed={this.onFinishFailed}>
|
||||||
|
{/* <Form.Item label="选择自定义图层"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入图层名称!',
|
||||||
|
}
|
||||||
|
]}>
|
||||||
|
<Select name='name'
|
||||||
|
// value={this.state.pointEdit.layerId}
|
||||||
|
defaultValue={() => {
|
||||||
|
return this.state.selectLayerList.map((item) => {
|
||||||
|
if (item.value == this.state.pointEdit.layerId.toString()) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
options={this.state.selectLayerList}
|
||||||
|
onChange={this.onEditLayerNameChange}
|
||||||
|
allowClear>
|
||||||
|
</Select>
|
||||||
|
</Form.Item> */}
|
||||||
|
<Form.Item label="点位名称"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入点位名称!',
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input name='note'
|
||||||
|
value={this.state.pointEdit.name}
|
||||||
|
onChange={this.onEditPointAddNameChange} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="点位地址"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入点位地址!',
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input name='note' value={this.state.pointEdit.address} onChange={this.onEditPointAddAddressChange} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="图层备注">
|
||||||
|
<Input name='note' value={this.state.pointEdit.note} onChange={this.onEditLayerNoteChange} />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
<Button disabled className={styles.btnRight}>点位导入</Button>
|
<Button disabled className={styles.btnRight}>点位导入</Button>
|
||||||
</div>
|
</div>
|
||||||
{/* 地图 */}
|
{/* 地图 */}
|
||||||
<div className={styles.mapWrap} id='redio-btn-group'>
|
<div className={styles.mapWrap} id='redio-btn-group'>
|
||||||
<div style={{ width: '100%', height: '100vh' }} id="container" />
|
<div style={{ width: '100%', height: '100vh' }} id="container" />
|
||||||
</div>
|
</div>
|
||||||
|
<div className='hideItem'>
|
||||||
|
<Pop popParameter={this.state.popParameter} className='hideItem'></Pop>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
41
src/pages/BaseMap/pop.js
Normal file
41
src/pages/BaseMap/pop.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import { Alert, Button, Space } from "antd";
|
||||||
|
import {deletePoint} from '../../api'
|
||||||
|
import { useState } from "react";
|
||||||
|
import '../../index.less';
|
||||||
|
|
||||||
|
|
||||||
|
function pop(e){
|
||||||
|
let memoContent = null;
|
||||||
|
if(e.popParameter.memo == undefined || e.popParameter.memo == null || e.popParameter.memo == ''){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
e.popParameter.memo = <div class="popup-memo">备注:{memoContent}</div>;
|
||||||
|
}
|
||||||
|
return(
|
||||||
|
<>
|
||||||
|
<div id='custom-pop' >
|
||||||
|
<div className="popup-coat">
|
||||||
|
<div className="popup-title">
|
||||||
|
<span className="popup-title-border"></span>
|
||||||
|
详情信息
|
||||||
|
</div>
|
||||||
|
<div className="popup-name">名称:{e.popParameter.pointName}</div>
|
||||||
|
<div className="popup-address">地址:{e.popParameter.address || ''}</div>
|
||||||
|
{memoContent}
|
||||||
|
</div>
|
||||||
|
<div className="button-div">
|
||||||
|
<Button type="link"
|
||||||
|
className="edit-button"
|
||||||
|
>编辑</Button>
|
||||||
|
<Button type="link"
|
||||||
|
danger
|
||||||
|
className="delete-button"
|
||||||
|
>删除</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default pop;
|
@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
import { passwordLogin } from '../../api';
|
import { passwordLogin } from '../../api';
|
||||||
import '../../index.less';
|
import '../../index.less';
|
||||||
import loginStore from '../../store/login.store';
|
import loginStore from '../../store/login.store';
|
||||||
|
import { setToken } from '../../utils/token'
|
||||||
|
|
||||||
function Login (e) {
|
function Login (e) {
|
||||||
let navigate = useNavigate();
|
let navigate = useNavigate();
|
||||||
@ -11,10 +12,12 @@ function Login (e) {
|
|||||||
passwordLogin({phone: values.phone, password: values.password}).then((e) => {
|
passwordLogin({phone: values.phone, password: values.password}).then((e) => {
|
||||||
if (!e.success) {
|
if (!e.success) {
|
||||||
message.error(e.message);
|
message.error(e.message);
|
||||||
} else {
|
} else {debugger
|
||||||
let setToken = loginStore;
|
// let setToken = loginStore;
|
||||||
setToken.setAuthName(e.data.username);
|
// setToken.setAuthName(e.data.username);
|
||||||
setToken.setToken(e.data.token)
|
// setToken.setToken(e.data.token)
|
||||||
|
setToken(e.data.token)
|
||||||
|
loginStore.setAuthName(e.data.username)
|
||||||
navigate('/home');
|
navigate('/home');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -8,17 +8,17 @@ class LoginStore {
|
|||||||
makeAutoObservable(this)
|
makeAutoObservable(this)
|
||||||
}
|
}
|
||||||
// token
|
// token
|
||||||
get isLoggedIn() {
|
// get isLoggedIn() {
|
||||||
return !!this.token;
|
// return !!this.token;
|
||||||
}
|
// }
|
||||||
setToken = (data) => {
|
// setToken = (data) => {
|
||||||
this.token = data;
|
// this.token = data;
|
||||||
localStorage.setItem('authToken', data);
|
// localStorage.setItem('authToken', data);
|
||||||
}
|
// }
|
||||||
clearToken() {
|
// clearToken() {
|
||||||
this.token = null;
|
// this.token = null;
|
||||||
localStorage.removeItem('authToken');
|
// localStorage.removeItem('authToken');
|
||||||
}
|
// }
|
||||||
// 登录名
|
// 登录名
|
||||||
get authName() {
|
get authName() {
|
||||||
return !!this.authName;
|
return !!this.authName;
|
||||||
|
Loading…
Reference in New Issue
Block a user