fix: refactor view letter

This commit is contained in:
riefive
2025-10-29 13:22:06 +07:00
parent 2d2e14ede0
commit 02e33c4f61
6 changed files with 78 additions and 17 deletions
+4 -2
View File
@@ -131,8 +131,10 @@ watch(props, (value) => {
nationalId.value = objects?.nationalIdentity || '-'
medicalRecordNumber.value = objects?.medicalRecordNumber || '-'
patientName.value = objects?.patientName || '-'
// Set admission type to 1 (rujukan) if sepType exists in query params
if (objects?.sepType) {
if (objects?.sepType === 'internal') {
admissionType.value = '4'
}
if (objects?.sepType === 'external') {
admissionType.value = '1'
}
isDateReload.value = true
@@ -0,0 +1,51 @@
import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
const SelectedRadio = defineAsyncComponent(() => import('~/components/pub/my-ui/data/select-radio.vue'))
export const config: Config = {
cols: [
{ width: 50 },
{ width: 150 },
{ width: 120 },
{ width: 120 },
{ width: 120 },
{ width: 120 },
{ width: 120 },
{ width: 150 },
],
headers: [
[
{ label: '' },
{ label: 'NO. SURAT KONTROL' },
{ label: 'TANGGAL SURAT KONTROL' },
{ label: 'NO. SEP' },
{ label: 'NAMA PASIEN' },
{ label: 'NO. KARTU BPJS' },
{ label: 'KLINIK TUJUAN' },
{ label: 'DOKTER' },
],
],
keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic', 'doctor'],
delKeyNames: [
{ key: 'code', label: 'Code' },
{ key: 'name', label: 'Name' },
],
parses: {},
components: {
check(rec, idx) {
return {
idx,
rec: { ...(rec as object), menu: 'letter' },
component: SelectedRadio,
}
},
},
htmls: {},
}
+6 -8
View File
@@ -10,26 +10,25 @@ export interface LetterData {
patientName: string
bpjsCardNo: string
clinic: string
doctor: string
doctor?: string
}
export const config: Config = {
cols: [{ width: 50 }, { width: 150 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 150 }, { width: 200 }],
cols: [{ width: 50 }, { width: 150 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }],
headers: [
[
{ label: '' },
{ label: 'NO. SURAT' },
{ label: 'TANGGAL SURAT' },
{ label: 'NO. SURAT RUJUKAN' },
{ label: 'TANGGAL SURAT RUJUKAN' },
{ label: 'NO. SEP' },
{ label: 'NAMA PASIEN' },
{ label: 'NO. KARTU BPJS' },
{ label: 'KLINIK TUJUAN' },
{ label: 'DOKTER' },
],
],
keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic', 'doctor'],
keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic'],
delKeyNames: [
{ key: 'code', label: 'Code' },
@@ -42,7 +41,7 @@ export const config: Config = {
check(rec, idx) {
return {
idx,
rec: { ...rec as object, menu: 'letter' },
rec: { ...(rec as object), menu: 'letter' },
component: SelectedRadio,
}
},
@@ -50,4 +49,3 @@ export const config: Config = {
htmls: {},
}
+6 -2
View File
@@ -7,14 +7,18 @@ import type { LetterData } from './list-cfg.letter'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs
import { config } from './list-cfg.letter'
import { config as configControl } from './list-cfg.control'
import { config as configLetter } from './list-cfg.letter'
const props = defineProps<{
data: LetterData[]
menu?: string
selected?: string
paginationMeta?: PaginationMeta
}>()
const menu = props.menu || 'control'
const emit = defineEmits<{
pageChange: [page: number]
}>()
@@ -26,7 +30,7 @@ function handlePageChange(page: number) {
<template>
<PubMyUiDataTable
v-bind="config"
v-bind="menu === 'control' ? configControl : configLetter"
:rows="props.data"
:selected="props.selected"
/>
+2
View File
@@ -23,6 +23,7 @@ import { refDebounced } from '@vueuse/core'
const props = defineProps<{
open: boolean
menu?: string
letters: Array<LetterData>
selected: string
paginationMeta?: PaginationMeta
@@ -101,6 +102,7 @@ watch(debouncedSearch, (newValue) => {
<div class="overflow-x-auto rounded-lg border">
<ListLetter
:data="letters"
:menu="props.menu"
:selected="props.selected"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"