|
|
@ -1,12 +1,177 @@ |
|
|
|
// subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
|
|
|
|
// // subpages/InspectionReport/pages/InspectionReport/InspectionReport.js
|
|
|
|
// const QQMapWX = require('../../../../utils/qqmap-wx-jssdk')
|
|
|
|
// import addRecord from "../../../../utils/api"
|
|
|
|
// import {securityCheckk} from "../../../../utils/api"
|
|
|
|
// Page({
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 页面的初始数据
|
|
|
|
// */
|
|
|
|
// data: {
|
|
|
|
// pageNo: 1,
|
|
|
|
// pageSize: 10,
|
|
|
|
// id: 0,
|
|
|
|
// addressContent:'',
|
|
|
|
// fmData: {
|
|
|
|
// gridId: '',
|
|
|
|
// attachmentList:[],//图片
|
|
|
|
// voiceList:[],
|
|
|
|
// latitude:"",
|
|
|
|
// longitude:"",
|
|
|
|
// resiId:"",
|
|
|
|
// happenTime:"",
|
|
|
|
// content:"",//内容
|
|
|
|
// address:"",//地址
|
|
|
|
// namesArray:[],
|
|
|
|
// checkPersons:''
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 生命周期函数--监听页面加载
|
|
|
|
// */
|
|
|
|
// onLoad(options) {
|
|
|
|
// this.data.qqMapWX = new QQMapWX({
|
|
|
|
// key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ'
|
|
|
|
// })
|
|
|
|
// this.reverseLocation()
|
|
|
|
// // this.ToaddRecord()
|
|
|
|
// this.getList()
|
|
|
|
|
|
|
|
// },
|
|
|
|
// getList() {
|
|
|
|
// securityCheckk({
|
|
|
|
// pageNo: this.data.pageNo,
|
|
|
|
// pageSize: this.data.pageSize,
|
|
|
|
// }).then(({data}) => {
|
|
|
|
// console.log("123131",data.list)
|
|
|
|
// this.setData({
|
|
|
|
// marsi: data.list,
|
|
|
|
// total: data.total
|
|
|
|
// })
|
|
|
|
// this.setData({
|
|
|
|
// 'fmData.namesArray': data.list.map(item => ({ id: item.id, name: item.name })),
|
|
|
|
// 'fmData.checkPersons': data.list.map(item => item.checkPersons)
|
|
|
|
// });
|
|
|
|
// // console.log("123131", this.data.fmData.checkPersons);
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 生命周期函数--监听页面初次渲染完成
|
|
|
|
// */
|
|
|
|
// onReady() {
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 生命周期函数--监听页面显示
|
|
|
|
// */
|
|
|
|
// onShow() {
|
|
|
|
// this.reverseLocation
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 生命周期函数--监听页面隐藏
|
|
|
|
// */
|
|
|
|
// onHide() {
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 生命周期函数--监听页面卸载
|
|
|
|
// */
|
|
|
|
// onUnload() {
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
// */
|
|
|
|
// onPullDownRefresh() {
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 页面上拉触底事件的处理函数
|
|
|
|
// */
|
|
|
|
// onReachBottom() {
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 用户点击右上角分享
|
|
|
|
// */
|
|
|
|
// onShareAppMessage() {},
|
|
|
|
// //跳转地图选点
|
|
|
|
// toughGetLocation() {
|
|
|
|
// // this.getLocation(false);
|
|
|
|
// wx.chooseLocation({
|
|
|
|
// success: res => {
|
|
|
|
// console.log('resadddres', res)
|
|
|
|
// const {
|
|
|
|
// fmData
|
|
|
|
// } = this.data;
|
|
|
|
// this.setData({
|
|
|
|
// fmData: {
|
|
|
|
// ...fmData,
|
|
|
|
// address: res.address,
|
|
|
|
// longitude: res.longitude,
|
|
|
|
// latitude: res.latitude
|
|
|
|
// },
|
|
|
|
// addressContent: res.address
|
|
|
|
// });
|
|
|
|
// console.log(this.data.fmData);
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
// //
|
|
|
|
// reverseLocation() {
|
|
|
|
// const _this = this
|
|
|
|
// this.data.qqMapWX.reverseGeocoder({
|
|
|
|
// success(res) {
|
|
|
|
// console.log(res);
|
|
|
|
// _this.setData({
|
|
|
|
// addressContent:res.result.address,
|
|
|
|
// 'fmData.address': res.result.address,
|
|
|
|
// 'fmData.longitude':res.result.location.lng,
|
|
|
|
// 'fmData.latitude':res.result.location.lat,
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
// fail(err) {
|
|
|
|
// console.debug(err)
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ToaddRecord(){
|
|
|
|
// addRecord().then(res=>{
|
|
|
|
// console.log(res)
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// subpages/safetyinspection/pages/safetyinspection/safetyinspection.js
|
|
|
|
const QQMapWX = require('../../../../utils/qqmap-wx-jssdk') |
|
|
|
import addRecord from "../../../../utils/api" |
|
|
|
const App = getApp() |
|
|
|
import {addRecord,securityCheckk,inspectionStaff} from "../../../../utils/api" |
|
|
|
Page({ |
|
|
|
|
|
|
|
/** |
|
|
|
* 页面的初始数据 |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
addRecord:[], |
|
|
|
attachmentUrl:'', |
|
|
|
reviewTime:'', |
|
|
|
hazardDesc:'', |
|
|
|
checkResultFlag:'', |
|
|
|
checkPersonsIdList:[], |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 10, |
|
|
|
id: 0, |
|
|
|
addressContent:'', |
|
|
|
fmData: { |
|
|
|
gridId: '', |
|
|
@ -18,27 +183,105 @@ Page({ |
|
|
|
happenTime:"", |
|
|
|
content:"",//内容
|
|
|
|
address:"",//地址
|
|
|
|
namesArray:[], |
|
|
|
AllnamesArray:[], |
|
|
|
checkPersons:'' |
|
|
|
}, |
|
|
|
imageUrl:'', |
|
|
|
remarks:'',//备注
|
|
|
|
getData:'', |
|
|
|
gridName:'', |
|
|
|
array: ['不合格', '合格'], // 选择器的数据源
|
|
|
|
result: ['a', 'b', 'c'], |
|
|
|
arrlist:[], |
|
|
|
fileList: [], |
|
|
|
companyId: '', |
|
|
|
showPopup: false, // 控制弹出层显示/隐藏的状态
|
|
|
|
selectedOptions: [], // 选中的复选框项
|
|
|
|
selectedNames:[],//显示检察人员
|
|
|
|
// 用于存放复选框选择的结果
|
|
|
|
result: [], |
|
|
|
// 用于存放输入框的值
|
|
|
|
newPassword: '', |
|
|
|
arr:[ |
|
|
|
// {value:"1",name:'小王'},
|
|
|
|
// {value:"2",name:'李四'},
|
|
|
|
// {value:"3",name:'张三'}
|
|
|
|
], |
|
|
|
arr1:[ |
|
|
|
// {value:"1",name:'1.车间一些软件设备出现生锈断裂情况严重'},
|
|
|
|
// {value:"2",name:'2.还有部分货运车辆已过年检。'},
|
|
|
|
], |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad(options) { |
|
|
|
this.data.qqMapWX = new QQMapWX({ |
|
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' |
|
|
|
}) |
|
|
|
this.reverseLocation() |
|
|
|
this.ToaddRecord() |
|
|
|
|
|
|
|
console.log(options.resiId) |
|
|
|
this.setData({ |
|
|
|
companyId: options.resiId |
|
|
|
}) |
|
|
|
this.data.qqMapWX = new QQMapWX({ |
|
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' |
|
|
|
}) |
|
|
|
this.reverseLocation() |
|
|
|
// this.ToaddRecord()
|
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
|
|
|
|
submitBiao(){ |
|
|
|
console.log("122131") |
|
|
|
const currentDate = new Date(); |
|
|
|
addRecord({ |
|
|
|
companyId: this.data.companyId, |
|
|
|
checkTime:currentDate, |
|
|
|
checkPersonsIdList: this.data.checkPersonsIdList, |
|
|
|
checkResultFlag: this.data.checkResultFlag, |
|
|
|
reviewTime:this.data.reviewTime, |
|
|
|
hazardDesc:[{hazardStatus:2},{hazardDesc:this.data.hazardDesc}], |
|
|
|
attachmentUrls:[{fileName:'文件'},{attachmentUrl:'http://tmp/2JqHQVjACkEA00497265d7c287d505d1c20123e0470c.png'}], |
|
|
|
remark:'123' |
|
|
|
}).then(({data}) => { |
|
|
|
console.log('data',data) |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getList() { |
|
|
|
securityCheckk({ |
|
|
|
pageNo: this.data.pageNo, |
|
|
|
pageSize: this.data.pageSize, |
|
|
|
}).then(({data}) => { |
|
|
|
// console.log("123131",data.list)
|
|
|
|
this.setData({ |
|
|
|
marsi: data.list, |
|
|
|
total: data.total |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
'fmData.AllnamesArray': data.list.map(item => ({ id: item.id, name: item.name })), |
|
|
|
'fmData.namesArray': data.list.map(item => (item.name)), |
|
|
|
|
|
|
|
'fmData.checkPersons': data.list.map((item, index) => ({ value: index, name: item.checkPersons })), |
|
|
|
}); |
|
|
|
// console.log("123131", this.data.fmData.namesArray.map(item => item.name));
|
|
|
|
}); |
|
|
|
inspectionStaff({ |
|
|
|
orgId: App.globalData.user.agencyId, |
|
|
|
orgType:'agency', |
|
|
|
pageNo:1, |
|
|
|
pageSize:100 |
|
|
|
}).then(({data}) => { |
|
|
|
this.setData({ |
|
|
|
arr: data.staffList |
|
|
|
}) |
|
|
|
}); |
|
|
|
///
|
|
|
|
|
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面初次渲染完成 |
|
|
|
*/ |
|
|
|
onReady() { |
|
|
|
|
|
|
|
}, |
|
|
|
onReady() {}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
@ -58,72 +301,211 @@ Page({ |
|
|
|
* 生命周期函数--监听页面卸载 |
|
|
|
*/ |
|
|
|
onUnload() { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
|
*/ |
|
|
|
onPullDownRefresh() { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 页面上拉触底事件的处理函数 |
|
|
|
*/ |
|
|
|
onReachBottom() { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 用户点击右上角分享 |
|
|
|
*/ |
|
|
|
onShareAppMessage() {}, |
|
|
|
//跳转地图选点
|
|
|
|
toughGetLocation() { |
|
|
|
// this.getLocation(false);
|
|
|
|
wx.chooseLocation({ |
|
|
|
success: res => { |
|
|
|
console.log('resadddres', res) |
|
|
|
onShareAppMessage() { |
|
|
|
}, |
|
|
|
onChange(event) { |
|
|
|
console.log(event) |
|
|
|
this.setData({ |
|
|
|
result: event.detail |
|
|
|
}); |
|
|
|
// event.detail 为当前输入的值
|
|
|
|
console.log(this.data.selectedOptions); |
|
|
|
}, |
|
|
|
afterRead(event) { |
|
|
|
const { |
|
|
|
file |
|
|
|
} = event.detail; |
|
|
|
console.log(file) |
|
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
|
wx.uploadFile({ |
|
|
|
url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
|
|
|
|
filePath: file.url, |
|
|
|
name: 'file', |
|
|
|
formData: { |
|
|
|
user: 'test' |
|
|
|
}, |
|
|
|
success(res) { |
|
|
|
// 上传完成需要更新 fileList
|
|
|
|
const { |
|
|
|
fmData |
|
|
|
fileList = [] |
|
|
|
} = this.data; |
|
|
|
fileList.push({ |
|
|
|
...file, |
|
|
|
url: res.data |
|
|
|
}); |
|
|
|
this.setData({ |
|
|
|
fmData: { |
|
|
|
...fmData, |
|
|
|
address: res.address, |
|
|
|
longitude: res.longitude, |
|
|
|
latitude: res.latitude |
|
|
|
}, |
|
|
|
addressContent: res.address |
|
|
|
fileList |
|
|
|
}); |
|
|
|
console.log(this.data.fmData); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
showPopup() { |
|
|
|
this.setData({ showPopup: true }); // 点击按钮显示弹出层
|
|
|
|
}, |
|
|
|
onClose() { |
|
|
|
this.setData({ showPopup: false }); // 关闭弹出层
|
|
|
|
}, |
|
|
|
onChange1(event) { |
|
|
|
console.log(event) |
|
|
|
this.setData({ |
|
|
|
selectedOptions: event.detail |
|
|
|
}); |
|
|
|
console.log(this.data.selectedOptions) |
|
|
|
},confirmSelection() { |
|
|
|
// 点击确定按钮后触发,处理选中的复选框项
|
|
|
|
console.log("选中的项:", this.data.selectedOptions); |
|
|
|
|
|
|
|
const selectedName = this.data.selectedOptions; |
|
|
|
this.setData({ |
|
|
|
showPopup: false, |
|
|
|
selectedNames: selectedName |
|
|
|
}); |
|
|
|
const matchedStaffIds = []; |
|
|
|
this.data.arr.forEach(item => { |
|
|
|
if (selectedName.includes(item.name)) { |
|
|
|
matchedStaffIds.push(item.staffId); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.setData({ |
|
|
|
checkPersonsIdList: matchedStaffIds |
|
|
|
}); |
|
|
|
// 关闭弹出层
|
|
|
|
|
|
|
|
}, |
|
|
|
changeNewPassword(e){ |
|
|
|
console.log("执行了") |
|
|
|
this.setData({ |
|
|
|
newPassword: e.detail.value |
|
|
|
}); |
|
|
|
console.log(this.data.newPassword) |
|
|
|
}, |
|
|
|
addAnother() { |
|
|
|
// // 获取输入框的值
|
|
|
|
// const newPassword = this.data.newPassword;
|
|
|
|
// // 将值添加到arr数组中
|
|
|
|
// const arr = this.data.arr.concat(newPassword);
|
|
|
|
// // 更新数据
|
|
|
|
// this.setData({
|
|
|
|
// arr: arr,
|
|
|
|
// // 清空输入框的值
|
|
|
|
// newPassword: ''
|
|
|
|
// });
|
|
|
|
let newValue = this.data.arr1.length + 1; // 根据数组长度确定新值
|
|
|
|
let newArr = this.data.arr1.concat({ value: newValue.toString(), name: this.data.newPassword }); |
|
|
|
this.setData({ |
|
|
|
arr1: newArr, |
|
|
|
newPassword: '', // 清空输入框的值
|
|
|
|
}); |
|
|
|
console.log('添加后的数组:', this.data.arr1); |
|
|
|
}, |
|
|
|
pickerChange: function(e) { |
|
|
|
// 更新当前选中的索引
|
|
|
|
console.log(e.detail.value), |
|
|
|
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
gridName: this.data.array[e.detail.value] |
|
|
|
}); |
|
|
|
this.data.checkResultFlag = e.detail.value |
|
|
|
console.log(this.data.gridName) |
|
|
|
// 在这里可以根据选择的值进行相应的逻辑处理
|
|
|
|
}, |
|
|
|
pickerChange1: function(e) { |
|
|
|
// 更新当前选中的索引
|
|
|
|
console.log(e.detail.value), |
|
|
|
this.setData({ |
|
|
|
getData: e.detail.value |
|
|
|
}); |
|
|
|
this.data.reviewTime = e.detail.value |
|
|
|
console.log(this.data.getData) |
|
|
|
// 在这里可以根据选择的值进行相应的逻辑处理
|
|
|
|
}, |
|
|
|
pickerChange2: function(e) { |
|
|
|
// 更新当前选中的索引
|
|
|
|
this.setData({ |
|
|
|
gridNName: this.data.fmData.namesArray[e.detail.value] |
|
|
|
}); |
|
|
|
this.data.addRecord = this.data.fmData.AllnamesArray[e.detail.value].id |
|
|
|
}, |
|
|
|
bindRemarkInput(e){ |
|
|
|
this.setData({ |
|
|
|
remarks: e.detail.value |
|
|
|
}); |
|
|
|
console.log(this.data.remarks) |
|
|
|
}, |
|
|
|
chooseImage() { |
|
|
|
wx.chooseMedia({ |
|
|
|
count: 1, |
|
|
|
sizeType: ['original', 'compressed'], |
|
|
|
sourceType: ['album', 'camera'], |
|
|
|
success(res) { |
|
|
|
console.log(res) |
|
|
|
const tempFilePaths = res.tempFilePaths; |
|
|
|
// 将选定的图片显示在页面上
|
|
|
|
this.setData({ |
|
|
|
imageUrl: tempFilePaths[0] |
|
|
|
}); |
|
|
|
console.log(this.data.imageUrl) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//
|
|
|
|
reverseLocation() { |
|
|
|
const _this = this |
|
|
|
this.data.qqMapWX.reverseGeocoder({ |
|
|
|
success(res) { |
|
|
|
console.log(res); |
|
|
|
_this.setData({ |
|
|
|
addressContent:res.result.address, |
|
|
|
'fmData.address': res.result.address, |
|
|
|
'fmData.longitude':res.result.location.lng, |
|
|
|
'fmData.latitude':res.result.location.lat, |
|
|
|
}) |
|
|
|
}, |
|
|
|
fail(err) { |
|
|
|
console.debug(err) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
ToaddRecord(){ |
|
|
|
addRecord().then(res=>{ |
|
|
|
console.log(res) |
|
|
|
}) |
|
|
|
} |
|
|
|
//跳转地图选点
|
|
|
|
toughGetLocation() { |
|
|
|
// this.getLocation(false);
|
|
|
|
wx.chooseLocation({ |
|
|
|
success: res => { |
|
|
|
console.log('resadddres', res) |
|
|
|
const { |
|
|
|
fmData |
|
|
|
} = this.data; |
|
|
|
this.setData({ |
|
|
|
fmData: { |
|
|
|
...fmData, |
|
|
|
address: res.address, |
|
|
|
longitude: res.longitude, |
|
|
|
latitude: res.latitude |
|
|
|
}, |
|
|
|
addressContent: res.address |
|
|
|
}); |
|
|
|
console.log(this.data.fmData); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//
|
|
|
|
reverseLocation() { |
|
|
|
const _this = this |
|
|
|
this.data.qqMapWX.reverseGeocoder({ |
|
|
|
success(res) { |
|
|
|
console.log(res); |
|
|
|
_this.setData({ |
|
|
|
addressContent:res.result.address, |
|
|
|
'fmData.address': res.result.address, |
|
|
|
'fmData.longitude':res.result.location.lng, |
|
|
|
'fmData.latitude':res.result.location.lat, |
|
|
|
}) |
|
|
|
}, |
|
|
|
fail(err) { |
|
|
|
console.debug(err) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |