提交应急

This commit is contained in:
”Rain“ 2024-05-22 01:51:58 +08:00
parent efeceec3fe
commit 92827d6a79

View File

@ -28,7 +28,8 @@
<script> <script>
import { import {
emergencyRecordAdd, emergencyRecordAdd,
emergencyRecordSendNotice emergencyRecordSendNotice,
emergencyRecordEdit
} from "@/api/index.js" } from "@/api/index.js"
export default { export default {
data() { data() {
@ -76,14 +77,58 @@
}); });
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
uni.getLocation({
type: 'gcj02',
// type: 'wgs84',
geocode: true, //true
isHighAccuracy: "true",
accuracy: "best", // 20m
success: function(res) {
console.log(res)
// const latitude = parseFloat(res.latitude);
// const longitude = parseFloat(res.longitude);
that.emergencyInfo.longitude =
that.emergencyInfo.latitude = parseFloat(res.latitude);
that.addressList = [
res.address.province,
res.address.city,
res.address.district,
res.address.street,
res.address.streetNum,
res.address.city,
res.address.poiName,
res.address.cityCode,
]
that.emergencyInfo.incidentSite = that.addressList.map(
item => item).join('、')
emergencyRecordEdit({
id: that.id,
projectSn: that.projectSn,
incidentSite: JSON.stringify(that.emergencyInfo
.incidentSite),
longitude: that.emergencyInfo.longitude,
latitude: that.emergencyInfo.latitude,
}).then(result => {
if (result.code == 200) {
uni.showToast({
title: result.message,
})
emergencyRecordSendNotice({ emergencyRecordSendNotice({
projectSn: this.projectSn, projectSn: that.projectSn,
id: that.id, id: that.id,
}).then(result => { }).then(result => {
if (result.code == 200) { if (result.code == 200) {
// uni.showToast({ // uni.showToast({
// title: "" // title: ""
// }) // })
} else {
uni.showToast({
title: result
.message,
icon: "none"
})
}
})
} else { } else {
uni.showToast({ uni.showToast({
title: result.message, title: result.message,
@ -91,6 +136,15 @@
}) })
} }
}) })
// that.addrDel = res;
},
fail: function() {
uni.showToast({
title: '获取地址失败,将导致部分功能不可用',
icon: 'none'
});
}
});
} }
} }
}); });