PatientFollowUpRecordsWidget.vue 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <script setup lang="ts">
  2. import { usePagination } from 'alova/client';
  3. import { getPatientFollowUpEvaluationRecordsMethod } from '@/request/api/report.api';
  4. import type { VxeGridInstance, VxeGridListeners, VxeGridProps } from 'vxe-table';
  5. import type { DiagnosisReportVO } from '@/model/diagnosis-report.model';
  6. import { VxeUI } from 'vxe-pc-ui';
  7. import type { FollowUpEvaluationReportVO } from '@/model/follow-up-report.model';
  8. import type { EvaluationModel } from '@/model';
  9. const props = defineProps<{ patient: { id: string } }>();
  10. const grid = ref<VxeGridInstance>();
  11. const { data, loading, page, isLastPage, refresh } = usePagination((page, size) => getPatientFollowUpEvaluationRecordsMethod(page, size, { patientId: props.patient.id }), {
  12. initialData: { total: 0, data: [] },
  13. initialPage: 0,
  14. initialPageSize: 100,
  15. append: true,
  16. watchingStates: [() => props.patient.id],
  17. }).onSuccess(({ data: { data } }) => {});
  18. const gridOptions = reactive<VxeGridProps<DiagnosisReportVO>>({
  19. // @ts-ignore
  20. loading,
  21. height: 'auto',
  22. headerAlign: 'center',
  23. align: 'center',
  24. columnConfig: {
  25. resizable: true,
  26. },
  27. columns: [
  28. { field: 'followUp.status.label', title: '随访状态' },
  29. { field: 'plan.name', title: '随访计划' },
  30. { field: 'diagnosis.date', title: '就诊时间', width: '150px' },
  31. { field: 'diagnosis.doctor.name', title: '就诊医生' },
  32. { field: 'patient.phone', title: '手机号码' },
  33. { field: 'tags', title: '标签' },
  34. { field: 'evaluation.status.label', title: '评估状态' },
  35. { field: 'evaluation.result.label', title: '评估结果' },
  36. { field: 'evaluation.operator.name', title: '评估人' },
  37. { title: '操作', align: 'center', width: 120, showOverflow: false, slots: { default: 'cell-operation' } },
  38. ],
  39. // @ts-ignore
  40. data,
  41. scrollY: {
  42. gt: 0,
  43. },
  44. });
  45. const gridEvents: VxeGridListeners = {
  46. scrollBoundary({ direction, isBottom }) {
  47. if (isBottom && direction === 'bottom' && !isLastPage.value) page.value++;
  48. },
  49. };
  50. function openPatientDiagnosisRecordPreview(row: FollowUpEvaluationReportVO, index: number) {
  51. const component = defineAsyncComponent(() => import('@/components/Evaluation.vue'));
  52. const id = `assess-modal`;
  53. const onDestroy = () => { VxeUI.modal.close(id); };
  54. onDestroy();
  55. VxeUI.modal.open({
  56. id, title: `随访评估详情`,
  57. escClosable: true,
  58. destroyOnClose: true,
  59. resize: true,
  60. width: window.innerWidth * 0.6,
  61. height: window.innerHeight * 0.8,
  62. minWidth: Math.min(window.innerWidth * 0.98, 1200),
  63. slots: {
  64. default() {
  65. return h(component, {
  66. data: row.__origin__! as any,
  67. onSubmit() {
  68. refresh(page.value);
  69. onDestroy();
  70. },
  71. });
  72. },
  73. },
  74. });
  75. }
  76. </script>
  77. <template>
  78. <vxe-grid ref="grid" v-bind="gridOptions" v-on="gridEvents">
  79. <template #cell-operation="{ row, rowIndex }">
  80. <vxe-button @click="openPatientDiagnosisRecordPreview(row, rowIndex)">{{ row.evaluation.status.value === '1' ? '查看' : '评估' }}</vxe-button>
  81. </template>
  82. </vxe-grid>
  83. </template>
  84. <style scoped lang="scss"></style>