list.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="main">
  3. <view class="top">
  4. <view class="nameBox">
  5. <view class="name">{{param.patientName}}</view>
  6. <text class="icon arrow" style="margin-left: 10px;">&#xeb73;</text>
  7. <view class="change" @click="go('/pages/visit/doctor/selectUser')">切换就诊人</view>
  8. </view>
  9. <view class="cardNum">{{param.cardId}}</view>
  10. <view style="display: flex;text-align: center;margin: 5px;padding: 13px;font-size: 13px;"
  11. @click="calendar = true">
  12. <input placeholder="点击选择时间" :disabled="true" v-model="startTime" type="select" />
  13. <view>至</view>
  14. <input placeholder="点击选择时间" :disabled="true" v-model="endTime" type="select" />
  15. </view>
  16. </view>
  17. <view class="tab">
  18. <u-tabs :list="tab" :current="current" keyName="label" @click="click"></u-tabs>
  19. </view>
  20. <view class="content">
  21. <view class="list">
  22. <view class="item" v-for="(item, index) in list" @click="go(`/pages/visit/doctor/detail?cardId=${param.cardId}&patientName=${param.patientName}&id=${item.id}`)">
  23. <view class="title omit">{{ item.department }}</view>
  24. <view class="time">{{ item.admissionTime }}</view>
  25. </view>
  26. </view>
  27. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  28. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  29. </view>
  30. <u-calendar :show="calendar" monthNum="120" mode="range" :maxDate="util.getDate()" minDate="2020-01-01"
  31. @confirm="confirm" @close="close()" :closeOnClickOverlay="true"></u-calendar>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. userList: [],
  39. current: 0,
  40. time: null,
  41. tab: [{
  42. label: '就诊记录'
  43. }, ],
  44. startTime: null,
  45. endTime: null,
  46. list: [],
  47. param: {
  48. // pageNum: 1,
  49. // pageSize: 10,
  50. cardId:null,
  51. patientName:null,
  52. },
  53. loadMore: true,
  54. calendar: false,
  55. user:{},
  56. }
  57. },
  58. onLoad(e) {
  59. console.log(e);
  60. this.setDefTime()
  61. this.param.cardId = e.cardId
  62. this.param.patientName = e.patientName
  63. this.getData();
  64. },
  65. methods: {
  66. groupChange(n) {
  67. uni.showModal({
  68. title: '提示',
  69. content: '确定切换就诊人',
  70. success: (res) => {
  71. if (res.confirm) {
  72. this.http.request({
  73. url: '/app/user/bind/change/' + n.id,
  74. success: (res) => {
  75. this.param.patientName = n.patientName
  76. this.param.cardId = n.cardId
  77. this.closePopup()
  78. this.refresh()
  79. }
  80. });
  81. }
  82. }
  83. });
  84. },
  85. setDefTime() {
  86. const today = new Date();
  87. const todayYear = today.getFullYear()
  88. const todayMonth = (today.getMonth() + 1) < 10 ? "0" + (today.getMonth() + 1) : (today.getMonth() + 1)
  89. const todayDay = today.getDate() < 10 ? "0" + today.getDate() : today.getDate()
  90. this.param.endTime = todayYear + todayMonth + todayDay
  91. this.endTime = todayYear + '-' + todayMonth + '-' + todayDay
  92. let beforeTime = new Date(today.getTime() - 24 * 60 * 60 * 1000 * 30);
  93. //一个月前
  94. let beforeTimeYear = beforeTime.getFullYear();
  95. let beforeTimeMonth = beforeTime.getMonth() + 1;
  96. let beforeTimeDay = beforeTime.getDate();
  97. beforeTimeMonth = beforeTimeMonth < 10 ? "0" + beforeTimeMonth : beforeTimeMonth;
  98. beforeTimeDay = beforeTimeDay < 10 ? "0" + beforeTimeDay : beforeTimeDay;
  99. this.param.startTime = beforeTimeYear + beforeTimeMonth + beforeTimeDay
  100. this.startTime = beforeTimeYear + "-" + beforeTimeMonth + "-" + beforeTimeDay
  101. },
  102. confirm(e) {
  103. this.calendar = false;
  104. this.param.startTime = e[0].replace(/-/g, '');;
  105. this.param.endTime = e[e.length - 1].replace(/-/g, '');;
  106. this.startTime = e[0]
  107. this.endTime = e[e.length - 1]
  108. this.refresh();
  109. },
  110. close() {
  111. this.calendar = false;
  112. },
  113. getData() {
  114. console.log(this.param.cardId);
  115. this.http.request({
  116. url: '/work/visit/list?cardId=' + this.param.cardId,
  117. data:this.param,
  118. success: (res) => {
  119. this.list = res.data.rows
  120. this.loadMore = false
  121. //暂时没有分页
  122. // this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  123. // this.list.push(...res.data.rows);
  124. }
  125. });
  126. },
  127. click(e) {
  128. this.current = e.index;
  129. this.param.type = e.dictValue;
  130. this.refresh();
  131. },
  132. selectTime(e) {
  133. console.log(e);
  134. },
  135. go(url) {
  136. uni.navigateTo({
  137. url: url
  138. });
  139. },
  140. //刷新数据
  141. refresh() {
  142. this.loadMore = true;
  143. // this.param.pageNum = 1;
  144. this.list = [];
  145. this.getData();
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss">
  151. .top {
  152. padding: 15px;
  153. background-color: white;
  154. border-radius: 8px;
  155. .nameBox {
  156. display: flex;
  157. align-items: center;
  158. .name {
  159. font-weight: bold;
  160. font-size: 16px;
  161. }
  162. .change {
  163. color: royalblue;
  164. margin-left: 20px;
  165. }
  166. }
  167. .cardNum {
  168. padding-top: 10px;
  169. font-size: 14px;
  170. }
  171. }
  172. .content {
  173. padding: 15px;
  174. background-color: white;
  175. border-radius: 8px;
  176. .list {
  177. .item {
  178. overflow: hidden;
  179. padding: 13px 0;
  180. border-bottom: 1px solid $line;
  181. margin-bottom: 10px;
  182. .title {
  183. font-size: 18px;
  184. font-weight: bold;
  185. }
  186. .time {
  187. font-size: 14px;
  188. padding-top: 15px;
  189. color: $font-c;
  190. }
  191. }
  192. }
  193. }
  194. .userChangeTitle {
  195. display: flex;
  196. justify-content: center;
  197. align-items: center;
  198. height: 48px;
  199. font-weight: bold;
  200. }
  201. .userChangeItem {
  202. width: 100%;
  203. .userChangeItemName {
  204. padding: 5px 10px;
  205. }
  206. .userChangeCartNo {
  207. padding: 5px 10px;
  208. }
  209. }
  210. </style>