xuncha.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import http from '../../base/httputil'
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 组件的初始数据
  6. */
  7. data: {
  8. host: app.globalData.host,
  9. todayXunchaCount: 0,
  10. todayRiskCount: 0,
  11. todayEnterpriseCount: 0,
  12. xunchaList: null,
  13. menulist: [{
  14. "id": "1",
  15. "url": "icon-anquanxuncha",
  16. "title": "巡更",
  17. },
  18. {
  19. "id": "2",
  20. "url": "icon-xunjian",
  21. "title": "巡检",
  22. },
  23. ],
  24. mainmodel: {
  25. }
  26. },
  27. onLoad() {
  28. this.getXunchaCount()
  29. this.getXunchaList()
  30. },
  31. getXunchaCount() {
  32. http.post("/system/AppXunchaController/getXunchaCount", null, this.getXunchaCountSuccess)
  33. },
  34. getXunchaCountSuccess(res) {
  35. console.log("@@@@",res)
  36. if(res.code==200){
  37. this.setData({
  38. todayXunchaCount: res.data.xunchaCount.todayXunchaCount,
  39. todayRiskCount: res.data.xunchaCount.todayRiskCount,
  40. todayEnterpriseCount: res.data.xunchaCount.todayEnterpriseCount
  41. })
  42. }
  43. },
  44. getXunchaList() {
  45. let obj = new Object()
  46. obj.pageNum = this.data.pageNum
  47. obj.busEnterpriseName = ""
  48. obj.pageSize = 10
  49. obj.reasonable = true
  50. http.send_get("/system/AppXunchaController/getXunchaList", obj, this.getXunchaListSuccess)
  51. },
  52. getXunchaListSuccess(res) {
  53. console.log("@@@@",res)
  54. if(res.code==200){
  55. this.setData({
  56. xunchaList: res.data.rows
  57. })
  58. }
  59. },
  60. // 搜索结果跳页
  61. bindViewSearchEnd() {
  62. wx.navigateTo({
  63. url: '../xunchawu/xunchawu'
  64. })
  65. },
  66. toBindXunjinaMore(e){
  67. let isrisk = e.currentTarget.dataset.isrisk
  68. let buslogid = e.currentTarget.dataset.buslogid
  69. if(isrisk == 0){
  70. wx.showToast({
  71. title: '没有发现安全隐患,请放心!!',
  72. icon: "none"
  73. })
  74. }else{
  75. console.log(isrisk,"####",buslogid)
  76. wx.navigateTo({
  77. url: '../xunjianmore/xunjianmore?buslogid='+buslogid
  78. })
  79. }
  80. },
  81. menuItemClick: function (res) {
  82. //获取点击事件的信息
  83. let clickInfo = res.detail.iteminfo
  84. //巡更
  85. if(clickInfo.id ==1){
  86. wx.scanCode({
  87. onlyFromCamera: true,
  88. success: (res) => {
  89. wx.navigateTo({
  90. url: '../xungengdetails/xungengdetails?id='+res.result,
  91. })
  92. },
  93. fail: (res) => {
  94. // console.log(res);
  95. // wx.showToast({
  96. // title: '扫描失败',
  97. // icon:'none'
  98. // })
  99. }
  100. })
  101. }else if(clickInfo.id==2){
  102. //企业 巡检
  103. wx.navigateTo({
  104. url: '../search/search',
  105. })
  106. }
  107. // 根据不同类型进行判别处理
  108. //事件的处理 代码
  109. }
  110. })