report.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // pages/report/report.js
  2. import { myReportList } from '../../api/my'
  3. import { documentList } from "../../api/document";
  4. const app = getApp()
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. reportList: [],
  11. showPage: true
  12. },
  13. /**
  14. * 生命周期函数--监听页面显示
  15. */
  16. onShow() {
  17. app.globalData.selectedInex = 1
  18. this.getMyReportList()
  19. },
  20. // 我的报告
  21. getMyReportList () {
  22. var that = this
  23. wx.showLoading({
  24. title: '加载中...',
  25. mask: true
  26. })
  27. myReportList({}).then(res => {
  28. wx.hideLoading()
  29. var response = res.data || []
  30. that.setData({
  31. reportList: response
  32. })
  33. }).catch(e => {
  34. wx.hideLoading()
  35. wx.showModal({
  36. content: e,
  37. confirmColor: '#333',
  38. showCancel: false
  39. })
  40. })
  41. },
  42. /**
  43. * 立即预约
  44. */
  45. handleAppoint() {
  46. this.getDocumentList()
  47. },
  48. /**
  49. * 生命周期函数--监听页面卸载
  50. */
  51. onUnload() {
  52. },
  53. /**
  54. * 页面相关事件处理函数--监听用户下拉动作
  55. */
  56. onPullDownRefresh() {
  57. },
  58. /**
  59. * 页面上拉触底事件的处理函数
  60. */
  61. onReachBottom() {
  62. },
  63. /**
  64. * 点击报告进入详情
  65. */
  66. handleDetail(e) {
  67. var reportId = e.currentTarget.dataset.reportid
  68. var realName = e.currentTarget.dataset.realname
  69. var addTime = e.currentTarget.dataset.addtime
  70. wx.navigateTo({
  71. url: '/pages/reportDetail/reportDetail?reportid=' + reportId + '&realName=' + realName + '&addTime=' + addTime
  72. })
  73. },
  74. // 获取用户档案信息
  75. getDocumentList () {
  76. var that = this
  77. wx.showLoading({
  78. title: '加载中...',
  79. mask: true
  80. })
  81. documentList({
  82. currentPage: 1
  83. }).then(res => {
  84. wx.hideLoading()
  85. const response = res.data.vos || []
  86. if (response.length == 0) {
  87. wx.showModal({
  88. content: '预约用户前需要先添加检测人员信息',
  89. cancelColor: '#666',
  90. confirmColor: '#333',
  91. success (res) {
  92. if (res.confirm) {
  93. wx.navigateTo({
  94. url: '/pages/createFile/createFile?from=index'
  95. })
  96. }
  97. }
  98. })
  99. } else {
  100. wx.navigateTo({
  101. url: '/pages/appointment/appointment',
  102. })
  103. }
  104. }).catch(e => {
  105. wx.hideLoading()
  106. wx.showModal({
  107. content: e,
  108. confirmColor: '#333',
  109. showCancel: false
  110. })
  111. })
  112. }
  113. })