|
|
@ -13,7 +13,7 @@ import "./index.scss"; |
|
|
|
|
|
|
|
|
|
|
|
function Appointment() { |
|
|
|
|
|
|
|
const pattern = /^\d+$/; // 正整数正则 |
|
|
|
// 详情弹窗 |
|
|
|
const [detailVisible, setDetailVisible] = useState(false); |
|
|
|
// 列表数据 |
|
|
@ -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() { |
|
|
|
<FormInput |
|
|
|
yisaLabel="充电站名称" |
|
|
|
placeholder="请输入充电站名称" |
|
|
|
isRequired |
|
|
|
isShowAfterIcon={false} |
|
|
|
value={addFormData.name} |
|
|
|
onChange={e => { setAddFormData({ name: e.target.value }) }} |
|
|
@ -385,6 +398,7 @@ function Appointment() { |
|
|
|
<FormInput |
|
|
|
yisaLabel="充电站编码" |
|
|
|
placeholder="请输入充电站编码" |
|
|
|
isRequired |
|
|
|
isShowAfterIcon={false} |
|
|
|
value={addFormData.code} |
|
|
|
onChange={e => { setAddFormData({ code: e.target.value }) }} |
|
|
@ -394,6 +408,8 @@ function Appointment() { |
|
|
|
<FormInput |
|
|
|
yisaLabel="车位数量" |
|
|
|
placeholder="请输入车位数量" |
|
|
|
isRequired |
|
|
|
type={"Number"} |
|
|
|
isShowAfterIcon={false} |
|
|
|
value={addFormData.count} |
|
|
|
onChange={e => { setAddFormData({ count: e.target.value }) }} |
|
|
@ -403,6 +419,7 @@ function Appointment() { |
|
|
|
<FormSelect |
|
|
|
yisaLabel="站点类型" |
|
|
|
placeholder="请选择站点类型" |
|
|
|
required |
|
|
|
hasUnlimited={false} |
|
|
|
defaultValue={addFormData.site_type || null} |
|
|
|
yisaData={sysConfig?.stationType || []} |
|
|
@ -415,6 +432,7 @@ function Appointment() { |
|
|
|
yisaLabel="所属区域" |
|
|
|
labelPosition="left" |
|
|
|
placeholder="请选择所属区域" |
|
|
|
isRequired |
|
|
|
value={addFormData.area || null} |
|
|
|
fieldNames={{ |
|
|
|
label: "name", |
|
|
@ -431,6 +449,7 @@ function Appointment() { |
|
|
|
<FormSelect |
|
|
|
yisaLabel="商户名称" |
|
|
|
placeholder="请选择商户名称" |
|
|
|
required |
|
|
|
hasUnlimited={false} |
|
|
|
defaultValue={addFormData.operator || null} |
|
|
|
yisaData={operatorList} |
|
|
@ -442,6 +461,7 @@ function Appointment() { |
|
|
|
<FormInput |
|
|
|
yisaLabel="经纬度" |
|
|
|
placeholder="请选择经纬度" |
|
|
|
isRequired |
|
|
|
isShowAfterIcon={false} |
|
|
|
defaultValue={addFormData.lng_lat || null} |
|
|
|
value={addFormData.lng_lat} |
|
|
@ -449,6 +469,7 @@ function Appointment() { |
|
|
|
/> |
|
|
|
<div className="latlng-box"> |
|
|
|
<SelectGaodeLngLat |
|
|
|
isClickMarker |
|
|
|
open={() => 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)} |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -466,6 +488,7 @@ function Appointment() { |
|
|
|
<FormInput |
|
|
|
yisaLabel="详细地址" |
|
|
|
placeholder="请输入详细地址" |
|
|
|
isRequired |
|
|
|
isShowAfterIcon={false} |
|
|
|
value={addFormData.address} |
|
|
|
onChange={e => { setAddFormData({ address: e.target.value }) }} |
|
|
@ -473,6 +496,7 @@ function Appointment() { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="right"> |
|
|
|
<div className="required">*</div> |
|
|
|
<Upload |
|
|
|
name="file" |
|
|
|
listType="picture-card" |
|
|
|