[fix] แก้ไขกรณีแก้ไขตำแหน่ง/แก้ไขอัตรากำลังแล้วมีคนครองอยู่
This commit is contained in:
parent
d2c5a515ff
commit
4bcd54aea2
2 changed files with 10 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ interface RowDetailPositions {
|
|||
posExecutiveId: string;
|
||||
isSpecial: boolean;
|
||||
positionIsSelected: string;
|
||||
isNew?: boolean;
|
||||
}
|
||||
|
||||
interface DataOption2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue