Fix: Refactor Organization CRUD {id} to {code}

This commit is contained in:
hasyim_kai
2025-11-11 14:07:46 +07:00
parent 3f63f195d0
commit 270869b928
52 changed files with 211 additions and 216 deletions

No files matched your search

+12 -16
View File
@@ -103,26 +103,22 @@ const getCurrentUnitDetail = async (id: number | string) => {
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
if (Number(recId.value) > 0) {
const id = Number(recId.value)
if (recItem.value.code.length > 0) {
navigateTo({
name: 'org-src-unit-id',
params: {
id: recItem.value.code,
},
})
recAction.value = ''
recItem.value = null
recId.value = 0
isFormEntryDialogOpen.value = false
isReadonly.value = false
navigateTo({
name: 'org-src-unit-id',
params: {
id,
},
})
}
break
case ActionEvents.showEdit:
getCurrentUnitDetail(recId.value)
getCurrentUnitDetail(recItem.value.code)
title.value = 'Edit Unit'
isReadonly.value = false
break
@@ -133,7 +129,7 @@ watch([recId, recAction], () => {
})
onMounted(async () => {
installations.value = await getInstallationList()
installations.value = await getInstallationList({}, true)
await getUnitList()
})
</script>
@@ -172,8 +168,8 @@ onMounted(async () => {
:is-readonly="isReadonly"
@submit="
(values: UnitFormData | Record<string, any>, resetForm: () => void) => {
if (recId > 0) {
handleActionEdit(recId, values, getUnitList, resetForm, toast)
if (recItem?.code.length > 0) {
handleActionEdit(recItem.code, values, getUnitList, resetForm, toast)
return
}
handleActionSave(values, getUnitList, resetForm, toast)
@@ -188,7 +184,7 @@ onMounted(async () => {
v-model:open="isRecordConfirmationOpen"
action="delete"
:record="recItem"
@confirm="() => handleActionRemove(recId, getUnitList, toast)"
@confirm="() => handleActionRemove(recItem.code, getUnitList, toast)"
@cancel=""
>
<template #default="{ record }">