油漆实验室

This commit is contained in:
卢江海 2025-04-01 15:27:17 +08:00
parent c90ed71ae5
commit 2ee698d264

View File

@ -414,9 +414,10 @@ export default {
const rowIndex = this.qualityStatistics.findIndex(
(r) => r.id === row.id
);
// 6
const groupIndex = Math.floor(rowIndex / 6) * 6;
// 5
const groupIndex = Math.floor(rowIndex / 5) * 5;
//
if (!groupMap.has(groupIndex)) {
groupMap.set(groupIndex, {
@ -427,19 +428,18 @@ export default {
//
const group = groupMap.get(groupIndex);
group.modifiedRows.add(rowIndex % 6); //
group.modifiedRows.add(rowIndex % 5); //
});
//
const updateList = [];
groupMap.forEach((group, groupIndex) => {
const groupRows = this.qualityStatistics.slice(
groupIndex,
groupIndex + 6
groupIndex + 5
);
// 6使
Array.from({ length: 6 }).forEach((_, i) => {
Array.from({ length: 5 }).forEach((_, i) => {
const row = groupRows[i] || {};
if (group.baseRow == undefined) {
throw new Error("需要保存的数据不在当前页");
@ -456,11 +456,11 @@ export default {
plValue04: row.value04,
plValue05: row.value05,
plValue06: group.baseRow.value06,
plValue07: group.baseRow.value07,
plValue08: group.baseRow.value08,
plValue09: row.value09,
plValue10: row.value10,
plValue11: row.value11,
plValue07: row.value07,
plValue08: row.value08,
plValue09: group.baseRow.value09,
plValue10: group.baseRow.value10,
plValue11: group.baseRow.value11,
plCreatedBy: row.createdBy,
plCreatedTime: row.createdTime,
plUpdatedBy: row.updatedBy,
@ -468,14 +468,13 @@ export default {
});
});
});
const { code, data } = await UpdateRawMateriallist(updateList);
if (code === 200) {
this.$message.success(`成功保存${data}条记录`);
this.modifiedRows = {};
await this.fetchData();
//
this.mergeTableRows(6);
this.mergeTableRows(5);
}
} catch (error) {
console.error("保存失败:", error);
@ -643,37 +642,37 @@ export default {
});
},
// updateRow(row) {
// const baseIndex = Math.floor(this.qualityStatistics.indexOf(row) / 5) * 5;
// const updatedData = Array.from({ length: 5 }, (_, i) => ({
// id: this.qualityStatistics[baseIndex + i].id,
// plIdGroup: this.qualityStatistics[baseIndex + i].idGroup,
// description: this.qualityStatistics[baseIndex].description,
// plCode: this.qualityStatistics[baseIndex].code,
// plPci: this.qualityStatistics[baseIndex].pci,
// plValue01: this.qualityStatistics[baseIndex + i].value01,
// plValue02: this.qualityStatistics[baseIndex + i].value02,
// plValue03: this.qualityStatistics[baseIndex + i].value03,
// plValue04: this.qualityStatistics[baseIndex + i].value04,
// plValue05: this.qualityStatistics[baseIndex + i].value05,
// plValue06: this.qualityStatistics[baseIndex].value06,
// plValue07: this.qualityStatistics[baseIndex + i].value07,
// plValue08: this.qualityStatistics[baseIndex + i].value08,
// plValue09: this.qualityStatistics[baseIndex].value09,
// plValue10: this.qualityStatistics[baseIndex].value10,
// plValue11: this.qualityStatistics[baseIndex].value11,
// plCreatedBy: this.qualityStatistics[baseIndex + i].createdBy,
// plCreatedTime: this.qualityStatistics[baseIndex + i].createdTime,
// plUpdatedBy: this.qualityStatistics[baseIndex + i].updatedBy,
// plUpdatedTime: this.qualityStatistics[baseIndex + i].updatedTime,
// }));
updateRow(row) {
const baseIndex = Math.floor(this.qualityStatistics.indexOf(row) / 5) * 5;
const updatedData = Array.from({ length: 5 }, (_, i) => ({
id: this.qualityStatistics[baseIndex + i].id,
plIdGroup: this.qualityStatistics[baseIndex + i].idGroup,
description: this.qualityStatistics[baseIndex].description,
plCode: this.qualityStatistics[baseIndex].code,
plPci: this.qualityStatistics[baseIndex].pci,
plValue01: this.qualityStatistics[baseIndex + i].value01,
plValue02: this.qualityStatistics[baseIndex + i].value02,
plValue03: this.qualityStatistics[baseIndex + i].value03,
plValue04: this.qualityStatistics[baseIndex + i].value04,
plValue05: this.qualityStatistics[baseIndex + i].value05,
plValue06: this.qualityStatistics[baseIndex].value06,
plValue07: this.qualityStatistics[baseIndex + i].value07,
plValue08: this.qualityStatistics[baseIndex + i].value08,
plValue09: this.qualityStatistics[baseIndex].value09,
plValue10: this.qualityStatistics[baseIndex].value10,
plValue11: this.qualityStatistics[baseIndex].value11,
plCreatedBy: this.qualityStatistics[baseIndex + i].createdBy,
plCreatedTime: this.qualityStatistics[baseIndex + i].createdTime,
plUpdatedBy: this.qualityStatistics[baseIndex + i].updatedBy,
plUpdatedTime: this.qualityStatistics[baseIndex + i].updatedTime,
}));
// UpdateRawMateriallist(updatedData).then((res) => {
// if (res.code === 200) {
// this.$message.success(`-${res.data}`);
// }
// });
// },
UpdateRawMateriallist(updatedData).then((res) => {
if (res.code === 200) {
this.$message.success(`更新成功-${res.data}`);
}
});
},
mergeTableRows(rowsPerGroup) {
this.mergedCells = [];