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