b288dae2 by xukangle

fix

1 parent 858dbda3
......@@ -185,12 +185,12 @@ const tempRowData = ref<any>([]);
// 编辑行
const editRow = (row) => {
// console.log('编辑:', row);
// // 暂存编辑前的数据 用于取消编辑时恢复原始数据,先判断是否已经暂存过tempRowData通过fieldGuid
// if (!tempRowData.value.find((item) => item.fieldGuid === row.fieldGuid)) {
// tempRowData.value.push({ ...row });
// }
console.log('编辑:', row);
// 暂存编辑前的数据 用于取消编辑时恢复原始数据,先判断是否已经暂存过tempRowData通过fieldGuid
if (!tempRowData.value.find((item) => item.fieldGuid === row.fieldGuid)) {
tempRowData.value.push({ ...row });
}
console.log('tempRowData:', tempRowData.value);
// console.log('tempRowData:', tempRowData.value);
// if (row.fieldLengthCondition) {
// const arr = row.fieldLengthCondition.split('#'); // 按 '#' 分割
......@@ -404,9 +404,20 @@ const cancel = () => {
// 点击取消
const cancelEdit = (row) => {
// console.log('取消编辑:', row, tempRowData.value);
// // 可在此恢复原始数据逻辑,要查找暂存的数据 tempRowData 中 fieldGuid 与当前行的 fieldGuid 相同的数据
// const tempRow = tempRowData.value.find((item) => item.fieldGuid === row.fieldGuid);
// Object.assign(row, tempRow);
// 可在此恢复原始数据逻辑,要查找暂存的数据 tempRowData 中 fieldGuid 与当前行的 fieldGuid 相同的数据
const tempRow = tempRowData.value.find((item) => item.fieldGuid === row.fieldGuid);
// 遍历tableData.value,找到当前行并恢复原始数据
tableData.value.forEach((item) => {
if (item.fieldGuid === tempRow.fieldGuid) {
// 恢复原始数据
row.fieldLengthCondition = item.fieldLengthCondition;
row.fieldPrecision = item.fieldPrecision;
row.isUnique = item.isUnique;
row.notNull = item.notNull;
row.fieldValueRange = item.fieldValueRange;
}
});
row.isEdit = false; // 退出编辑状态
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!