b288dae2 by xukangle

fix

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