index.vue 3.2 KB

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