PatientTagWidget.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <script setup lang="ts">
  2. import type { PatientModel } from '@/model';
  3. import { patientMark } from '@/request/api/patient.api';
  4. import { tagsSearchMethod } from '@/request/api/system.api';
  5. import { useRequest } from 'alova/client';
  6. const { data: tags, loading: tagsLoading } = useRequest(tagsSearchMethod, { initialData: { total: 0, data: [] } });
  7. const { send } = useRequest((data: string[]) => patientMark(props.patient.id, data), { immediate: false });
  8. const props = defineProps<{
  9. patient: Partial<PatientModel>;
  10. editable?: boolean;
  11. }>();
  12. function save({ value }) {
  13. console.log(value);
  14. send(value);
  15. }
  16. </script>
  17. <template>
  18. <div class="card">
  19. <div class="card__header sticky flex justify-between items-center">
  20. <div class="card__title">
  21. <span>标签</span>
  22. <a-spin v-if="props.loading" size="small" style="margin-left: 4px;" />
  23. </div>
  24. </div>
  25. <div class="card__content">
  26. <vxe-select :options="tags.data" :loading="tagsLoading" :option-props="{value: 'id', label: 'name'}"
  27. @change="save" multiple
  28. ></vxe-select>
  29. </div>
  30. </div>
  31. </template>
  32. <style scoped lang="scss">
  33. @import "@/themes/report-card";
  34. </style>