Sfoglia il codice sorgente

Merge branch 'master' of http://192.168.1.12:3000/SmartCost/ConstructionCost

TonyKang 7 anni fa
parent
commit
63650ddeb6

+ 9 - 4
modules/glj/controllers/glj_controller.js

@@ -14,6 +14,8 @@ import UnitPriceFileModel from "../models/unit_price_file_model";
 let logger = require("../../../logs/log_helper").logger;
 let consts = require('../../main/models/project_consts');
 let glj_type_util = require('../../../public/cache/std_glj_type_util');
+let mongoose = require('mongoose');
+let ration = mongoose.model('ration');
 
 const ProjectModel = require('../../pm/models/project_model').project;
 class GLJController extends BaseController {
@@ -552,7 +554,7 @@ class GLJController extends BaseController {
         res.json(result);
     }
 
-    async addGlj(req,res){
+    async modifyKeyValue(req,res){//修改工料机关键的属性:名称、类型、规格、型号等
         let result={
             error:0
         }
@@ -560,9 +562,12 @@ class GLJController extends BaseController {
             let data = req.body.data;
             data = JSON.parse(data);
             let gljListModel = new GLJListModel();
-            // 添加项目工料机
-            let datas = await gljListModel.addList(data);
-            result.data=datas;
+            let ration_data = await ration.findOne(data.ration);
+            //  修改项目工料机
+            let projcetGLJ = await gljListModel.modifyGLJ(data.updateData,ration_data);
+
+           // let datas = await gljListModel.addList(data);
+            result.data=projcetGLJ;
         }catch (err){
             logger.err(err);
             result.error=1;

+ 17 - 4
modules/glj/models/glj_list_model.js

@@ -377,7 +377,7 @@ class GLJListModel extends BaseModel {
         let unitPriceFileId = unitPriceFile.id;
         let unitPriceModel = new UnitPriceModel();
         let [unitPriceData, isAdd] = await unitPriceModel.addUnitPrice(data, unitPriceFileId,"modify");
-        let gljData={};
+        let gljData=null;
         if(isAdd){ //如果是新增,则新增一条新的项目工料机
             data.code = unitPriceData.code;
             gljData  = await this.insertGLJWhenIsAdd(data,ration_glj,unitPriceFileId);
@@ -390,8 +390,15 @@ class GLJListModel extends BaseModel {
                 type:data.type,
                 unit:data.unit
             }
-            gljData = await this.findDataByCondition(condition,{_id: 0});
-            if(!gljData){
+            let gljList = await this.findDataByCondition(condition,{_id: 0},false);
+            if(gljList&&gljList.length>0){
+                for(let tem of gljList){
+                    if(tem.code == unitPriceData.code){
+                        gljData = tem;
+                    }
+                }
+            }
+            if(gljData==null){
                 data.code = unitPriceData.code;
                 gljData  = await this.insertGLJWhenIsAdd(data,ration_glj,unitPriceFileId);
             }
@@ -408,7 +415,13 @@ class GLJListModel extends BaseModel {
         if (glj.type === GLJTypeConst.CONCRETE || glj.type === GLJTypeConst.MORTAR ||
             glj.type === GLJTypeConst.MIX_RATIO || glj.type === GLJTypeConst.GENERAL_MACHINE){
             // 配合比数据插入
-            let connect_key =this.getIndex(ration_glj,['code','name','specs','unit','type']);
+            let key_array = [];
+            if(ration_glj.subType){//定额类型的工料机和定额工料机的key有点不同subType
+                key_array=  ['code','name','specs','unit','subType'];
+            }else {
+                key_array=  ['code','name','specs','unit','type'];
+            }
+            let connect_key =this.getIndex(ration_glj,key_array);
             let connect_key_n =this.getIndex(glj,['code','name','specs','unit','type']);
             //先查找配合比数据是否已经存在
             let mixRatioModel = new MixRatioModel();

+ 3 - 1
modules/glj/models/unit_price_model.js

@@ -121,7 +121,9 @@ class UnitPriceModel extends BaseModel {
         };
         if(data.from=='cpt'){//如果是来自补充工料机,则都添加新增标记
             insertData.is_add=1;
-        }else if (unitPriceData&&unitPriceData.length>0) {// 如果原始编码能找到,但不存在一样的编号,名称,单位.型号等,更改code和添加新增标记
+        }
+
+        if (unitPriceData&&unitPriceData.length>0) {// 如果原始编码能找到,但不存在一样的编号,名称,单位.型号等,更改code和添加新增标记
             insertData.code = data.original_code+"-"+unitPriceData.length;
             insertData.is_add=1;
         }

+ 1 - 1
modules/glj/routes/glj_router.js

@@ -22,7 +22,7 @@ router.post('/change-file', gljController.init, gljController.changeUnitPriceFil
 router.post('/save-as', gljController.init, gljController.unitPriceSaveAs);
 router.post('/get-composition', gljController.init, gljController.getComposition);
 router.post('/updatePrice', gljController.init, gljController.updateUnitPrice);
-router.post('/add',gljController.init, gljController.addGlj)
+router.post('/modifyKeyValue',gljController.init, gljController.modifyKeyValue);
 
 router.get('/test', gljController.init, gljController.test);
 router.get('/testModify', gljController.init, gljController.testModify);

+ 1 - 0
modules/main/models/ration.js

@@ -66,6 +66,7 @@ let rationSchema = new Schema({
     specs:String,//规格型号
     shortName:String,//缩写
     customQuantity:String,//自定义消耗
+    adjCoe:Number,
     from:{type: String,default:'std'}//std, cpt  来自标准工料机库、补充工料机库
 
 });

+ 1 - 1
modules/ration_glj/facade/glj_calculate_facade.js

@@ -101,7 +101,7 @@ async function calculateQuantityPerGLJ(glj,index,coeList,assList,adjustState,noN
     };
     try {
         if(noNeedCal==null){
-            if(!glj._doc.hasOwnProperty('customQuantity')||glj.customQuantity==null){
+            if(!glj._doc.hasOwnProperty('customQuantity')||glj.customQuantity==null||glj.customQuantity==""){
                 quantity =scMathUtil.roundTo(parseFloat(glj.rationItemQuantity),-decimal);
                 quantity =calculateAss(quantity,assList,glj);
                 quantity = calculateQuantityByCoes(quantity,coeList,glj);

+ 0 - 1
modules/ration_glj/facade/ration_glj_facade.js

@@ -717,7 +717,6 @@ async function insertGLJAsRation(data) {
     let gljList = data.gljList;
     //先更新counter
     let counter = await projCounter.model.findOneAndUpdate({projectID:data.projectID},{ration:data.rationCount},{new:true});
-    console.log(counter);
     if(data.hasOwnProperty("selectedSerialNo")){ //如果需要,更新序列号。
         let query={
             projectID:data.projectID,

+ 11 - 1
public/web/scMathUtil.js

@@ -159,6 +159,16 @@ let scMathUtil = {
     isNumber : function (obj) {
         return obj === +obj;
     },
+    roundForObj:function(obj,decimal){
+        let me = this;
+        let value;
+        if(me.isNumber(obj)){
+            value = me.roundTo(obj,-decimal)
+        }else {
+            value = me.roundTo(Number(obj),-decimal);
+        }
+        return value
+    },
     roundToString:function(obj,decimal){
         let me = this;
         let value;
@@ -173,7 +183,7 @@ let scMathUtil = {
 
 Number.prototype.toDecimal = function (ADigit) {
     //return parseFloat(this.toFixed(ADigit));
-    digit = (ADigit && typeof(ADigit) === 'number' && Number.isInteger(ADigit) && ADigit >= 0) ? -ADigit : -2;
+    digit = ((ADigit!=null||ADigit!=undefined) && typeof(ADigit) === 'number' && Number.isInteger(ADigit) && ADigit >= 0) ? -ADigit : -2;
     // var s = scMathUtil.roundTo(this, digit);
     // console.log('Number: ' + this + '   Digit: ' + digit + '    Result: ' + s);
     // return parseFloat(s);

+ 2 - 2
public/web/sheet/sheet_common.js

@@ -235,7 +235,7 @@ var sheetCommonObj = {
         ComboCellForActiveCell.prototype = new GC.Spread.Sheets.CellTypes.ComboBox();
         ComboCellForActiveCell.prototype.paintValue = function (ctx, value, x, y, w, h, style, options) {
             let sheet = options.sheet;
-            if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()) {
+            if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex() && !sheet.getCell(options.row, options.col).locked()) {
                 GC.Spread.Sheets.CellTypes.ComboBox.prototype.paintValue.apply(this, arguments);
 
             } else {
@@ -244,7 +244,7 @@ var sheetCommonObj = {
         };
         ComboCellForActiveCell.prototype.getHitInfo = function (x, y, cellStyle, cellRect, options) {
             let sheet = options.sheet;
-            if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()) {
+            if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex() && !sheet.getCell(options.row, options.col).locked()) {
                 return GC.Spread.Sheets.CellTypes.ComboBox.prototype.getHitInfo.apply(this, arguments);
 
             } else {

+ 5 - 0
web/building_saas/css/main.css

@@ -323,4 +323,9 @@ body {
 label.title{
     display: inline-block;
     width: 100px;
+}
+.modal-feeRate {max-width: 550px}
+
+.gc-column-header-cell{
+    text-align: center!important;
 }

+ 27 - 9
web/building_saas/main/js/models/calc_program.js

@@ -341,18 +341,24 @@ let executeObj = {
                 if (!me.treeNode.data.gljList) return 0;
                 let result = 0;
                 for (let glj of me.treeNode.data.gljList) {
-                    let price = 0;
+                    let price = 0, temp = 0;
                     if (base.gljTypes.indexOf(glj.type) >= 0) {
-                        if (base.calcType == baseCalcType.baseCalc){ price = parseFloat(glj["basePrice"]);}
-                        else if (base.calcType == baseCalcType.adjustCalc){price = parseFloat(glj["adjustPrice"]);}
-                        else if (base.calcType == baseCalcType.budgetCalc){price = parseFloat(glj["marketPrice"]);}
-                        else if (base.calcType == baseCalcType.diffCalc){
+                        if (base.calcType == baseCalcType.diffCalc){
                             let aprice = glj["adjustPrice"] ? glj["adjustPrice"] : 0;
+                            aprice = parseFloat(aprice);
                             let mprice = glj["marketPrice"] ? glj["marketPrice"] : 0;
-                            price = (parseFloat(mprice) - parseFloat(aprice)).toDecimal(decimalObj.process);
+                            mprice = parseFloat(mprice);
+                            temp = (glj["quantity"] * mprice).toDecimal(decimalObj.ration.unitPrice) - (glj["quantity"] * aprice).toDecimal(decimalObj.ration.unitPrice);
+                            temp = temp.toDecimal(decimalObj.ration.unitPrice);
+                        }
+                        else {
+                            if (base.calcType == baseCalcType.baseCalc){ price = parseFloat(glj["basePrice"]);}
+                            else if (base.calcType == baseCalcType.adjustCalc){price = parseFloat(glj["adjustPrice"]);}
+                            else if (base.calcType == baseCalcType.budgetCalc){price = parseFloat(glj["marketPrice"]);}
+                            temp = (glj["quantity"] * price).toDecimal(decimalObj.ration.unitPrice);
                         };
-                        result = result + (glj["quantity"] * price).toDecimal(decimalObj.process);
-                        result = (result).toDecimal(decimalObj.process);
+
+                        result = (result + temp).toDecimal(decimalObj.ration.unitPrice);
                     };
                 };
                 return result;
@@ -601,6 +607,18 @@ class CalcProgram {
         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 = [];
@@ -915,7 +933,7 @@ class CalcProgram {
                     feeRate: node.data.feeRate,
                     feeRateID: node.data.feeRateID
                 };
-                if(node.sourceType==ModuleNames.ration&&node.data.type==rationType.gljRation){//定额类型的工料机做特殊处理
+                if(node.sourceType==ModuleNames.ration && node.data.type==rationType.gljRation){//定额类型的工料机做特殊处理
                     data.code=node.data.code;
                     data.projectGLJID = node.data.projectGLJID;
                     delete data.marketUnitFee;

+ 70 - 0
web/building_saas/main/js/models/project_glj.js

@@ -154,10 +154,80 @@ ProjectGLJ.prototype.updatePriceFromRG=function(recode,updateField,newval){
     }
 };
 
+ProjectGLJ.prototype.updatePropertyFromMainSpread = function (node,updateField,newval) {
+   if(updateField=="contain"){
+
+   }else {
+       this.updateGLJProperty(node,updateField,newval);
+   }
+};
+
+
+ProjectGLJ.prototype.updateGLJProperty=function (node,updateField,newval) {
+    let rationTypeGLJ = node.data;
+    let postData = {};
+    if(rationTypeGLJ[updateField]==newval){
+        return;
+    }
+    let data ={
+        glj_id: rationTypeGLJ.GLJID,
+        project_id: rationTypeGLJ.projectID,
+        code: rationTypeGLJ.code,
+        original_code:rationTypeGLJ.original_code,
+        name: rationTypeGLJ.name,
+        shortName:rationTypeGLJ.shortName,
+        specs: rationTypeGLJ.specs,
+        unit: rationTypeGLJ.unit,
+        type:rationTypeGLJ.subType,
+        type_of_work:rationTypeGLJ.subType,
+        base_price: rationTypeGLJ.basePrice,
+        market_price: rationTypeGLJ.basePrice,
+        repositoryId:rationTypeGLJ.repositoryId,
+        adjCoe:rationTypeGLJ.adjCoe,
+        from:rationTypeGLJ.from?rationTypeGLJ.from:'std'//std:标准工料机库, cpt:补充工料机库
+    };
+    if(updateField=='subType'){
+        data.type = newval;
+        data.type_of_work = newval;
+        data.shortName = this.getShortNameByID(newval);
+    }else {
+        data[updateField]=newval;
+    }
+    postData.ration = {
+        ID:rationTypeGLJ.ID,
+        projectID:rationTypeGLJ.projectID
+    };
+    postData.updateData = data;
+    $.bootstrapLoading.start();
+    CommonAjax.post("/glj/modifyKeyValue",postData,function (result) {
+        console.log(result);  //更新节点信息
+        rationTypeGLJ[updateField]=newval;
+        rationTypeGLJ.projectGLJID = result.id;
+        rationTypeGLJ.code = result.code;
+        rationTypeGLJ.basePrice = result.unit_price.base_price;
+        rationTypeGLJ.marketUnitFee = result.unit_price.market_price;
+        rationTypeGLJ.isAdd = result.unit_price.is_add;
+        rationTypeGLJ.isEstimate=result.is_evaluate;
+        rationTypeGLJ.shortName = result.unit_price.short_name;
+        //触发计算并更新节点信息
+        node.changed=true;
+        projectObj.project.projectGLJ.loadData(function () {
+            projectObj.project.calcProgram.calculate(node);
+            projectObj.project.calcProgram.saveNode(node);
+            $.bootstrapLoading.end();
+        });//重新加载项目工料机数据
+        //上面两步都是异步操作,这句应该是要等上面两步做完了再执行的
+    },function (err) {
+        $.bootstrapLoading.end();
+    });
+    
+}
+
 ProjectGLJ.prototype.updateBasePriceFromRG=function(recode,updateField,newval){
     let me = this;
     let projectGljs = this.datas.gljList;
     let glj = _.find(projectGljs,{'id':recode.projectGLJID});
+    console.log(glj);
     if(glj){
         let data = {id:glj.unit_price.id,field:updateField,newval:newval};
         let callback =function (data) {

+ 1 - 1
web/building_saas/main/js/models/ration_glj.js

@@ -653,11 +653,11 @@ var ration_glj = {
                 var mixRatioMap = projectGLJData.mixRatioMap;
                 var glj = _.find(projectGljs,{'id':ration.projectGLJID});
                 if(glj){
+                    ration.basePrice=glj.unit_price.base_price;
                     ration.marketUnitFee=glj.unit_price.market_price;
                     //ration_gljs[i].adjustPrice=glj.adjust_price;
                     ration.isEstimate=glj.is_evaluate;
                     ration.isAdd=glj.unit_price.is_add;
-                    ration.adjustPrice=projectObj.project.projectGLJ.getAdjustPrice(glj);
                     var connect_index = gljOprObj.getIndex(glj,['code','name','specs','unit','subType'])
                     if(mixRatioMap.hasOwnProperty(connect_index)){
                         var mixRatios = gljOprObj.getMixRationShowDatas(mixRatioMap[connect_index],projectGljs);

+ 7 - 1
web/building_saas/main/js/views/glj_view.js

@@ -606,9 +606,13 @@ var gljOprObj = {
               if(glj.isMixRatio==true){//如果是用于显示的组成物,则不用计算,跳过
                   continue;
               }
+              quantity = scMathUtil.roundForObj(quantity,getDecimal("ration.quantity"));
+              glj.quantity=scMathUtil.roundForObj(glj.quantity,getDecimal("glj.quantity"));
               glj.totalQuantity = scMathUtil.roundToString(quantity*glj.quantity,getDecimal("glj.quantity"));
               if(glj.hasOwnProperty('subList')){//需要计算glj下挂的组成物的总消耗量
                   for(let subG of glj.subList){
+                      subG.rationItemQuantity=scMathUtil.roundForObj(subG.rationItemQuantity,getDecimal("glj.quantity"));
+                      glj.totalQuantity=scMathUtil.roundForObj(glj.totalQuantity,getDecimal("glj.quantity"));
                       subG.totalQuantity = scMathUtil.roundToString(subG.rationItemQuantity*glj.totalQuantity,getDecimal("glj.quantity"));
                   }
               }
@@ -751,7 +755,7 @@ var gljOprObj = {
         var newval;
         if(updateField=='marketPrice'||updateField=='customQuantity'||updateField=='basePrice'){
             if(args.editingText==null){
-                updateField=='marketPrice'||updateField=='customQuantity'?newval=0:newval="";
+                updateField=='marketPrice'?newval=0:newval="";
             }else {
                 var decimal = updateField=='customQuantity'?getDecimal("glj.quantity"):getDecimal("glj.unitPrice");
                 newval = number_util.checkNumberValue(args.editingText,decimal);
@@ -794,6 +798,8 @@ var gljOprObj = {
             }
         }else {
             if(value!=null){
+                projectObj.project.projectGLJ.updatePropertyFromMainSpread(node,fieldName,value)
+                return;
                 //update
             }
         }

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

@@ -77,7 +77,7 @@ let MainTreeCol = {
             return node.sourceType === projectObj.project.Bills.getSourceType();
         },
         ration: function (node) {
-            return node.sourceType === projectObj.project.Ration.getSourceType();
+            return projectObj.project.calcProgram.isRation(node);
         },
         glj: function (node) {
             return node.sourceType == projectObj.project.ration_glj.getSourceType();

+ 0 - 1
web/building_saas/main/js/views/project_property_decimal_view.js

@@ -79,7 +79,6 @@ function isValidDigit(v){
 //newV用户可编辑数据
 function toUpdateDecimal(orgV, newV){
     let rst = false;
-    let len = Object.keys(newV).length;
     reCompare(orgV, newV);
     function reCompare(orgV, newV){
         for(let attr in newV){

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

@@ -59,7 +59,7 @@ let labourCoeView = {
         let value = args.newValue;
         let oValue = args.oldValue;
         if (number_util.isNumber(value)) {
-            value = value.toDecimal(3);
+            value = value.toDecimal(2);
             me.sheet.suspendEvent();
             cell.value(value);
             me.sheet.resumeEvent();

+ 107 - 8
web/building_saas/main/js/views/project_view.js

@@ -270,8 +270,8 @@ var projectObj = {
             project.ration_glj.updateFromMainSpread(value,node,fieldName);
         }if(node.sourceType==ModuleNames.ration&&node.data.type==rationType.gljRation){
             gljOprObj.updateRationTypeGLJ(value,node,fieldName);
-        } else if (value !== calcFees.getFee(node.data, fieldName)) {
-            if (fieldName === 'code') {
+        } else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
+            if (fieldName === 'code' && !project.calcProgram.isVolumePrice(node)) {
                 projectObj.updateCode(node, value);
             }
             else if(fieldName ==='feeRate'){
@@ -282,7 +282,11 @@ var projectObj = {
                 if (fieldName === 'quantity') {
                    if (value) {
                        value = project.quantity_detail.autoTransformQuantity(value,node);
-                       value = value.toDecimal(decimalObj.decimal(fieldName,node))
+                       value = scMathUtil.roundForObj(value,decimalObj.decimal(fieldName,node));
+                       if(value==node.data[fieldName]){
+                           projectObj.mainController.refreshTreeNode([node]);
+                           return;
+                       }
                    };
                    if(project.quantity_detail.quantityEditChecking(value,node,fieldName)){
                        node.data.isFromDetail=0;
@@ -461,6 +465,7 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.EnterCell, that.mainSpreadEnterCell);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.EditEnded, that.mainSpreadEditEnded);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.RangeChanged, that.mainSpreadRangeChanged);
+                that.mainSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, that.amountAreaNumber);
                 that.loadMainSpreadContextMenu();
                 that.loadFocusLocation();
             }
@@ -607,7 +612,95 @@ var projectObj = {
             this.mainController.setTreeSelected(this.mainController.tree.items[row]);//触发树节点选中事件
         }
     },
+    // 选中区域合计数字
+    amountAreaNumber: function(e, info) {
+        if (info.newSelections === undefined || info.newSelections.length <= 0) {
+            return false;
+        }
+        const selectedArea = info.newSelections[0];
+        const sheet = info.sheet;
+        if (selectedArea.colCount <= 1 && selectedArea.rowCount <= 1) {
+            return false;
+        }
+        // 获取鼠标位置
+        let x = window.event.clientX;
+        let y = window.event.clientY;
+
+        // 匹配数字或小数
+        const regular = /^([0-9]+[.]{1}[0-9]+)$|^([1-9]{1}\d+)$/;
+        // 小数点最高位数
+        let max = 0;
+        let total = 0;
+        for (let col = selectedArea.col; col < (selectedArea.colCount + selectedArea.col); col++) {
+            for (let row = selectedArea.row; row < (selectedArea.rowCount + selectedArea.row); row++) {
+                const value = sheet.getCell(row, col).value();
+                if (!regular.test(value)) {
+                    continue;
+                }
+                // 获取当前数据小数位数
+                let pointPosition = value.toString().indexOf(".");
+                pointPosition = pointPosition < 0 ? pointPosition : pointPosition + 1;
+                const current = pointPosition > 0 ? value.toString().substring(pointPosition, value.toString().length).length : 0;
+                max = current > max ? current : max;
+                total += parseFloat(value);
+            }
+        }
+        // 如果不为0则悬浮显示
+        if (total > 0) {
+            const div = $('<div id="total-tips"><p>合计: <input type="text" id="total" readonly="readonly" style="border: none;"/></p><p><a href="javascript:void(0);">复制</a></p></div>');
+            div.css({
+                position: "absolute",
+                border: "1px #C0C0C0 solid",
+                background: "#fff",
+                boxShadow: "1px 2px 5px rgba(0,0,0,0.4)",
+            });
+            div.children("p").css({
+                textAlign: "center",
+                padding: 8,
+                marginBottom: 2,
+            });
+            div.children("p").first().css({
+                borderBottom: "1px #C0C0C0 solid"
+            });
+            const totalString = total.toFixed(max);
+            // input长度
+            const inputWidth = totalString.length * 8;
+            // 计算是否会超出显示范围
+            const baseWidth = 48;
+            const baseHeight = 81;
+            const canvasWidth = $("#billsSpreadvp_vp").width();
+            const canvasHeight = $("#billsSpreadvp_vp").height();
+            x = x + baseWidth + inputWidth > canvasWidth ? x - baseWidth - inputWidth : x;
+            y = y + baseHeight > canvasHeight ? y - baseHeight : y;
+            div.css({
+                left: x,
+                top: y,
+            });
+
+            div.children().children("#total").width(inputWidth).val(totalString);
+            $("body").append(div);
+            // 用于判断是否要关闭窗体
+            setTimeout(function() {
+                isTotalShowing = true;
+            }, 200);
+        };
+    }
 };
+// 点击合计框中的复制
+$("body").on("click", "#total-tips a", function() {
+    const totalElement = $(this).parent().siblings("p").find("#total");
+    totalElement.select();
+    document.execCommand("Copy");
+    $(this).text("已复制");
+});
+// 合计框点击其他位置关闭
+let isTotalShowing = false;
+$("body").on("click",  function(e) {
+    if (isTotalShowing && !$(e.target).is("#total-tips") && !$(e.target).is("#total-tips p") && !$(e.target).is("#total-tips p a")) {
+        $("#total-tips").remove();
+        isTotalShowing = false;
+    }
+});
 
 $('#insert').click(function () {
     var controller = projectObj.mainController, project = projectObj.project;
@@ -752,16 +845,22 @@ $('#property_ok').click(function () {
     //清单工程量精度
     let newBillsDecimalDatas = billsDecimalView.toBillsDecimalDatas(billsDecimalView.cache);
     if(billsDecimalView.toUpdate(billsQuanDecimal.datas, newBillsDecimalDatas)){
+        billsQuanDecimal.datas = newBillsDecimalDatas;
         reCalcBills = true;
         properties['property.billsQuantityDecimal'] = newBillsDecimalDatas;
     }
     //小数位数
     let updateDecimal = m_getDecimalData($('input', '#poj-settings-decimal'));
-    if(toUpdateDecimal(decimalObj, updateDecimal)){
+    if(toUpdateDecimal(decimalObj, updateDecimal)) {
+        let frChanged = decimalObj.feeRate != updateDecimal.feeRate;
+        setDecimal(decimalObj, updateDecimal);
+        if (frChanged) {
+            project.calcProgram.compileAllTemps()
+        }
         reCalcRations = true;
         reCalcBills = true;
         properties['property.decimal'] = updateDecimal;
-    };
+    }
     // 呈现选项
     projDisplayView.updateChecking(projectID, properties);
 
@@ -776,7 +875,6 @@ $('#property_ok').click(function () {
         reCalcRations = true;
         reCalcBills = true;
     };
-    console.log(properties);
     // 重新计算树节点
     let changedNodes = [];
     if (reCalcRations)    // 定额动,全部计算。
@@ -806,8 +904,9 @@ $('#property_ok').click(function () {
         };
     };
 
-    console.log(mixDatas);
-    // return;   // for test.
+    // for test.
+/*    console.log(mixDatas);
+    return; */
     function hasMixData() {
         return Object.keys(mixDatas.properties).length > 0 ||
             mixDatas.labourCoes.updateData || mixDatas.rations.length > 0 || mixDatas.bills.length > 0;