Fix: Refactor Organization CRUD {id} to {code}
This commit is contained in:
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [division, divisionAttrs] = defineField('division_id')
|
||||
const [division, divisionAttrs] = defineField('division_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.division_id !== undefined)
|
||||
division.value = props.values.division_id ? Number(props.values.division_id) : null
|
||||
if (props.values.division_code !== undefined)
|
||||
division.value = props.values.division_code ? String(props.values.division_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -72,7 +72,7 @@ if (props.values) {
|
||||
const resetForm = () => {
|
||||
code.value = ''
|
||||
name.value = ''
|
||||
division.value = null
|
||||
division.value = ''
|
||||
employee.value = null
|
||||
headStatus.value = false
|
||||
}
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
division_id: division.value || null,
|
||||
division_code: division.value || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Posisi Divisi</Label>
|
||||
<Field :errMessage="errors.division_id">
|
||||
<Field :errMessage="errors.division_code">
|
||||
<Combobox
|
||||
id="division"
|
||||
v-model="division"
|
||||
|
||||
@@ -18,7 +18,7 @@ import { genDivisionPosition } from '~/models/division-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
divisionId: number
|
||||
divisionId: string
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
|
||||
@@ -36,25 +36,25 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
parent_id: null,
|
||||
parent_code: null,
|
||||
} as Partial<DivisionFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [parent, parentAttrs] = defineField('parent_id')
|
||||
const [parent, parentAttrs] = defineField('parent_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.parent_id !== undefined) parent.value = String(props.values.parent_id)
|
||||
if (props.values.parent_code !== undefined) parent.value = String(props.values.parent_code)
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
code.value = ''
|
||||
name.value = ''
|
||||
parent.value = null
|
||||
parent.value = ''
|
||||
}
|
||||
|
||||
// Form submission handler
|
||||
@@ -63,7 +63,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
parent_id: parent.value || null,
|
||||
parent_code: parent.value || '',
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
@@ -108,7 +108,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Divisi Induk</Label>
|
||||
<Field :errMessage="errors.parent_id">
|
||||
<Field :errMessage="errors.parent_code">
|
||||
<TreeSelect
|
||||
id="parent"
|
||||
v-model="parent"
|
||||
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [installation, installationAttrs] = defineField('installation_id')
|
||||
const [installation, installationAttrs] = defineField('installation_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.installation_id !== undefined)
|
||||
installation.value = props.values.installation_id ? Number(props.values.installation_id) : null
|
||||
if (props.values.installation_code !== undefined)
|
||||
installation.value = props.values.installation_code ? String(props.values.installation_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
installation_id: installation.value || null,
|
||||
installation_code: String(installation.value) || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Instalasi</Label>
|
||||
<Field :errMessage="errors.installation_id">
|
||||
<Field :errMessage="errors.installation_code">
|
||||
<Combobox
|
||||
id="installation"
|
||||
v-model="installation"
|
||||
|
||||
@@ -18,7 +18,7 @@ import { genSpecialistPosition } from '~/models/specialist-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
specialistId: number
|
||||
specialistId: string
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_id')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.specialist_id !== undefined)
|
||||
specialist.value = props.values.specialist_id ? Number(props.values.specialist_id) : null
|
||||
if (props.values.specialist_code !== undefined)
|
||||
specialist.value = props.values.specialist_code ? String(props.values.specialist_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -72,7 +72,7 @@ if (props.values) {
|
||||
const resetForm = () => {
|
||||
code.value = ''
|
||||
name.value = ''
|
||||
specialist.value = null
|
||||
specialist.value = ''
|
||||
employee.value = null
|
||||
headStatus.value = false
|
||||
}
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
specialist_id: specialist.value || null,
|
||||
specialist_code: specialist.value || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Spesialis</Label>
|
||||
<Field :errMessage="errors.specialist_id">
|
||||
<Field :errMessage="errors.specialist_code">
|
||||
<Combobox
|
||||
id="specialist"
|
||||
v-model="specialist"
|
||||
|
||||
@@ -36,19 +36,19 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
unit_id: 0,
|
||||
unit_code: '',
|
||||
} as Partial<SpecialistFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [unit, unitAttrs] = defineField('unit_id')
|
||||
const [unit, unitAttrs] = defineField('unit_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.unit_id !== undefined) unit.value = props.values.unit_id ? String(props.values.unit_id) : null
|
||||
if (props.values.unit_code !== undefined) unit.value = props.values.unit_code ? String(props.values.unit_code) : null
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -63,7 +63,7 @@ function onSubmitForm(values: any) {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
unit_id: unit.value ? Number(unit.value) : null,
|
||||
unit_code: unit.value ? String(unit.value) : null,
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { genSubSpecialistPosition } from '~/models/subspecialist-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
subspecialistId: number
|
||||
subspecialistId: string
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [subSpecialist, subSpecialistAttrs] = defineField('subspecialist_id')
|
||||
const [subSpecialist, subSpecialistAttrs] = defineField('subspecialist_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.subspecialist_id !== undefined)
|
||||
subSpecialist.value = props.values.subspecialist_id ? Number(props.values.subspecialist_id) : null
|
||||
if (props.values.subspecialist_code !== undefined)
|
||||
subSpecialist.value = props.values.subspecialist_code ? String(props.values.subspecialist_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
subspecialist_id: subSpecialist.value || null,
|
||||
subspecialist_code: subSpecialist.value || null,
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Sub Spesialis</Label>
|
||||
<Field :errMessage="errors.subspecialist_id">
|
||||
<Field :errMessage="errors.subspecialist_code">
|
||||
<Combobox
|
||||
id="specialist"
|
||||
v-model="subSpecialist"
|
||||
|
||||
@@ -36,20 +36,20 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
specialist_id: 0,
|
||||
specialist_code: '',
|
||||
} as Partial<SubspecialistFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_id')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.specialist_id !== undefined)
|
||||
specialist.value = props.values.specialist_id ? String(props.values.specialist_id) : null
|
||||
if (props.values.specialist_code !== undefined)
|
||||
specialist.value = props.values.specialist_code ? String(props.values.specialist_code) : null
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -64,7 +64,7 @@ function onSubmitForm(values: any) {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
specialist_id: specialist.value ? Number(specialist.value) : null,
|
||||
specialist_code: specialist.value ? String(specialist.value) : "",
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { genUnitPosition } from '~/models/unit-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
unitId: number
|
||||
unitId: string
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [unit, unitAttrs] = defineField('unit_id')
|
||||
const [unit, unitAttrs] = defineField('unit_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,7 +62,7 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.unit_id !== undefined) unit.value = props.values.unit_id ? Number(props.values.unit_id) : null
|
||||
if (props.values.unit_code !== undefined) unit.value = props.values.unit_code ? String(props.values.unit_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -82,7 +82,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
unit_id: unit.value || null,
|
||||
unit_code: unit.value || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -129,7 +129,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Unit</Label>
|
||||
<Field :errMessage="errors.unit_id">
|
||||
<Field :errMessage="errors.unit_code">
|
||||
<Combobox
|
||||
id="unit"
|
||||
v-model="unit"
|
||||
|
||||
@@ -35,20 +35,20 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
installation_id: 0,
|
||||
installation_code: '',
|
||||
} as Partial<UnitFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [installation, installationAttrs] = defineField('installation_id')
|
||||
const [installation, installationAttrs] = defineField('installation_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.installation_id !== undefined)
|
||||
installation.value = props.values.installation_id ? Number(props.values.installation_id) : null
|
||||
if (props.values.installation_code !== undefined)
|
||||
installation.value = props.values.installation_code ? String(props.values.installation_code) : null
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -62,7 +62,7 @@ function onSubmitForm() {
|
||||
const formData: UnitFormData = {
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
installation_id: installation.value ? Number(installation.value) : null,
|
||||
installation_code: installation.value ? String(installation.value) : "",
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
|
||||
@@ -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 }">
|
||||
|
||||
@@ -47,7 +47,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
divisionId: number
|
||||
divisionId: string
|
||||
}>()
|
||||
const division = ref<Division>({} as Division)
|
||||
// #endregion
|
||||
@@ -152,7 +152,7 @@ watch([recId, recAction], () => {
|
||||
console.log(recId, recAction)
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailDivisionPosition(recId.value)
|
||||
getDetailDivisionPosition(recItem.value.code)
|
||||
title.value = 'Edit Jabatan'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -201,8 +201,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: DivisionPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getDivisionPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getDivisionPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getDivisionPositionList, onResetState, toast)
|
||||
@@ -215,7 +215,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getDivisionPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getDivisionPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -105,26 +105,23 @@ const getCurrentDivisionDetail = 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-division-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-division-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentDivisionDetail(recId.value)
|
||||
getCurrentDivisionDetail(recItem.value.code)
|
||||
title.value = 'Edit Divisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -146,7 +143,7 @@ watch(
|
||||
if (result.success) {
|
||||
const currentData = result.body.data || []
|
||||
const normalizedData = currentData.filter((division: Division) => !division.parent_id)
|
||||
divisionsTrees.value = getValueTreeItems(normalizedData)
|
||||
divisionsTrees.value = getValueTreeItems(normalizedData, true)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -190,9 +187,9 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: DivisionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getDivisionList, resetForm, toast)
|
||||
// console.log(values)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getDivisionList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getDivisionList, resetForm, toast)
|
||||
@@ -207,7 +204,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 }">
|
||||
|
||||
@@ -108,7 +108,7 @@ watch([recId, recAction], () => {
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentInstallationDetail(recId.value)
|
||||
getCurrentInstallationDetail(recItem.value.code)
|
||||
title.value = 'Edit Instalasi - Posisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -120,7 +120,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
installations.value = await getInstallationLabelList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
installations.value = await getInstallationLabelList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -169,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: InstallationPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getInstallationPositionList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getInstallationPositionList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getInstallationPositionList, resetForm, toast)
|
||||
@@ -185,7 +185,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getInstallationPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getInstallationPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -47,7 +47,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
installationId: number
|
||||
installationId: string
|
||||
}>()
|
||||
const installation = ref<Installation>({} as Installation)
|
||||
// #endregion
|
||||
@@ -153,7 +153,7 @@ watch([recId, recAction], () => {
|
||||
console.log(recId, recAction)
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailInstallationPosition(recId.value)
|
||||
getDetailInstallationPosition(recItem.value.code)
|
||||
title.value = 'Edit Jabatan'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -202,8 +202,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: InstallationPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getInstallationPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getInstallationPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getInstallationPositionList, onResetState, toast)
|
||||
@@ -216,7 +216,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getInstallationPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getInstallationPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -102,26 +102,23 @@ const getCurrentInstallationDetail = 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-installation-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-installation-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentInstallationDetail(recId.value)
|
||||
getCurrentInstallationDetail(recItem.value.code)
|
||||
title.value = 'Edit Instalasi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -171,8 +168,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: InstallationFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getInstallationList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getInstallationList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getInstallationList, resetForm, toast)
|
||||
@@ -187,7 +184,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getInstallationList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getInstallationList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -105,12 +105,12 @@ const getCurrentSpecialistDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getCurrentSpecialistDetail(recId.value)
|
||||
getCurrentSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Detail Spesialis Posisi'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSpecialistDetail(recId.value)
|
||||
getCurrentSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Spesialis Posisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -122,7 +122,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
specialists.value = await getValueLabelSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
specialists.value = await getValueLabelSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -169,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSpecialistList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSpecialistList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSpecialistList, resetForm, toast)
|
||||
@@ -184,7 +184,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -48,7 +48,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
specialistId: number
|
||||
specialistId: string
|
||||
}>()
|
||||
const specialist = ref<Specialist>({} as Specialist)
|
||||
// #endregion
|
||||
@@ -154,7 +154,7 @@ provide('table_data_loader', isLoading)
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailSpecialistPosition(recId.value)
|
||||
getDetailSpecialistPosition(recItem.value.code)
|
||||
title.value = 'Edit Posisi'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -203,8 +203,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: SpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getPositionList, onResetState, toast)
|
||||
@@ -217,7 +217,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -103,26 +103,23 @@ const getCurrentSpecialistDetail = 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-specialist-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-specialist-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSpecialistDetail(recId.value)
|
||||
getCurrentSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Spesialis'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -133,7 +130,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
units.value = await getUnitList()
|
||||
units.value = await getUnitList({}, true)
|
||||
await getSpecialistList()
|
||||
})
|
||||
</script>
|
||||
@@ -172,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SpecialistFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSpecialistList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSpecialistList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSpecialistList, resetForm, toast)
|
||||
@@ -188,7 +185,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -110,12 +110,12 @@ const getCurrentSubSpecialistDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getCurrentSubSpecialistDetail(recId.value)
|
||||
getCurrentSubSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Detail Sub Spesialis Posisi'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSubSpecialistDetail(recId.value)
|
||||
getCurrentSubSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Sub Spesialis Posisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -127,7 +127,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
subSpecialists.value = await getValueLabelSubSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
subSpecialists.value = await getValueLabelSubSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -176,8 +176,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SubSpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSubSpecialistList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSubSpecialistList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSubSpecialistList, onResetState, toast)
|
||||
@@ -192,7 +192,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSubSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSubSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -51,7 +51,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
subspecialistId: number
|
||||
subspecialistId: string
|
||||
}>()
|
||||
const subSpecialist = ref<Subspecialist>({} as Subspecialist)
|
||||
// #endregion
|
||||
@@ -157,7 +157,7 @@ provide('table_data_loader', isLoading)
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailSubSpecialistPosition(recId.value)
|
||||
getDetailSubSpecialistPosition(recItem.value.code)
|
||||
title.value = 'Edit Posisi'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -206,8 +206,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: SubSpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getPositionList, onResetState, toast)
|
||||
@@ -220,7 +220,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -103,26 +103,23 @@ const getCurrentSubSpecialistDetail = 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-subspecialist-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-subspecialist-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSubSpecialistDetail(recId.value)
|
||||
getCurrentSubSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Sub Spesialis'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -133,7 +130,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
specialists.value = await getSpecialistsList()
|
||||
specialists.value = await getSpecialistsList({}, true)
|
||||
await getSubSpecialistList()
|
||||
})
|
||||
</script>
|
||||
@@ -172,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SubspecialistFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSubSpecialistList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSubSpecialistList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSubSpecialistList, resetForm, toast)
|
||||
@@ -188,7 +185,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSubSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSubSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -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 }">
|
||||
|
||||
@@ -47,7 +47,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
unitId: number
|
||||
unitId: string
|
||||
}>()
|
||||
const unit = ref<Unit>({} as Unit)
|
||||
// #endregion
|
||||
@@ -152,7 +152,7 @@ watch([recId, recAction], () => {
|
||||
console.log(recId, recAction)
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailUnitPosition(recId.value)
|
||||
getDetailUnitPosition(recItem.value.code)
|
||||
title.value = 'Edit Posisi'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -201,8 +201,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: UnitPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getPositionList, onResetState, toast)
|
||||
@@ -215,7 +215,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -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 }">
|
||||
|
||||
Reference in New Issue
Block a user