fix Replace ข้อมูลในตาราง
This commit is contained in:
parent
5fa8a7c5dd
commit
5c06f82031
1 changed files with 18 additions and 19 deletions
|
|
@ -611,26 +611,25 @@ async function onSave(val: any, id: string, close?: () => void) {
|
|||
.patch(config.API.salaryTemp + `/${salaryId.value}`, body)
|
||||
.then(async () => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
const idx = rows.value.findIndex((item) => item.id === salaryId.value);
|
||||
// อัปเดทข้อมูลในตาราง
|
||||
if (idx !== -1) {
|
||||
rows.value[idx] = {
|
||||
...rows.value[idx],
|
||||
...body,
|
||||
};
|
||||
}
|
||||
|
||||
rows.value = rows.value.map((item) => {
|
||||
if (item.id === salaryId.value) {
|
||||
return {
|
||||
...item,
|
||||
...body,
|
||||
};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
rowsMain.value = rowsMain.value.map((item) => {
|
||||
if (item.id === salaryId.value) {
|
||||
return {
|
||||
...item,
|
||||
...body,
|
||||
};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
// อัปเดทข้อมูลหลัก
|
||||
const idxMain = rowsMain.value.findIndex(
|
||||
(item) => item.id === salaryId.value
|
||||
);
|
||||
if (idxMain !== -1) {
|
||||
rowsMain.value[idxMain] = {
|
||||
...rowsMain.value[idxMain],
|
||||
...body,
|
||||
};
|
||||
}
|
||||
})
|
||||
.catch(async (err) => {
|
||||
await fetchData?.();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue