ServicePackageList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <script lang="ts" setup>
  2. import { ref } from 'vue';
  3. import { VxeUI } from 'vxe-pc-ui';
  4. import IntroduceProjectList from '@/service/IntroduceProjectList.vue';
  5. import { getSystemCpListMethod, getCopyCwMethod } from '@/request/api/care.api';
  6. import { usePagination } from 'alova/client';
  7. import type { SystemCwModel } from '@/model/care.model';
  8. type FollowModel = Partial<SystemCwModel>;
  9. const props = defineProps<{ data: FollowModel; institutionId: string,institutionName: string }>();
  10. const emit = defineEmits(['update:data']);
  11. const tableData = ref<SystemCwModel[]>([]);
  12. const { loading, page, pageSize, total, onSuccess, replace, refresh, remove } = usePagination((page, size) => getSystemCpListMethod(page, size), {
  13. initialData: { data: [], total: 0 },
  14. initialPage: 1,
  15. initialPageSize: 100,
  16. immediate: true,
  17. });
  18. onSuccess(({ data: { data } }) => {
  19. tableData.value = data;
  20. loading.value = false;
  21. });
  22. const id = ref<string>('');
  23. async function handleSubmit() {
  24. const res: any = await getCopyCwMethod(parms.value);
  25. if (res && res.items && res.items.length > 0) {
  26. res.items.forEach((item: any) => {
  27. delete item.conditioningProgramDetail.id;
  28. item.frequencyTypeing = item.frequencyType ? [item.frequencyType] : [];
  29. });
  30. const newItems = res.items.filter((item: any) => {
  31. return item.isForCopyCw == 'Y';
  32. });
  33. props.data.items = [...newItems];
  34. props.data.price = res.price;
  35. props.data.name = res.name;
  36. if (res.conditioningWrapPatientMatchRule) {
  37. props.data.conditioningWrapPatientMatchRule.diagnoseDiseaseNames = res.conditioningWrapPatientMatchRule.diagnoseDiseaseNames || [];
  38. props.data.conditioningWrapPatientMatchRule.diagnoseSyndromeNames = res.conditioningWrapPatientMatchRule.diagnoseSyndromeNames || [];
  39. props.data.conditioningWrapPatientMatchRule.constitutionGroupNames = res.conditioningWrapPatientMatchRule.constitutionGroupNames || [];
  40. props.data.conditioningWrapPatientMatchRule.sex = res.conditioningWrapPatientMatchRule.sex || '';
  41. props.data.conditioningWrapPatientMatchRule.age = res.conditioningWrapPatientMatchRule.age || '';
  42. props.data.conditioningWrapPatientMatchRule.willillStateNames = res.conditioningWrapPatientMatchRule.willillStateNames || [];
  43. }
  44. }
  45. }
  46. const parms = ref<any>({});
  47. async function handleSelect(model?: SystemCwModel) {
  48. if (model?.id) {
  49. id.value = model.id;
  50. parms.value = {
  51. types: 'institution',
  52. id: model.id,
  53. institutionId: props.institutionId,
  54. };
  55. }
  56. // 这里写你的选择逻辑
  57. VxeUI.modal.open({
  58. title: '引入项目',
  59. width: 920,
  60. height: 700,
  61. escClosable: true,
  62. destroyOnClose: true,
  63. id: `introduceProjectList-modal`,
  64. remember: true,
  65. storage: true,
  66. slots: {
  67. default() {
  68. return h(IntroduceProjectList, {
  69. data: { ...props.data },
  70. id: id.value,
  71. institutionId: props.institutionId,
  72. institutionName: props.institutionName,
  73. onSubmit() {
  74. // 提交之后刷新列表
  75. handleSubmit();
  76. VxeUI.modal.close(`introduceProjectList-modal`);
  77. },
  78. });
  79. },
  80. },
  81. });
  82. }
  83. </script>
  84. <template>
  85. <div style="background: #fff; padding: 32px; border-radius: 6px; box-shadow: 0 2px 8px #0001">
  86. <vxe-table :data="tableData" border>
  87. <vxe-column field="name" title="服务包名称" />
  88. <vxe-column field="conditioningWrapPatientMatchRule.diagnoseDiseaseNames" title="专病" />
  89. <vxe-column field="conditioningWrapPatientMatchRule.diagnoseSyndromeNames" title="证型" />
  90. <vxe-column field="conditioningWrapPatientMatchRule.constitutionGroupNames" title="体质" />
  91. <vxe-column field="price" title="价格(元)" />
  92. <vxe-column title="操作" width="80" align="center">
  93. <template #default="{ row }">
  94. <a style="color: #1677ff; cursor: pointer" @click="handleSelect(row)">选择</a>
  95. </template>
  96. </vxe-column>
  97. </vxe-table>
  98. </div>
  99. </template>