Blood.vue 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="page_patientManagement">
  3. <div class="toolBox">
  4. <div class="toolOne" @click="typeShow = true">
  5. <div style="display: flex;align-items: center;">
  6. {{ type }}
  7. <van-icon name="arrow-down" />
  8. </div>
  9. </div>
  10. <div class="toolOne" @click="typeShowOne = true">
  11. <div style="display: flex;align-items: center;">
  12. {{ typeOne }}
  13. <van-icon name="arrow-down" />
  14. </div>
  15. </div>
  16. </div>
  17. <div class="patientBox">
  18. <van-list
  19. v-model="loading"
  20. :finished="finished"
  21. finished-text="没有更多了"
  22. @load="onLoad"
  23. >
  24. <div
  25. class="patientOne"
  26. v-for="(item, index) in patients"
  27. :key="index"
  28. @click="toPatientDetail(item.id)"
  29. >
  30. <img :src="item.avatar" alt />
  31. <p>{{ item.name }}</p>
  32. </div>
  33. </van-list>
  34. </div>
  35. <!-- 弹出层 -->
  36. <div>
  37. <van-popup
  38. v-model="typeShow"
  39. position="bottom"
  40. :style="{ height: '40%' }"
  41. >
  42. <van-picker
  43. show-toolbar
  44. :columns="columns"
  45. @cancel="onCancel"
  46. @confirm="onConfirm"
  47. />
  48. </van-popup>
  49. <van-popup
  50. v-model="typeShowOne"
  51. position="bottom"
  52. :style="{ height: '40%' }"
  53. >
  54. <van-picker
  55. show-toolbar
  56. :columns="columnsOne"
  57. @cancel="onCancelOne"
  58. @confirm="onConfirmOne"
  59. />
  60. </van-popup>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import {
  66. getAllBloodDialysisPatient,
  67. SearchAllBlood
  68. } from "@/api/patient/patient";
  69. export default {
  70. props: {
  71. searchValue: String
  72. },
  73. props: {
  74. seacherActive: Number
  75. },
  76. data() {
  77. return {
  78. value: "",
  79. typeShow: false,
  80. typeShowOne: false,
  81. startShow: false,
  82. endShow: false,
  83. type: "归转状态",
  84. typeOne: "患者来源",
  85. columns: ["留治", "转出"],
  86. columnsOne: ["门诊", "住院"],
  87. searchVal: "",
  88. active: 0,
  89. list: [],
  90. loading: false,
  91. finished: false,
  92. page: 1,
  93. limit: 10,
  94. total: 0,
  95. value1: 0,
  96. value2: "a",
  97. value3: "a",
  98. option1: [
  99. { text: "患者类型", value: 0 },
  100. { text: "新款商品新款商品新款商品", value: 1 },
  101. { text: "活动商品", value: 2 }
  102. ],
  103. option2: [
  104. { text: "转规状态", value: "a" },
  105. { text: "好评排序", value: "b" },
  106. { text: "销量排序", value: "c" }
  107. ],
  108. option3: [
  109. { text: "患者来源", value: "a" },
  110. { text: "好评排序", value: "b" },
  111. { text: "销量排序", value: "c" }
  112. ],
  113. list: [],
  114. loading: false,
  115. finished: false,
  116. patients: [],
  117. form: {
  118. transfer_status: 0,
  119. patients_source: 0
  120. }
  121. };
  122. },
  123. methods: {
  124. onCancel(value) {
  125. this.typeShow = false;
  126. },
  127. onConfirm(value) {
  128. this.page = 1;
  129. if (value === "留治") {
  130. this.form.transfer_status = 1;
  131. this.type = value;
  132. this.typeShow = false;
  133. this.patients = [];
  134. this.getAllBloodDialysisPatient(
  135. this.page,
  136. this.limit,
  137. this.form.transfer_status,
  138. this.form.patients_source
  139. );
  140. }
  141. if (value === "转出") {
  142. this.form.transfer_status = 2;
  143. this.type = value;
  144. this.typeShow = false;
  145. this.patients = [];
  146. this.getAllBloodDialysisPatient(
  147. this.page,
  148. this.limit,
  149. this.form.transfer_status,
  150. this.form.patients_source
  151. );
  152. }
  153. },
  154. onCancelOne(value) {
  155. this.typeOne = value;
  156. this.typeShowOne = false;
  157. },
  158. onConfirmOne(value) {
  159. this.page = 1;
  160. if (value === "门诊") {
  161. this.form.patients_source = 1;
  162. this.typeOne = value;
  163. this.typeShowOne = false;
  164. this.patients = [];
  165. this.getAllBloodDialysisPatient(
  166. this.page,
  167. this.limit,
  168. this.form.transfer_status,
  169. this.form.patients_source
  170. );
  171. }
  172. if (value === "住院") {
  173. this.form.patients_source = 2;
  174. this.typeOne = value;
  175. this.typeShowOne = false;
  176. this.patients = [];
  177. this.getAllBloodDialysisPatient(
  178. this.page,
  179. this.limit,
  180. this.form.transfer_status,
  181. this.form.patients_source
  182. );
  183. }
  184. },
  185. getAllBloodDialysisPatient() {
  186. getAllBloodDialysisPatient(
  187. this.page,
  188. this.limit,
  189. this.form.transfer_status,
  190. this.form.patients_source
  191. ).then(response => {
  192. if (response.data.state === 1) {
  193. var patient = response.data.data.bloodpatient;
  194. let arr = this.patients;
  195. arr.push(...patient);
  196. this.patients = arr;
  197. var total = response.data.data.total;
  198. this.total = total;
  199. }
  200. });
  201. },
  202. onLoad() {
  203. setTimeout(() => {
  204. for (let i = 0; i < this.limit; i++) {
  205. this.list.push(this.list.length + 1);
  206. }
  207. // 加载状态结束
  208. this.loading = false;
  209. if (this.patients.length >= 10) {
  210. this.page++;
  211. this.getAllBloodDialysisPatient(this.page, this.limit);
  212. }
  213. // 数据全部加载完成
  214. if (this.list.length >= this.total) {
  215. this.finished = true;
  216. }
  217. }, 1000);
  218. },
  219. toPatientDetail(id) {
  220. this.$router.push(
  221. "/patientdetail?patientid=" +
  222. id +
  223. "&seacherActive=" +
  224. this.seacherActive
  225. );
  226. },
  227. SearchAllBlood(val) {
  228. SearchAllBlood(val).then(response => {
  229. if (response.data.state === 1) {
  230. var bloodpatient = response.data.data.bloodPatient;
  231. this.patients = bloodpatient;
  232. }
  233. });
  234. }
  235. },
  236. created() {
  237. if (this.searchValue) {
  238. this.SearchAllBlood(this.searchValue);
  239. } else {
  240. this.getAllBloodDialysisPatient();
  241. }
  242. },
  243. watch: {
  244. searchValue(newVal) {
  245. this.SearchAllBlood(newVal);
  246. }
  247. }
  248. };
  249. </script>
  250. <style lang="scss" scoped>
  251. .page_patientManagement {
  252. overflow-y: auto;
  253. height: 100%;
  254. background: #fff;
  255. .patientManagementTitle {
  256. background: #fff;
  257. padding: 0 1.125rem;
  258. height: 3.125rem;
  259. display: flex;
  260. align-items: center;
  261. justify-content: space-between;
  262. }
  263. .jiantou {
  264. font-size: 1.5rem;
  265. font-weight: 600;
  266. margin-right: 3rem;
  267. }
  268. .titleName {
  269. font-size: 1.125rem;
  270. font-weight: 600;
  271. }
  272. .iconBox {
  273. display: flex;
  274. align-items: center;
  275. float: right;
  276. }
  277. .iconOne {
  278. font-size: 1.5rem;
  279. }
  280. .add {
  281. margin-left: 1.25rem;
  282. }
  283. .toolBox {
  284. display: flex;
  285. height: 3.125rem;
  286. align-items: center;
  287. .toolOne {
  288. width: 5.625rem;
  289. height: 1.875rem;
  290. background: rgba(246, 246, 246, 1);
  291. border-radius: 5px;
  292. text-align: center;
  293. font-size: 0.8125rem;
  294. color: #8d8d8d;
  295. display: flex;
  296. align-items: center;
  297. justify-content: space-around;
  298. margin-left: 0.875rem;
  299. }
  300. }
  301. .van-dropdown-menu__title {
  302. width: 5.625rem;
  303. height: 1.875rem;
  304. line-height: 1.875rem;
  305. background: rgba(246, 246, 246, 1);
  306. border-radius: 5px;
  307. color: #8d8d8d;
  308. font-size: 0.875rem;
  309. }
  310. .van-dropdown-menu__title::after {
  311. right: 0.5rem;
  312. }
  313. .patientBox {
  314. padding: 0 0.875rem;
  315. .patientOne {
  316. display: flex;
  317. align-items: center;
  318. height: 3.75rem;
  319. img {
  320. width: 2.5rem;
  321. height: 2.5rem;
  322. margin-right: 0.875rem;
  323. }
  324. }
  325. }
  326. }
  327. ::-webkit-scrollbar {
  328. width: 0;
  329. }
  330. </style>
  331. <style lang="scss">
  332. .page_patientManagement {
  333. .searchBox {
  334. .van-cell__value {
  335. display: flex;
  336. align-items: center;
  337. }
  338. .van-field__body {
  339. width: 100%;
  340. }
  341. }
  342. }
  343. </style>