enhance (soapi): get detail

This commit is contained in:
Abizrh
2025-12-09 23:23:07 +07:00
parent a8bf9c172d
commit 6ba4b8ee6a
3 changed files with 11 additions and 6 deletions

No files matched your search

+7 -1
View File
@@ -68,6 +68,7 @@ const model = ref({
weight: '', weight: '',
height: '', height: '',
}) })
const formKey = ref(0)
const isLoading = reactive<DataTableLoader>({ const isLoading = reactive<DataTableLoader>({
isTableLoading: false, isTableLoading: false,
@@ -95,7 +96,11 @@ async function getDetail() {
isLoading.isTableLoading = true isLoading.isTableLoading = true
const resp = await xfetch(`/api/v1/soapi/${recordId.value}`) const resp = await xfetch(`/api/v1/soapi/${recordId.value}`)
if (resp.success) { if (resp.success) {
diagnoses.value = (resp.body as Record<string, any>).data const raw = (resp.body as Record<string, any>).data
const values = JSON.parse(raw.value)
console.log('values', values)
model.value = values
formKey.value++ // Force re-render with new data
} }
isLoading.isTableLoading = false isLoading.isTableLoading = false
} }
@@ -158,6 +163,7 @@ provide('icdPreview', icdPreview)
</script> </script>
<template> <template>
<Entry <Entry
:key="formKey"
ref="entryRehabRef" ref="entryRehabRef"
v-model="model" v-model="model"
:schema="schema" :schema="schema"
+3 -2
View File
@@ -44,6 +44,7 @@ const model = ref({
const isLoading = reactive<DataTableLoader>({ const isLoading = reactive<DataTableLoader>({
isTableLoading: false, isTableLoading: false,
}) })
const formKey = ref(0)
async function getDetail() { async function getDetail() {
isLoading.isTableLoading = true isLoading.isTableLoading = true
@@ -53,7 +54,7 @@ async function getDetail() {
const values = JSON.parse(raw.value) const values = JSON.parse(raw.value)
console.log('values', values) console.log('values', values)
model.value = values model.value = values
// diagnoses.value = (resp.body as Record<string, any>).data formKey.value++ // Force re-render with new data
} }
isLoading.isTableLoading = false isLoading.isTableLoading = false
} }
@@ -136,8 +137,8 @@ provide('table_data_loader', isLoading)
provide('icdPreview', icdPreview) provide('icdPreview', icdPreview)
</script> </script>
<template> <template>
{{ model }}
<Entry <Entry
:key="formKey"
ref="entryRef" ref="entryRef"
v-model="model" v-model="model"
:schema="schema" :schema="schema"
+1 -3
View File
@@ -84,9 +84,7 @@ const defaultKeys: Record<string, any> = {
id: 'rehab-medical-assessment', id: 'rehab-medical-assessment',
title: 'Pengkajian Awal Medis Rehabilitasi Medis', title: 'Pengkajian Awal Medis Rehabilitasi Medis',
classCode: ['ambulatory'], classCode: ['ambulatory'],
// FIXME: just for now unit: 'rehab',
// unit: 'rehab',
unit: 'all',
afterId: 'early-medical-assessment', afterId: 'early-medical-assessment',
}, },
functionAssessment: { functionAssessment: {