From 197e79bd0c85cc3c981816f89f5db8812dfb29b3 Mon Sep 17 00:00:00 2001 From: riefive Date: Fri, 24 Oct 2025 14:27:57 +0700 Subject: [PATCH] feat(sep): add selected prop to ListPatient and enhance radio selection handling in select-radio component --- app/components/app/sep/list-patient.vue | 2 ++ app/components/app/sep/select-radio.vue | 26 ++++++++++------ app/components/app/sep/view-patient.vue | 40 +++++++++++++++++++++++-- app/components/content/sep/entry.vue | 2 +- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/app/components/app/sep/list-patient.vue b/app/components/app/sep/list-patient.vue index f61011b6..2b9902f2 100644 --- a/app/components/app/sep/list-patient.vue +++ b/app/components/app/sep/list-patient.vue @@ -11,6 +11,7 @@ import { config } from './list-cfg.patient' const props = defineProps<{ data: PatientData[] + selected?: string paginationMeta?: PaginationMeta }>() @@ -27,6 +28,7 @@ function handlePageChange(page: number) { +import { computed, inject, type Ref } from 'vue' // Components import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group' const props = defineProps<{ rec: { id: string; name: string; menu: string } + selected?: string +}>() + +const emit = defineEmits<{ + // No emits needed - using provide/inject }>() const record = props.rec || {} -const recId = inject>('rec_select_id')! -const recMenu = inject>('rec_select_menu')! -const selected = ref('') +const recId = inject('rec_select_id') as Ref +const recMenu = inject('rec_select_menu') as Ref +const selected = computed(() => recId.value === Number(record.id) ? record.id : '') + +function handleSelection(value: string) { + if (value === record.id) { + recId.value = Number(record.id) || 0 + recMenu.value = record.menu || '' + } +}