Merge branch 'bjxz-rain' into bjxz-dev

This commit is contained in:
kun 2024-05-22 01:53:23 +08:00
commit 520e30fffd

View File

@ -28,14 +28,15 @@
<script>
import {
emergencyRecordAdd,
emergencyRecordSendNotice
emergencyRecordSendNotice,
emergencyRecordEdit
} from "@/api/index.js"
export default {
data() {
return {
projectSn:"",
workerInfoId:"",
id:"",
projectSn: "",
workerInfoId: "",
id: "",
}
},
onShow() {
@ -49,7 +50,7 @@
emergencyRecordAdd({
projectSn: this.projectSn,
emergencyTypeId: -1,
alarmPersonId:this.workerInfoId,
alarmPersonId: this.workerInfoId,
}).then(result => {
if (result.code == 200) {
// uni.showToast({
@ -72,25 +73,78 @@
success: function(res) {
if (res.confirm) {
uni.navigateTo({
url:`${url}?id=${that.id}`,
url: `${url}?id=${that.id}`,
});
} else if (res.cancel) {
console.log('用户点击取消');
emergencyRecordSendNotice({
projectSn: this.projectSn,
id:that.id,
}).then(result => {
if (result.code == 200) {
// uni.showToast({
// title: ""
// })
} else {
uni.showToast({
title: result.message,
icon: "none"
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({
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'
});
}
})
});
}
}
});