import http from '../../base/httputil'
Page({

  onLoad(e){
    let busEnterpriseId = e.busEnterpriseId
    this.data.busEnterpriseId = busEnterpriseId
    this.setData({
      businessName : e.businessName
    })
    this.getXunchaCount();
    this.getXunchaList();
  },

  getXunchaCount(){
    let obj = new Object();
    obj.busEnterpriseId = this.data.busEnterpriseId 
    http.post("/system/AppXunchaController/getXunchaCount",obj,this.getXunchaCountSuccess)
  },
  getXunchaCountSuccess(res){
    this.setData({
      todayXunchaCount:res.xunchaCount.todayXunchaCount,
      todayRiskCount : res.xunchaCount.todayRiskCount
    })
  },
  getXunchaList(){
    let obj = new Object();
    obj.busEnterpriseId = this.data.busEnterpriseId 
    http.post("/system/AppXunchaController/getXunchaList",obj,this.getXunchaListSuccess)
  },
  getXunchaListSuccess(res){
    console.log(res.rows)
    this.setData({
      xunchaList :  res.rows
    })
  },

  /**
   * 页面的初始数据
   */
  data: {
    busEnterpriseId : null,
    businessName : null,
    todayXunchaCount : 0,
    todayRiskCount : 0,
    xunchaList : null
  },
 // 巡检详细
 bindViewXunJianMore(){
  wx.navigateTo({
    url: '../xunjianmore/xunjianmore',
  })
}
})