소스 검색

colSetting

MaiXinRong 7 년 전
부모
커밋
5ff200a97d
2개의 변경된 파일19개의 추가작업 그리고 19개의 파일을 삭제
  1. 1 1
      web/building_saas/main/html/main.html
  2. 18 18
      web/building_saas/main/js/views/main_tree_col.js

+ 1 - 1
web/building_saas/main/html/main.html

@@ -584,7 +584,7 @@
                         <span aria-hidden="true">&times;</span>
                     </button>
                 </div>
-                <div class="modal-body modal-auto-height" id="col_setting_spread" style="height: 130px; overflow: hidden;">
+                <div class="modal-body modal-auto-height" id="col_setting_spread" style="overflow: hidden;">
                 </div>
                 <div class="modal-footer">
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>

+ 18 - 18
web/building_saas/main/js/views/main_tree_col.js

@@ -108,33 +108,33 @@ let colSettingObj = {
     settingSpread: null,
     checkBox: new GC.Spread.Sheets.CellTypes.CheckBox(),
     loadSetting: function (sheet, setting) {
-        sheet.setColumnCount(setting.cols.length);
-        sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
-        sheet.setRowCount(1);
-        sheet.getRange(0, -1, 1, -1).cellType(this.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
+        sheet.setRowCount(setting.cols.length);
+        sheet.setColumnCount(setting.headRows, GC.Spread.Sheets.SheetArea.rowHeader);
+        sheet.setColumnCount(1);
+        sheet.getRange(-1, 0, -1, 1).cellType(this.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
 
-        setting.headRowHeight.forEach(function (rowHeight, index) {
-            sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
-        });
         setting.cols.forEach(function (col, index) {
-            let i, iRow = 0, cell;
+            let i, iCol = 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);
+                    cell = sheet.getCell(index, iCol, GC.Spread.Sheets.SheetArea.rowHeader);
+                    cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]);
                 }
                 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);
+                    sheet.addSpan(index, iCol, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.rowHeader);
                 }
-                iRow += col.head.spanRows[i];
+                iCol += col.head.spanRows[i];
             };
-            sheet.setColumnWidth(index, col.width);
-            cell = sheet.getCell(0, index).value(col.visible);
+            let colWidth = sheet.getColumnWidth(index, GC.Spread.Sheets.SheetArea.rowHeader);
+            colWidth = colWidth > col.width ? colWidth : col.width;
+            sheet.setColumnWidth(index, colWidth, GC.Spread.Sheets.SheetArea.rowHeader);
+            cell = sheet.getCell(index, 0).value(col.visible);            
+            sheet.autoFitRow(index);
         });
     },
     initSettingSpread: function () {
         this.settingSpread = SheetDataHelper.createNewSpread($('#col_setting_spread')[0], {sheetCount: 1});
-        this.settingSpread.options.showScrollTip = GC.Spread.Sheets.ShowScrollTip.horizontal;
+        this.settingSpread.options.showScrollTip = GC.Spread.Sheets.ShowScrollTip.vertical;
         this.loadSetting(this.settingSpread.getActiveSheet(), projectObj.project.projSetting.main_tree_col);
     }
 };
@@ -147,9 +147,9 @@ $('#column').on('shown.bs.modal', function () {
 
 $('#column').on('hide.bs.modal', function () {
     let sheet = colSettingObj.settingSpread.getActiveSheet();
-    for (let iCol = 0; iCol < sheet.getColumnCount(); iCol ++) {
-        projectObj.project.projSetting.main_tree_col.cols[iCol].visible = sheet.getValue(0, iCol);
-        projectObj.project.projSetting.mainGridSetting.cols[iCol].visible = sheet.getValue(0, iCol);
+    for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
+        projectObj.project.projSetting.main_tree_col.cols[iRow].visible = sheet.getValue(iRow, 0);
+        projectObj.project.projSetting.mainGridSetting.cols[iRow].visible = sheet.getValue(iRow, 0);
     }
     SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, projectObj.mainSpread.getActiveSheet());
     projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {projectID: projectObj.project.ID(), main_tree_col: projectObj.project.projSetting.main_tree_col});