Browse Source

fix():修复地图组件、充电站管理页面问题与样式

tags/PMS_V1.0.0_Alpha6
zhugy 1 year ago
parent
commit
a72d7824de
  1. 23
      src/components/SelectGaodeLngLat/index.jsx
  2. 8
      src/components/SelectGaodeLngLat/index.scss
  3. 15
      src/components/TableModule/index.jsx
  4. 2
      src/components/form/FormInput/index.jsx
  5. 1
      src/pages/InRoadMgm/RoadMgm/AddRoad/loadable.jsx
  6. 4
      src/pages/InRoadMgm/RoadMgm/ConfigRoad/loadable.jsx
  7. 22
      src/pages/NewEnergy/ChargeStationMgm/index.scss
  8. 32
      src/pages/NewEnergy/ChargeStationMgm/loadable.jsx
  9. 7
      src/pages/NewEnergy/RecordsInquiry/Violation/loadable.jsx
  10. 1
      src/pages/OutRoadMgm/OutSegmentMgm/OutSegment/AddParking.jsx

23
src/components/SelectGaodeLngLat/index.jsx

@ -13,9 +13,11 @@ function SelectGaodeLngLat(props) {
const { const {
getLntLat = () => { }, getLntLat = () => { },
close, close,
hide,
lngLatVisible = false, lngLatVisible = false,
open, open,
onChange = () => { }, onChange = () => { },
isClickMarker = false //
} = props; } = props;
const [lnglat, setLnglat] = useState([]); const [lnglat, setLnglat] = useState([]);
const [marker, setMarker] = useState([]); const [marker, setMarker] = useState([]);
@ -93,6 +95,7 @@ function SelectGaodeLngLat(props) {
打开 打开
</Button> </Button>
<Modal <Modal
className="map-modal"
visible={lngLatVisible} visible={lngLatVisible}
width={1000} width={1000}
footer={false} footer={false}
@ -108,6 +111,7 @@ function SelectGaodeLngLat(props) {
setLnglat={setLnglat} setLnglat={setLnglat}
getLntLat={getLntLat} getLntLat={getLntLat}
searchLnglatValue={searchLnglatValue} searchLnglatValue={searchLnglatValue}
isClickMarker={isClickMarker}
markerPoint={marker} markerPoint={marker}
> >
</ModalMap> </ModalMap>
@ -117,7 +121,7 @@ function SelectGaodeLngLat(props) {
<div className="input-search"> <div className="input-search">
<AutoComplete <AutoComplete
options={getLngLabel} options={getLngLabel}
placeholder={address?address:"请选择地址"}
placeholder={address ? address : "请选择地址"}
onSearch={searchLnglat} onSearch={searchLnglat}
onSelect={onSelect} onSelect={onSelect}
// enterButton={""} // enterButton={""}
@ -132,11 +136,11 @@ function SelectGaodeLngLat(props) {
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
close();
hide();
getLocationMessage(); getLocationMessage();
}} }}
> >
关闭
保存
</Button> </Button>
</div> </div>
</div> </div>
@ -149,6 +153,7 @@ function ModalMap(props) {
setLnglat = () => { }, setLnglat = () => { },
getLntLat = () => { }, getLntLat = () => { },
searchLnglatValue = [], searchLnglatValue = [],
isClickMarker = false, //
markerPoint = [] markerPoint = []
} = props; } = props;
const mapConfig = { const mapConfig = {
@ -164,6 +169,7 @@ function ModalMap(props) {
const [map, setMap] = useState(null); const [map, setMap] = useState(null);
const [Marker, setMarker] = useState(null); const [Marker, setMarker] = useState(null);
const mapRef = useRef(null); const mapRef = useRef(null);
const [latLng, setLatLng] = useState([])
const initMap = () => { const initMap = () => {
// console.log(mapConfig); // console.log(mapConfig);
// const _map = L.map("mapid", { // const _map = L.map("mapid", {
@ -201,15 +207,20 @@ function ModalMap(props) {
// onClick(info) // onClick(info)
setLnglat([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]); setLnglat([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]);
getLntLat([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 mapRef.current = map
}; };
useEffect(() => { useEffect(() => {
setLatLng(markerPoint)
}, [markerPoint]);
useEffect(() => {
if (map) { if (map) {
addMarker(markerPoint); //
addMarker(latLng); //
} }
}, [markerPoint]);
}, [latLng]);
const markerContent = `<div class="custom-content-marker"> const markerContent = `<div class="custom-content-marker">
<img src='${Rerm}' /> <img src='${Rerm}' />
</div>`; </div>`;

8
src/components/SelectGaodeLngLat/index.scss

@ -1,4 +1,12 @@
.SelectLnglat { .SelectLnglat {
}
.map-modal {
.ant-modal-close-x {
width: 30px;
height: 30px;
line-height: 30px;
}
} }
.bottom-input { .bottom-input {
display: flex; display: flex;

15
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 operatorNameType = formSearch.filter((item) => item.type === "Select")[0]?.operatorName || null;
const [loading, setLoading] = useState(false); 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({ const [timeGroup, setTimeGroup] = useState({
timeType: 1, timeType: 1,

2
src/components/form/FormInput/index.jsx

@ -6,6 +6,7 @@ import "./index.scss";
export default function FormInput(props) { export default function FormInput(props) {
const { const {
type,
yisaLabel = "", yisaLabel = "",
labelPosition = "top", labelPosition = "top",
onChange = () => { }, onChange = () => { },
@ -43,6 +44,7 @@ export default function FormInput(props) {
)} )}
<div className={`cc-form-content`}> <div className={`cc-form-content`}>
<Input <Input
type={type}
placeholder={placeholder} placeholder={placeholder}
value={value || ""} value={value || ""}
onChange={setValue} onChange={setValue}

1
src/pages/InRoadMgm/RoadMgm/AddRoad/loadable.jsx

@ -560,6 +560,7 @@ function AddRoad(props) {
form1.setFieldValue("address", adress); form1.setFieldValue("address", adress);
}} }}
close={() => setLngLatVisible(false)} close={() => setLngLatVisible(false)}
hide={() => setLngLatVisible(false)}
/> />
</Col> </Col>
</Row> </Row>

4
src/pages/InRoadMgm/RoadMgm/ConfigRoad/loadable.jsx

@ -2161,6 +2161,7 @@ const ConfigRoad = (props) => {
setLngLat(value); setLngLat(value);
}} }}
close={() => setLngLatVisible(false)} close={() => setLngLatVisible(false)}
hide={() => setLngLatVisible(false)}
/> />
} }
/> />
@ -2402,6 +2403,9 @@ const ConfigRoad = (props) => {
close={() => close={() =>
setLngLatModal({ ...lngLatModal, visible: false }) setLngLatModal({ ...lngLatModal, visible: false })
} }
hide={() =>
setLngLatModal({ ...lngLatModal, visible: false })
}
/> />
</Col> </Col>
</Row> </Row>

22
src/pages/NewEnergy/ChargeStationMgm/index.scss

@ -29,6 +29,14 @@
} }
} }
.right { .right {
position: relative;
.required {
position: absolute;
top: -8px;
left: -10px;
color: red;
font-size: 16px;
}
.img-box { .img-box {
position: relative; position: relative;
height: 100%; 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;
}
}
} }

32
src/pages/NewEnergy/ChargeStationMgm/loadable.jsx

@ -13,7 +13,7 @@ import "./index.scss";
function Appointment() { function Appointment() {
const pattern = /^\d+$/; //
// //
const [detailVisible, setDetailVisible] = useState(false); const [detailVisible, setDetailVisible] = useState(false);
// //
@ -175,7 +175,7 @@ function Appointment() {
label: "商户名称", label: "商户名称",
defaultValue: "0", defaultValue: "0",
placeholder: "请选择商户名称", placeholder: "请选择商户名称",
operatorName:1
operatorName: 1
}, },
]; ];
@ -236,6 +236,10 @@ function Appointment() {
setLoading(false) setLoading(false)
setDetailVisible(true) setDetailVisible(true)
} }
const handelClose = () => {
setLngLatVisible(false)
setAddFormData({ lng_lat: "", address: "" })
}
const handelOk = () => { const handelOk = () => {
// console.log(addFormData); // console.log(addFormData);
if (!addFormData.name) { if (!addFormData.name) {
@ -250,6 +254,14 @@ function Appointment() {
message.warn("请输入车位数量") message.warn("请输入车位数量")
return return
} }
if (addFormData.count < 1) {
message.warn("请输入正确的车位数量")
return
}
if (!pattern.test(addFormData.count)) {
message.warn("请输入正整数的车位数量")
return
}
if (!addFormData.address) { if (!addFormData.address) {
message.warn("请输入详细地址") message.warn("请输入详细地址")
return return
@ -271,7 +283,7 @@ function Appointment() {
return return
} }
if (!addFormData.img) { if (!addFormData.img) {
message.warn("请上传充电片")
message.warn("请上传充电站图片")
return return
} }
ajax.addStation(addFormData).then((res) => { ajax.addStation(addFormData).then((res) => {
@ -376,6 +388,7 @@ function Appointment() {
<FormInput <FormInput
yisaLabel="充电站名称" yisaLabel="充电站名称"
placeholder="请输入充电站名称" placeholder="请输入充电站名称"
isRequired
isShowAfterIcon={false} isShowAfterIcon={false}
value={addFormData.name} value={addFormData.name}
onChange={e => { setAddFormData({ name: e.target.value }) }} onChange={e => { setAddFormData({ name: e.target.value }) }}
@ -385,6 +398,7 @@ function Appointment() {
<FormInput <FormInput
yisaLabel="充电站编码" yisaLabel="充电站编码"
placeholder="请输入充电站编码" placeholder="请输入充电站编码"
isRequired
isShowAfterIcon={false} isShowAfterIcon={false}
value={addFormData.code} value={addFormData.code}
onChange={e => { setAddFormData({ code: e.target.value }) }} onChange={e => { setAddFormData({ code: e.target.value }) }}
@ -394,6 +408,8 @@ function Appointment() {
<FormInput <FormInput
yisaLabel="车位数量" yisaLabel="车位数量"
placeholder="请输入车位数量" placeholder="请输入车位数量"
isRequired
type={"Number"}
isShowAfterIcon={false} isShowAfterIcon={false}
value={addFormData.count} value={addFormData.count}
onChange={e => { setAddFormData({ count: e.target.value }) }} onChange={e => { setAddFormData({ count: e.target.value }) }}
@ -403,6 +419,7 @@ function Appointment() {
<FormSelect <FormSelect
yisaLabel="站点类型" yisaLabel="站点类型"
placeholder="请选择站点类型" placeholder="请选择站点类型"
required
hasUnlimited={false} hasUnlimited={false}
defaultValue={addFormData.site_type || null} defaultValue={addFormData.site_type || null}
yisaData={sysConfig?.stationType || []} yisaData={sysConfig?.stationType || []}
@ -415,6 +432,7 @@ function Appointment() {
yisaLabel="所属区域" yisaLabel="所属区域"
labelPosition="left" labelPosition="left"
placeholder="请选择所属区域" placeholder="请选择所属区域"
isRequired
value={addFormData.area || null} value={addFormData.area || null}
fieldNames={{ fieldNames={{
label: "name", label: "name",
@ -431,6 +449,7 @@ function Appointment() {
<FormSelect <FormSelect
yisaLabel="商户名称" yisaLabel="商户名称"
placeholder="请选择商户名称" placeholder="请选择商户名称"
required
hasUnlimited={false} hasUnlimited={false}
defaultValue={addFormData.operator || null} defaultValue={addFormData.operator || null}
yisaData={operatorList} yisaData={operatorList}
@ -442,6 +461,7 @@ function Appointment() {
<FormInput <FormInput
yisaLabel="经纬度" yisaLabel="经纬度"
placeholder="请选择经纬度" placeholder="请选择经纬度"
isRequired
isShowAfterIcon={false} isShowAfterIcon={false}
defaultValue={addFormData.lng_lat || null} defaultValue={addFormData.lng_lat || null}
value={addFormData.lng_lat} value={addFormData.lng_lat}
@ -449,6 +469,7 @@ function Appointment() {
/> />
<div className="latlng-box"> <div className="latlng-box">
<SelectGaodeLngLat <SelectGaodeLngLat
isClickMarker
open={() => setLngLatVisible(true)} open={() => setLngLatVisible(true)}
lngLatVisible={lngLatVisible} lngLatVisible={lngLatVisible}
getLntLat={(value) => { getLntLat={(value) => {
@ -458,7 +479,8 @@ function Appointment() {
// console.log(adress); // console.log(adress);
setAddFormData({ address: adress }) setAddFormData({ address: adress })
}} }}
close={() => setLngLatVisible(false)}
close={handelClose}
hide={() => setLngLatVisible(false)}
/> />
</div> </div>
</div> </div>
@ -466,6 +488,7 @@ function Appointment() {
<FormInput <FormInput
yisaLabel="详细地址" yisaLabel="详细地址"
placeholder="请输入详细地址" placeholder="请输入详细地址"
isRequired
isShowAfterIcon={false} isShowAfterIcon={false}
value={addFormData.address} value={addFormData.address}
onChange={e => { setAddFormData({ address: e.target.value }) }} onChange={e => { setAddFormData({ address: e.target.value }) }}
@ -473,6 +496,7 @@ function Appointment() {
</div> </div>
</div> </div>
<div className="right"> <div className="right">
<div className="required">*</div>
<Upload <Upload
name="file" name="file"
listType="picture-card" listType="picture-card"

7
src/pages/NewEnergy/RecordsInquiry/Violation/loadable.jsx

@ -16,7 +16,12 @@ function Violation() {
// //
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
// //
const [typeList, setTypeList] = useState([]);
const [typeList, setTypeList] = useState([
{
label: "全部",
value: "0"
}
]);
// //
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
// //

1
src/pages/OutRoadMgm/OutSegmentMgm/OutSegment/AddParking.jsx

@ -613,6 +613,7 @@ function AddParking(props) {
} }
}} }}
close={() => setLngLatVisible(false)} close={() => setLngLatVisible(false)}
hide={() => setLngLatVisible(false)}
/> />
</Col> </Col>
</Row> </Row>

Loading…
Cancel
Save