dev: hotfix, consultation

This commit is contained in:
2025-12-02 14:50:10 +07:00
parent e6ac4bbadd
commit 9a8ee9d90f
5 changed files with 24 additions and 27 deletions

No files matched your search

+11 -11
View File
@@ -35,24 +35,24 @@ const { defineField, errors, meta } = useForm({
initialValues: {
date: props.values.date || today.toISOString().slice(0, 10),
problem: '',
dstUnit_id: 0,
} as Partial<ConsultationFormData>,
dstUnit_code: '',
} as ConsultationFormData,
})
const [date, dateAttrs] = defineField('date')
const [unit_id, unitAttrs] = defineField('unit_id')
const [unit_code, unitAttrs] = defineField('unit_code')
const [problem, problemAttrs] = defineField('problem')
// Fill fields from props.values if provided
if (props.values) {
if (props.values.date !== undefined) date.value = props.values.date.substring(0, 10)
if (props.values.dstUnit_id !== undefined) unit_id.value = props.values.dstUnit_id
if (props.values.dstUnit_code !== undefined) unit_code.value = props.values.dstUnit_code
if (props.values.problem !== undefined) problem.value = props.values.problem
}
const resetForm = () => {
date.value = date.value ?? today.toISOString().slice(0, 10)
unit_id.value = 0
unit_code.value = 0
problem.value = ''
}
@@ -62,7 +62,7 @@ function onSubmitForm(values: any) {
encounter_id: props.encounter_id,
date: date.value ? `${date.value}T00:00:00Z` : '',
problem: problem.value || '',
dstUnit_id: unit_id.value || 0,
dstUnit_code: unit_code.value || '',
}
emit('submit', formData, resetForm)
}
@@ -89,18 +89,18 @@ function onCancelForm() {
</DE.Cell>
<DE.Cell>
<DE.Label>Unit</DE.Label>
<DE.Field :errMessage="errors.unit_id">
{{ errors.unit_id }}
<DE.Field :errMessage="errors.unit_code">
{{ errors.unit_code }}
<Select
id="strUnit_id"
v-model.number="unit_id"
id="strUnit_code"
v-model="unit_code"
icon-name="i-lucide-chevron-down"
placeholder="Pilih poliklinik tujuan"
v-bind="unitAttrs"
:items="props.units || []"
:disabled="isLoading || isReadonly"
/>
<!-- <Input type="number" id="unit_id" v-model.number="unit_id" v-bind="unitAttrs" :disabled="isLoading || isReadonly" /> -->
<!-- <Input type="number" id="unit_code" v-model.number="unit_code" v-bind="unitAttrs" :disabled="isLoading || isReadonly" /> -->
</DE.Field>
</DE.Cell>
<DE.Cell :colSpan="3">
+1 -1
View File
@@ -43,7 +43,7 @@ interface Props {
}
const props = defineProps<Props>()
let units = ref<{ value: string; label: string }[]>([])
const units = ref<{ value: string; label: string }[]>([])
const encounterId = ref<number>(props?.encounter?.id || 0)
const title = ref('')