From fff5f2c11d9d7a78e0d56cc159e89984a621a19b Mon Sep 17 00:00:00 2001 From: riefive Date: Mon, 6 Oct 2025 11:06:29 +0700 Subject: [PATCH] fix: update content list of specialist, subspecialist, etc --- .../content/specialist/list-prev.vue | 240 ------------------ app/components/content/specialist/list.vue | 16 +- .../content/subspecialist/list-prev.vue | 239 ----------------- app/components/content/subspecialist/list.vue | 15 +- app/components/content/tools/list.vue | 5 +- app/components/content/unit/list-prev.vue | 207 --------------- app/components/content/unit/list.vue | 15 +- app/components/content/uom/list.vue | 10 +- app/handlers/_shared.handler.ts | 5 - 9 files changed, 34 insertions(+), 718 deletions(-) delete mode 100644 app/components/content/specialist/list-prev.vue delete mode 100644 app/components/content/subspecialist/list-prev.vue delete mode 100644 app/components/content/unit/list-prev.vue diff --git a/app/components/content/specialist/list-prev.vue b/app/components/content/specialist/list-prev.vue deleted file mode 100644 index 9ed71016..00000000 --- a/app/components/content/specialist/list-prev.vue +++ /dev/null @@ -1,240 +0,0 @@ - - - - - diff --git a/app/components/content/specialist/list.vue b/app/components/content/specialist/list.vue index c48036b4..71d573b4 100644 --- a/app/components/content/specialist/list.vue +++ b/app/components/content/specialist/list.vue @@ -28,12 +28,12 @@ import { handleActionRemove, handleCancelForm, } from '~/handlers/specialist.handler' -import { units, getUnitList } from '~/handlers/_shared.handler' // Services -import { getSpecialists, getSpecialistDetail } from '~/services/specialist.service' -import { get } from "@vueuse/core" +import { getList, getDetail } from '~/services/specialist.service' +import { getValueLabelList as getUnitList } from '~/services/unit.service' +const units = ref<{ value: string | number; label: string }[]>([]) const title = ref('') const { @@ -46,10 +46,10 @@ const { fetchData: getSpecialistList, } = usePaginatedList({ fetchFn: async (params: any) => { - // TODO: use pagination params - const result = await getSpecialists({ + const result = await getList({ search: params.search, - page: params['page-number'] || 0, + 'page-number': params['page-number'] || 0, + 'page-size': params['page-size'] || 10, includes: 'unit', }) return { success: result.success || false, body: result.body || {} } @@ -89,7 +89,7 @@ provide('rec_item', recItem) provide('table_data_loader', isLoading) const getCurrentSpecialistDetail = async (id: number | string) => { - const result = await getSpecialistDetail(id) + const result = await getDetail(id) if (result.success) { const currentValue = result.body?.data || {} recItem.value = currentValue @@ -117,8 +117,8 @@ watch([recId, recAction], () => { }) onMounted(async () => { + units.value = await getUnitList() await getSpecialistList() - await getUnitList() }) diff --git a/app/components/content/subspecialist/list-prev.vue b/app/components/content/subspecialist/list-prev.vue deleted file mode 100644 index 81f59399..00000000 --- a/app/components/content/subspecialist/list-prev.vue +++ /dev/null @@ -1,239 +0,0 @@ - - - diff --git a/app/components/content/subspecialist/list.vue b/app/components/content/subspecialist/list.vue index bc1df2d4..bf60598e 100644 --- a/app/components/content/subspecialist/list.vue +++ b/app/components/content/subspecialist/list.vue @@ -28,11 +28,12 @@ import { handleActionRemove, handleCancelForm, } from '~/handlers/subspecialist.handler' -import { specialists, getSpecialistsList } from '~/handlers/_shared.handler' // Services -import { getSubspecialists, getSubspecialistDetail } from '~/services/subspecialist.service' +import { getList, getDetail } from '~/services/subspecialist.service' +import { getValueLabelList as getSpecialistsList } from '~/services/specialist.service' +const specialists = ref<{ value: string | number; label: string }[]>([]) const title = ref('') const { @@ -45,10 +46,10 @@ const { fetchData: getSubSpecialistList, } = usePaginatedList({ fetchFn: async (params: any) => { - // TODO: use pagination params - const result = await getSubspecialists({ + const result = await getList({ search: params.search, - page: params['page-number'] || 0, + 'page-number': params['page-number'] || 0, + 'page-size': params['page-size'] || 10, includes: 'specialist', }) return { success: result.success || false, body: result.body || {} } @@ -88,7 +89,7 @@ provide('rec_item', recItem) provide('table_data_loader', isLoading) const getCurrentSubSpecialistDetail = async (id: number | string) => { - const result = await getSubspecialistDetail(id) + const result = await getDetail(id) if (result.success) { const currentValue = result.body?.data || {} recItem.value = currentValue @@ -116,8 +117,8 @@ watch([recId, recAction], () => { }) onMounted(async () => { + specialists.value = await getSpecialistsList() await getSubSpecialistList() - await getSpecialistsList() }) diff --git a/app/components/content/tools/list.vue b/app/components/content/tools/list.vue index c1946260..32fbbdea 100644 --- a/app/components/content/tools/list.vue +++ b/app/components/content/tools/list.vue @@ -28,11 +28,12 @@ import { handleActionRemove, handleCancelForm, } from '~/handlers/device.handler' -import { uoms, getUomList } from '~/handlers/_shared.handler' // Services import { getList, getDetail } from '~/services/device.service' +import { getValueLabelList as getUomList } from '~/services/uom.service' +const uoms = ref<{ value: string; label: string }[]>([]) const title = ref('') const { @@ -116,8 +117,8 @@ watch([recId, recAction], () => { }) onMounted(async () => { + uoms.value = await getUomList() await getToolsList() - await getUomList() }) diff --git a/app/components/content/unit/list-prev.vue b/app/components/content/unit/list-prev.vue deleted file mode 100644 index e5498f25..00000000 --- a/app/components/content/unit/list-prev.vue +++ /dev/null @@ -1,207 +0,0 @@ - - - - - diff --git a/app/components/content/unit/list.vue b/app/components/content/unit/list.vue index 812f0e05..d8ffafa5 100644 --- a/app/components/content/unit/list.vue +++ b/app/components/content/unit/list.vue @@ -28,11 +28,12 @@ import { handleActionRemove, handleCancelForm, } from '~/handlers/unit.handler' -import { installations, getInstallationList } from '~/handlers/_shared.handler' // Services -import { getUnits, getUnitDetail } from '~/services/unit.service' +import { getList, getDetail } from '~/services/unit.service' +import { getValueLabelList as getInstallationList } from '~/services/installation.service' +const installations = ref<{ value: string; label: string }[]>([]) const title = ref('') const { @@ -45,10 +46,10 @@ const { fetchData: getUnitList, } = usePaginatedList({ fetchFn: async (params: any) => { - // TODO: use pagination params - const result = await getUnits({ + const result = await getList({ search: params.search, - page: params['page-number'] || 0, + 'page-number': params['page-number'] || 0, + 'page-size': params['page-size'] || 10, includes: 'installation', }) return { success: result.success || false, body: result.body || {} } @@ -88,7 +89,7 @@ provide('rec_item', recItem) provide('table_data_loader', isLoading) const getCurrentUnitDetail = async (id: number | string) => { - const result = await getUnitDetail(id) + const result = await getDetail(id) if (result.success) { const currentValue = result.body?.data || {} recItem.value = currentValue @@ -116,8 +117,8 @@ watch([recId, recAction], () => { }) onMounted(async () => { + installations.value = await getInstallationList() await getUnitList() - await getInstallationList() }) diff --git a/app/components/content/uom/list.vue b/app/components/content/uom/list.vue index 8c9a3f4a..116f0a4d 100644 --- a/app/components/content/uom/list.vue +++ b/app/components/content/uom/list.vue @@ -29,7 +29,7 @@ import { } from '~/handlers/uom.handler' // Services -import { getUoms, getUomDetail } from '~/services/uom.service' +import { getList, getDetail } from '~/services/uom.service' const title = ref('') @@ -43,7 +43,11 @@ const { fetchData: getUomList, } = usePaginatedList({ fetchFn: async (params: any) => { - const result = await getUoms({ search: params.search, page: params['page-number'] || 0 }) + const result = await getList({ + search: params.search, + 'page-number': params['page-number'] || 0, + 'page-size': params['page-size'] || 10, + }) return { success: result.success || false, body: result.body || {} } }, entityName: 'uom', @@ -81,7 +85,7 @@ provide('rec_item', recItem) provide('table_data_loader', isLoading) const getCurrentUomDetail = async (id: number | string) => { - const result = await getUomDetail(id) + const result = await getDetail(id) if (result.success) { const currentValue = result.body?.data || {} recItem.value = currentValue diff --git a/app/handlers/_shared.handler.ts b/app/handlers/_shared.handler.ts index eb6b9bf4..e69de29b 100644 --- a/app/handlers/_shared.handler.ts +++ b/app/handlers/_shared.handler.ts @@ -1,5 +0,0 @@ -// variables -export const installations = ref<{ value: string; label: string }[]>([]) -export const specialists = ref<{ value: string | number; label: string }[]>([]) -export const units = ref<{ value: string | number; label: string }[]>([]) -