IntroduceProjectList.vue 4.5 KB

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