selectUser.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="main">
  3. <view style="padding: 15px 0">
  4. <u-search placeholder="患者姓名" v-model="param.patientName" bgColor="white" :showAction="false" @search="refresh()" @clear="(param.patientName = ''), refresh()"></u-search>
  5. </view>
  6. <view class="list">
  7. <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/detection/doctor/list?cardId=' + item.cardId + '&patId=' + item.patId + '&patientName=' + item.name)">
  8. <view class="title omit">
  9. <text>{{ item.name }}</text>
  10. <text class="check">({{ item.cardId }})</text>
  11. </view>
  12. </view>
  13. <u-empty v-if="list.length == 0" text="暂无患者"></u-empty>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. list: [],
  22. param: {
  23. pageNum: 1,
  24. pageSize: 20
  25. },
  26. loadMore: true
  27. };
  28. },
  29. onLoad(e) {
  30. this.getData();
  31. uni.$on('bind', (res) => {
  32. this.getData();
  33. });
  34. },
  35. methods: {
  36. getData() {
  37. this.param.userId = this.getUser().userId;
  38. this.http.request({
  39. url: '/work/visit/patientCard',
  40. data: this.param,
  41. success: (res) => {
  42. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  43. res.data.rows.forEach((item) => {
  44. this.list.push(item);
  45. });
  46. }
  47. });
  48. },
  49. go(url) {
  50. uni.navigateTo({ url: url });
  51. },
  52. //刷新数据
  53. refresh() {
  54. this.loadMore = true;
  55. this.param.pageNum = 1;
  56. this.list = [];
  57. this.getData();
  58. }
  59. },
  60. //上拉加载
  61. onReachBottom() {
  62. if (this.loadMore) {
  63. this.param.pageNum++;
  64. this.getData();
  65. }
  66. }
  67. };
  68. </script>
  69. <style lang="scss">
  70. .list {
  71. background-color: white;
  72. border-radius: 10px;
  73. .item {
  74. padding: 16px 12px 16px 12px;
  75. border-bottom: 1px solid $line;
  76. overflow: hidden;
  77. .title {
  78. font-size: 15px;
  79. font-weight: bold;
  80. .check {
  81. color: #737373;
  82. font-size: 13px;
  83. font-weight: normal;
  84. padding-left: 5px;
  85. }
  86. }
  87. .del {
  88. color: #f44336;
  89. float: right;
  90. margin-top: -20px;
  91. font-size: 20px;
  92. }
  93. }
  94. }
  95. </style>