PatientCareRecordsWidget.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <script setup lang="ts">
  2. import { usePagination } from 'alova/client';
  3. import { getConditioningRecordMethod } from '@/request/api/care.api';
  4. import type { VxeGridInstance, VxeGridListeners, VxeGridProps } from 'vxe-table';
  5. import { VxeUI } from 'vxe-pc-ui';
  6. import type { FollowUpEvaluationReportVO } from '@/model/follow-up-report.model';
  7. import type { ConditioningRecordListModel } from '@/model/care.model';
  8. import ServicePackageDetail from '@/service/ServicePackageDetail.vue';
  9. import CareProcess from '@/service/CareProgress.vue';
  10. const props = defineProps<{ patient: { id: string } }>();
  11. const grid = ref<VxeGridInstance>();
  12. const { data, loading, page, isLastPage, refresh } = usePagination((page, size) => getConditioningRecordMethod(page, size, { patientId: props.patient.id }), {
  13. initialData: { total: 0, data: [] },
  14. initialPage: 0,
  15. initialPageSize: 100,
  16. append: true,
  17. // watchingStates: [() => props.patient.id],
  18. }).onSuccess(({ data: { data } }) => {});
  19. const gridOptions = reactive<VxeGridProps<ConditioningRecordListModel>>({
  20. // @ts-ignore
  21. loading,
  22. height: 'auto',
  23. headerAlign: 'center',
  24. align: 'center',
  25. rowConfig: {
  26. isHover: true,
  27. isCurrent: true,
  28. },
  29. columnConfig: {
  30. resizable: true,
  31. },
  32. columns: [
  33. { type: 'seq', width: 70, fixed: 'left' },
  34. { field: 'patientName', title: '姓名' },
  35. { field: 'conditioningWrapName', title: '服务包名称' },
  36. { field: 'diagnosis', title: '疾病名称' },
  37. { field: 'symptom', title: '证型' },
  38. { field: 'constitutionGroupName', title: '体质' },
  39. { field: 'createBy', title: '开具医生' },
  40. { field: 'estimatedStartDate', title: '开始调养日期' },
  41. { field: 'progress', title: '调理状态', slots: { default: 'patients' } },
  42. {
  43. field: 'action',
  44. title: '操作',
  45. align: 'center',
  46. width: 120,
  47. cellRender: {
  48. name: 'VxeButtonGroup',
  49. props: {
  50. mode: 'text',
  51. },
  52. options: [
  53. { content: '详情', status: 'primary', name: 'serviceDetail' },
  54. { content: '调养过程', status: 'primary', name: 'conditioningProcess' },
  55. ],
  56. events: {
  57. click({ row, rowIndex }: { row: ConditioningRecordListModel; rowIndex: number }, { name }: { name: string }) {
  58. let method;
  59. if (name === 'serviceDetail') {
  60. method = serviceDetail;
  61. } else if (name === 'conditioningProcess') {
  62. method = conditioningProcess;
  63. }
  64. method?.(row, rowIndex);
  65. },
  66. },
  67. },
  68. },
  69. ],
  70. // @ts-ignore
  71. data,
  72. scrollY: {
  73. gt: 0,
  74. },
  75. });
  76. // 调养过程
  77. function conditioningProcess(model?: ConditioningRecordListModel) {
  78. VxeUI.modal.open({
  79. title: model?.id ? `调养过程` : `新增调养过程`,
  80. height: window.innerHeight,
  81. width: window.innerWidth,
  82. fullscreen: true,
  83. escClosable: true,
  84. destroyOnClose: true,
  85. id: `conditioning-process-modal`,
  86. remember: true,
  87. storage: true,
  88. slots: {
  89. default() {
  90. return h(CareProcess, <any>{
  91. data: model,
  92. onSubmit(data: ConditioningRecordListModel) {
  93. refresh(page.value);
  94. VxeUI.modal.close(`conditioning-process-modal`);
  95. },
  96. });
  97. },
  98. },
  99. });
  100. }
  101. // 调养记录详情
  102. function serviceDetail(model?: ConditioningRecordListModel, index?: number) {
  103. const types = 'record';
  104. VxeUI.modal.open({
  105. id: 'servicePackageDetail-modal',
  106. title: '服务包详情',
  107. height: window.innerHeight,
  108. width: window.innerWidth,
  109. fullscreen: true,
  110. escClosable: true,
  111. destroyOnClose: true,
  112. slots: {
  113. default() {
  114. return h(ServicePackageDetail, <any>{
  115. data: {
  116. ...model,
  117. types,
  118. },
  119. onVoidSubmit(data: ConditioningRecordListModel) {
  120. console.log(data, '作废之后刷新页面');
  121. refresh(page.value);
  122. },
  123. });
  124. },
  125. },
  126. });
  127. }
  128. const gridEvents: VxeGridListeners = {
  129. scrollBoundary({ direction, isBottom }) {
  130. if (isBottom && direction === 'bottom' && !isLastPage.value) page.value++;
  131. },
  132. };
  133. </script>
  134. <template>
  135. <vxe-grid ref="grid" v-bind="gridOptions" v-on="gridEvents">
  136. <template #patients="{ row }">
  137. <div>
  138. {{
  139. row.progress === '0'
  140. ? '待付款'
  141. : row.progress === '1'
  142. ? '已作废'
  143. : row.progress === '2'
  144. ? '用户取消'
  145. : row.progress === '3'
  146. ? '未开始'
  147. : row.progress === '4'
  148. ? '调理中'
  149. : row.progress === '5'
  150. ? '已完结'
  151. : ''
  152. }}
  153. </div>
  154. </template>
  155. </vxe-grid>
  156. </template>
  157. <style scoped lang="scss"></style>