1
0

index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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)" v-if="item.state == 0">删除</text>
  16. <text class="edit" @click.stop="go('/pages/follow/doctor/add?id=' + item.id + ' &patientName=' + item.patientName)" v-if="item.state == 0">编辑</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. <u-popup :show="show" round="15" mode="center" :closeable="true" :customStyle="{ width: '95%' }" @close="show = false">
  31. <view class="popup">
  32. <view class="mtt">{{ item.templateName }}</view>
  33. <view class="item">
  34. <text class="tt">科室名称</text>
  35. <text class="la">{{ user.dept.deptName || '无科室' }}</text>
  36. </view>
  37. <view class="item">
  38. <text class="tt">医生姓名</text>
  39. <text class="la">{{ item.createBy }}</text>
  40. </view>
  41. <view class="item">
  42. <text class="tt">复诊内容</text>
  43. <text class="la">{{ item.op }}</text>
  44. </view>
  45. <view class="item">
  46. <text class="tt">提醒日期</text>
  47. <text class="la">{{ item.createTime }}</text>
  48. </view>
  49. </view>
  50. </u-popup>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. user: this.getUser(),
  58. list: [],
  59. param: { pageNum: 1, pageSize: 10 },
  60. loadMore: true,
  61. show: false,
  62. item: {}
  63. };
  64. },
  65. onLoad(e) {
  66. this.param.type = e.type || 0;
  67. this.getData();
  68. uni.$on('record', (res) => {
  69. this.refresh();
  70. });
  71. setTimeout(() => {
  72. uni.setNavigationBarTitle({ title: this.param.type == 0 ? '复诊提醒' : '随访记录' });
  73. }, 300);
  74. },
  75. methods: {
  76. getData() {
  77. this.http.request({
  78. url: '/work/record/list',
  79. data: this.param,
  80. loading: 'false',
  81. success: (res) => {
  82. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  83. res.data.rows.forEach((item) => {
  84. item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
  85. this.list.push(item);
  86. });
  87. }
  88. });
  89. },
  90. del(item, index) {
  91. uni.showModal({
  92. title: '提示',
  93. content: '确定删除该内容?',
  94. success: (res) => {
  95. if (res.confirm) {
  96. this.http.request({
  97. url: '/work/record/remove/' + item.id,
  98. success: (res) => {
  99. uni.showToast({ title: '删除成功' });
  100. this.list.splice(index, 1);
  101. }
  102. });
  103. }
  104. }
  105. });
  106. },
  107. detail(item) {
  108. if (this.param.type == 0) {
  109. this.show = true;
  110. this.http.request({
  111. url: '/work/record/detail/' + item.id,
  112. success: (res) => {
  113. this.item = res.data.data;
  114. }
  115. });
  116. }
  117. if (this.param.type == 1) {
  118. uni.navigateTo({ url: '/pages/follow/detail?id=' + item.id });
  119. }
  120. },
  121. go(url) {
  122. uni.navigateTo({ url: url });
  123. },
  124. //刷新数据
  125. refresh() {
  126. this.loadMore = true;
  127. this.param.pageNum = 1;
  128. this.list = [];
  129. this.getData();
  130. }
  131. },
  132. //下拉刷新
  133. onPullDownRefresh() {
  134. setTimeout(() => {
  135. this.refresh();
  136. uni.stopPullDownRefresh();
  137. }, 1000);
  138. },
  139. //上拉加载
  140. onReachBottom() {
  141. if (this.loadMore) {
  142. this.param.pageNum++;
  143. this.getData();
  144. }
  145. }
  146. };
  147. </script>
  148. <style lang="scss"></style>