Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit fa788c00 authored by Kritkhanin Anantakul's avatar Kritkhanin Anantakul
Browse files

fix target

parent 70653915
No related branches found
No related tags found
No related merge requests found
...@@ -53,10 +53,10 @@ export const useProductionTargetStore = defineStore('productionTarget', () => { ...@@ -53,10 +53,10 @@ export const useProductionTargetStore = defineStore('productionTarget', () => {
const updated = await productionTargetService.updateProductionTarget(id, payload); const updated = await productionTargetService.updateProductionTarget(id, payload);
const index = productionTargets.value.findIndex(p => p.ProductionTargetID === id); const index = productionTargets.value.findIndex(p => p.ProductionTargetID === id);
if (index !== -1) { if (index !== -1) {
// ✅ อัปเดตค่าจริงใน local state เพื่อให้ computed re-render // ✅ อัปเดตทั้ง ActualProduced และ Status จาก response backend
productionTargets.value[index] = { productionTargets.value[index] = {
...productionTargets.value[index], ...productionTargets.value[index],
...payload, // ใช้ payload (เช่น ActualProduced) ทับของเดิม ...updated, // รวม ActualProduced, Status และ field อื่น ๆ ที่ backend ส่งกลับ
}; };
} }
} catch (e: any) { } catch (e: any) {
...@@ -66,6 +66,7 @@ export const useProductionTargetStore = defineStore('productionTarget', () => { ...@@ -66,6 +66,7 @@ export const useProductionTargetStore = defineStore('productionTarget', () => {
} }
} }
async function editTodayTarget(payload: { ProductionTargetID: number, ActualProduced: number }) { async function editTodayTarget(payload: { ProductionTargetID: number, ActualProduced: number }) {
loading.value = true; loading.value = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment