report.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. wx.navigateTo({
  69. url: '/pages/reportDetail/reportDetail?reportid=' + reportId
  70. })
  71. },
  72. // 获取用户档案信息
  73. getDocumentList () {
  74. var that = this
  75. wx.showLoading({
  76. title: '加载中...',
  77. mask: true
  78. })
  79. documentList({
  80. currentPage: 1
  81. }).then(res => {
  82. wx.hideLoading()
  83. const response = res.data.vos || []
  84. if (response.length == 0) {
  85. wx.showModal({
  86. content: '预约用户前需要先添加检测人员信息',
  87. cancelColor: '#666',
  88. confirmColor: '#333',
  89. success (res) {
  90. if (res.confirm) {
  91. wx.navigateTo({
  92. url: '/pages/createFile/createFile?from=index'
  93. })
  94. }
  95. }
  96. })
  97. } else {
  98. wx.navigateTo({
  99. url: '/pages/appointment/appointment',
  100. })
  101. }
  102. }).catch(e => {
  103. wx.hideLoading()
  104. wx.showModal({
  105. content: e,
  106. confirmColor: '#333',
  107. showCancel: false
  108. })
  109. })
  110. }
  111. })