From a72d7824de12af633d6c580b9761666526e20db8 Mon Sep 17 00:00:00 2001 From: zhugy Date: Mon, 29 Jan 2024 18:07:11 +0800 Subject: [PATCH] =?UTF-8?q?fix():=E4=BF=AE=E5=A4=8D=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E3=80=81=E5=85=85=E7=94=B5=E7=AB=99=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E9=97=AE=E9=A2=98=E4=B8=8E=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SelectGaodeLngLat/index.jsx | 23 ++++++++++++---- src/components/SelectGaodeLngLat/index.scss | 8 ++++++ src/components/TableModule/index.jsx | 15 ++++++++-- src/components/form/FormInput/index.jsx | 2 ++ src/pages/InRoadMgm/RoadMgm/AddRoad/loadable.jsx | 1 + .../InRoadMgm/RoadMgm/ConfigRoad/loadable.jsx | 4 +++ src/pages/NewEnergy/ChargeStationMgm/index.scss | 22 +++++++++++++++ src/pages/NewEnergy/ChargeStationMgm/loadable.jsx | 32 +++++++++++++++++++--- .../RecordsInquiry/Violation/loadable.jsx | 7 ++++- .../OutSegmentMgm/OutSegment/AddParking.jsx | 1 + 10 files changed, 102 insertions(+), 13 deletions(-) diff --git a/src/components/SelectGaodeLngLat/index.jsx b/src/components/SelectGaodeLngLat/index.jsx index f54752f..19fb46c 100644 --- a/src/components/SelectGaodeLngLat/index.jsx +++ b/src/components/SelectGaodeLngLat/index.jsx @@ -13,9 +13,11 @@ function SelectGaodeLngLat(props) { const { getLntLat = () => { }, close, + hide, lngLatVisible = false, open, onChange = () => { }, + isClickMarker = false // 点击地图添加标记 } = props; const [lnglat, setLnglat] = useState([]); const [marker, setMarker] = useState([]); @@ -93,6 +95,7 @@ function SelectGaodeLngLat(props) { 打开 @@ -117,7 +121,7 @@ function SelectGaodeLngLat(props) {
{ - close(); + hide(); getLocationMessage(); }} > - 关闭 + 保存
@@ -149,6 +153,7 @@ function ModalMap(props) { setLnglat = () => { }, getLntLat = () => { }, searchLnglatValue = [], + isClickMarker = false, // 点击地图添加标记 markerPoint = [] } = props; const mapConfig = { @@ -164,6 +169,7 @@ function ModalMap(props) { const [map, setMap] = useState(null); const [Marker, setMarker] = useState(null); const mapRef = useRef(null); + const [latLng, setLatLng] = useState([]) const initMap = () => { // console.log(mapConfig); // const _map = L.map("mapid", { @@ -201,15 +207,20 @@ function ModalMap(props) { // onClick(info) setLnglat([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]); getLntLat([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]); - //addMarker([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]) + if (isClickMarker) { + setLatLng([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]) + } }) mapRef.current = map }; useEffect(() => { + setLatLng(markerPoint) + }, [markerPoint]); + useEffect(() => { if (map) { - addMarker(markerPoint); // 添加点位 + addMarker(latLng); // 添加点位 } - }, [markerPoint]); + }, [latLng]); const markerContent = `
`; diff --git a/src/components/SelectGaodeLngLat/index.scss b/src/components/SelectGaodeLngLat/index.scss index 4b35319..1e924cb 100644 --- a/src/components/SelectGaodeLngLat/index.scss +++ b/src/components/SelectGaodeLngLat/index.scss @@ -1,4 +1,12 @@ .SelectLnglat { + +} +.map-modal { + .ant-modal-close-x { + width: 30px; + height: 30px; + line-height: 30px; + } } .bottom-input { display: flex; diff --git a/src/components/TableModule/index.jsx b/src/components/TableModule/index.jsx index 0403a84..2e911c3 100644 --- a/src/components/TableModule/index.jsx +++ b/src/components/TableModule/index.jsx @@ -98,9 +98,20 @@ const TableModule = forwardRef((props, ref) => { const operatorNameType = formSearch.filter((item) => item.type === "Select")[0]?.operatorName || null; const [loading, setLoading] = useState(false); //区域的下拉数据 - const [areaList, setAreaList] = useState([]); + const [areaList, setAreaList] = useState([ + { + id: "0", + name: "全部", + pid: "0" + } + ]); //商户名称 - const [operatorList, setOperatorList] = useState([]); + const [operatorList, setOperatorList] = useState([ + { + label: "全部", + value: "0" + } + ]); //时间范围 const [timeGroup, setTimeGroup] = useState({ timeType: 1, diff --git a/src/components/form/FormInput/index.jsx b/src/components/form/FormInput/index.jsx index 9ae0b13..67c973d 100644 --- a/src/components/form/FormInput/index.jsx +++ b/src/components/form/FormInput/index.jsx @@ -6,6 +6,7 @@ import "./index.scss"; export default function FormInput(props) { const { + type, yisaLabel = "", labelPosition = "top", onChange = () => { }, @@ -43,6 +44,7 @@ export default function FormInput(props) { )}
setLngLatVisible(false)} + hide={() => setLngLatVisible(false)} /> diff --git a/src/pages/InRoadMgm/RoadMgm/ConfigRoad/loadable.jsx b/src/pages/InRoadMgm/RoadMgm/ConfigRoad/loadable.jsx index b87772b..6099e52 100644 --- a/src/pages/InRoadMgm/RoadMgm/ConfigRoad/loadable.jsx +++ b/src/pages/InRoadMgm/RoadMgm/ConfigRoad/loadable.jsx @@ -2161,6 +2161,7 @@ const ConfigRoad = (props) => { setLngLat(value); }} close={() => setLngLatVisible(false)} + hide={() => setLngLatVisible(false)} /> } /> @@ -2402,6 +2403,9 @@ const ConfigRoad = (props) => { close={() => setLngLatModal({ ...lngLatModal, visible: false }) } + hide={() => + setLngLatModal({ ...lngLatModal, visible: false }) + } /> diff --git a/src/pages/NewEnergy/ChargeStationMgm/index.scss b/src/pages/NewEnergy/ChargeStationMgm/index.scss index d72bd54..7f6d376 100644 --- a/src/pages/NewEnergy/ChargeStationMgm/index.scss +++ b/src/pages/NewEnergy/ChargeStationMgm/index.scss @@ -29,6 +29,14 @@ } } .right { + position: relative; + .required { + position: absolute; + top: -8px; + left: -10px; + color: red; + font-size: 16px; + } .img-box { position: relative; height: 100%; @@ -51,4 +59,18 @@ } } } + .ant-modal-footer{ + display: flex; + justify-content: center; + .ant-btn{ + width: 88px; + height: 35px; + color: #fff; + border: none; + border-radius: 4px; + } + .ant-btn:last-child{ + background: #409eff; + } + } } \ No newline at end of file diff --git a/src/pages/NewEnergy/ChargeStationMgm/loadable.jsx b/src/pages/NewEnergy/ChargeStationMgm/loadable.jsx index 8caccb7..94ae789 100644 --- a/src/pages/NewEnergy/ChargeStationMgm/loadable.jsx +++ b/src/pages/NewEnergy/ChargeStationMgm/loadable.jsx @@ -13,7 +13,7 @@ import "./index.scss"; function Appointment() { - + const pattern = /^\d+$/; // 正整数正则 // 详情弹窗 const [detailVisible, setDetailVisible] = useState(false); // 列表数据 @@ -175,7 +175,7 @@ function Appointment() { label: "商户名称", defaultValue: "0", placeholder: "请选择商户名称", - operatorName:1 + operatorName: 1 }, ]; @@ -236,6 +236,10 @@ function Appointment() { setLoading(false) setDetailVisible(true) } + const handelClose = () => { + setLngLatVisible(false) + setAddFormData({ lng_lat: "", address: "" }) + } const handelOk = () => { // console.log(addFormData); if (!addFormData.name) { @@ -250,6 +254,14 @@ function Appointment() { message.warn("请输入车位数量") return } + if (addFormData.count < 1) { + message.warn("请输入正确的车位数量") + return + } + if (!pattern.test(addFormData.count)) { + message.warn("请输入正整数的车位数量") + return + } if (!addFormData.address) { message.warn("请输入详细地址") return @@ -271,7 +283,7 @@ function Appointment() { return } if (!addFormData.img) { - message.warn("请上传充电照片") + message.warn("请上传充电站图片") return } ajax.addStation(addFormData).then((res) => { @@ -376,6 +388,7 @@ function Appointment() { { setAddFormData({ name: e.target.value }) }} @@ -385,6 +398,7 @@ function Appointment() { { setAddFormData({ code: e.target.value }) }} @@ -394,6 +408,8 @@ function Appointment() { { setAddFormData({ count: e.target.value }) }} @@ -403,6 +419,7 @@ function Appointment() {
setLngLatVisible(true)} lngLatVisible={lngLatVisible} getLntLat={(value) => { @@ -458,7 +479,8 @@ function Appointment() { // console.log(adress); setAddFormData({ address: adress }) }} - close={() => setLngLatVisible(false)} + close={handelClose} + hide={() => setLngLatVisible(false)} />
@@ -466,6 +488,7 @@ function Appointment() { { setAddFormData({ address: e.target.value }) }} @@ -473,6 +496,7 @@ function Appointment() {
+
*
setLngLatVisible(false)} + hide={() => setLngLatVisible(false)} />