1
0

index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view>
  3. <view class="search">
  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="listv">
  7. <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/follow/doctor/detail?id=' + item.id)">
  8. <view class="title omit">
  9. <text class="icon" v-if="item.top === 1">&#xe61f;</text>
  10. <text>{{ item.templateName }}</text>
  11. </view>
  12. <view class="desc">
  13. <text>{{ item.patientName }}</text>
  14. <text>{{ item.createTime }}</text>
  15. <text class="del" @click.stop="del(item, index)">删除</text>
  16. <text class="edit" @click.stop="go('/pages/follow/doctor/add?id=' + item.id + ' &patientName=' + item.patientName)">编辑</text>
  17. <text class="icon state" :style="{ color: item.state == 0 ? '#b5b5b5' : '#4CAF50' }">&#xe830;{{ item.state == 0 ? '待回访' : '已回访' }}</text>
  18. </view>
  19. </view>
  20. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  21. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  22. </view>
  23. <view class="mfooter">
  24. <button class="btn" @click="go('/pages/follow/doctor/add?type=1')">
  25. <text class="icon">&#xe8d5;</text>
  26. <text>新增</text>
  27. </button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. list: [],
  36. param: { pageNum: 1, pageSize: 10, type: 1, orderByColumn: 'k.id', isAsc: 'desc' },
  37. loadMore: true
  38. };
  39. },
  40. onLoad(e) {
  41. this.getData();
  42. uni.$on('record', (res) => {
  43. this.refresh();
  44. });
  45. },
  46. methods: {
  47. getData() {
  48. this.http.request({
  49. url: '/work/record/list',
  50. data: this.param,
  51. loading: 'false',
  52. success: (res) => {
  53. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  54. res.data.rows.forEach((item) => {
  55. item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
  56. this.list.push(item);
  57. });
  58. }
  59. });
  60. },
  61. del(item, index) {
  62. uni.showModal({
  63. title: '提示',
  64. content: '确定删除该知识?',
  65. success: (res) => {
  66. if (res.confirm) {
  67. this.http.request({
  68. url: '/work/record/remove/' + item.id,
  69. success: (res) => {
  70. uni.showToast({ title: '删除成功' });
  71. this.list.splice(index, 1);
  72. }
  73. });
  74. }
  75. }
  76. });
  77. },
  78. go(url) {
  79. uni.navigateTo({ url: url });
  80. },
  81. //刷新数据
  82. refresh() {
  83. this.loadMore = true;
  84. this.param.pageNum = 1;
  85. this.list = [];
  86. this.getData();
  87. }
  88. },
  89. //下拉刷新
  90. onPullDownRefresh() {
  91. setTimeout(() => {
  92. this.refresh();
  93. uni.stopPullDownRefresh();
  94. }, 1000);
  95. },
  96. //上拉加载
  97. onReachBottom() {
  98. if (this.loadMore) {
  99. this.param.pageNum++;
  100. this.getData();
  101. }
  102. }
  103. };
  104. </script>
  105. <style lang="scss"></style>