methods.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import Apis from '@/common/apis/index'
  2. let isOver = false
  3. export default {
  4. // 获取已绑定人
  5. async initData() {
  6. try {
  7. uni.showLoading({
  8. title: '加载中...'
  9. })
  10. const res = await Apis.GetAssociation()
  11. if (!res.data.length) {
  12. this.userList = []
  13. this.currentPatient = ''
  14. return uni.hideLoading()
  15. }
  16. this.userList = res.data
  17. this.initHealthReport()
  18. } catch (e) {
  19. //TODO handle the exception
  20. }
  21. },
  22. // 获取报告
  23. async initHealthReport() {
  24. try {
  25. if (this.$store.state.counter.currentPatient) {
  26. this.currentPatient = this.$store.state.counter.currentPatient;
  27. } else {
  28. this.currentPatient = this.userList.length ? this.userList[0] : ''
  29. }
  30. if (!this.currentPatient) return
  31. this.dateIndex = 0
  32. const res = await Apis.GetHealthReport({
  33. id: this.currentPatient.id
  34. })
  35. // res.data.forEach((v) => {
  36. // v.date = v.time && v.time.split(' ')[0]
  37. // })
  38. this.currentPatient = {
  39. ...this.currentPatient,
  40. ...res.data[0]
  41. }
  42. this.data = res.data
  43. uni.hideLoading()
  44. } catch (e) {
  45. //TODO handle the exception
  46. }
  47. },
  48. onEnterPage(page, val) {
  49. if (!this.userInfo) {
  50. return uni.navigateTo({
  51. url: '../login/index'
  52. })
  53. }
  54. switch (page) {
  55. case 'addPatient':
  56. uni.navigateTo({
  57. url: '../addPatient/index'
  58. })
  59. break
  60. case 'chart':
  61. uni.navigateTo({
  62. url: '../chart/index?id=' + val
  63. })
  64. break
  65. }
  66. },
  67. bindLookMemo(name) {
  68. this.popupData.title = name
  69. this.popupData.img = ''
  70. switch (name) {
  71. case '球镜':
  72. this.popupData.content =
  73. '球镜(S)代表近视或者远视的度数,单位为屈光度(D),其屈光力大小在各个方向相同。当球镜符号为(﹣)时代表近视,符号为(+)时代表远视。医学上用于记录的方式与我们生活中所说的眼镜度数略有不同,-3.00DS代表“300度近视”,而+2.50DS则代表“250度远视”。'
  74. break
  75. case '柱镜':
  76. this.popupData.content =
  77. '柱镜(C)表示散光的度数,单位为屈光度(D),散光是指眼睛在不同方向上的屈光力并不相同,使外界的平行光线进入眼睛后不能形成一个焦点,此时需要通过柱镜进行矫正。当柱镜符号为(﹣)时代表近视散光,符号为(+)时代表远视散光。如-0.50DC代表“50度近视散光”,+0.75DC代表“75度远视散光”。'
  78. break
  79. case '轴位':
  80. this.popupData.content =
  81. '轴位(A)代表柱镜所在轴的方向。当眼睛存在散光时,需要通过柱镜对屈光状态进行矫正,此时精确验配柱镜的轴位可以良好的改善视觉效果,如果眼镜散光轴位验配误差较大,则有可能导致镜片适应不良、视物变形、头晕甚至呕吐。'
  82. break
  83. }
  84. this.$refs.popupShow.open()
  85. },
  86. bindChangeDate(item, index) {
  87. this.dateIndex = index
  88. this.scrollView = 'bl' + item.code
  89. this.currentPatient = {
  90. ...this.currentPatient,
  91. ...item
  92. }
  93. },
  94. async bindChangeTag(data) {
  95. if (data.tag) return
  96. try {
  97. uni.showLoading({
  98. title: '更新中...'
  99. })
  100. data.tag = 1
  101. await Apis.PostInspectionReportStatus({
  102. code: data.code
  103. })
  104. uni.navigateTo({
  105. url: '../webview/index?img=screening_check_1.jpg'
  106. })
  107. } catch (err) {
  108. data.tag = 0
  109. console.error(err)
  110. }
  111. },
  112. // 打开切换学生弹窗
  113. bindOpenUserPopup() {
  114. this.$refs.userPopup.open()
  115. },
  116. // 切换学生
  117. bindChangeUser(event) {
  118. this.userValue = event.detail.value
  119. },
  120. // 滑动开始
  121. bindPickStartUser() {
  122. isOver = true
  123. },
  124. // 滑动结束
  125. bindPickEndUser() {
  126. isOver = false
  127. },
  128. // 确认选择学生
  129. bindConfirmUser() {
  130. if (isOver) return
  131. uni.showLoading({
  132. title: '加载中...'
  133. })
  134. this.currentPatient = this.userList.length ? this.userList[this.userValue[0]] : null
  135. this.$store.commit('SET_CURRENT_PATIENT', this.currentPatient)
  136. this.initHealthReport();
  137. this.$refs.userPopup.close()
  138. },
  139. bindScrollPage(event) {
  140. var scrollfx = event.detail.deltaY;
  141. if (scrollfx < 0) {
  142. // 向下滑动
  143. this.scrollBottom = true
  144. } else {
  145. // 向上滑动
  146. this.scrollBottom = false
  147. }
  148. },
  149. bindContact() {
  150. this.$refs.popupKfShow.open()
  151. // wx.openCustomerServiceChat({
  152. // extInfo: {
  153. // url: 'https://work.weixin.qq.com/kfid/kfce39316a3339975af'
  154. // },
  155. // corpId: 'wwb7c792b57c03f17b',
  156. // complete(res) {
  157. // console.log(res)
  158. // }
  159. // })
  160. }
  161. }