Fix: refactor constList Uplaod Doc

This commit is contained in:
hasyim_kai
2025-11-14 15:47:11 +07:00
parent 60c13649d9
commit bb0017ffcb
4 changed files with 15 additions and 6 deletions
@@ -2,7 +2,7 @@
import type { FormErrors } from '~/types/error' import type { FormErrors } from '~/types/error'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue' import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import { cn, mapToComboboxOptList } from '~/lib/utils' import { cn, mapToComboboxOptList } from '~/lib/utils'
import { supportingDocTypeCode, supportingDocOpt, type supportingDocTypeCodeKey } from '~/lib/constants' import { docTypeCode, supportingDocOpt, type docTypeCodeKey } from '~/lib/constants'
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service' import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
import { getValueLabelList as getUnitLabelList } from '~/services/unit.service' import { getValueLabelList as getUnitLabelList } from '~/services/unit.service'
@@ -1,5 +1,6 @@
import type { Config } from '~/components/pub/my-ui/data-table' import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { docTypeCode, docTypeLabel, type docTypeCodeKey } from '~/lib/constants'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dd.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dd.vue'))
@@ -22,6 +23,10 @@ export const config: Config = {
], ],
parses: { parses: {
type_code: (v: unknown) => {
console.log(v)
return docTypeLabel[v as docTypeCodeKey]
},
}, },
components: { components: {
+7 -3
View File
@@ -405,17 +405,21 @@ export const encounterDocOpt: { label: string; value: encounterDocTypeCodeKey }[
] ]
export const supportingDocTypeCode = { export const docTypeCode = {
"encounter-patient": 'encounter-patient', "encounter-patient": 'encounter-patient',
"encounter-support": 'encounter-support', "encounter-support": 'encounter-support',
"encounter-other": 'encounter-other', "encounter-other": 'encounter-other',
"vclaim-sep": 'vclaim-sep',
"vclaim-sipp": 'vclaim-sipp',
} as const } as const
export const supportingDocTypeLabel = { export const docTypeLabel = {
"encounter-patient": 'Data Pasien', "encounter-patient": 'Data Pasien',
"encounter-support": 'Data Penunjang', "encounter-support": 'Data Penunjang',
"encounter-other": 'Lain - Lain', "encounter-other": 'Lain - Lain',
"vclaim-sep": 'SEP',
"vclaim-sipp": 'SIPP',
} as const } as const
export type supportingDocTypeCodeKey = keyof typeof supportingDocTypeCode export type docTypeCodeKey = keyof typeof docTypeCode
export const supportingDocOpt = [ export const supportingDocOpt = [
{ label: 'Data Pasien', value: 'encounter-patient' }, { label: 'Data Pasien', value: 'encounter-patient' },
{ label: 'Data Penunjang', value: 'encounter-support' }, { label: 'Data Penunjang', value: 'encounter-support' },
+2 -2
View File
@@ -1,5 +1,5 @@
import { type Base, genBase } from "./_base" import { type Base, genBase } from "./_base"
import { supportingDocOpt, supportingDocTypeCode, supportingDocTypeLabel, type supportingDocTypeCodeKey } from '~/lib/constants' import { docTypeLabel, } from '~/lib/constants'
import { genEmployee, type Employee } from "./employee" import { genEmployee, type Employee } from "./employee"
import { genEncounter, type Encounter } from "./encounter" import { genEncounter, type Encounter } from "./encounter"
@@ -21,7 +21,7 @@ export function genEncounterDocument(): EncounterDocument {
encounter: genEncounter(), encounter: genEncounter(),
upload_employee_id: 0, upload_employee_id: 0,
employee: genEmployee(), employee: genEmployee(),
type_code: supportingDocTypeLabel["encounter-patient"], type_code: docTypeLabel["encounter-patient"],
name: 'example', name: 'example',
filePath: 'https://bing.com', filePath: 'https://bing.com',
fileName: 'example', fileName: 'example',