Browse Source

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

zhangweicheng 7 years ago
parent
commit
2b3198c61f

+ 1 - 0
public/web/tree_sheet/tree_sheet_helper.js

@@ -362,6 +362,7 @@ var TREE_SHEET_HELPER = {
                 sheet.defaults.rowHeight = setting.defaultRowHeight;
             }
             sheet.setRowCount(tree.count() + setting.emptyRows, GC.Spread.Sheets.SheetArea.viewport);
+            sheet.getRange(tree.count(), -1, setting.emptyRows, -1).locked(true);
             setting.cols.forEach(function (colSetting, iCol) {
                 sheet.setStyle(-1, iCol, TREE_SHEET_HELPER.getSheetCellStyle(colSetting));
                 if (colSetting.showHint) {

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

@@ -557,7 +557,7 @@
     </div>    
     <!--弹出列设置-->
     <div class="modal fade" id="column" data-backdrop="static">
-        <div class="modal-dialog modal-lg" role="document">
+        <div class="modal-dialog modal-lg" role="document" style="width: 350px;">
             <div class="modal-content">
                 <div class="modal-header">
                     <h5 class="modal-title"><i class="fa fa-table"></i> 列设置</h5>

+ 0 - 49
web/building_saas/main/js/calc/calc_fees.js

@@ -1,38 +1,6 @@
 /**
  * Created by Mai on 2017/7/21.
  */
-
-let feeType = [
-    // {type: 'common', name: '工程造价'},
-    // {type: 'baseLabour', name: '基价人工费'},
-    // {type: 'material', name: '材料费'},
-    // {type: 'machine', name: '机械费'},
-    // {type: 'rationDirect', name: '定额直接费'},
-    // {type: 'manage', name: '企业管理费'},
-    // {type: 'profit', name: '利润'},
-    // {type: 'risk', name: '风险费'},
-
-// 以下标准由缪佩玲提供
-    {type: 'direct', name: '直接费'},
-    {type: 'labour', name: '人工费'},
-    {type: 'material', name: '材料费'},
-    {type: 'machine', name: '机械费'},
-    {type: 'mainMaterial', name: '主材费'},
-    {type: 'equipment', name: '设备费'},
-    {type: 'manage', name: '企业管理费'},
-    {type: 'profit', name: '利润'},
-    {type: 'risk', name: '风险费'},
-    {type: 'labourDiff', name: '人工价差'},
-    {type: 'materialDiff', name: '材料价差'},
-    {type: 'machineDiff', name: '机械价差'},
-    {type: 'common', name: '工程造价'},
-    {type: 'adjustLabour', name: '调整人工费'},
-    {type: 'adjustMachineLabour', name: '调整机上人工费'},
-    {type: 'zangu', name: '暂估'},
-    // 模拟用户新增
-    {type: 'fee1', name: '甲供材料费'}
-];
-
 let calcFees = {
     findFee: function (data, fieldName) {
         if (!data.fees) {
@@ -107,22 +75,5 @@ let calcFees = {
                 };
             }
         }
-    },
-    // CSL,2017.08.28
-    feeTypeToName: function (type) {
-        for (let ft of feeType) {
-            if (ft.type === type) {
-                return ft.name;
-            };
-        };
-    },
-
-    feeNameToType: function (name) {
-        for (let ft of feeType) {
-            if (ft.name === name) {
-                return ft.type;
-            };
-        };
-        return '';
     }
 }

+ 2 - 2
web/building_saas/main/js/models/bills.js

@@ -118,7 +118,7 @@ var Bills = {
 
         // 提交数据后的错误处理方法
         bills.prototype.doAfterUpdate = function(err, data){
-            console.log(data)
+            // console.log(data)
             if(data.quantityRefresh){
                 this.refreshDatas(data,'quantity');
             }
@@ -394,4 +394,4 @@ function isDef(v) {
 
 function isFlag(v) {
     return this.isDef(v.flagsIndex) && this.isDef(v.flagsIndex.fixed);
-}
+}

+ 77 - 31
web/building_saas/main/js/models/calc_program.js

@@ -150,6 +150,27 @@ let rationCalcBase = [
     }
 ];
 
+let cpFeeTypes = [
+    {type: 'direct', name: '直接费'},
+    {type: 'labour', name: '人工费'},
+    {type: 'material', name: '材料费'},
+    {type: 'machine', name: '机械费'},
+    {type: 'mainMaterial', name: '主材费'},
+    {type: 'equipment', name: '设备费'},
+    {type: 'manage', name: '企业管理费'},
+    {type: 'profit', name: '利润'},
+    {type: 'risk', name: '风险费'},
+    {type: 'labourDiff', name: '人工价差'},
+    {type: 'materialDiff', name: '材料价差'},
+    {type: 'machineDiff', name: '机械价差'},
+    {type: 'adjustLabour', name: '调整人工费'},
+    {type: 'adjustMachineLabour', name: '调整机上人工费'},
+    {type: 'zangu', name: '暂估'},
+    {type: 'fee1', name: '甲供材料费'},
+    // 模拟用户新增
+    {type: 'common', name: '工程造价'}
+];
+
 let analyzer = {
     calcTemplate: null,
     success: true,
@@ -363,7 +384,7 @@ let executeObj = {
                 };
                 return result;
             };
-            // 量价没有具体的工料机类型,但仍然要用定额的计算程序,所以要给计算基数直接指定。
+            // 量价没有具体的工料机类型,但仍然要用定额的计算程序,所以要给计算基数直接指定。
             function volumePriceFee() {
                 let result = 0;
                 if (
@@ -399,6 +420,39 @@ let executeObj = {
     }
 };
 
+let treeNodeTools = {
+    // 获取全部有公式的树节点清单
+    getFormulaNodes: function () {
+        let nodes = [];
+        for (let node of projectObj.project.mainTree.items){
+              if (node.sourceType == ModuleNames.bills && node.data.calcBase && node.data.calcBase != '') nodes.push(node);
+        };
+        return nodes;
+    },
+
+    isRation: function(treeNode){
+        return treeNode.sourceType === ModuleNames.ration && treeNode.data.type === rationType.ration;
+    },
+
+    isLeafBill: function(treeNode){
+        return treeNode.sourceType === projectObj.project.Bills.getSourceType() &&
+            treeNode.source.children &&
+            treeNode.source.children.length === 0;
+    },
+
+    isNullBill: function (treeNode) {
+        return this.isLeafBill(treeNode) && (treeNode.children.length === 0) && (!treeNode.data.calcBase);
+    },
+
+    isVolumePrice: function (treeNode) {
+        return treeNode.sourceType === ModuleNames.ration && treeNode.data.type === rationType.volumePrice;
+    },
+
+    isGljRation: function (treeNode) {
+        return treeNode.sourceType === ModuleNames.ration && treeNode.data.type === rationType.gljRation;
+    }
+};
+
 class CalcProgram {
     constructor(project){
         let me = this;
@@ -437,7 +491,7 @@ class CalcProgram {
 
         me.feeRates = this.project.FeeRate.datas.rates;
         me.labourCoes = this.project.labourCoe.datas.coes;
-        me.feeTypes = feeType;
+        me.feeTypes = cpFeeTypes;
         me.calcBases = rationCalcBase;
         me.templates = this.project.calcProgram.datas.templates;
 
@@ -594,30 +648,6 @@ class CalcProgram {
         };
     };
 
-    isLeafBill(treeNode){
-        let me = this;
-        return treeNode.sourceType === me.project.Bills.getSourceType() &&
-               treeNode.source.children &&
-               treeNode.source.children.length === 0;
-    };
-
-    isNullBill(treeNode){
-        let me = this;
-        return me.isLeafBill(treeNode) && (treeNode.children.length ===0) && (!treeNode.data.calcBase);
-    };
-
-    isRation(treeNode){
-        return treeNode.sourceType === ModuleNames.ration && treeNode.data.type === rationType.ration;
-    };
-
-    isVolumePrice(treeNode){
-        return treeNode.sourceType === ModuleNames.ration && treeNode.data.type === rationType.volumePrice;
-    };
-
-    isGljRation(treeNode){
-        return treeNode.sourceType === ModuleNames.ration && treeNode.data.type === rationType.gljRation;
-    };
-
     initFeeField(treeNode, fieldName){
         if (!treeNode.data.fees) {
             treeNode.data.fees = [];
@@ -688,7 +718,7 @@ class CalcProgram {
 
             let objsArr = (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees) ? project.Ration.getRationsByNode(treeNode) : treeNode.children;
             let rst = [];
-            for (let ft of feeType) {
+            for (let ft of cpFeeTypes) {
                 let ftObj = {};
                 ftObj.fieldName = ft.type;
                 ftObj.name = ft.name;
@@ -782,7 +812,9 @@ class CalcProgram {
             if (treeNode.data.programID) treeNode.data.programID = null;
 
             let f = treeNode.data.feeRate ? treeNode.data.feeRate : 100;
-            let q = treeNode.data.quantity ? treeNode.data.quantity : 0;
+            // let q = treeNode.data.quantity ? treeNode.data.quantity : 0;
+            if (!treeNode.data.quantity) treeNode.data.quantity = 1;
+            let q = treeNode.data.quantity;
             let b = treeNode.data.calcBaseValue ? treeNode.data.calcBaseValue : 0;
             let uf = (b * f * q / 100).toDecimal(decimalObj.bills.unitPrice);
             let tuf = uf;
@@ -869,10 +901,10 @@ class CalcProgram {
         if (isRation){
             treeNode.calcType = treeNodeCalcType.ctRationCalcProgram;
         }
-        else  if (me.isNullBill(treeNode)){
+        else  if (treeNodeTools.isNullBill(treeNode)){
             treeNode.calcType = treeNodeCalcType.ctCommonUnitFee;
         }
-        else if (me.isLeafBill(treeNode)) {
+        else if (treeNodeTools.isLeafBill(treeNode)) {
             if (treeNode.children && treeNode.children.length > 0){
                 // 清单单价计算模式下的叶子清单:取自己的计算程序ID,找到自己的计算程序计算。(汇总清单所有定额的工料机)
                 if (me.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
@@ -984,10 +1016,24 @@ class CalcProgram {
         return changedNodes;
     };
 
+    // 计算全部公式项
+    calcFormulaNodes(){
+        let nodes = treeNodeTools.getFormulaNodes();
+        if (nodes.length == 0) return;
+        for (let node of nodes){
+              this.calcFormulaNode(node);
+        };
+    };
+
+    // 计算公式项。(它一定是叶子结点,它的父结点一定没有公式)
+    calcFormulaNode(treeNode){
+        // do
+    };
+
     // 计算叶子清单下的所有子结点(如定额、量价、工料机定额等), 并计算自身和所有父结点。最后打包存储。
     calcLeafAndSave(treeNode){
         let me = this;
-        if(!me.isLeafBill(treeNode)) return;
+        if(!treeNodeTools.isLeafBill(treeNode)) return;
         if (treeNode.children && treeNode.children.length > 0) {
             let changedNodes = [];
             for (let child of treeNode.children){

+ 1 - 3
web/building_saas/main/js/models/main_consts.js

@@ -11,7 +11,6 @@ const ModuleNames = {
     ration_coe:'ration_coe',
     ration_ass:'ration_ass',
     quantity_detail:'quantity_detail',
-    // volume_price: 'volume_price',
     labour_coe: 'labour_coe',
     calc_program: 'calc_program'
 };
@@ -114,7 +113,6 @@ const volumePriceMaps = {
     5: "量设"
 };
 
-
 const rationType = {
     ration: 1,
     volumePrice: 2,
@@ -176,4 +174,4 @@ const fixedFlag = {
 };
 
 const gljKeyArray =['code','name','specs','unit','type'];
-const gljLibKeyArray =['code', 'name', 'specs', 'unit', 'gljType'];
+const gljLibKeyArray =['code', 'name', 'specs', 'unit', 'gljType'];

+ 1 - 1
web/building_saas/main/js/views/character_content_view.js

@@ -668,7 +668,7 @@ let pageCCOprObj = {
         node.data.itemCharacter = itemCharacter;
         this.nameCache = name;
         // 根据规则设置对应特征、内容、名称格式
-        const setting = projectObj.project.property.addRule !== undefined ? projectObj.project.property.addRule : null;
+        const setting = projectObj.project.property.addRule !== undefined ? projectObj.project.property.addRule : getAddRuleSetting();
         const updateData = pageCCOprObj.getCharacterUpdateData(setting, node);
         node.data.jobContentText = updateData.jobContentText;
         node.data.itemCharacterText = updateData.itemCharacterText;

+ 7 - 6
web/building_saas/main/js/views/main_tree_col.js

@@ -43,7 +43,7 @@ let MainTreeCol = {
         calcProgramName: function (node) {
             if (
                 node.sourceType === projectObj.project.Ration.getSourceType() ||
-                (projectObj.project.calcProgram.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
+                (treeNodeTools.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
             ) return false
             else return true;
         },
@@ -51,7 +51,7 @@ let MainTreeCol = {
             return node.data.subType != 201 && node.data.subType != 4 && node.data.subType != 5
         },
         commonUnitFee: function (node) {
-            return !projectObj.project.calcProgram.isNullBill(node);
+            return !treeNodeTools.isNullBill(node);
         },
         //根据节点、父节点类型判断是否可用计算基数
         calcBaseType: function (node) {
@@ -85,7 +85,7 @@ let MainTreeCol = {
             return node.sourceType === projectObj.project.Bills.getSourceType();
         },
         ration: function (node) {
-            return projectObj.project.calcProgram.isRation(node);
+            return treeNodeTools.isRation(node);
         },
         glj: function (node) {
             return node.sourceType == projectObj.project.ration_glj.getSourceType();
@@ -159,7 +159,7 @@ let MainTreeCol = {
         calcProgramName: function (node) {
             if (
                 node.sourceType === projectObj.project.Ration.getSourceType() ||
-                (projectObj.project.calcProgram.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
+                (treeNodeTools.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
             ) {
                 // var names = new GC.Spread.Sheets.CellTypes.ComboBox();
                 var names = sheetCommonObj.getDynamicCombo();
@@ -252,7 +252,8 @@ let colSettingObj = {
         sheet.setColumnCount(1);
         sheet.getRange(-1, 0, -1, 1).cellType(this.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
         sheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.colHeader).value('显示');
-        sheet.setColumnWidth(0, 300);
+        sheet.setColumnWidth(0, 100);
+        sheet.setColumnWidth(0, 150, GC.Spread.Sheets.SheetArea.rowHeader);
 
         setting.cols.forEach(function (col, index) {
             let i, iCol = 0, cell;
@@ -269,7 +270,7 @@ let colSettingObj = {
             ;
             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);
+            //sheet.setColumnWidth(index, colWidth, GC.Spread.Sheets.SheetArea.rowHeader);
             cell = sheet.getCell(index, 0).value(col.visible);
             sheet.autoFitRow(index);
         });

+ 3 - 3
web/building_saas/main/js/views/project_view.js

@@ -268,10 +268,10 @@ var projectObj = {
         let project = projectObj.project, fieldName = colSetting.data.field;
         if(node.sourceType==project.ration_glj.getSourceType()){
             project.ration_glj.updateFromMainSpread(value,node,fieldName);
-        }else if(node.sourceType==ModuleNames.ration&&node.data.type==rationType.gljRation){
+        }else if(treeNodeTools.isGljRation(node)){
             gljOprObj.updateRationTypeGLJ(value,node,fieldName);
         } else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
-            if (fieldName === 'code' && !project.calcProgram.isVolumePrice(node)) {
+            if (fieldName === 'code' && !treeNodeTools.isVolumePrice(node)) {
                 projectObj.updateCode(node, value);
             }
             else if(fieldName ==='feeRate'){
@@ -391,7 +391,7 @@ var projectObj = {
                 that.project.property = projectInfoObj.projectInfo.property;
                 //that.project.calcProgram.compileAllTemps();
                 that.project.calcBase.init(that.project);
-                that.project.calcFields = JSON.parse(JSON.stringify(feeType));
+                that.project.calcFields = JSON.parse(JSON.stringify(cpFeeTypes));
                 // that.project.initCalcFields();
                 let str = JSON.stringify(that.project.projSetting.main_tree_col);
                 that.project.projSetting.mainGridSetting = JSON.parse(str);

+ 1 - 1
web/building_saas/main/js/views/std_bills_lib.js

@@ -281,7 +281,7 @@ var billsLibObj = {
                 "font":"Arial"
             }
         }, {
-            "width":50,
+            "width":45,
             "readOnly": true,
             "showHint": true,
             "head":{