xuncha.js 2.5 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. if(res.code==200){
  36. this.setData({
  37. todayXunchaCount: res.data.xunchaCount.todayXunchaCount,
  38. todayRiskCount: res.data.xunchaCount.todayRiskCount,
  39. todayEnterpriseCount: res.data.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. if(res.code==200){
  53. this.setData({
  54. xunchaList: res.data.rows
  55. })
  56. }
  57. },
  58. // 搜索结果跳页
  59. bindViewSearchEnd() {
  60. wx.navigateTo({
  61. url: '../xunchawu/xunchawu'
  62. })
  63. },
  64. toBindXunjinaMore(e){
  65. let isrisk = e.currentTarget.dataset.isrisk
  66. let buslogid = e.currentTarget.dataset.buslogid
  67. if(isrisk == 0){
  68. wx.showToast({
  69. title: '没有发现安全隐患,请放心!!',
  70. icon: "none"
  71. })
  72. }else{
  73. wx.navigateTo({
  74. url: '../xunjianmore/xunjianmore?buslogid='+buslogid
  75. })
  76. }
  77. },
  78. menuItemClick: function (res) {
  79. //获取点击事件的信息
  80. let clickInfo = res.detail.iteminfo
  81. //巡更
  82. if(clickInfo.id ==1){
  83. wx.scanCode({
  84. onlyFromCamera: true,
  85. success: (res) => {
  86. wx.navigateTo({
  87. url: '../xungengdetails/xungengdetails?id='+res.result,
  88. })
  89. },
  90. fail: (res) => {
  91. // console.log(res);
  92. // wx.showToast({
  93. // title: '扫描失败',
  94. // icon:'none'
  95. // })
  96. }
  97. })
  98. }else if(clickInfo.id==2){
  99. //企业 巡检
  100. wx.navigateTo({
  101. url: '../search/search',
  102. })
  103. }
  104. // 根据不同类型进行判别处理
  105. //事件的处理 代码
  106. }
  107. })