xuncha.js 2.2 KB

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