// pages/details/details.js var req_url = getApp().globalData.base_url; const app = getApp() import Notify from '../../miniprogram_npm/@vant/weapp/notify/notify' Page({ /** * 页面的初始数据 */ data: { zypcode: '1004', title: '航锦电子作业票', name: '王飞', phone: 18701153496, locations: '地点', zyppdf:'', type: 'DongHuo', active: 2, steps: [ { text: '作业负责人意见', desc: '描述信息', }, { text: '分厂初审意见', desc: '描述信息', }, { text: '安全部门审批意见', desc: '描述信息', }, { text: '动火前,岗位当班班长验票情况', desc: '描述信息', }, { text: '完工验收', desc: '描述信息', }, ], }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options); var local = '无' if (!options.local) { local=options.local } this.setData({ zypcode: options.num, type:options.type, name:options.name, phone:options.phone, locations:local, }) this.getList() }, getList: function () { var that = this; console.log(that.data.zypcode); //请求后台数据 wx.request({ url: req_url + "/findHandleCode", data: { code: that.data.zypcode, }, method: 'get', success: function (res) { console.log(res); var datas = res.data; if (res.statusCode != 200) { wx.showToast({ title: '获取数据失败', icon: 'none', duration: 2000 }); } else { var zypd = [] var json = {} var num = 0 datas.forEach((e, index) => { json.text = e.bumen+"意见" if (e.handeltime != null) { // json.desc = "处理时间:"+e.handeltime json.desc = "处理时间:" + e.handeltime + "\n处理人:" + e.handelname } if (e.ishandle == 1) { num = index } zypd.push(json) json = {} }); console.log(zypd); that.setData({ zyppdf:datas.zyppdf, steps: zypd, active: num }) console.log(that.data.steps); // json.text = that.data.safetyMeasure[0].context, // json.refer = datas.refer1 // json.safetymeasure = datas.safetymeasure1 } } }) }, bindViewTap() { wx.navigateTo({ url: '../index/index' }) }, itemPdfOn(e) { // wx.showLoading({ // title: '加载中',//加载转圈显示 // }); console.log(this.data.zypcode); // wx.navigateTo({ // url: `../webview/webview?zypcode=` + this.data.zypcode // }) var type = '' if (this.data.type=='动火作业') { console.log(this.data.zypcode); wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppDongHuo.jsp&zypcode='+this.data.zypcode }) // type = 'DongHuo' }else if (this.data.type=='受限空间') { wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppSpace.jsp&zypcode='+this.data.zypcode }) // type = 'ShouXian' }else if (this.data.type=='动土安全') { wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppGround.jsp&zypcode='+this.data.zypcode }) // type = 'DongTu' }else if (this.data.type=='高处安全') { wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppAltitude.jsp&zypcode='+this.data.zypcode }) // type = 'GaoChu' }else if (this.data.type=='临时用电安全') { wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppElectricity.jsp&zypcode='+this.data.zypcode }) // type = 'YongDian' }else if (this.data.type=='吊装安全') { wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppLifting.jsp&zypcode='+this.data.zypcode }) // type = 'DiaoZhuang' }else if (this.data.type=='断路安全') { wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppCircuit.jsp&zypcode='+this.data.zypcode }) // type = 'DuanLu' }else if (this.data.type=='盲板抽堵') { wx.navigateTo({ url: `../webview/webview?src=`+'https://hj.iotposition.com/hxzkuwb/HouTai/JobTicket/AppBlind.jsp&zypcode='+this.data.zypcode }) // type = 'MangBan' } // console.log("https://hj.iotposition.com:6544/zuoyepiao/"+type+'/'+this.data.zypcode+'.pdf'); // // // 下载文件方法 // wx.downloadFile({ // url: "https://hj.iotposition.com:6544/zuoyepiao/"+type+'/'+this.data.zypcode+'.pdf', // // url: 'http://119.115.132.26:7002/hxzkuwb/zuoyepiao/航锦化工一级动火安全作业证.pdf',//编号。pdf // success: function (res) { // console.log(res); // if (res.statusCode==404) { // wx.hideLoading() // return Notify({ // message: '未生成作业票pdf文件', // top: app.globalData.CustomBar, // type: 'warning' // }) // }else{ // wx.hideLoading() // var Path = res.tempFilePath //返回的文件临时地址,用于后面打开本地预览所用 // wx.openDocument({ // filePath: Path, // success: function () { // console.log("打开文档成功"); // wx.hideLoading() // } // }) // } // }, // fail: function (res) { // } // }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })