Просмотр исходного кода

修复复制粘贴之间存在隐藏列问题

laiguoran 3 лет назад
Родитель
Сommit
3170e1e9ae
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      app/public/js/change_information_set.js

+ 8 - 1
app/public/js/change_information_set.js

@@ -509,6 +509,8 @@ $(document).ready(() => {
             }
             const data = [];
             // const rowData = [];
+            let needCopyIgnore = !$('#customCheck1').is(':checked');
+            let needColAdd = false;
             for (let iRow = 0; iRow < range.rowCount; iRow++) {
                 let bPaste = true;
                 const curRow = range.row + iRow;
@@ -518,7 +520,12 @@ $(document).ready(() => {
                 let sameCol = 0;
                 for (let iCol = 0; iCol < range.colCount; iCol++) {
                     const curCol = range.col + iCol;
-                    const colSetting = info.sheet.zh_setting.cols[curCol];
+                    let colSetting = info.sheet.zh_setting.cols[curCol];
+                    if ((needColAdd && curCol > 2) || (needCopyIgnore && curCol === 2)) { // 要判断是否已隐藏了变更详情,是则变更详情后面的curCol要+1
+                        const newCurCol = curCol + 1;
+                        needColAdd = true;
+                        colSetting = info.sheet.zh_setting.cols[newCurCol];
+                    }
                     if (!colSetting) continue;
 
                     let validText = info.sheet.getText(curRow, curCol);