[fix] แก้ไขกรณีแก้ไขตำแหน่ง/แก้ไขอัตรากำลังแล้วมีคนครองอยู่

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-08-22 15:10:36 +07:00
parent d2c5a515ff
commit 4bcd54aea2
2 changed files with 10 additions and 2 deletions

View file

@ -282,7 +282,7 @@ function onSubmit() {
dialogConfirm($q, async () => {
const positionsData = rows.value.map(
(e: RowDetailPositions, index: number) => ({
id: e.id, //id
id: !e.isNew ? e.id : null, //id
posDictName: e.positionName, // ()
posDictField: e.positionField, //
posTypeId: e.posTypeId, //*
@ -426,7 +426,8 @@ async function addPosition(data: RowDetailPositions) {
item.positionName == data.positionName &&
item.isSpecial == data.isSpecial
);
data.id = null; // Reset id to ensure a new entry
// data.id = null; // Reset id to ensure a new entry
data.isNew = true; // Mark as new entry
if (!isIdExist) {
rows.value = [...rows.value, data];
}
@ -441,6 +442,12 @@ function deleteData(id: string) {
const updatedRows = dataRow.filter(
(item: RowDetailPositions) => item.id !== id
);
// selectedPos
if (dataRow.find((item) => item.id === id)?.positionIsSelected) {
selectedPos.value = [];
}
rows.value = updatedRows;
}

View file

@ -145,6 +145,7 @@ interface RowDetailPositions {
posExecutiveId: string;
isSpecial: boolean;
positionIsSelected: string;
isNew?: boolean;
}
interface DataOption2 {