IntroduceProjectList.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <script lang="ts" setup>
  2. import { ref, onMounted, reactive } from 'vue';
  3. import type { SystemItemModel, SystemCwModel } from '@/model/care.model';
  4. import { VxeUI } from 'vxe-pc-ui';
  5. import { getCopyCwMethod } from '@/request/api/care.api';
  6. import AddItems from '@/service/addItems.vue';
  7. import HealthEvaluation from '@/service/HealthEvaluation.vue';
  8. const emit = defineEmits<{
  9. submit: [data: any];
  10. }>();
  11. const tableData = ref<SystemItemModel[]>([]);
  12. type FollowModel = Partial<SystemCwModel>;
  13. const props = defineProps<{ data: FollowModel; id: number | string; institutionId: number | string }>();
  14. // 引入已有项目
  15. async function handleAdd() {
  16. // 关闭引入服务包弹窗
  17. VxeUI.modal.close(`systemService-list-modal`);
  18. // 关闭引入已有项目弹窗
  19. VxeUI.modal.close(`introduceProjectList-modal`);
  20. // 向父组件传入数据
  21. emit('submit', props.data as SystemCwModel);
  22. }
  23. function handleCancel() {
  24. VxeUI.modal.close(`introduceProjectList-modal`);
  25. }
  26. const detailData = ref<any>({});
  27. const dataObj = reactive({
  28. types: 'institution',
  29. id: props.id,
  30. institutionId: props.institutionId,
  31. });
  32. // 获取详情数据
  33. async function getDetailData(data?: SystemItemModel) {
  34. console.log(data, '点击确定');
  35. const res: any = await getCopyCwMethod(dataObj as Partial<SystemCwModel>);
  36. if (res && res.items && res.items.length > 0) {
  37. tableData.value = res.items;
  38. }
  39. }
  40. onMounted(async () => {
  41. const res: any = await getCopyCwMethod(dataObj as Partial<SystemCwModel>);
  42. detailData.value = res;
  43. if (res && res.items && res.items.length > 0) {
  44. tableData.value = res.items;
  45. }
  46. });
  47. const checked = ref(true);
  48. function addProject(row: any) {
  49. console.log(row, '添加项目');
  50. row.sourceId = row.id;
  51. delete row.id;
  52. const addType = 'itemsList';
  53. if (row?.isErasable === 'N') {
  54. // 健康咨询 健康评估 x显示
  55. VxeUI.modal.open({
  56. title: row?.conditioningProgramType,
  57. height: 400,
  58. width: 750,
  59. id: `health-consultation-modal`,
  60. remember: true,
  61. storage: true,
  62. slots: {
  63. default() {
  64. return h(HealthEvaluation, <any>{
  65. data: {
  66. ...row,
  67. addType,
  68. },
  69. onSubmit(data?: SystemItemModel) {
  70. console.log(data, '点击确定');
  71. // 点击确定 刷新列表
  72. getDetailData();
  73. VxeUI.modal.close(`health-consultation-modal`);
  74. },
  75. });
  76. },
  77. },
  78. });
  79. } else {
  80. VxeUI.modal.open({
  81. id: 'add-items-modal',
  82. title: '新增项目',
  83. width: 1000,
  84. height: 700,
  85. escClosable: true,
  86. destroyOnClose: true,
  87. slots: {
  88. default() {
  89. return h(AddItems, {
  90. data: {
  91. ...row,
  92. addType,
  93. },
  94. onSubmit(data?: SystemItemModel) {
  95. console.log(data, '点击确定刷新列表');
  96. // 点击确定 刷新列表
  97. getDetailData();
  98. VxeUI.modal.close(`add-items-modal`);
  99. },
  100. });
  101. },
  102. },
  103. });
  104. }
  105. }
  106. </script>
  107. <template>
  108. <div style="background: #fff; border-radius: 6px">
  109. <vxe-table :data="tableData" border :row-class-name="({ row }) => (row.isForCopyCw === 'N' ? 'highlight-row' : '')">
  110. <vxe-column field="conditioningProgramDetail.name" title="项目名称" />
  111. <vxe-column field="conditioningProgramDetail.conditioningProgramType" title="方案类型" />
  112. <vxe-column title="是否可引入" align="center">
  113. <template #default="{ row }">
  114. <span v-if="row.isForCopyCw !== 'Y'" style="color: #f5222d; font-size: 11px">机构没有此项目,请先维护</span>
  115. <a-checkbox v-else v-model:checked="checked" />
  116. </template>
  117. </vxe-column>
  118. <vxe-column field="conditioningProgramDetail" title="操作" align="center">
  119. <template #default="{ row }">
  120. <a-button type="primary" @click="addProject(row.conditioningProgramDetail)" v-if="row.isForCopyCw === 'N'">新增</a-button>
  121. </template>
  122. </vxe-column>
  123. </vxe-table>
  124. <div style="display: flex; justify-content: center; margin-top: 24px">
  125. <a-button style="margin-right: 24px" @click="handleCancel">取消</a-button>
  126. <a-button type="primary" @click="handleAdd">引入已有项目</a-button>
  127. </div>
  128. </div>
  129. </template>
  130. <style scoped>
  131. .highlight-row {
  132. background: red !important;
  133. }
  134. </style>