From c0d99bb4013db82cfaa4811643eedc094f4e7fe7 Mon Sep 17 00:00:00 2001 From: wenlele Date: Tue, 31 Jan 2023 10:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=B5=8C=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/log/development.log | 6 ++ web/client/index.html | 35 +++++------ .../projectRegime/components/pointModel.js | 63 +++++++++++++++++-- .../components/projectAddModel.js | 61 ++++++++++++++---- web/log/development.txt | 27 ++++++++ 5 files changed, 159 insertions(+), 33 deletions(-) diff --git a/api/log/development.log b/api/log/development.log index 6a4b708..e7b1f9b 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -4162,3 +4162,9 @@ notNull Violation: PatrolPlan.patrolCount cannot be null 2023-01-30 16:47:16.531 - debug: [FS-LOGGER] Init. 2023-01-30 16:47:16.660 - info: [FS-ATTACHMENT] Inject attachment mw into router. 2023-01-30 16:47:16.661 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-30 17:12:59.959 - debug: [FS-LOGGER] Init. +2023-01-30 17:13:00.144 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-30 17:13:00.144 - info: [FS-AUTH] Inject auth and api mv into router. +2023-01-30 17:16:09.126 - debug: [FS-LOGGER] Init. +2023-01-30 17:16:09.250 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2023-01-30 17:16:09.250 - info: [FS-AUTH] Inject auth and api mv into router. diff --git a/web/client/index.html b/web/client/index.html index ad9326e..3f5eb76 100644 --- a/web/client/index.html +++ b/web/client/index.html @@ -2,28 +2,27 @@ - - - - - - + + + + + + - -
- - - + +
+ + + \ No newline at end of file diff --git a/web/client/src/sections/projectRegime/components/pointModel.js b/web/client/src/sections/projectRegime/components/pointModel.js index 9f40205..742c49e 100644 --- a/web/client/src/sections/projectRegime/components/pointModel.js +++ b/web/client/src/sections/projectRegime/components/pointModel.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import { Button, Form, Input, Modal, Select, DatePicker } from 'antd'; +import { EnvironmentTwoTone } from '@ant-design/icons'; const { TextArea } = Input; import { connect } from 'react-redux'; import Uploads from '$components/Uploads'; @@ -9,10 +10,46 @@ import moment from 'moment'; const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, qrCodeId }) => { const { projectRegime } = actions + const [showBaiduMap, setShowBaiduMap] = useState(false) const [form] = Form.useForm(); useEffect(() => { - // console.log(modelData); + if (modelData?.longitude && modelData?.latitude) { + form.setFieldValue('longitude', modelData?.longitude) + form.setFieldValue('latitude', modelData?.latitude) + } + var map = new AMap.Map('container', { + resizeEnable: true, //是否监控地图容器尺寸变化 + zoom: 11, //初始化地图层级 + center: [116.397428, 39.90923] //初始化地图中心点 + }); + + var autoOptions = { + input: "tipinput" + }; + + AMap.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'], () => { + var auto = new AMap.AutoComplete(autoOptions); + var placeSearch = new AMap.PlaceSearch({ + map: map + }); //构造地点查询类 + + function select (e) { + if (e) { + placeSearch.setCity(e.poi.adcode); + placeSearch.search(e.poi.name, function (status, result) { + form.setFieldValue('longitude', result.poiList.pois[0].location.lat) + form.setFieldValue('latitude', result.poiList.pois[0].location.lng) + }) //关键字查询查询 + } + } + auto.on("select", select);//注册监听,当选中某条记录时会触发 + map.on('click', function (e) { //点击地图获取经纬度 + form.setFieldValue('longitude', e.lnglat.lat) + form.setFieldValue('latitude', e.lnglat.lng) + }); + }); + }, []) @@ -54,9 +91,9 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q > -
+
{/* /^\d+$|^\d*\.\d+$/g */} - { const sjh = /^\d+$|^\d*\.\d+$/g; @@ -74,7 +111,7 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q ~ - { const sjh = /^\d+$|^\d*\.\d+$/g; @@ -91,7 +128,25 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q > + { + setShowBaiduMap(true) + }} />
+ + + + +
+
diff --git a/web/client/src/sections/projectRegime/components/projectAddModel.js b/web/client/src/sections/projectRegime/components/projectAddModel.js index adb7527..b37f9fd 100644 --- a/web/client/src/sections/projectRegime/components/projectAddModel.js +++ b/web/client/src/sections/projectRegime/components/projectAddModel.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; -import { Button, Form, Input, Modal, Select, DatePicker } from 'antd'; +import { Button, Form, Input, Modal, Select, DatePicker, Icon } from 'antd'; +import { EnvironmentTwoTone } from '@ant-design/icons'; const { TextArea } = Input; import { connect } from 'react-redux'; import Uploads from '$components/Uploads'; @@ -9,15 +10,50 @@ import moment from 'moment'; const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, firmList }) => { const { projectRegime } = actions - const [showBaiduMap, setShowBaiduMap] = useState(true) + const [showBaiduMap, setShowBaiduMap] = useState(false) const [form] = Form.useForm(); useEffect(() => { - // console.log(modelData); + if (modelData?.longitude && modelData?.latitude) { + form.setFieldValue('longitude', modelData?.longitude) + form.setFieldValue('latitude', modelData?.latitude) + } + var map = new AMap.Map('container', { + resizeEnable: true, //是否监控地图容器尺寸变化 + zoom: 11, //初始化地图层级 + center: [116.397428, 39.90923] //初始化地图中心点 + }); + + var autoOptions = { + input: "tipinput" + }; + + AMap.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete', 'AMap.Geocoder'], () => { + var auto = new AMap.AutoComplete(autoOptions); + var placeSearch = new AMap.PlaceSearch({ + map: map + }); //构造地点查询类 + + function select (e) { + if (e) { + placeSearch.setCity(e.poi.adcode); + placeSearch.search(e.poi.name, function (status, result) { + form.setFieldValue('longitude', result.poiList.pois[0].location.lat) + form.setFieldValue('latitude', result.poiList.pois[0].location.lng) + }) //关键字查询查询 + } + } + auto.on("select", select);//注册监听,当选中某条记录时会触发 + map.on('click', function (e) { //点击地图获取经纬度 + form.setFieldValue('longitude', e.lnglat.lat) + form.setFieldValue('latitude', e.lnglat.lng) + }); + }); }, []) + return ( -
- + { const sjh = /^\d+$|^\d*\.\d+$/g; @@ -106,22 +142,25 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, f > + { + setShowBaiduMap(true) + }} />
- {/* - + -
-
*/} +
+