index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. const {
  2. disinfectList,
  3. disinfectRemind
  4. } = require('../../../utils/api/xiaosha');
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. list: [],
  11. userInfo: wx.getStorageSync('userInfo'),
  12. disinfectAreaName: '', //搜索区域名称
  13. checkAuth: false,
  14. },
  15. // 获取搜索框
  16. getVaule(e) {
  17. this.setData({
  18. disinfectAreaName: e.detail.value
  19. })
  20. },
  21. // 获取数据
  22. getList() {
  23. let {
  24. userInfo,
  25. disinfectAreaName
  26. } = this.data
  27. let data = {
  28. adminId: userInfo.orgId,
  29. disinfectAreaName,
  30. userId: userInfo.userId,
  31. }
  32. disinfectList(data).then(res => {
  33. this.setData({
  34. list: res.data
  35. })
  36. })
  37. },
  38. // 提醒消杀
  39. remindFun(event) {
  40. let {
  41. userInfo,
  42. list
  43. } = this.data
  44. console.log(list[event.target.dataset.index].disinfectAreaId);
  45. let data = {
  46. adminId: userInfo.orgId,
  47. disinfectAreaId: list[event.target.dataset.index].disinfectAreaId,
  48. userId: userInfo.userId,
  49. }
  50. disinfectRemind(data).then(res => {
  51. if (res.code == 200) {
  52. wx.showModal({
  53. title: '提示',
  54. content: res.data,
  55. showCancel: false,
  56. })
  57. } else {
  58. wx.showToast({
  59. title: res.msg,
  60. icon: 'none'
  61. })
  62. }
  63. })
  64. },
  65. // 跳转详情页/编辑页
  66. gotoFun(e) {
  67. let item = e.currentTarget.dataset.item
  68. let type = e.currentTarget.dataset.type
  69. wx.navigateTo({
  70. url: `/pages/wx_airport/Xiaosha_record/${type}/inidex?item=${JSON.stringify(item)}`
  71. })
  72. },
  73. /**
  74. * 生命周期函数--监听页面加载
  75. */
  76. onLoad(options) {
  77. console.log(options);
  78. if (options) {
  79. this.setData({
  80. checkAuth: JSON.parse(options.checkAuth)
  81. })
  82. }
  83. },
  84. /**
  85. * 生命周期函数--监听页面初次渲染完成
  86. */
  87. onReady() {
  88. },
  89. /**
  90. * 生命周期函数--监听页面显示
  91. */
  92. onShow() {
  93. this.getList()
  94. },
  95. /**
  96. * 生命周期函数--监听页面隐藏
  97. */
  98. onHide() {
  99. },
  100. /**
  101. * 生命周期函数--监听页面卸载
  102. */
  103. onUnload() {
  104. },
  105. /**
  106. * 页面相关事件处理函数--监听用户下拉动作
  107. */
  108. onPullDownRefresh() {
  109. },
  110. /**
  111. * 页面上拉触底事件的处理函数
  112. */
  113. onReachBottom() {
  114. },
  115. /**
  116. * 用户点击右上角分享
  117. */
  118. onShareAppMessage() {
  119. }
  120. })