xuncha.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. let enterpriseId=e.currentTarget.dataset.busenterpriseid;
  68. if(isrisk == 0){
  69. wx.showToast({
  70. title: '没有发现安全隐患,请放心!!',
  71. icon: "none"
  72. })
  73. }else{
  74. wx.navigateTo({
  75. url: '../xunjianmore/xunjianmore?buslogid='+buslogid+'&busEnterpriseId='+enterpriseId
  76. })
  77. }
  78. },
  79. menuItemClick: function (res) {
  80. //获取点击事件的信息
  81. let clickInfo = res.detail.iteminfo
  82. //巡更
  83. if(clickInfo.id ==1){
  84. wx.scanCode({
  85. onlyFromCamera: true,
  86. success: (res) => {
  87. wx.navigateTo({
  88. url: '../xungengdetails/xungengdetails?id='+res.result,
  89. })
  90. },
  91. fail: (res) => {
  92. // console.log(res);
  93. // wx.showToast({
  94. // title: '扫描失败',
  95. // icon:'none'
  96. // })
  97. }
  98. })
  99. }else if(clickInfo.id==2){
  100. //企业 巡检
  101. wx.navigateTo({
  102. url: '../search/search',
  103. })
  104. }
  105. // 根据不同类型进行判别处理
  106. //事件的处理 代码
  107. }
  108. })