return-visit.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view>
  3. <view class="header">
  4. <view>{{ memberName }}</view>
  5. <text class="warning">请根据计划安排到院{{ activeTypeName }}</text>
  6. </view>
  7. <view class="body">
  8. <view
  9. v-for="item in pushContent"
  10. :key="item.Id"
  11. :class="{ 'is-active': item.IsActive }"
  12. class="time-line"
  13. >
  14. <view class="dot">
  15. <view class="location" v-if="item.IsActive"></view>
  16. </view>
  17. <view class="wrapper">
  18. <view class="timestamp">
  19. <view>{{ item.ExecDate }}</view>
  20. <view>{{ item.OutPatientPushTypeName }}</view>
  21. </view>
  22. <text style="white-space: pre-wrap" class="content">{{ item.PushContent }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script lang="ts" setup>
  29. import { ref, watch } from 'vue';
  30. import Props from './props';
  31. import { PatientRead } from '../../../service';
  32. import { common } from '@kasite/uni-app-base';
  33. const props = defineProps(Props);
  34. const option = ref({} as any);
  35. const pushContent = ref([]);
  36. const activeTypeName = ref('');
  37. const init = async (datas) => {
  38. if (datas && !datas.length) return;
  39. const today = common.dateFormat(new Date()).formatYear;
  40. activeTypeName.value = '';
  41. datas.forEach((item) => {
  42. item.IsActive = item.ExecDate == today;
  43. if (item.IsActive) activeTypeName.value = item.OutPatientPushTypeName;
  44. });
  45. let readRes = datas[0].IsRead;
  46. if (!readRes) {
  47. const resp = await PatientRead({
  48. Id: datas[0].Id,
  49. });
  50. readRes = !!resp;
  51. const pages = getCurrentPages();
  52. const homePage = pages.find((p: any) => p && p.route && p.route.indexOf('pagesCrm/business/home/home') !== -1);
  53. const target: any = homePage || (pages.length >= 2 ? pages[pages.length - 2] : undefined);
  54. const vm = target && (target as any).$vm;
  55. if (vm && typeof vm.changeItemReadStatus === 'function') {
  56. vm.changeItemReadStatus(props.date, props.index, 1);
  57. } else {
  58. uni.$emit('changeItemReadStatus', { date: props.date, index: props.index, status: 1 });
  59. }
  60. }
  61. pushContent.value = datas;
  62. option.value = datas[0];
  63. };
  64. watch(
  65. () => props.content,
  66. (v) => {
  67. init(v);
  68. },
  69. {
  70. immediate: true,
  71. deep: true,
  72. }
  73. );
  74. </script>
  75. <style lang="scss" scoped>
  76. @import './common.scss';
  77. .body {
  78. padding: 30rpx;
  79. }
  80. .time-line {
  81. padding-left: 71rpx;
  82. position: relative;
  83. margin-bottom: 38rpx;
  84. }
  85. .timestamp {
  86. font-weight: bold;
  87. font-size: 32rpx;
  88. color: #212326;
  89. line-height: 48rpx;
  90. display: flex;
  91. gap: 20rpx;
  92. margin-bottom: 22rpx;
  93. }
  94. .dot {
  95. width: 26rpx;
  96. height: 26rpx;
  97. background: #fff;
  98. border: 4rpx solid #d8d8d8;
  99. border-radius: 100%;
  100. position: absolute;
  101. left: 20rpx;
  102. top: 5rpx;
  103. z-index: 1;
  104. }
  105. .time-line::after {
  106. content: '';
  107. width: 6rpx;
  108. height: calc(100% + 38rpx);
  109. background: #d8d8d8;
  110. position: absolute;
  111. top: 5rpx;
  112. left: 30rpx;
  113. z-index: 0;
  114. }
  115. .content {
  116. background: #f7f7fb;
  117. border-radius: 6rpx;
  118. padding: 20rpx;
  119. font-size: 28rpx;
  120. color: #434349;
  121. line-height: 48rpx;
  122. display: block;
  123. }
  124. .time-line:last-child::after {
  125. display: none;
  126. }
  127. /** 激活状态 */
  128. .time-line.is-active .timestamp {
  129. color: var(--dominantColor);
  130. }
  131. .time-line.is-active .dot {
  132. width: 38rpx;
  133. height: 38rpx;
  134. border: none;
  135. background-color: var(--dominantColor);
  136. left: 14rpx;
  137. top: -2rpx;
  138. }
  139. .time-line.is-active .dot::after {
  140. --width: 6rpx;
  141. content: '';
  142. position: absolute;
  143. border-top: var(--width) solid var(--dominantColor);
  144. border-left: var(--width) solid transparent;
  145. border-right: var(--width) solid transparent;
  146. border-bottom: var(--width) solid transparent;
  147. left: 50%;
  148. transform: translateX(-50%);
  149. bottom: -14rpx;
  150. }
  151. .location {
  152. width: 20rpx;
  153. height: 20rpx;
  154. background: #fff;
  155. border-radius: 100%;
  156. position: absolute;
  157. left: 50%;
  158. transform: translateX(-50%);
  159. top: 6rpx;
  160. }
  161. .location::before {
  162. content: '';
  163. width: 8rpx;
  164. height: 8rpx;
  165. background: var(--dominantColor);
  166. border-radius: 100%;
  167. position: absolute;
  168. left: 50%;
  169. top: 50%;
  170. transform: translateX(-50%) translateY(-50%);
  171. }
  172. .location::after {
  173. --width: 8rpx;
  174. content: '';
  175. position: absolute;
  176. border-top: calc(var(--width) + 4rpx) solid #fff;
  177. border-left: var(--width) solid transparent;
  178. border-right: var(--width) solid transparent;
  179. border-bottom: calc(var(--width) + 4rpx) solid transparent;
  180. left: 50%;
  181. transform: translateX(-50%);
  182. bottom: -18rpx;
  183. }
  184. </style>