index.js 2.4 KB

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