xuncha.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. this.setData({
  36. todayXunchaCount: res.xunchaCount.todayXunchaCount,
  37. todayRiskCount: res.xunchaCount.todayRiskCount,
  38. todayEnterpriseCount: res.xunchaCount.todayEnterpriseCount
  39. })
  40. },
  41. getXunchaList() {
  42. http.post("/system/AppXunchaController/getXunchaList", null, this.getXunchaListSuccess)
  43. },
  44. getXunchaListSuccess(res) {
  45. this.setData({
  46. xunchaList: res.rows
  47. })
  48. },
  49. // 搜索结果跳页
  50. bindViewSearchEnd() {
  51. wx.navigateTo({
  52. url: '../xunchawu/xunchawu'
  53. })
  54. },
  55. toBindXunjinaMore(e){
  56. let isrisk = e.currentTarget.dataset.isrisk
  57. let buslogid = e.currentTarget.dataset.buslogid
  58. if(isrisk == 0){
  59. wx.showToast({
  60. title: '没有发现安全隐患,请放心!!',
  61. icon: "none"
  62. })
  63. }else{
  64. console.log(isrisk,"####",buslogid)
  65. wx.navigateTo({
  66. url: '../xunjianmore/xunjianmore?buslogid='+buslogid
  67. })
  68. }
  69. },
  70. menuItemClick: function (res) {
  71. //获取点击事件的信息
  72. let clickInfo = res.detail.iteminfo
  73. if(clickInfo.id ==2){
  74. //巡检
  75. wx.navigateTo({
  76. url: '../search/search',
  77. })
  78. }
  79. // 根据不同类型进行判别处理
  80. //事件的处理 代码
  81. }
  82. })