|
@ -16,6 +16,7 @@ Page({ |
|
|
itemData: '', //单条数据
|
|
|
itemData: '', //单条数据
|
|
|
changeTwo: '', //是否异常
|
|
|
changeTwo: '', //是否异常
|
|
|
changeThree: '', //严重等级
|
|
|
changeThree: '', //严重等级
|
|
|
|
|
|
address: '', //当前位置
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleChangeTwo(e) { |
|
|
handleChangeTwo(e) { |
|
@ -52,7 +53,8 @@ Page({ |
|
|
msgInp: '', //巡查详情
|
|
|
msgInp: '', //巡查详情
|
|
|
changeTwo: '', //是否异常
|
|
|
changeTwo: '', //是否异常
|
|
|
changeThree: '', //严重等级
|
|
|
changeThree: '', //严重等级
|
|
|
imgs: [] |
|
|
imgs: [], |
|
|
|
|
|
address: '' |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -174,7 +176,7 @@ Page({ |
|
|
// 开始巡检录入
|
|
|
// 开始巡检录入
|
|
|
addPatrolRecord: function () { |
|
|
addPatrolRecord: function () { |
|
|
let that = this; |
|
|
let that = this; |
|
|
let { itemData, imgs, msgInp, changeTwo, changeThree, dataList, imgUrl } = that.data; |
|
|
let { itemData, imgs, msgInp, changeTwo, changeThree, dataList, imgUrl, address } = that.data; |
|
|
let newImgs = imgs.map(i => { |
|
|
let newImgs = imgs.map(i => { |
|
|
i = i.replace(imgUrl, ''); |
|
|
i = i.replace(imgUrl, ''); |
|
|
return i; |
|
|
return i; |
|
@ -196,7 +198,8 @@ Page({ |
|
|
} |
|
|
} |
|
|
let data = { |
|
|
let data = { |
|
|
patrolPlanId: dataList.id, |
|
|
patrolPlanId: dataList.id, |
|
|
lastInspectionTime: moment().format('YYYY-MM-DD'), |
|
|
pointId: itemData.id, |
|
|
|
|
|
lastInspectionTime: itemData.lastInspectionTime, |
|
|
inspectionTime: moment().format('YYYY-MM-DD'), |
|
|
inspectionTime: moment().format('YYYY-MM-DD'), |
|
|
points: { |
|
|
points: { |
|
|
user: dataList.user, |
|
|
user: dataList.user, |
|
@ -206,6 +209,7 @@ Page({ |
|
|
msgInp: msgInp, |
|
|
msgInp: msgInp, |
|
|
changeThree: changeThree == 'slight' ? '轻微' : changeThree == 'moderate' ? '中度' : '严重', |
|
|
changeThree: changeThree == 'slight' ? '轻微' : changeThree == 'moderate' ? '中度' : '严重', |
|
|
imgs: newImgs, |
|
|
imgs: newImgs, |
|
|
|
|
|
address: address |
|
|
}, |
|
|
}, |
|
|
alarm: true |
|
|
alarm: true |
|
|
} |
|
|
} |
|
@ -219,13 +223,15 @@ Page({ |
|
|
if (changeTwo == 'normal') { |
|
|
if (changeTwo == 'normal') { |
|
|
let data = { |
|
|
let data = { |
|
|
patrolPlanId: dataList.id, |
|
|
patrolPlanId: dataList.id, |
|
|
lastInspectionTime: moment().format('YYYY-MM-DD'), |
|
|
pointId: itemData.id, |
|
|
|
|
|
lastInspectionTime: itemData.lastInspectionTime, |
|
|
inspectionTime: moment().format('YYYY-MM-DD'), |
|
|
inspectionTime: moment().format('YYYY-MM-DD'), |
|
|
points: { |
|
|
points: { |
|
|
user: dataList.user, |
|
|
user: dataList.user, |
|
|
project: dataList.project, |
|
|
project: dataList.project, |
|
|
frequency: dataList.frequency, |
|
|
frequency: dataList.frequency, |
|
|
itemData: itemData, |
|
|
itemData: itemData, |
|
|
|
|
|
address: address |
|
|
}, |
|
|
}, |
|
|
alarm: false |
|
|
alarm: false |
|
|
} |
|
|
} |
|
@ -246,58 +252,90 @@ Page({ |
|
|
|
|
|
|
|
|
// 获取巡检记录
|
|
|
// 获取巡检记录
|
|
|
getPatrolRecord: function () { |
|
|
getPatrolRecord: function () { |
|
|
Request.get(getPatrolRecord(this.data.dataList.id)).then(res => { |
|
|
let that = this; |
|
|
|
|
|
let { dataList } = that.data; |
|
|
|
|
|
let pointId = dataList.points.map(i => { |
|
|
|
|
|
return i.id; |
|
|
|
|
|
}) |
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: '加载中' |
|
|
|
|
|
}) |
|
|
|
|
|
Request.get(getPatrolRecord(dataList.id, 'null', 'null', 'null', pointId)).then(res => { |
|
|
console.log(res); |
|
|
console.log(res); |
|
|
|
|
|
dataList.points.map(e => { |
|
|
|
|
|
res.map(i => { |
|
|
|
|
|
wx.hideLoading(); |
|
|
|
|
|
console.log(i, '------'); |
|
|
|
|
|
if (i == null) { |
|
|
|
|
|
e.lastInspectionTime = moment().format('YYYY-MM-DD'); |
|
|
|
|
|
e.inspectionTime = moment().format('YYYY-MM-DD'); |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
return e; |
|
|
|
|
|
}) |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
dataList |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 解析经纬度
|
|
|
|
|
|
ToDegrees(val) { |
|
|
|
|
|
if (typeof (val) == "undefined" || val == "") { |
|
|
|
|
|
return ""; |
|
|
|
|
|
} |
|
|
|
|
|
var i = val.indexOf('.'); |
|
|
|
|
|
var strDu = i < 0 ? val : val.substring(0, i);//获取度
|
|
|
|
|
|
var strFen = 0; |
|
|
|
|
|
var strMiao = 0; |
|
|
|
|
|
if (i > 0) { |
|
|
|
|
|
var strFen = "0" + val.substring(i); |
|
|
|
|
|
strFen = strFen * 60 + ""; |
|
|
|
|
|
i = strFen.indexOf('.'); |
|
|
|
|
|
if (i > 0) { |
|
|
|
|
|
strMiao = "0" + strFen.substring(i); |
|
|
|
|
|
strFen = strFen.substring(0, i);//获取分
|
|
|
|
|
|
strMiao = strMiao * 60 + ""; |
|
|
|
|
|
i = strMiao.indexOf('.'); |
|
|
|
|
|
strMiao = strMiao.substring(0, i + 4);//取到小数点后面三位
|
|
|
|
|
|
strMiao = parseFloat(strMiao).toFixed(2);//精确小数点后面两位
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return strDu + "°" + strFen + "′" + strMiao + "″"; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// selfLocation() {
|
|
|
// 获取当前位置
|
|
|
// const self = this
|
|
|
selfLocation() { |
|
|
// wx.showLoading({
|
|
|
const that = this |
|
|
// title: '定位中',
|
|
|
wx.showLoading({ |
|
|
// mask: true,
|
|
|
title: '定位中', |
|
|
// });
|
|
|
mask: true, |
|
|
// wx.getLocation({
|
|
|
}); |
|
|
// type: 'gcj02',
|
|
|
wx.getLocation({ |
|
|
// success: (res) => {
|
|
|
type: 'wgs84', |
|
|
// let latitude, longitude;
|
|
|
success: (res) => { |
|
|
// latitude = res.latitude.toString();
|
|
|
wx.request({ |
|
|
// longitude = res.longitude.toString();
|
|
|
url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${res.longitude}&key=${getApp().globalData.key}`, |
|
|
// this.latitude = res.latitude
|
|
|
success: function (res) { |
|
|
// this.longitude = res.longitude
|
|
|
wx.hideLoading(); |
|
|
// getGeocoder({ lat: latitude, long: longitude }).then(res => { // 获取详细信息的接口
|
|
|
//根据自己项目需求获取res内容
|
|
|
// const data = res.data;
|
|
|
that.setData({ |
|
|
// self.userAddress.userAddressdetail = ''
|
|
|
address: res.data.result.address |
|
|
// var params = {
|
|
|
}) |
|
|
// text: data.address
|
|
|
} |
|
|
// }
|
|
|
}) |
|
|
// parseAddress(params).then(res => { // 粘贴详细信息的接口
|
|
|
}, |
|
|
// console.log(res)
|
|
|
fail: (res) => { |
|
|
// if (res.status == 200 && res.message == "success") {
|
|
|
console.log(res) |
|
|
// this.$forceUpdate(); // 定位后,界面没有反应,因此加上强制刷新
|
|
|
wx.hideLoading(); |
|
|
// this.userAddress.userAddressdetail = res.data.town + res.data.detail;
|
|
|
wx.showToast({ |
|
|
// this.$set(this.userAddress, 'selectAddress', parseInt(res.data.county_info.city_id));
|
|
|
title: res.errMsg, |
|
|
// this.addressInfo[0] = res.data.province_info ? res.data.province_info : {};
|
|
|
icon: 'none', |
|
|
// this.addressInfo[1] = res.data.city_info ? res.data.city_info : {};
|
|
|
duration: 1000 |
|
|
// this.addressInfo[2] = res.data.county_info ? res.data.county_info : {};
|
|
|
}); |
|
|
// }
|
|
|
} |
|
|
// }).catch(res => {
|
|
|
}); |
|
|
// console.log("没有地址信息")
|
|
|
}, |
|
|
// })
|
|
|
|
|
|
// wx.hideLoading();
|
|
|
|
|
|
// })
|
|
|
|
|
|
// },
|
|
|
|
|
|
// fail: (res) => {
|
|
|
|
|
|
// console.log(res)
|
|
|
|
|
|
// wx.hideLoading();
|
|
|
|
|
|
// wx.showToast({
|
|
|
|
|
|
// title: res.errMsg,
|
|
|
|
|
|
// icon: 'none',
|
|
|
|
|
|
// duration: 1000
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 生命周期函数--监听页面加载 |
|
|
* 生命周期函数--监听页面加载 |
|
@ -312,7 +350,7 @@ Page({ |
|
|
dataList: data, |
|
|
dataList: data, |
|
|
points |
|
|
points |
|
|
}) |
|
|
}) |
|
|
// that.getPatrolRecord()
|
|
|
that.getPatrolRecord(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|