|
@@ -38,9 +38,18 @@ let MainTreeCol = {
|
|
|
billsParent: function (node) {
|
|
|
return node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children.length > 0;
|
|
|
},
|
|
|
+ leafBillsWithDetail: function (node) {
|
|
|
+ return (!MainTreeCol.readOnly.billsParent(node)) && (node.children.length > 0);
|
|
|
+ },
|
|
|
forCalcBase: function (node) {
|
|
|
// to do according to billsParentType
|
|
|
- return MainTreeCol.readOnly.billsParent && MainTreeCol.readOnly.non_bills;
|
|
|
+ return MainTreeCol.readOnly.billsParent(node) || MainTreeCol.readOnly.non_bills(node)||MainTreeCol.readOnly.leafBillsWithDetail(node);
|
|
|
+ },
|
|
|
+ forUnitFee: function (node) {
|
|
|
+ return MainTreeCol.readOnly.ration(node) || MainTreeCol.readOnly.billsParent(node) || MainTreeCol.readOnly.leafBillsWithDetail(node);
|
|
|
+ },
|
|
|
+ forTotalFee: function (node) {
|
|
|
+ return MainTreeCol.readOnly.non_bills(node) || MainTreeCol.readOnly.billsParent(node) || (MainTreeCol.readOnly.leafBillsWithDetail(node));
|
|
|
}
|
|
|
},
|
|
|
cellType: {
|
|
@@ -49,8 +58,11 @@ let MainTreeCol = {
|
|
|
combo.itemHeight(10).items(['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
|
|
|
'根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']);
|
|
|
return combo;
|
|
|
+ },
|
|
|
+ feeRate: function () {
|
|
|
+ return feeRateObject.getFeeRateEditCellType();
|
|
|
}
|
|
|
- },
|
|
|
+ },
|
|
|
getEvent: function (eventName) {
|
|
|
let names = eventName.split('.');
|
|
|
let event = this;
|
|
@@ -86,3 +98,54 @@ let MainTreeCol = {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+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);
|
|
|
+
|
|
|
+ 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;
|
|
|
+ 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);
|
|
|
+ cell = sheet.getCell(0, index).value(col.visible);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ initSettingSpread: function () {
|
|
|
+ this.settingSpread = SheetDataHelper.createNewSpread($('#col_setting_spread')[0], {sheetCount: 1});
|
|
|
+ this.settingSpread.options.showScrollTip = GC.Spread.Sheets.ShowScrollTip.horizontal;
|
|
|
+ this.loadSetting(this.settingSpread.getActiveSheet(), projectObj.project.projSetting.main_tree_col);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+$('#column').on('shown.bs.modal', function () {
|
|
|
+ if (!colSettingObj.settingSpread) {
|
|
|
+ colSettingObj.initSettingSpread();
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+$('#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);
|
|
|
+ }
|
|
|
+ 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});
|
|
|
+});
|