ViewsEvaluation.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <script setup lang="ts">
  2. import Swiper from '@/components/Swiper.vue';
  3. import type { TagModel, PlanModel } from '@/model/system.model';
  4. import { tagEditMethod, tagMethod, tagsSearchMethod } from '@/request/api/system.api';
  5. import { useRequest } from 'alova/client';
  6. import { type VxeFormListeners, type VxeFormProps, type VxeGridProps, VxeUI } from 'vxe-table';
  7. import { statusLabel } from '@/model/options';
  8. type FormModel = Partial<TagModel>;
  9. type FollowModel = Partial<PlanModel>;
  10. const defaultModel = {};
  11. const props = defineProps<{ data: FormModel }>();
  12. // const plain = defineProps<{ data: FollowModel }>();
  13. const emits = defineEmits<{
  14. submit: [data?: TagModel];
  15. }>();
  16. const { loading, send: load } = useRequest(tagMethod, {
  17. immediate: false,
  18. initialData: props.data ?? defaultModel,
  19. }).onSuccess(({ data }) => {
  20. formProps.data = { ...data };
  21. });
  22. const { loading: submitting, send: submit } = useRequest(tagEditMethod, {
  23. immediate: false,
  24. }).onSuccess(({ data }) => {
  25. emits('submit');
  26. });
  27. const gridOptions = reactive<VxeGridProps<FormModel>>({
  28. border: true,
  29. showOverflow: true,
  30. width: window.innerWidth - 256,
  31. // height: 800,
  32. showHeader: false,
  33. columns: [{ field: 'title', title: '-' }],
  34. data: [
  35. { title: '日期', key: 'date', col0: '-' },
  36. { title: '好转', key: 'k1' },
  37. { title: '恶化', key: 'k2' },
  38. { title: '面', key: 'face' },
  39. ],
  40. });
  41. function load2(data = []) {
  42. const columns = gridOptions.columns;
  43. const rows = gridOptions.data;
  44. let col = columns.length;
  45. for (const item of data) {
  46. const field = `col${col}`;
  47. columns.push({
  48. field,
  49. title: `标题${col}`,
  50. slots: { default: 'cell' },
  51. });
  52. col++;
  53. for (let r = 0; r < rows.length; r++) {
  54. rows[r][field] = item[rows[r].key];
  55. }
  56. }
  57. }
  58. load2(
  59. Array.from({ length: 4 }, (_, i) => ({
  60. date: `2025/01/0${i}`,
  61. k1: `第${i + 1}项,col2字段`,
  62. k2: `第${i + 1}项,col3字段`,
  63. face: `https://vxeui.com/resource/img/fj577.jpg`,
  64. }))
  65. );
  66. onBeforeMount(() => {
  67. if (props.data?.tagId) load(props.data);
  68. });
  69. const value = ref<number>(1);
  70. const radioStyle = reactive({
  71. display: 'flex',
  72. height: '30px',
  73. lineHeight: '30px',
  74. });
  75. function cellClickEvent({ row, column }, model?: TagModel) {
  76. console.log(row, column, row.title, row.title === '面', 'row===');
  77. if (row.title === '面') {
  78. // 判断当表头等于姓名字段时执行一个方法
  79. VxeUI.modal.open({
  80. escClosable: true,
  81. destroyOnClose: true,
  82. id: `swiper`,
  83. remember: true,
  84. storage: true,
  85. width: window.innerWidth - 256,
  86. slots: {
  87. default() {
  88. return h(Swiper, <any>{
  89. data: model,
  90. onSubmit(data: TagModel) {
  91. refresh(page.value);
  92. VxeUI.modal.close(`swiper`);
  93. },
  94. });
  95. },
  96. },
  97. });
  98. }
  99. }
  100. </script>
  101. <template>
  102. <div>
  103. <div class="flex font-bold border-1 border-gray border-solid pt-1 pb-1">
  104. <div class="border-r border-r-2 border-r-gray border-r-solid pr-3 flex">
  105. <div class="mr-2">基本信息</div>
  106. <div class="mr-2">2024.09.29</div>
  107. 孙明 男 28岁
  108. </div>
  109. <div class="border-r border-r-2 border-r-gray border-r-solid pr-3 pl-3">诊断:心火旺盛</div>
  110. <div class="pl-3">症状:难以入眠、头晕、心慌、麦轩、小便黄</div>
  111. </div>
  112. <vxe-grid class="reverse-table" v-bind="gridOptions" @cell-click="cellClickEvent">
  113. <template #cell="{ row, rowIndex, column }">
  114. <!-- {{row}}-{{rowIndex}}-->
  115. <a-image v-if="rowIndex === 3" :src="row[column.field]"></a-image>
  116. <template v-else>{{ row[column.field] }}</template>
  117. </template>
  118. <template #right>
  119. <div class="pl-6 pr-4">
  120. <div style="width: 160px" class="border-1 border-gray font-bold mt-2 mb-3 text-sm">随访结果评估</div>
  121. <div style="width: 160px" class="border-1 border-gray font-bold mt-2 mb-3">疾病转归</div>
  122. <div class="mb-8 indent-6">好转</div>
  123. <div class="font-bold mt-2 mb-1">备注:</div>
  124. <p class="indent-6 w-30 text-pretty">可正常入眠,舌和耳边均有好转,但睡眠还易夜醒</p>
  125. <div class="font-bold mb-4 mt-15">下一步处置</div>
  126. <div class="indent-6 font-bold">复诊</div>
  127. <div class="mt-10 flex justify-end flex-col items-center">
  128. <div>智医生</div>
  129. <div>2024.10.05</div>
  130. </div>
  131. </div>
  132. </template>
  133. </vxe-grid>
  134. </div>
  135. </template>
  136. <style scoped lang="scss"></style>