xuncha.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. },
  29. onShow(){
  30. this.getXunchaCount()
  31. this.getXunchaList()
  32. },
  33. getXunchaCount() {
  34. http.post("/system/AppXunchaController/getXunchaCount", null, this.getXunchaCountSuccess)
  35. },
  36. getXunchaCountSuccess(res) {
  37. if(res.code==200){
  38. this.setData({
  39. todayXunchaCount: res.data.xunchaCount.todayXunchaCount,
  40. todayRiskCount: res.data.xunchaCount.todayRiskCount,
  41. todayEnterpriseCount: res.data.xunchaCount.todayEnterpriseCount
  42. })
  43. }
  44. },
  45. getXunchaList() {
  46. let obj = new Object()
  47. obj.pageNum = this.data.pageNum
  48. obj.busEnterpriseName = ""
  49. obj.pageSize = 10
  50. obj.reasonable = true
  51. http.send_get("/system/AppXunchaController/getXunchaList", obj, this.getXunchaListSuccess)
  52. },
  53. getXunchaListSuccess(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. let enterpriseId=e.currentTarget.dataset.busenterpriseid;
  70. if(isrisk == 0){
  71. wx.showToast({
  72. title: '没有发现安全隐患,请放心!!',
  73. icon: "none"
  74. })
  75. }else{
  76. wx.navigateTo({
  77. url: '../xunjianmore/xunjianmore?buslogid='+buslogid+'&busEnterpriseId='+enterpriseId
  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. })