xuncha.js 2.8 KB

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