Slow.vue 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="page_patientManagement">
  3. <div class="patientBox" v-if="patients.length > 0">
  4. <van-list
  5. v-model="loading"
  6. :finished="finished"
  7. finished-text="没有更多了"
  8. @load="onLoad"
  9. >
  10. <div class="patientMain">
  11. <div
  12. class="patientOne"
  13. v-for="(item, index) in patients"
  14. :key="index"
  15. @click="toPatientDetail(item.id)"
  16. >
  17. <img :src="item.avatar" alt />
  18. <p>{{ item.name }}</p>
  19. </div>
  20. </div>
  21. </van-list>
  22. </div>
  23. <div class="noData" v-else>
  24. <img src="../../../assets/images/none.png" alt />
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import { getAllSlowPatient, getSlowSearchPatient } from "@/api/patient/patient";
  30. export default {
  31. props: {
  32. searchValue: String
  33. },
  34. props: {
  35. seacherActive: Number
  36. },
  37. data() {
  38. return {
  39. loading: false,
  40. finished: false,
  41. limit: 10,
  42. page: 1,
  43. total: 0,
  44. patients: [],
  45. list: []
  46. };
  47. },
  48. methods: {
  49. getAllSlowPatient() {
  50. getAllSlowPatient(this.page, this.limit).then(response => {
  51. if (response.data.state === 1) {
  52. var patients = response.data.data.slowpatient;
  53. let arr = this.patients;
  54. arr.push(...patients);
  55. this.patients = arr;
  56. var total = response.data.data.total;
  57. this.total = total;
  58. }
  59. });
  60. },
  61. onLoad() {
  62. setTimeout(() => {
  63. for (let i = 0; i < this.limit; i++) {
  64. this.list.push(this.list.length + 1);
  65. }
  66. // 加载状态结束
  67. this.loading = false;
  68. if (this.patients.length > 10) {
  69. this.page++;
  70. }
  71. this.getAllSlowPatient(this.page, this.limit);
  72. // 数据全部加载完成
  73. if (this.list.length >= this.total) {
  74. this.finished = true;
  75. }
  76. }, 1000);
  77. },
  78. toPatientDetail(id) {
  79. this.$router.push(
  80. "/patientdetail?patientid=" +
  81. id +
  82. "&seacherActive=" +
  83. this.seacherActive
  84. );
  85. },
  86. getSlowSearchPatient(val) {
  87. getSlowSearchPatient(val).then(response => {
  88. if (response.data.state === 1) {
  89. var slowpatient = response.data.data.slowPatient;
  90. this.patients = slowpatient;
  91. }
  92. });
  93. }
  94. },
  95. created() {
  96. if (this.searchValue) {
  97. this.getSlowSearchPatient(this.searchValue);
  98. } else {
  99. this.getAllSlowPatient();
  100. }
  101. },
  102. watch: {
  103. searchValue(newVal) {
  104. this.getSlowSearchPatient(newVal);
  105. }
  106. }
  107. };
  108. </script>
  109. <style lang="scss" scoped>
  110. .page_patientManagement {
  111. overflow-y: auto;
  112. height: 100%;
  113. background: #fff;
  114. .patientManagementTitle {
  115. background: #fff;
  116. padding: 0 1.125rem;
  117. height: 3.125rem;
  118. display: flex;
  119. align-items: center;
  120. justify-content: space-between;
  121. }
  122. .jiantou {
  123. font-size: 1.5rem;
  124. font-weight: 600;
  125. margin-right: 3rem;
  126. }
  127. .titleName {
  128. font-size: 1.125rem;
  129. font-weight: 600;
  130. }
  131. .iconBox {
  132. display: flex;
  133. align-items: center;
  134. float: right;
  135. }
  136. .iconOne {
  137. font-size: 1.5rem;
  138. }
  139. .add {
  140. margin-left: 1.25rem;
  141. }
  142. .toolBox {
  143. display: flex;
  144. height: 3.125rem;
  145. align-items: center;
  146. .toolOne {
  147. width: 5.625rem;
  148. height: 1.875rem;
  149. background: rgba(246, 246, 246, 1);
  150. border-radius: 5px;
  151. text-align: center;
  152. font-size: 0.8125rem;
  153. color: #8d8d8d;
  154. display: flex;
  155. align-items: center;
  156. justify-content: space-around;
  157. margin-left: 0.875rem;
  158. }
  159. }
  160. .van-dropdown-menu__title {
  161. width: 5.625rem;
  162. height: 1.875rem;
  163. line-height: 1.875rem;
  164. background: rgba(246, 246, 246, 1);
  165. border-radius: 5px;
  166. color: #8d8d8d;
  167. font-size: 0.875rem;
  168. }
  169. .van-dropdown-menu__title::after {
  170. right: 0.5rem;
  171. }
  172. .patientBox {
  173. padding: 0 0.875rem;
  174. .patientMain{
  175. >div:last-child{
  176. border: none;
  177. }
  178. }
  179. .patientOne {
  180. display: flex;
  181. align-items: center;
  182. height: 3.75rem;
  183. font-size: 1rem;
  184. border-bottom: 1px solid #e5e5e5;
  185. img {
  186. width: 2.5rem;
  187. height: 2.5rem;
  188. margin-right: 0.875rem;
  189. }
  190. }
  191. }
  192. .noData {
  193. width: 9.375rem;
  194. height: 9.375rem;
  195. position: fixed;
  196. left: 50%;
  197. top: 50%;
  198. transform: translate(-50%, -50%);
  199. img {
  200. width: 100%;
  201. height: 100%;
  202. }
  203. }
  204. }
  205. ::-webkit-scrollbar {
  206. width: 0;
  207. }
  208. </style>
  209. <style lang="scss">
  210. .page_patientManagement {
  211. .searchBox {
  212. .van-cell__value {
  213. display: flex;
  214. align-items: center;
  215. }
  216. .van-field__body {
  217. width: 100%;
  218. }
  219. }
  220. }
  221. </style>