index.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. const _my = require("../../../__antmove/api/index.js")(my);
  2. const wx = _my;
  3. // pages/wx_airport/Xiaosha_registration/index.js
  4. var util = require("../../../utils/util");
  5. const {
  6. disinfectScanQrcode,
  7. disinfectCommit
  8. } = require("../../../utils/api/xiaosha");
  9. Page({
  10. /**
  11. * 页面的初始数据
  12. */
  13. data: {
  14. userInfo: wx.getStorageSync("userInfo"),
  15. disinfectAreaId: null,
  16. //消杀时间id
  17. timeBreak: null,
  18. //消杀时间val
  19. headerData: null,
  20. status: "2",
  21. //消杀状态
  22. disinfectTimeBreakId: null,
  23. disinfectRemarks: null
  24. },
  25. // 重新扫码
  26. goQrcode() {
  27. wx.navigateTo({
  28. url: "/pages/wx_airport/Xiaosha_registration/scan_code/index"
  29. });
  30. },
  31. // 消杀状态
  32. onChange(event) {
  33. this.setData({
  34. status: event.detail
  35. });
  36. },
  37. // 下拉-消杀时间
  38. getTime(e) {
  39. let {
  40. disinfectAreaTimeVOList
  41. } = this.data.headerData;
  42. this.setData({
  43. timeBreak: disinfectAreaTimeVOList[e.detail.value].timeBreak,
  44. disinfectTimeBreakId: disinfectAreaTimeVOList[e.detail.value].disinfectAreaTimeId
  45. });
  46. },
  47. // 备注
  48. problemDetailFun(e) {
  49. this.setData({
  50. disinfectRemarks: e.detail.value
  51. });
  52. },
  53. // 上报
  54. report() {
  55. let {
  56. status,
  57. disinfectTimeBreakId,
  58. disinfectRemarks,
  59. userInfo,
  60. disinfectAreaId
  61. } = this.data;
  62. if (status == 2 && disinfectTimeBreakId && !disinfectRemarks) {
  63. wx.showToast({
  64. title: "标红内容不能为空",
  65. icon: "none"
  66. });
  67. return;
  68. }
  69. let data = {
  70. status,
  71. adminId: userInfo.orgId,
  72. userId: userInfo.userId,
  73. disinfectAreaId,
  74. disinfectRemarks,
  75. disinfectTimeBreakId
  76. };
  77. disinfectCommit(data).then(res => {
  78. if (res.code === 200) {
  79. my.alert({
  80. title: "提示",
  81. content: "上报成功!",
  82. success: res => {
  83. wx.navigateTo({
  84. url: "/pages/wx_airport/rlxf_pass/rlxf_pass?orgId=" + userInfo.orgId
  85. });
  86. }
  87. });
  88. } else {
  89. wx.showToast({
  90. title: res.msg,
  91. icon: "none"
  92. });
  93. }
  94. });
  95. },
  96. // 获取顶部信息
  97. getMsg() {
  98. let data = {
  99. adminId: this.data.userInfo.orgId,
  100. userId: this.data.userInfo.userId,
  101. disinfectAreaId: this.data.disinfectAreaId
  102. };
  103. console.log(data);
  104. disinfectScanQrcode(data).then(res => {
  105. if (res.code === 200) {
  106. if (res.data.waitDisinfectPipei) {
  107. let index = res.data.disinfectAreaTimeVOList.findIndex(item => {
  108. return item.timeBreak === res.data.waitDisinfectPipei;
  109. });
  110. this.setData({
  111. timeBreak: res.data.disinfectAreaTimeVOList[index].timeBreak,
  112. disinfectTimeBreakId: res.data.disinfectAreaTimeVOList[index].disinfectAreaTimeId
  113. });
  114. }
  115. this.setData({
  116. headerData: res.data
  117. });
  118. } else {
  119. wx.showToast({
  120. title: res.msg,
  121. icon: "none"
  122. });
  123. }
  124. });
  125. },
  126. /**
  127. * 生命周期函数--监听页面加载
  128. */
  129. onLoad(options) {
  130. if (options) {
  131. this.setData({
  132. disinfectAreaId: options.disinfectAreaId
  133. });
  134. }
  135. this.getMsg();
  136. },
  137. /**
  138. * 生命周期函数--监听页面初次渲染完成
  139. */
  140. onReady() {},
  141. /**
  142. * 生命周期函数--监听页面显示
  143. */
  144. onShow() {},
  145. /**
  146. * 生命周期函数--监听页面隐藏
  147. */
  148. onHide() {},
  149. /**
  150. * 生命周期函数--监听页面卸载
  151. */
  152. onUnload() {},
  153. /**
  154. * 页面相关事件处理函数--监听用户下拉动作
  155. */
  156. onPullDownRefresh() {},
  157. /**
  158. * 页面上拉触底事件的处理函数
  159. */
  160. onReachBottom() {},
  161. /**
  162. * 用户点击右上角分享
  163. */
  164. onShareAppMessage() {},
  165. antmoveAction: function () {
  166. //执行时动态赋值,请勿删除
  167. }
  168. });