From 91574eea42586e4aa3c15c0d85fa29bb142a5c02 Mon Sep 17 00:00:00 2001 From: guoxin Date: Fri, 1 Dec 2023 18:04:23 +0800 Subject: [PATCH] =?UTF-8?q?fix():=E5=8F=8D=E9=A6=88=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=92=A4=E5=9B=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SelectGaodeLngLat/index.jsx | 87 ++++++++++++++++------ .../CallbackSuggestion/loadable.jsx | 14 +--- src/services/search.js | 12 ++- 3 files changed, 79 insertions(+), 34 deletions(-) diff --git a/src/components/SelectGaodeLngLat/index.jsx b/src/components/SelectGaodeLngLat/index.jsx index e1657a3..7f1b24b 100644 --- a/src/components/SelectGaodeLngLat/index.jsx +++ b/src/components/SelectGaodeLngLat/index.jsx @@ -1,29 +1,66 @@ import React, { useState, useEffect, useRef, useLayoutEffect } from "react"; -import { Button, Input, Modal, message } from "antd"; +import { Button, Input, Modal, message, AutoComplete } from "antd"; import { BaseMap } from "../MapComponets"; import L from "leaflet"; import "leaflet/dist/leaflet.css"; import "leaflet.chinatmsproviders"; import ajax from "@/services"; import "./index.scss"; + +let timer = null; function SelectGaodeLngLat(props) { const { - getLntLat = () => {}, + getLntLat = () => { }, close, lngLatVisible = false, open, - onChange = () => {}, + onChange = () => { }, } = props; const [lnglat, setLnglat] = useState([]); const [address, setAddress] = useState(""); const [searchLnglatValue, setSearchLnglatValue] = useState([]); + const [getLngLabel, setGetLngLabel] = useState([]) const searchLnglat = (values) => { - if (values.split(",").length < 2) { - return; - } - let lat = values.split(",")[0]; - let lng = values.split(",")[1]; - setSearchLnglatValue([lng, lat]); + clearTimeout(timer); + timer = setTimeout(() => { + ajax.handleLng({ + keywords: values, + }).then( + (res) => { + if (parseInt(res?.status) === 20000) { + setGetLngLabel( + res?.data.map((ele) => { + return { + ...ele, + label: ( +
+ {ele.label} +
+ ), + value: ele.label, + values: ele.value + }; + }) + ); + } else { + message.error(res?.message); + } + }, + (err) => { + console.log(err); + } + ); + }, 1000); + + }; + //选择 + const onSelect = (data) => { + console.log(getLngLabel); + let add = getLngLabel.filter((ele) => ele.value == data)[0] || []; + console.log(add); + // setSearchLnglatValue([ add.lng,add.lat]) + setLnglat([add.lng, add.lat]); + getLntLat([add.lng, add.lat]); }; function getLocationMessage() { // const lat_lng = lnglat.reverse().join(","); @@ -71,10 +108,14 @@ function SelectGaodeLngLat(props) {
- + onSelect={onSelect} + // enterButton={"搜索"} + style={{ width: 300 }} + >
@@ -98,8 +139,8 @@ function SelectGaodeLngLat(props) { } function ModalMap(props) { const { - setLnglat = () => {}, - getLntLat = () => {}, + setLnglat = () => { }, + getLntLat = () => { }, searchLnglatValue = [], } = props; const mapConfig = { @@ -137,16 +178,16 @@ function ModalMap(props) { // setMap(_map); // mapRef.current = _map; let _map = new AMap.Map("mapid", { - resizeEnable: true, - layers: [ - new AMap.TileLayer.Satellite(), - new AMap.TileLayer.RoadNet() - ] + resizeEnable: true, + layers: [ + new AMap.TileLayer.Satellite(), + new AMap.TileLayer.RoadNet() + ] }); _map.setCenter([mapConfig.center[1], mapConfig.center[0]], mapConfig.zoom); setMap(_map) - _map.on('click', function(e) { + _map.on('click', function (e) { console.log(e) // onClick(info) setLnglat([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]); @@ -170,8 +211,10 @@ function ModalMap(props) { }; }, []); useEffect(() => { - if (searchLnglatValue.length === 0) return; - mapRef.current.setView(searchLnglatValue, 13); + setTimeout(()=>{ + if (searchLnglatValue.length === 0) return; + mapRef.current.setView(searchLnglatValue, 13); + },800) }, [searchLnglatValue]); return ( diff --git a/src/pages/OperationCenter/CustomerServieMgm/CallbackSuggestion/loadable.jsx b/src/pages/OperationCenter/CustomerServieMgm/CallbackSuggestion/loadable.jsx index 0a279a9..be83dd5 100644 --- a/src/pages/OperationCenter/CustomerServieMgm/CallbackSuggestion/loadable.jsx +++ b/src/pages/OperationCenter/CustomerServieMgm/CallbackSuggestion/loadable.jsx @@ -314,9 +314,7 @@ function CallbackSuggestion(props) { } }) } - const [getAgain, setGetAgain] = useState(true) const handleAgain = (res) => { - setGetAgain(false) setRepairData({ content: res.replyContent }) } const handleRepair = () => { @@ -703,15 +701,9 @@ function CallbackSuggestion(props) {
{ handleReject(res) }}>撤回
: - <> - { - getAgain == true ? -
你撤回了一条消息 - { handleAgain(res) }}>重新编辑 -
: '' - } - - +
你撤回了一条消息 + { handleAgain(res) }}>重新编辑 +
}
diff --git a/src/services/search.js b/src/services/search.js index 46c3f5a..c80810e 100644 --- a/src/services/search.js +++ b/src/services/search.js @@ -439,7 +439,7 @@ const assetsModel = (params) => { // 领用人 const recipient = (params) => { return ajax({ - url: "/api/bpm/operator/get_all_worker", + url: "/api/bpm/operator/get_on_job_worker", type: "get", data: params, }); @@ -452,6 +452,15 @@ const assetsList = (params) => { data: params, }); }; +//物品管理列表 +const handleLng = (params) => { + return ajax({ + url: "/PMS/api/ana/overview/geocode_copy", + type: "get", + data: params, + }); +}; + //物品管理--添加物品 const saveData = (params) => { return ajax({ @@ -1067,6 +1076,7 @@ export default { getAnalysisRules, getFileList, getTagList, + handleLng, getPictureListData, getWorkerStatData, getSalesStatData,