提交应急

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

View File

@ -28,14 +28,15 @@
<script> <script>
import { import {
emergencyRecordAdd, emergencyRecordAdd,
emergencyRecordSendNotice emergencyRecordSendNotice,
emergencyRecordEdit
} from "@/api/index.js" } from "@/api/index.js"
export default { export default {
data() { data() {
return { return {
projectSn:"", projectSn: "",
workerInfoId:"", workerInfoId: "",
id:"", id: "",
} }
}, },
onShow() { onShow() {
@ -49,7 +50,7 @@
emergencyRecordAdd({ emergencyRecordAdd({
projectSn: this.projectSn, projectSn: this.projectSn,
emergencyTypeId: -1, emergencyTypeId: -1,
alarmPersonId:this.workerInfoId, alarmPersonId: this.workerInfoId,
}).then(result => { }).then(result => {
if (result.code == 200) { if (result.code == 200) {
// uni.showToast({ // uni.showToast({
@ -72,25 +73,78 @@
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
uni.navigateTo({ uni.navigateTo({
url:`${url}?id=${that.id}`, url: `${url}?id=${that.id}`,
}); });
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
emergencyRecordSendNotice({ uni.getLocation({
projectSn: this.projectSn, type: 'gcj02',
id:that.id, // type: 'wgs84',
}).then(result => { geocode: true, //true
if (result.code == 200) { isHighAccuracy: "true",
// uni.showToast({ accuracy: "best", // 20m
// title: "" success: function(res) {
// }) console.log(res)
} else { // const latitude = parseFloat(res.latitude);
uni.showToast({ // const longitude = parseFloat(res.longitude);
title: result.message, that.emergencyInfo.longitude =
icon: "none" 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({
projectSn: that.projectSn,
id: that.id,
}).then(result => {
if (result.code == 200) {
// uni.showToast({
// title: ""
// })
} else {
uni.showToast({
title: result
.message,
icon: "none"
})
}
})
} else {
uni.showToast({
title: result.message,
icon: "none"
})
}
}) })
// that.addrDel = res;
},
fail: function() {
uni.showToast({
title: '获取地址失败,将导致部分功能不可用',
icon: 'none'
});
} }
}) });
} }
} }
}); });