This commit is contained in:
sundongyu 2024-04-09 13:08:07 +08:00
commit 5651aed6b7
2 changed files with 33 additions and 8 deletions

View File

@ -206,6 +206,13 @@ const columns = ref([
align: "center", align: "center",
width: "100", width: "100",
}, },
{
colKey: "breakInfo",
title: "报损原因",
ellipsis: true,
align: "center",
width: "100",
},
{ {
colKey: "status", colKey: "status",
title: "操作", title: "操作",
@ -337,12 +344,13 @@ const FORM_RULES = {
const breakSub = async ({ validateResult, firstError }) => { const breakSub = async ({ validateResult, firstError }) => {
if (validateResult === true) { if (validateResult === true) {
dialogData.value = { dialogData.value = {
...rowItem.row.value, ...rowItem.value.row,
breakStatus: Number(dialogData.value.Status),
}; };
await destroyList.auditDestroyList(dialogData.value); await destroyList.auditDestroyList(dialogData.value);
getNewTable(); getNewTable();
MessagePlugin.success("提交成功");
visiblePost.value = false; visiblePost.value = false;
MessagePlugin.success("提交成功");
} else { } else {
console.log("Validate Errors: ", firstError, validateResult); console.log("Validate Errors: ", firstError, validateResult);
} }

View File

@ -8,15 +8,32 @@ export const useDestroy = defineStore("destroyList", {
}, },
actions: { actions: {
async getDestroyList() { async getDestroyList() {
this.destroyList = JSON.parse( const storedData = localStorage.getItem("breakageList");
localStorage.getItem("breakageList") if (storedData) {
).destroyList; const parsedData = JSON.parse(storedData);
console.log(this.destroyList); this.destroyList = parsedData.destroyList;
}
return this.destroyList; return this.destroyList;
}, },
auditDestroyList(item) { auditDestroyList(item) {
console.log(item); const storedData = localStorage.getItem("breakageList");
// let arr = thisz if (storedData) {
const parsedData = JSON.parse(storedData);
parsedData.destroyList = parsedData.destroyList.filter(
(i) => i.id !== item.id
);
parsedData.breakageList = parsedData.breakageList.map((i) => {
console.log(i.id, item.id);
if (i.id === item.id) {
console.log(item.breakStatus);
return { ...i, breakStatus: item.breakStatus }; // 返回更新后的对象
}
return i; // 保持其他项不变
});
console.log(parsedData.breakageList);
localStorage.setItem("breakageList", JSON.stringify(parsedData));
this.destroyList = parsedData.destroyList; // 更新store中的destroyList状态
}
}, },
}, },
persist: true, persist: true,