// pages/space/space.js var req_url = getApp().globalData.base_url; const app = getApp() Page({ /** * 页面的初始数据 */ data: { activeNames: [], spanCode: '', applicant: "", operatingunit: "", applicationtime: "", bumen: '', operationmanager: "", otherworkandnum: "", reason: "", operationaladvice: "", branchopinion: '', checkstatus: '', result: [], safetyadvice: '', otherinjuries: '', hottime: '', secureper: '', receive: '', completionacceptance: '', organizer: '', safetymeasureother: '', rightText: '处理', safetyMeasure: [ { context: "作业前,制定交通组织方案,并已通知相关部门或单位", safetymeasure: '', refer: "", }, { context: "作业前,在断路的路口和相关道路上设置交通警示标志,在作业区域附近设置路栏、道路作业警示灯、导向标等交通警示设施", safetymeasure: '', refer: "", }, { context: "夜间作业设置警示灯", safetymeasure: '', refer: "", }, ], }, onChange(event) { this.setData({ activeNames: event.detail, }); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ spanCode: options.num }) if (options.handle==1) { this.setData({ rightText: "完结" }) } this.getList() }, onClickLeft() { wx.redirectTo({ url: `/pages/index/index` }) }, onClickRight() { wx.navigateTo({ url: '../handle/handle?zypcode=' + this.data.spanCode + '&zyptepe= 断路安全作业证' }) }, /** * 请求后台获取数据 */ getList: function () { var that = this; // var onRefresh = that.data.onRefresh;//false为重新刷新数据,true为分页累加数据 //请求后台数据 wx.request({ url: req_url + "/findCircuitCode", data: { code: that.data.spanCode, }, method: 'get', success: function (res) { var datas = res.data; if (res.statusCode != 200) { wx.showToast({ title: '获取数据失败', icon: 'none', duration: 2000 }); } else { var zypd = [] var json = {} json.context = that.data.safetyMeasure[0].context json.refer = datas.refer1 json.safetymeasure = datas.safetymeasure1 zypd.push(json) var json1 = {} json1.context = that.data.safetyMeasure[1].context json1.refer = datas.refer2 json1.safetymeasure = datas.safetymeasure2 zypd.push(json1) var json2 = {} json2.context = that.data.safetyMeasure[2].context json2.refer = datas.refer3 json2.safetymeasure = datas.safetymeasure3 zypd.push(json2) var fenxian = [] if (datas.firehazard != null && datas.firehazard != '') { fenxian.push("firehazard") } if (datas.drowning != null && datas.drowning != '') { fenxian.push("drowning") } if (datas.getshock != null && datas.getshock != '') { fenxian.push("getshock") } if (datas.guardian != null && datas.guardian != '') { fenxian.push("guardian") } if (datas.highfall != null && datas.highfall != '') { fenxian.push("highfall") } if (datas.liftinginjury != null && datas.liftinginjury != '') { fenxian.push("liftinginjury") } if (datas.mechanicalinjury != null && datas.mechanicalinjury != '') { fenxian.push("mechanicalinjury") } if (datas.otherexplosions != null && datas.otherexplosions != '') { fenxian.push("otherexplosions") } if (datas.scalding != null && datas.scalding != '') { fenxian.push("scalding") } if (datas.zdandzx != null && datas.zdandzx != '') { fenxian.push("zdandzx") } if (datas.physicalattack != null && datas.physicalattack != '') { fenxian.push("physicalattack") } if (datas.containerexplosion != null && datas.containerexplosion != '') { fenxian.push("containerexplosion") } if (datas.boilerexplosion != null && datas.boilerexplosion != '') { fenxian.push("boilerexplosion") } if (datas.collapse != null && datas.collapse != '') { fenxian.push("collapse") } if (datas.vehicleinjury != null && datas.vehicleinjury != '') { fenxian.push("vehicleinjury") } that.setData({ safetyMeasure: zypd, spanCode: datas.code, applicant: datas.applicant, applicationtime: datas.applicationtime, operatingunit: datas.operatingunit, bumen: datas.bumen, reason: datas.reason, operationmanager: datas.operationmanager, otherworkandnum: datas.otherworkandnum, result: fenxian, otherinjuries: datas.otherinjuries, branchopinion: datas.branchopinion, operationaladvice: datas.operationaladvice, checkstatus: datas.checkstatus, countersignedopinion: datas.countersignedopinion, operation: datas.operation, hottime: datas.hottime, secureper: datas.secureper, receive: datas.receive, operationaladvice: datas.operationaladvice, safetyadvice: datas.safetyadvice, completionacceptance: datas.completionacceptance, organizer: datas.organizer, safetymeasureother: datas.safetymeasureother, }) } }, complete: function (res) { wx.hideLoading(); }, fail: function (res) { } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })