Quellcode durchsuchen

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionOperation

TonyKang vor 7 Jahren
Ursprung
Commit
b471be94a1

+ 3 - 3
Dockerfile

@@ -1,8 +1,8 @@
-FROM server:3.0
+FROM operationbase:latest
 
-COPY . ConstructionOperation
+WORKDIR /ConstructionOperation
 
-WORKDIR ConstructionOperation
+RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionOperation master
 
 RUN mkdir tmp
 

+ 3 - 3
Dockerfile_qa

@@ -1,8 +1,8 @@
-FROM server:3.0
+FROM operationbase:latest
 
-COPY . ConstructionOperation
+WORKDIR /ConstructionOperation
 
-WORKDIR ConstructionOperation
+RUN git pull http://192.168.1.12:3000/SmartCost/ConstructionOperation master
 
 RUN mkdir tmp
 

+ 3 - 0
package.json

@@ -27,5 +27,8 @@
     "log4js": "~2.3.3",
     "pdfkit": "^0.8.2",
     "ueditor": "^1.2.3"
+  },
+  "scripts": {
+    "start": "C:\\Users\\mai\\AppData\\Roaming\\npm\\babel-node.cmd operation.js"
   }
 }

+ 23 - 9
web/users/js/col_setting.js

@@ -42,20 +42,29 @@ let ColSettingObj = {
         style.wordWrap = true;
         return style;
     },
+    getSettingItems: function (type, items) {
+        let events = MainTreeCol[type];
+        for (let prop in events) {
+            if (typeof(events[prop]) === 'function') {
+                items.push(type + '.' + prop);
+            }
+        }
+    },
     initCellType: function () {
         this.cellType.readOnly = new GC.Spread.Sheets.CellTypes.ComboBox();
-        this.cellType.readOnly.items([true, false,
-            'readOnly.bills', 'readOnly.ration', 'readOnly.volumePrice',
-            'readOnly.non_bills', 'readOnly.non_ration', 'readOnly.non_volumePrice',
-            'readOnly.billsParent', 'readOnly.forCalcBase', 'readOnly.forUnitFee',
-            'readOnly.forTotalFee', 'readOnly.leafBillsWithDetail'
-        ]);
+        let readOnlyItems = [true, false];
+        this.getSettingItems('readOnly', readOnlyItems);
+        this.cellType.readOnly.items(readOnlyItems);
 
         this.cellType.getText = new GC.Spread.Sheets.CellTypes.ComboBox();
-        this.cellType.getText.items(['getText.type']);
+        let getTextItems = [];
+        this.getSettingItems('getText', getTextItems);
+        this.cellType.getText.items(getTextItems);
 
         this.cellType.cellType = new GC.Spread.Sheets.CellTypes.ComboBox();
-        this.cellType.cellType.items(['cellType.units', 'cellType.feeRate']);
+        let cellTypeItems = [];
+        this.getSettingItems('cellType', cellTypeItems)
+        this.cellType.cellType.items(cellTypeItems);
 
         this.cellType.checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
     },
@@ -291,9 +300,14 @@ let ColSettingObj = {
             if (cell.text() !== '') {
                 col.data.getText = cell.text();
             }
-            setting.cols.push(col);
             // wordWrap
             col.data.wordWrap = sheet.getValue(setting.headRows + this.Rows.wordWrap, iCol) || false;
+            // cellType
+            cell = sheet.getCell(setting.headRows + this.Rows.cellType, iCol);
+            if (cell.text() !== '') {
+                col.data.cellType = cell.text();
+            }
+            setting.cols.push(col);
         }
         return setting;
     }

+ 65 - 2
web/users/js/main_tree_col.js

@@ -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});
+});

+ 1 - 0
web/users/views/compilation/engineering.html

@@ -157,4 +157,5 @@
 <script type="text/javascript" src="/public/web/id_tree.js"></script>
 <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
 <script type="text/javascript" src="/web/users/js/compilation.js"></script>
+<script type="text/javascript" src="/web/users/js/main_tree_col.js"></script>
 <%include ../compilation/modal.html %>