Browse Source

tree_sheet速度优化,优化列头设置

MaiXinRong 7 năm trước cách đây
mục cha
commit
e1f352fd12
1 tập tin đã thay đổi với 25 bổ sung23 xóa
  1. 25 23
      public/web/tree_sheet/tree_sheet_helper.js

+ 25 - 23
public/web/tree_sheet/tree_sheet_helper.js

@@ -47,29 +47,31 @@ var TREE_SHEET_HELPER = {
         return style;
     },
     loadSheetHeader: function (setting, sheet) {
-        if (setting.frozenCols) {
-            sheet.frozenColumnCount(setting.frozenCols);
-        }
-        sheet.setColumnCount(setting.cols.length);
-        sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
-        setting.headRowHeight.forEach(function (rowHeight, index) {
-            sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
-        });
-        setting.cols.forEach(function (col, index) {
-            var i, iRow = 0, cell;
-            for (i = 0; i < col.head.spanCols.length; i++) {
-                if (col.head.spanCols[i] !== 0) {
-                    cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
-                    cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
-                }
-                if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
-                    sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
-                }
-                iRow += col.head.spanRows[i];
-            };
-            sheet.setColumnWidth(index, col.width);
-            sheet.setColumnVisible(index, col.visible && true);
-        });
+        this.massOperationSheet(sheet, function () {
+            if (setting.frozenCols) {
+                sheet.frozenColumnCount(setting.frozenCols);
+            }
+            sheet.setColumnCount(setting.cols.length);
+            sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
+            setting.headRowHeight.forEach(function (rowHeight, index) {
+                sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
+            });
+            setting.cols.forEach(function (col, index) {
+                var i, iRow = 0, cell;
+                for (i = 0; i < col.head.spanCols.length; i++) {
+                    if (col.head.spanCols[i] !== 0) {
+                        cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
+                        cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
+                    }
+                    if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
+                        sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
+                    }
+                    iRow += col.head.spanRows[i];
+                };
+                sheet.setColumnWidth(index, col.width);
+                sheet.setColumnVisible(index, col.visible && true);
+            });
+        });      
     },
     protectdSheet: function (sheet) {
         var option = {