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
@@ -105,12 +105,12 @@ const getCurrentDivisionDetail = async (id: number | string) => {
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
getCurrentDivisionDetail(recId.value)
getCurrentDivisionDetail(recItem.value.code)
title.value = 'Detail Divisi Position'
isReadonly.value = true
break
case ActionEvents.showEdit:
getCurrentDivisionDetail(recId.value)
getCurrentDivisionDetail(recItem.value.code)
title.value = 'Edit Divisi Position'
isReadonly.value = false
break
@@ -122,7 +122,7 @@ watch([recId, recAction], () => {
onMounted(async () => {
try {
divisions.value = await getDivisionLabelList({ sort: 'createdAt:asc', 'page-size': 100 })
divisions.value = await getDivisionLabelList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
await getDivisionList()
} catch (err) {
@@ -172,9 +172,8 @@ onMounted(async () => {
:is-readonly="isReadonly"
@submit="
(values: DivisionPositionFormData | Record<string, any>, resetForm: () => void) => {
console.log(values)
if (recId > 0) {
handleActionEdit(recId, values, getDivisionList, resetForm, toast)
if (recItem?.code.length > 0) {
handleActionEdit(recItem.code, values, getDivisionList, resetForm, toast)
return
}
handleActionSave(values, getDivisionList, resetForm, toast)
@@ -189,7 +188,7 @@ onMounted(async () => {
v-model:open="isRecordConfirmationOpen"
action="delete"
:record="recItem"
@confirm="() => handleActionRemove(recId, getDivisionList, toast)"
@confirm="() => handleActionRemove(recItem.code, getDivisionList, toast)"
@cancel=""
>
<template #default="{ record }">