Browse Source

fix(): 地图点位选取bug

tags/PMS_Frontend_v1.0.6-develop
wanghx 1 year ago
parent
commit
a41a0227ab
  1. 10
      src/pages/SystemMgm/AreaManage/ModalAreaAdd/index.jsx
  2. 8
      src/pages/SystemMgm/AreaManage/loadable.jsx

10
src/pages/SystemMgm/AreaManage/ModalAreaAdd/index.jsx

@ -26,7 +26,15 @@ function ModalAreaAdd(props) {
const handleOk = () => {
form.validateFields().then(formData => {
onOk(formData={...formData,id: editForm.id}, editStatus, )
const latlngObj = {
lat: '',
lng: ''
}
if (formData.latlng && formData.latlng.split(',').length) {
latlngObj['lat'] = formData.latlng.split(',')[0]
latlngObj['lng'] = formData.latlng.split(',')[1]
}
onOk(formData={...formData,id: editForm.id, ...latlngObj}, editStatus, )
form.resetFields()
}).catch((err) => {
console.log(err)

8
src/pages/SystemMgm/AreaManage/loadable.jsx

@ -83,7 +83,7 @@ function AreaManage() {
}
const handleAreaEdit = ({ name, id, virtually_code, code, lng, lat, type }) => {
setEditForm({ name, id, virtually_code, code, lng_lat: lng ? `${lng}, ${lat}` : "", type })
setEditForm({ name, id, virtually_code, code, latlng: lng ? `${lng}, ${lat}` : "", type })
setEditStatus(true)
setModalAreaVisible(true)
}
@ -126,7 +126,7 @@ function AreaManage() {
setModalMapVisible(true)
}
const handleMapClick = ({ lat, lng }) => {
setLatlng([lat.toFixed(4), lng.toFixed(4)])
setLatlng([lat.toFixed(4), lng.toFixed(4)].join(','))
}
//
@ -150,9 +150,9 @@ function AreaManage() {
}
const handleLatLngConfirm = () => {
if (latlng == '' || latlng == []) {
if (latlng == '') {
message.error('请选择经纬度')
} else if (!(isArray(latlng) && latlng.length == 2)) {
} else if (latlng.split(',').length != 2) {
message.error('请检查经纬度格式')
} else {
setModalMapVisible(false)

Loading…
Cancel
Save