xuncha.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. "id": "3",
  25. "url": "icon-yujing",
  26. "title": "预警",
  27. },
  28. ],
  29. // mainmodel: {
  30. // }
  31. },
  32. onLoad() {
  33. },
  34. onShow(){
  35. this.getXunchaCount()
  36. this.getXunchaList()
  37. },
  38. getXunchaCount() {
  39. http.post("/system/AppXunchaController/getXunchaCount", null, this.getXunchaCountSuccess)
  40. },
  41. getXunchaCountSuccess(res) {
  42. if(res.code==200){
  43. this.setData({
  44. todayXunchaCount: res.data.xunchaCount.todayXunchaCount,
  45. todayRiskCount: res.data.xunchaCount.todayRiskCount,
  46. todayEnterpriseCount: res.data.xunchaCount.todayEnterpriseCount
  47. })
  48. }
  49. },
  50. getXunchaList() {
  51. let obj = new Object()
  52. obj.pageNum = this.data.pageNum
  53. obj.busEnterpriseName = ""
  54. obj.pageSize = 10
  55. obj.reasonable = true
  56. http.send_get("/system/AppXunchaController/getXunchaList", obj, this.getXunchaListSuccess)
  57. },
  58. getXunchaListSuccess(res) {
  59. if(res.code==200){
  60. this.setData({
  61. xunchaList: res.data.rows
  62. })
  63. }
  64. },
  65. // 搜索结果跳页
  66. bindViewSearchEnd() {
  67. wx.navigateTo({
  68. url: '../xunchawu/xunchawu'
  69. })
  70. },
  71. toBindXunjinaMore(e){
  72. let isrisk = e.currentTarget.dataset.isrisk
  73. let buslogid = e.currentTarget.dataset.buslogid
  74. let enterpriseId=e.currentTarget.dataset.busenterpriseid;
  75. if(isrisk == 0){
  76. wx.showToast({
  77. title: '没有发现安全隐患,请放心!!',
  78. icon: "none"
  79. })
  80. }else{
  81. wx.navigateTo({
  82. url: '../xunjianmore/xunjianmore?buslogid='+buslogid+'&busEnterpriseId='+enterpriseId
  83. })
  84. }
  85. },
  86. menuItemClick: function (res) {
  87. //获取点击事件的信息
  88. let clickInfo = res.detail.iteminfo
  89. //巡更
  90. if(clickInfo.id ==1){
  91. wx.scanCode({
  92. onlyFromCamera: true,
  93. success: (res) => {
  94. wx.navigateTo({
  95. url: '../xungengdetails/xungengdetails?id='+res.result,
  96. })
  97. },
  98. fail: (res) => {
  99. // console.log(res);
  100. // wx.showToast({
  101. // title: '扫描失败',
  102. // icon:'none'
  103. // })
  104. }
  105. })
  106. }else if(clickInfo.id==2){
  107. //企业 巡检
  108. wx.navigateTo({
  109. url: '../search/search',
  110. })
  111. }else if(clickInfo.id==3){
  112. wx.navigateTo({
  113. url: '../early_warning_list/early_warning_list',
  114. })
  115. }
  116. }
  117. })