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