فهرست منبع

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

zhongzewei 7 سال پیش
والد
کامیت
b2cdb7562c
34فایلهای تغییر یافته به همراه338 افزوده شده و 155 حذف شده
  1. 2 2
      config/gulpConfig.js
  2. 1 0
      modules/complementary_glj_lib/models/schemas.js
  3. 3 2
      modules/glj/models/glj_list_model.js
  4. 2 5
      modules/glj/models/schemas/glj.js
  5. 1 0
      modules/main/models/bills.js
  6. 2 2
      modules/main/models/project.js
  7. 2 2
      modules/main/models/project_consts.js
  8. 18 17
      modules/main/models/ration.js
  9. 2 2
      modules/main/models/schemas/proj_counter.js
  10. 2 2
      modules/pm/controllers/copy_proj_controller.js
  11. 2 0
      modules/ration_glj/facade/ration_glj_facade.js
  12. 2 0
      modules/ration_glj/models/ration_glj.js
  13. 1 1
      modules/reports/rpt_component/jpc_bill_tab.js
  14. 52 2
      modules/reports/util/rpt_construct_data_util.js
  15. 49 1
      modules/reports/util/rpt_pdf_util.js
  16. 13 0
      public/web/scMathUtil.js
  17. 5 3
      public/web/sheet/sheet_common.js
  18. 2 3
      test/unit/reports/test_cover_01.js
  19. 1 1
      web/building_saas/glj/html/glj_index.html
  20. 3 1
      web/building_saas/glj/js/project_glj_spread.js
  21. 4 4
      web/building_saas/main/html/main.html
  22. 9 8
      web/building_saas/main/js/controllers/project_controller.js
  23. 4 3
      web/building_saas/main/js/models/bills.js
  24. 15 13
      web/building_saas/main/js/models/calc_program.js
  25. 28 2
      web/building_saas/main/js/models/main_consts.js
  26. 6 5
      web/building_saas/main/js/models/project.js
  27. 15 1
      web/building_saas/main/js/models/project_glj.js
  28. 16 11
      web/building_saas/main/js/models/ration.js
  29. 1 0
      web/building_saas/main/js/models/ration_glj.js
  30. 28 10
      web/building_saas/main/js/views/glj_view.js
  31. 23 18
      web/building_saas/main/js/views/main_tree_col.js
  32. 1 1
      web/building_saas/main/js/views/project_property_decimal_view.js
  33. 21 31
      web/building_saas/main/js/views/project_view.js
  34. 2 2
      web/building_saas/main/js/views/std_ration_lib.js

+ 2 - 2
config/gulpConfig.js

@@ -43,6 +43,7 @@ module.exports = {
         'lib/jquery-ui/jquery-ui-datepickerCN.js',
         'lib/jquery-contextmenu/*.js',
         'lib/lodash/lodash.js',
+        'test/tmp_data/test_ration_calc/ration_calc_base.js',
         'web/building_saas/main/js/models/main_consts.js',
         'web/building_saas/glj/js/project_glj.js',
         'web/building_saas/glj/js/composition.js',
@@ -74,10 +75,9 @@ module.exports = {
         'web/building_saas/main/js/models/ration_glj.js',
         'web/building_saas/main/js/models/ration_coe.js',
         'web/building_saas/main/js/models/ration_ass.js',
-        'web/building_saas/main/js/models/volume_price.js',
+        // 'web/building_saas/main/js/models/volume_price.js',
         'web/building_saas/main/js/models/labour_coe.js',
         'public/web/id_tree.js',
-        'test/tmp_data/test_ration_calc/ration_calc_base.js',
         'web/building_saas/main/js/models/cache_tree.js',
         'web/building_saas/main/js/calc/calc_fees.js',
         'web/building_saas/main/js/calc/ration_calc.js',

+ 1 - 0
modules/complementary_glj_lib/models/schemas.js

@@ -52,6 +52,7 @@ let stdGljSchema = new Schema({
     gljType: Number,
     shortName: String,
     unit: String,
+    adjCoe: Number,
     component: [stdGjlComponentSchema]
 },{versionKey: false});
 

+ 3 - 2
modules/glj/models/glj_list_model.js

@@ -243,7 +243,7 @@ class GLJListModel extends BaseModel {
         glj.unit_price.base_price = glj_basePrice;
         glj.unit_price.market_price = scMathUtil.roundTo(parseFloat(glj.unit_price.market_price), -2);
         // 计算调整基价
-        switch (glj.unit_price.type + '') {
+     /*   switch (glj.unit_price.type + '') {
             // 人工: 调整基价=基价单价*调整系数
             case GLJTypeConst.LABOUR:
                 glj.adjust_price = scMathUtil.roundTo(parseFloat(glj.adjustment * glj_basePrice), -2);
@@ -255,7 +255,7 @@ class GLJListModel extends BaseModel {
             // 材料、主材、设备
             default:
                 glj.adjust_price = glj.unit_price.base_price;
-        }
+        }*/
     }
 
     /**
@@ -611,6 +611,7 @@ class GLJListModel extends BaseModel {
                 specs: tmp.specs,
                 unit: tmp.unit === undefined ? '' : tmp.unit,
                 type: tmp.gljType,
+                adjCoe:tmp.adjCoe,
                 original_code:tmp.code
             };
             gljInsertData.push(gljData);

+ 2 - 5
modules/glj/models/schemas/glj.js

@@ -62,11 +62,8 @@ let modelSchema = {
         type: Number,
         default: 0
     },
-    // 调整系数
-    adjustment: {
-        type: Number,
-        default: 1
-    },
+    // 调整系数ID
+    adjCoe: Number,
 
     // 规格型号
     specs: {

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

@@ -30,6 +30,7 @@ let billsSchema = new Schema({
     feeRate:String,
     isFromDetail:{type: Number,default:0},//1 true 0 false
     programID: Number,
+    calcBase: String,
     // 工程量计算规则
     ruleText: String,
     // 说明

+ 2 - 2
modules/main/models/project.js

@@ -11,7 +11,7 @@ var quantity_detail_data = require('../facade/quantity_detail_facade');
 var fee_rate_data = require('../../fee_rates/facade/fee_rates_facade');
 let projCounter = require('./proj_counter_model');
 let projSetting = require('./proj_setting_model');
-let volumePriceData = require('../../volume_price/models/volume_price_model');
+// let volumePriceData = require('../../volume_price/models/volume_price_model');
 var labour_coe_facade = require('../facade/labour_coe_facade');
 var calc_program_facade = require('../facade/calc_program_facade');
 
@@ -33,7 +33,7 @@ moduleMap[projectConsts.RATION_ASS] = ration_ass_data;
 moduleMap[projectConsts.QUANTITY_DETAIL] = quantity_detail_data;
 moduleMap[projCounter.collectionName] = projCounter;
 moduleMap[projSetting.collectionName] = projSetting;
-moduleMap[volumePriceData.collectionName] = volumePriceData;
+// moduleMap[volumePriceData.collectionName] = volumePriceData;
 moduleMap[projectConsts.FEERATE] = fee_rate_data;
 moduleMap[projectConsts.LABOUR_COE] = labour_coe_facade;
 moduleMap[projectConsts.CALC_PROGRAM] = calc_program_facade;

+ 2 - 2
modules/main/models/project_consts.js

@@ -13,7 +13,7 @@ let projectConst = {
     GLJLIST: 'GLJList',
     UNITPRICEFILE: 'unitPriceFile',
     PROPERTIES: 'properties',
-    VOLUMEPRICE: 'volume_price',
+    // VOLUMEPRICE: 'volume_price',
     FEERATE:'feeRate',
     LABOUR_COE:'labour_coe',
     CALC_PROGRAM:'calc_program'
@@ -31,7 +31,7 @@ let projectConstList = [
     'GLJList',
     'unitPriceFile',
     'properties',
-    'volume_price',
+    // 'volume_price',
     'feeRate',
     'labour_coe',
     'calc_program'

+ 18 - 17
modules/main/models/ration.js

@@ -26,37 +26,38 @@ var rationAssItemSchema = mongoose.Schema({
     maxValue: String
 }, { _id: false });
 
+// 定额、量价、工料机定额 合并存储
 let rationSchema = new Schema({
+    // 公用属性部分
     ID: Number,
     projectID: Number,
     billsItemID: Number,
     serialNo: Number,
-    libID: Number,
     code: String,
     name: String,
-    maskName: String,
-    caption: String,
     unit: String,
-    quantity: String, // Decimal
+    quantity: String,
+    programID: Number,
     marketUnitFee: String,
     marketTotalFee: String,
-    isFromDetail:{type: Number,default:0},  //1 true 2 false
-    programID: Number,
+    fees: [subSchema.feesSchema],
+    deleteInfo: deleteSchema,
+    type: Number,                               // 1 定额、2 量价、3 工料机定额
+    subType: Number,                            // 子类型:1人工、201材料、301机械、4主材、5设备
+
+    // 定额特有属性:
+    libID: Number,
+    maskName: String,
+    caption: String,
+    isFromDetail:{type: Number,default:0},       // 1 true 2 false
     adjustState: String,
     content: String,
     rationProjName: String,
-    // 说明
-    comments: String,
-    // 费用字段
-    fees: [subSchema.feesSchema],
-    // 标记字段
-    flags: [subSchema.flagsSchema],
-    deleteInfo: deleteSchema,
+    comments: String,                           // 说明
+    flags: [subSchema.flagsSchema],             // 标记字段
     rationAssList: [rationAssItemSchema],
-    // 工作内容
-    content: String,
-    // 计算规则
-    ruleText: String
+    content: String,                            // 工作内容
+    ruleText: String                            // 计算规则
 });
 
 let ration = db.model("ration", rationSchema, "ration");

+ 2 - 2
modules/main/models/schemas/proj_counter.js

@@ -8,8 +8,8 @@ let collectionName = 'projCounter';
 let projSettingSchema = {
     projectID: Number,
     bills: Number,
-    ration: Number,
-    volume_price: Number
+    ration: Number/*,
+    volume_price: Number*/
 };
 let model = mongoose.model(collectionName, new Schema(projSettingSchema, {versionKey: false, collection: collectionName}));
 export {model as default, collectionName as collectionName};

+ 2 - 2
modules/pm/controllers/copy_proj_controller.js

@@ -6,7 +6,7 @@ let billsData = require('../../main/models/bills');
 let rationData = require('../../main/models/ration');
 let projCounter = require('../../main/models/proj_counter_model');
 let projSetting = require('../../main/models/proj_setting_model');
-let volumePriceData = require('../../volume_price/models/volume_price_model');
+// let volumePriceData = require('../../volume_price/models/volume_price_model');
 let async = require('async');
 
 module.exports = {
@@ -32,7 +32,7 @@ module.exports = {
         fun.push(copyData(rationData));
         fun.push(copyData(projCounter));
         fun.push(copyData(projSetting));
-        fun.push(copyData(volumePriceData));
+        // fun.push(copyData(volumePriceData));
         async.parallel(fun, (err) => callback(err));
     }
 };

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

@@ -125,6 +125,7 @@ function get_lib_glj_info(ration_glj) {
                 ration_glj.shortName = glj.shortName;
                 ration_glj.type = glj.gljType;
                 ration_glj.repositoryId = glj.repositoryId;
+                ration_glj.adjCoe = glj.adjCoe;
                 getInfoFromProjectGLJ(ration_glj).then(function (info) {
                     if(info){
                         let tem={};
@@ -555,6 +556,7 @@ function getGLJSearchInfo(ration_glj) {
         base_price: ration_glj.basePrice,
         market_price: ration_glj.basePrice,
         repositoryId:ration_glj.repositoryId,
+        adjCoe:ration_glj.adjCoe,
         from:ration_glj.from?ration_glj.from:'std'//std:标准工料机库, cpt:补充工料机库
     };
      if(data.from=='cpt'){//从补充工料机来的数据即为新增数据

+ 2 - 0
modules/ration_glj/models/ration_glj.js

@@ -24,6 +24,8 @@ var ration_glj = new Schema({
     shortName:String,
     billsItemID: Number,
     type:Number,
+    // 调整系数ID
+    adjCoe: Number,
     quantity:String,
     customQuantity:String,
     rationItemQuantity:String,

+ 1 - 1
modules/reports/rpt_component/jpc_bill_tab.js

@@ -83,7 +83,7 @@ JpcBillTabSrv.prototype.createNew = function(){
                     if (!(tab_field[JV.PROP_HIDDEN])) {
                         let val = JpcFieldHelper.getValue(data_field, page - 1);
                         let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_field, val, controls);
-                        cellItem[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, true, false);
+                        cellItem[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
                         rst.push(cellItem);
                     }
                 }

+ 52 - 2
modules/reports/util/rpt_construct_data_util.js

@@ -623,6 +623,50 @@ function shielded_exec_env($PROJECT, $ME, rptDataItemObj) {
     }
 }
 
+function getActPropertyVal(firstPropKey, secPropKey, orgObj) {
+    let rst = null;
+    if (orgObj[firstPropKey]) {
+        rst = orgObj[firstPropKey];
+    } else if (orgObj[secPropKey]){
+        rst = orgObj[secPropKey];
+    }
+    return rst;
+}
+
+function getDeepProperty(propKey, orgObj, destArr) {
+    let keys = propKey.split(".");
+    let dftPropKey = "key", dftPropVal = "value", secDftPropVal = "items";
+    let parent = orgObj, lastVal = null;
+    for (let key of keys) {
+        if (parent instanceof Array) {
+            for (let item of parent) {
+                if (item[dftPropKey] === key) {
+                    lastVal = getActPropertyVal(dftPropVal, secDftPropVal, item);
+                    break;
+                }
+            }
+        } else {
+            lastVal = null;
+            if (parent[key] !== undefined) {
+                lastVal = parent[key];
+            } else if (parent[secDftPropVal]){
+                for (let item of parent[secDftPropVal]) {
+                    if (item[dftPropKey] === key) {
+                        // lastVal = item[dftPropVal];
+                        lastVal = getActPropertyVal(dftPropVal, secDftPropVal, item);
+                        break;
+                    }
+                }
+            }
+        }
+        parent = lastVal;
+        if (parent === null) break;
+    }
+    if (destArr && destArr instanceof Array) {
+        destArr.push(lastVal);
+    }
+}
+
 function ext_mainGetPropety(propKey) {
     let rst = [], parentObj = this;
     let dtObj = parentObj["myOwnRawDataObj"];
@@ -631,10 +675,11 @@ function ext_mainGetPropety(propKey) {
             if (!dtObj["property"][propKey] && dtObj[propKey]) {
                 rst.push(dtObj[propKey]);
             } else {
-                rst.push(dtObj["property"][propKey]);
+                getDeepProperty(propKey, dtObj["property"], rst);
             }
         } else  {
-            rst.push(dtObj[propKey]);
+            // rst.push(dtObj[propKey]);
+            getDeepProperty(propKey, dtObj, rst);
         }
     }
     return rst;
@@ -647,6 +692,11 @@ function ext_getPropety(propKey) {
         for (let dItem of dtObj.data) {
             let doc = (dItem._doc === null || dItem._doc === undefined)?dItem:dItem._doc;
             if (doc.hasOwnProperty("property")) {
+                // if (!doc["property"][propKey] && doc[propKey]) {
+                //     rst.push(doc[propKey]);
+                // } else {
+                //     getDeepProperty(propKey, doc["property"], rst);
+                // }
                 rst.push(doc["property"][propKey]);
             } else if (doc.hasOwnProperty(propKey)) {
                 rst.push(doc[propKey]);

+ 49 - 1
modules/reports/util/rpt_pdf_util.js

@@ -42,7 +42,11 @@ function export_pdf_file (pageData, paperSize, fName, callback) {
     let newPageMergeBand = private_getIniPageMergeBorder(pageObj[JV.BAND_PROP_MERGE_BAND]);
     if (pageObj && pageObj.items.length > 0 ) {
         for(let i=0;i<pageObj.items.length;i++){
-            doc.addPage({size:[size[1]*DPI,size[0]*DPI]});
+            if (pageData[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][0] > pageData[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][1]) {
+                doc.addPage({size:[size[1]*DPI,size[0]*DPI]});
+            } else {
+                doc.addPage({size:[size[0]*DPI,size[1]*DPI]});
+            }
             let page = pageObj.items[i],
                 fonts = pageObj[JV.NODE_FONT_COLLECTION],
                 styles = pageObj[JV.NODE_STYLE_COLLECTION],
@@ -179,7 +183,51 @@ function export_pdf_file (pageData, paperSize, fName, callback) {
             }
         }
 
+        function private_drawUnderline() {
+            //A. 暂不支持角度; B. 坐标已经translate
+            let ctx = doc;
+            //1. 计算下划线的相关坐标
+            let width = ctx.widthOfString(val);
+            let height = dftFontHeight;
+            let startX = area[JV.IDX_LEFT], startY = area[JV.IDX_TOP], endX = area[JV.IDX_RIGHT], endY = area[JV.IDX_BOTTOM];
+            // let startX = 0, startY = 0, endX = width, endY = startY;
+            if (control.Horizon === "left") {
+                // 无变化;
+            } else if (control.Horizon === "right") {
+                startX = Math.round(startX - width);
+            } else {
+                startX = Math.round(startX - width / 2);
+            }
+            endX = Math.round(startX + width);
+
+            if (control.Vertical === "top") {
+                startY += JV.OUTPUT_OFFSET[JV.IDX_TOP] + JV.OUTPUT_OFFSET[JV.IDX_BOTTOM];
+            } else if (control.Vertical === "bottom") {
+                // startY = Math.round(startY);
+                startY += JV.OUTPUT_OFFSET[JV.IDX_TOP] + JV.OUTPUT_OFFSET[JV.IDX_BOTTOM];
+            } else {
+                startY = Math.round(height / 2) - JV.OUTPUT_OFFSET[JV.IDX_TOP] - JV.OUTPUT_OFFSET[JV.IDX_BOTTOM];
+                // startY += JV.OUTPUT_OFFSET[JV.IDX_TOP] + JV.OUTPUT_OFFSET[JV.IDX_BOTTOM];
+            }
+            endY = Math.round(startY);
+            //2. 画线
+            // ctx.save();
+            if ( output[1] !== Math.round(output[1])) {
+                ctx.translate(0,0.5);
+            }
+            // ctx.beginPath();
+            ctx.moveTo(startX, startY);
+            ctx.lineWidth(1);
+            ctx.strokeStyle = "BLACK";
+            ctx.lineTo(endX, endY);
+            ctx.stroke();
+            // ctx.restore();
+        }
+
         let rotateOptions;
+        if (font[JV.FONT_PROPS[5]] === 'T' && parseInt(font.FontAngle) === 0) {
+            // private_drawUnderline();
+        }
         if (parseInt(font.FontAngle) !== 0) {
             if (control){
                 rotateOptions=private_setupAreaRotateOption(area,w,control.Vertical,dftFontHeight, output);

+ 13 - 0
public/web/scMathUtil.js

@@ -84,6 +84,19 @@ let scMathUtil = {
     roundTo: function(num, digit){
         let me = this;
         return me.innerRoundTo(me.binToFloat(me.incMantissa(me.floatToBin(num))), digit);
+    },
+    isNumber : function (obj) {
+        return obj === +obj;
+    },
+    roundToString: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.toFixed(decimal);
     }
 };
 

+ 5 - 3
public/web/sheet/sheet_common.js

@@ -126,10 +126,12 @@ var sheetCommonObj = {
                 //var cell = sheet.getCell(row, col, GC.Spread.Sheets.SheetArea.viewport);
                 var val = data[row][setting.header[col].dataCode];
                 if(val&&setting.header[col].dataType === "Number"){
-                    if(setting.header[col].hasOwnProperty('tofix')){
-                        val =parseFloat(val).toFixed(setting.header[col].tofix);
+                    if(setting.header[col].hasOwnProperty('decimalField')){
+                        var decimal = getDecimal(setting.header[col].decimalField);
+                        val =scMathUtil.roundToString(val,decimal);
+                        sheet.setFormatter(-1, col,getFormatter(decimal), GC.Spread.Sheets.SheetArea.viewport);
                     }else {
-                        val =parseFloat(val).toFixed(2);
+                        val =scMathUtil.roundToString(val,2);
                     }
                 }
                 if(val!=null&&setting.header[col].cellType === "checkBox"){

+ 2 - 3
test/unit/reports/test_cover_01.js

@@ -40,8 +40,7 @@ let demoPrjId = - 1;
 let demoRptId = 223, pagesize = "A4";
 
 let userId_Leng = 1142; //小冷User Id
-// demoPrjId = 720; //QA: DW3
-demoPrjId = 838; //QA:
+demoPrjId = 1220; //QA:
 /*/
  let userId_Dft = userId_Leng;
  /*/
@@ -82,7 +81,7 @@ test('测试 - 打开模板: 封-1 ', function (t) {
                     let maxPages = printCom.totalPages;
                     let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties);
                     if (pageRst) {
-                        fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.js");
+                        // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.js");
                     } else {
                         console.log("oh! no pages were created!");
                     }

+ 1 - 1
web/building_saas/glj/html/glj_index.html

@@ -12,7 +12,7 @@
 </div>
 <div class="container-fluid">
     <div class="row">
-        <div class="main-content col-lg-12 p-0">
+        <div class="col-lg-12 p-0">
             <div class="top-content">
                 <div class="main-data-top" id="project-glj">
                     <p style="text-align: center; margin-top: 30px;">正在加载数据</p>

+ 3 - 1
web/building_saas/glj/js/project_glj_spread.js

@@ -246,6 +246,7 @@ ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
     // 获取列号
     let isEvaluateColumn = this.sheetObj.getFieldColumn('is_evaluate');
     let marketPriceColumn = this.sheetObj.getFieldColumn('unit_price.market_price');
+    let adjustPriceColumn = this.sheetObj.getFieldColumn("adjust_price");
     let connectCodeColumn = this.sheetObj.getFieldColumn('connect_code');
     let consumptionColumn = this.sheetObj.getFieldColumn('consumption');
     let supplyColumn = this.sheetObj.getFieldColumn('supply');
@@ -306,7 +307,8 @@ ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
             activeSheet.setValue(rowCounter, connectCodeColumn, connectCodeString);
             activeSheet.setValue(rowCounter, consumptionColumn, consumptionString);
         }
-
+        data.adjust_price = projectObj.project.projectGLJ.getAdjustPrice(data);
+        activeSheet.setValue(rowCounter,adjustPriceColumn,data.adjust_price);
         rowCounter++;
     }
 };

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

@@ -621,7 +621,8 @@
 
 
         <!-- inject:js -->
-
+        <script type="text/javascript" src="/test/tmp_data/test_ration_calc/ration_calc_base.js"></script>
+        <script type="text/javascript" src="/web/building_saas/main/js/models/main_consts.js"></script>
         <script type="text/javascript" src="/web/building_saas/glj/js/project_glj.js"></script>
         <script type="text/javascript" src="/web/building_saas/glj/js/composition.js"></script>
         <script type="text/javascript" src="/web/building_saas/glj/js/common_spread.js"></script>
@@ -662,7 +663,7 @@
 
         <!--<script src="/lib/spreadjs/views/locale/gc.spread.views.dataview.locale.zh-CN.10.0.0.min.js" type="text/javascript"></script>-->
         <!-- Model -->
-        <script type="text/javascript" src="/web/building_saas/main/js/models/main_consts.js"></script>
+
         <script type="text/javascript" src="/web/building_saas/main/js/models/project.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/models/bills.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/models/ration.js"></script>
@@ -673,13 +674,12 @@
         <script type="text/javascript" src="/web/building_saas/main/js/models/ration_glj.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/models/ration_coe.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/models/ration_ass.js"></script>
-        <script type="text/javascript" src="/web/building_saas/main/js/models/volume_price.js"></script>
+        <!--<script type="text/javascript" src="/web/building_saas/main/js/models/volume_price.js"></script>-->
         <script type="text/javascript" src="/web/building_saas/main/js/models/labour_coe.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/models/calc_program.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/views/calc_program_manage.js"></script>
 
         <script type="text/javascript" src="/public/web/id_tree.js"></script>
-        <script type="text/javascript" src="/test/tmp_data/test_ration_calc/ration_calc_base.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/models/cache_tree.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/calc/calc_fees.js"></script>
         <script type="text/javascript" src="/web/building_saas/main/js/calc/ration_calc.js"></script>

+ 9 - 8
web/building_saas/main/js/controllers/project_controller.js

@@ -47,7 +47,7 @@ ProjectController = {
             this.syncDisplayNewNode(sheetController, newNode);
         }
     },
-    addRation: function (project, sheetController, std) {
+    addRation: function (project, sheetController, rationType, std) {
         if (!project || !sheetController) { return; }
 
         let selected = project.mainTree.selected, newSource = null, newNode = null;
@@ -68,12 +68,13 @@ ProjectController = {
 
                 newNode = project.mainTree.insert(selected.getID(), selected.tree.rootID());
             }
-        } else if (selected.sourceType === project.Ration.getSourceType() || selected.sourceType === project.VolumePrice.getSourceType()) {
+        }
+        else if (selected.sourceType === project.Ration.getSourceType()) {
             if (std) {
                 newSource = project.Ration.insertStdRation(selected.source[project.masterField.ration], selected.source, std);
                 project.ration_glj.addRationGLJ(newSource,std);
             } else {
-                newSource = project.Ration.insertRation(selected.source[project.masterField.ration], selected.source);
+                newSource = project.Ration.insertRation(selected.source[project.masterField.ration], selected.source, rationType);
             }
             newNode = project.mainTree.insert(selected.getParentID(), selected.getNextSiblingID());
         };
@@ -98,8 +99,8 @@ ProjectController = {
         } else {
             alert('当前焦点行不是定额,无法替换。');
         }
-    },
-    addVolumePrice: function (project, sheetController) {
+    }
+/*    addVolumePrice: function (project, sheetController) {
         if (!project || !sheetController) { return null; }
 
         var selected = project.mainTree.selected;
@@ -122,13 +123,13 @@ ProjectController = {
 
             this.syncDisplayNewNode(sheetController, newNode);
         }
-    },
-    calculateAll: function (project, sheetController, CalcType) {
+    },*/
+/*    calculateAll: function (project, sheetController, CalcType) {
         this.project.setCalcFlag(CalcType);
         let calc = new BillsCalcHelper(project);
         calc.calcAll();
         sheetController.showTreeData();
         project.Bills.updateAll();
         calc = null;
-    }
+    }*/
 }

+ 4 - 3
web/building_saas/main/js/models/bills.js

@@ -196,15 +196,16 @@ var Bills = {
         bills.prototype.deleteBills = function (node) {
             let deleteNode = function (node) {
                 this.project.Ration.deleteByBills([node]);
-                this.project.VolumePrice.deleteByBills([node]);
+                // this.project.VolumePrice.deleteByBills([node]);
                 return this.tree.delete(node);
             }
             var deleteData = this.tree.getDeleteData(node);
             var ration_glj =projectObj.project.ration_glj;
-            let modules =[ModuleNames.bills, ModuleNames.ration, ModuleNames.ration_glj, ModuleNames.volume_price];
+            // let modules =[ModuleNames.bills, ModuleNames.ration, ModuleNames.ration_glj, ModuleNames.volume_price];
+            let modules =[ModuleNames.bills, ModuleNames.ration, ModuleNames.ration_glj];
             let deleteDatas=[tools.coverseTreeUpdateData(deleteData, this.project.ID()),
                 this.project.Ration.getDeleteDataByBill([node]), ration_glj.getDeleteDataByBills(deleteData),
-                this.project.VolumePrice.getDeleteDataByBills([node])
+                // this.project.VolumePrice.getDeleteDataByBills([node])
             ];
             project.ration_glj.deleteByBills(deleteData);
             project.quantity_detail.deleteByBills(deleteData);

+ 15 - 13
web/building_saas/main/js/models/calc_program.js

@@ -311,17 +311,17 @@ let executeObj = {
             function volumePriceFee() {
                 let result = 0;
                 if (
-                    ( me.treeNode.data.type === '人工' && base.dispName === '定额基价人工费') ||
-                    ( me.treeNode.data.type === '材料' && base.dispName === '定额基价材料费') ||
-                    ( me.treeNode.data.type === '机械' && base.dispName === '定额基价机械费') ||
-                    ( me.treeNode.data.type === '主材' && base.dispName === '主材费') ||
-                    ( me.treeNode.data.type === '设备' && base.dispName === '设备费')
+                    ( me.treeNode.data.subType === gljType.LABOUR && base.dispName === '定额基价人工费') ||
+                    ( me.treeNode.data.subType === gljType.GENERAL_MATERIAL && base.dispName === '定额基价材料费') ||
+                    ( me.treeNode.data.subType === gljType.GENERAL_MACHINE && base.dispName === '定额基价机械费') ||
+                    ( me.treeNode.data.subType === gljType.MAIN_MATERIAL && base.dispName === '主材费') ||
+                    ( me.treeNode.data.subType === gljType.EQUIPMENT && base.dispName === '设备费')
                 ) result = me.treeNode.data.marketUnitFee;
 
                 return result;
             };
 
-            if (me.treeNode.sourceType === projectObj.project.VolumePrice.getSourceType()){
+            if (me.treeNode.data.type == rationType.volumePrice || me.treeNode.data.type == rationType.gljRation){
                 rst = volumePriceFee();
             }
             else{
@@ -624,14 +624,17 @@ class CalcProgram {
                 };
             }
             else if (treeNode.calcType == treeNodeCalcType.ctRationCalcProgram) {
-                if (treeNode.sourceType === me.project.Ration.getSourceType()){
-                    treeNode.data.gljList = me.project.ration_glj.getGljArrByRation(treeNode.data.ID);
-                }
-                else if (treeNode.sourceType === me.project.VolumePrice.getSourceType()){
+                if (treeNode.data.type == rationType.volumePrice){
                     delete treeNode.data.gljList;
                     let muf = treeNode.data.marketUnitFee ? treeNode.data.marketUnitFee : 0;
                     let q = treeNode.data.quantity ? treeNode.data.quantity : 0;
                     treeNode.data.marketTotalFee = (muf * q).toDecimal(me.digit);
+                }
+                else if (treeNode.data.type == rationType.gljRation){
+
+                }
+                else{
+                    treeNode.data.gljList = me.project.ration_glj.getGljArrByRation(treeNode.data.ID);
                 };
 
                 if (treeNode.data.programID == undefined){
@@ -680,12 +683,11 @@ class CalcProgram {
         let me = this;
 
         let isRation = treeNode.sourceType === me.project.Ration.getSourceType();
-        let isVolumePrice = treeNode.sourceType === me.project.VolumePrice.getSourceType();
         let isBill = treeNode.sourceType === me.project.Bills.getSourceType();
         let isLeafBill = isBill && treeNode.source.children && treeNode.source.children.length === 0;   // 是清单且其下没有子清单
         let isBillPriceCalc = me.project.projSetting.billsCalcMode === billsPrice;
 
-        if (isRation || isVolumePrice){
+        if (isRation){
             treeNode.calcType = treeNodeCalcType.ctRationCalcProgram;
         }
         else if (isLeafBill) {
@@ -738,7 +740,7 @@ class CalcProgram {
                 let data = {
                     ID: node.data.ID,
                     projectID: me.project.ID(),
-                    type: node.data.type,
+                    subType: node.data.subType,
                     quantity: node.data.quantity,
                     calcBase: node.data.calcBase,
                     programID: node.data.programID,

+ 28 - 2
web/building_saas/main/js/models/main_consts.js

@@ -11,7 +11,7 @@ const ModuleNames = {
     ration_coe:'ration_coe',
     ration_ass:'ration_ass',
     quantity_detail:'quantity_detail',
-    volume_price: 'volume_price',
+    // volume_price: 'volume_price',
     projectGLJ: 'project_glj',
     labour_coe: 'labour_coe',
     calc_program: 'calc_program'
@@ -58,4 +58,30 @@ const subSheetIndex = {
     ssiCalcProgram: 4,
     ssiMemo: 5,
     ssiFeature: 6
-}
+};
+
+const volumePriceMaps = {
+    "量人": gljType.LABOUR,
+    "量材": gljType.GENERAL_MATERIAL,
+    "量机": gljType.GENERAL_MACHINE,
+    "量主": gljType.MAIN_MATERIAL,
+    "量设": gljType.EQUIPMENT,
+
+    "人工": gljType.LABOUR,
+    "材料": gljType.GENERAL_MATERIAL,
+    "机械": gljType.GENERAL_MACHINE,
+    "主材": gljType.MAIN_MATERIAL,
+    "设备": gljType.EQUIPMENT,
+
+    1: "量人",
+    201: "量材",
+    301: "量机",
+    4: "量主",
+    5: "量设"
+};
+
+const rationType = {
+    ration: 1,
+    volumePrice: 2,
+    gljRation: 3
+};

+ 6 - 5
web/building_saas/main/js/models/project.js

@@ -77,7 +77,7 @@ var PROJECT = {
             this.ration_ass = ration_ass.createNew(this);
             this.quantity_detail = quantity_detail.createNew(this);
             this.FeeRate = FeeRate.createNew(this);
-            this.VolumePrice = VolumePrice.createNew(this);
+            // this.VolumePrice = VolumePrice.createNew(this);
             this.projectGLJ = new ProjectGLJ();
             this.projectGLJ.loadData();
             this.composition = new Composition();
@@ -92,7 +92,8 @@ var PROJECT = {
             this.labourCoe = new LabourCoe(this);
             this.calcProgram = new CalcProgram(this);
 
-            this.masterField = {ration: 'billsItemID', volumePrice: 'billsItemID'};
+            // this.masterField = {ration: 'billsItemID', volumePrice: 'billsItemID'};
+            this.masterField = {ration: 'billsItemID'};
         };
 
         // prototype用于定义public方法
@@ -135,7 +136,7 @@ var PROJECT = {
                     newNode.data = br[i];
                 }
             };
-            let loadVolumePriceNode = function (cacheNode) {
+/*            let loadVolumePriceNode = function (cacheNode) {
                 let newNode = null, bv = that.VolumePrice.getBillsSortVolumePrice(cacheNode.source.getID());
                 for (let v of bv) {
                     newNode = that.mainTree.addNode(cacheNode);
@@ -143,7 +144,7 @@ var PROJECT = {
                     newNode.sourceType = that.VolumePrice.getSourceType();
                     newNode.data = v;
                 }
-            };
+            };*/
             var loadIdTreeNode = function (nodes, parent) {
                 var newNode, i;
                 for (i = 0; i < nodes.length; i++) {
@@ -154,7 +155,7 @@ var PROJECT = {
                     that.FeeRate.loadFeeRateToBill(newNode);
                     if (nodes[i].children.length === 0) {
                         loadRationNode(that.Ration.datas, newNode);
-                        loadVolumePriceNode(newNode);
+                        // loadVolumePriceNode(newNode);
                     } else {
                         loadIdTreeNode(nodes[i].children, newNode);
                     }

+ 15 - 1
web/building_saas/main/js/models/project_glj.js

@@ -212,7 +212,8 @@ ProjectGLJ.prototype.setAdjustPrice=function(glj){
     switch (glj.unit_price.type + '') {
         // 人工: 调整基价=基价单价*调整系数
         case GLJTypeConst.LABOUR:
-            glj.adjust_price = scMathUtil.roundTo(parseFloat(glj.adjustment * glj.unit_price.base_price), -2);
+        case GLJTypeConst.MACHINE_LABOUR:
+            glj.adjust_price = this.getAdjustPrice(glj);
             break;
         // 机械类型的算法
         case GLJTypeConst.MACHINE:
@@ -222,4 +223,17 @@ ProjectGLJ.prototype.setAdjustPrice=function(glj){
         default:
             glj.adjust_price = glj.unit_price.base_price;
     }
+}
+
+ProjectGLJ.prototype.getAdjustPrice = function (glj) {
+    GLJTypeConst = this.datas.constData.GLJTypeConst !== undefined ? JSON.parse(this.datas.constData.GLJTypeConst) : GLJTypeConst;
+    if(glj.unit_price.type==GLJTypeConst.LABOUR||glj.unit_price.type==GLJTypeConst.MACHINE_LABOUR){
+        let labour = projectObj.project.calcProgram.compiledLabourCoes[glj.adjCoe];
+        let coe = labour&&labour.coe?labour.coe:1;
+        let decimal = getDecimal("glj.unitPrice");
+        return scMathUtil.roundTo(parseFloat(coe*glj.unit_price.base_price),-decimal);
+    }else {
+        return glj.unit_price.base_price
+    }
+
 }

+ 16 - 11
web/building_saas/main/js/models/ration.js

@@ -101,9 +101,14 @@ var Ration = {
             });
             controller.sheet.getCell(selected[0].row,col).value(data[fieldName]);
         };
-        ration.prototype.getTempRationData = function (id, billsID, serialNo) {
+        ration.prototype.getTempRationData = function (id, billsID, serialNo, rType) {
             var newData = {'ID': id, 'serialNo': serialNo, projectID: this.project.ID()};
             newData[project.masterField.ration] = billsID;
+            newData['type'] = rType;
+            if (rType == rationType.volumePrice){
+                newData['subType'] = gljType.GENERAL_MATERIAL;   // 默认的量价类型为材料
+                newData['programID'] = projectInfoObj.projectInfo.property.engineering;
+            };
             return newData;
         };
 
@@ -151,17 +156,17 @@ var Ration = {
             return rations;
         };
 
-        ration.prototype.getInsertRationData = function (billsID, preRation) {
+        ration.prototype.getInsertRationData = function (billsID, preRation, rationType) {
             var br = this.getBillsSortRation(billsID);
             var updateData = [];
-            if (preRation && br.indexOf(preRation) > -1) {  // CSL, 2017-11-28  如果preIndex是-1,表明preRation 是量价。
+            if (preRation) {
                 var preIndex = br.indexOf(preRation), i;
-                updateData.push({updateType: 'ut_create', updateData: this.getTempRationData(this.maxRationID() + 1, billsID, preIndex < br.length - 1 ? br[preIndex + 1].serialNo : br[preIndex].serialNo + 1)});
+                updateData.push({updateType: 'ut_create', updateData: this.getTempRationData(this.maxRationID() + 1, billsID, preIndex < br.length - 1 ? br[preIndex + 1].serialNo : br[preIndex].serialNo + 1, rationType)});
                 for (i = preIndex + 1; i < br.length; i++) {
-                    updateData.push({updateType: 'ut_update', updateData: this.getTempRationData(br[i].ID, billsID, i < br.length - 1 ? br[i+1].serialNo : br[i].serialNo + 1)});
+                    updateData.push({updateType: 'ut_update', updateData: this.getTempRationData(br[i].ID, billsID, i < br.length - 1 ? br[i+1].serialNo : br[i].serialNo + 1, rationType)});
                 }
             } else {
-                updateData.push({updateType: 'ut_create', updateData: this.getTempRationData(this.maxRationID() + 1, billsID, br.length > 0 ? br[br.length - 1].serialNo + 1 : 1)});
+                updateData.push({updateType: 'ut_create', updateData: this.getTempRationData(this.maxRationID() + 1, billsID, br.length > 0 ? br[br.length - 1].serialNo + 1 : 1, rationType)});
             }
             return updateData;
         };
@@ -174,27 +179,27 @@ var Ration = {
             }
             return updateData;
         };
-        ration.prototype.insertRation = function (billsID, preRation) {
+        ration.prototype.insertRation = function (billsID, preRation, rationType) {
             var br = this.getBillsSortRation(billsID);
             this.project.pushNow('insertRation', [this.getSourceType(), this.project.projCounter()],
-                [this.getInsertRationData(billsID, preRation), this.getCounterData()]);
+                [this.getInsertRationData(billsID, preRation, rationType), this.getCounterData()]);
 
             var newRation = null;
             if (preRation) {
                 var preIndex = br.indexOf(preRation), i;
-                newRation = this.getTempRationData(this.getNewRationID(), billsID, preIndex < br.length - 1 ? br[preIndex + 1].serialNo : br[preIndex].serialNo + 1);
+                newRation = this.getTempRationData(this.getNewRationID(), billsID, preIndex < br.length - 1 ? br[preIndex + 1].serialNo : br[preIndex].serialNo + 1, rationType);
                 this.datas.push(newRation);
                 for (i = preIndex + 1; i < br.length; i++) {
                     br[i].serialNo = i < br.length - 1 ? br [i + 1].serialNo : br[i].serialNo + 1;
                 }
             } else {
-                newRation = this.getTempRationData(this.getNewRationID(), billsID, br.length > 0 ? br[br.length - 1].serialNo + 1 : 1);
+                newRation = this.getTempRationData(this.getNewRationID(), billsID, br.length > 0 ? br[br.length - 1].serialNo + 1 : 1, rationType);
                 this.datas.push(newRation);
             }
             return newRation;
         };
         ration.prototype.insertStdRation = function (billsID, preRation, std) {
-            var br = this.getBillsSortRation(billsID), updateData = this.getInsertRationData(billsID, preRation), newRation = null, that = this;
+            var br = this.getBillsSortRation(billsID), updateData = this.getInsertRationData(billsID, preRation, rationType.ration), newRation = null, that = this;
             updateData.forEach(function (data) {
 
                 if (data.updateType === 'ut_create') {

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

@@ -360,6 +360,7 @@ var ration_glj = {
                   basePrice:glj.basePrice,
                   shortName:glj.shortName,
                   type:glj.gljType,
+                  adjCoe:glj.adjCoe,
                   createType:'add',
                   repositoryId:glj.repositoryId
               }

+ 28 - 10
web/building_saas/main/js/views/glj_view.js

@@ -29,12 +29,12 @@ var gljOprObj = {
             {headerName: "规格型号", headerWidth: 120, dataCode: "specs", dataType: "String", hAlign: "left"},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
             {headerName: "类型", headerWidth: 45, dataCode: "shortName", dataType: "String", hAlign: "center"},
-            {headerName: "定额消耗量", headerWidth: 80, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right",formatter:"0.000",tofix:3},    // dataType: "Number", formatter: "0.00"
-            {headerName: "自定义消耗量", headerWidth: 80, dataCode: "customQuantity", dataType: "Number", hAlign: "right",formatter:"0.000",tofix:3},
-            {headerName: "消耗量", headerWidth: 80, dataCode: "quantity", dataType: "Number", hAlign: "right",formatter:"0.000",tofix:3},
-            {headerName: "基价单价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right",formatter:"0.00"},
-            {headerName: "调整基价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right",formatter:"0.00"},
-            {headerName: "市场单价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right",formatter:"0.00"},
+            {headerName: "定额消耗量", headerWidth: 80, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right",decimalField:"glj.quantity"},    // dataType: "Number", formatter: "0.00"
+            {headerName: "自定义消耗量", headerWidth: 80, dataCode: "customQuantity", dataType: "Number", hAlign: "right",decimalField:"glj.quantity"},
+            {headerName: "消耗量", headerWidth: 80, dataCode: "quantity", dataType: "Number", hAlign: "right",decimalField:"glj.quantity"},
+            {headerName: "基价单价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right",decimalField:"glj.unitPrice"},
+            {headerName: "调整基价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right",decimalField:"glj.unitPrice"},
+            {headerName: "市场单价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right",decimalField:"glj.unitPrice"},
             {headerName: "是否暂估", headerWidth: 65, dataCode: "isEstimate", dataType: "String", hAlign: "center",vAlign:"center",cellType:"checkBox"}
         ],
         view: {
@@ -605,9 +605,10 @@ var gljOprObj = {
                 if(glj){
                     ration_gljs[i].basePrice=glj.unit_price.base_price;
                     ration_gljs[i].marketPrice=glj.unit_price.market_price;
-                    ration_gljs[i].adjustPrice=glj.adjust_price;
+                    //ration_gljs[i].adjustPrice=glj.adjust_price;
                     ration_gljs[i].isEstimate=glj.is_evaluate;
                     ration_gljs[i].isAdd=glj.unit_price.is_add;
+                    ration_gljs[i].adjustPrice=projectObj.project.projectGLJ.getAdjustPrice(glj);
                     var connect_index = this.getIndex(glj,['code','name','specs','unit','type'])
                     if(mixRatioMap.hasOwnProperty(connect_index)){
                         var mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index],projectGljs);
@@ -1240,9 +1241,26 @@ $(function(){
         data.addItems = items;
         return data;
     }
-
-
 })
 
+function getDecimal(fieldID,node) {
+    if(node){
+        return decimalObj.decimal(fieldID,node);
+    }else if(fieldID.indexOf(".")){
+        var keyArray = fieldID.split(".");
+        return decimalObj[keyArray[0]][keyArray[1]];
+    }else {
+        return decimalObj.decimal(fieldID);
+    }
+}
 
-
+function getFormatter(decimal) {
+    var pre = "0.";
+    if(decimal<=0){
+        return "0";
+    }
+    for(i=0;i<decimal;i++){
+        pre += "0"
+    }
+    return pre;
+}

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

@@ -4,17 +4,19 @@
 
 let MainTreeCol = {
     getText: {
-        type: function (node) {
+        subType: function (node) {
             if (node.sourceType === projectObj.project.Bills.getSourceType()) {
                 return '';
+            // CSL, 2017-11-29
             } else if (node.sourceType === projectObj.project.Ration.getSourceType()) {
-                return '定';
-            } else if (node.sourceType === projectObj.project.VolumePrice.getSourceType()) {
-                if (node.data.type === '人工') return '量人'
-                else if (node.data.type === '材料') return '量材'
-                else if (node.data.type === '机械') return '量机'
-                else if (node.data.type === '主材') return '量主'
-                else if (node.data.type === '设备') return '量设';
+                if (node.data.type == 1 || node.data.type == undefined)    // 兼容旧定额
+                    return '定'
+                else if (node.data.type == 2){    // 量价
+                    return volumePriceMaps[node.data.subType];
+                }
+                else if (node.data.type == 3){    // 工料机定额
+                    return '工料机';     // 这里明细值等张伟城确定
+                }
             } else if (node.sourceType === projectObj.project.ration_glj.getSourceType()) {
                 return '主';
             }
@@ -28,13 +30,12 @@ let MainTreeCol = {
         }
     },
     readOnly: {
-        type: function (node){
-            return node.sourceType !== projectObj.project.VolumePrice.getSourceType();
+        subType: function (node){
+            return (node.data.type != 2 && node.data.type != 3);
         },
         // CSL, 2017-11-28
         calcProgramName: function (node) {
             if (
-                node.sourceType === projectObj.project.VolumePrice.getSourceType() ||
                 node.sourceType === projectObj.project.Ration.getSourceType() ||
                 (node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children && node.source.children.length === 0 && projectObj.project.projSetting.billsCalcMode === billsPrice)
             ) return false
@@ -48,7 +49,7 @@ let MainTreeCol = {
             return node.sourceType === projectObj.project.Ration.getSourceType();
         },
         volumePrice: function (node) {
-            return node.sourceType === projectObj.project.VolumePrice.getSourceType();
+            return (node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
         },
         non_bills: function (node) {
             return node.sourceType !== projectObj.project.Bills.getSourceType();
@@ -57,7 +58,7 @@ let MainTreeCol = {
             return node.sourceType !== projectObj.project.Ration.getSourceType();
         },
         non_volumePrice: function (node) {
-            return node.sourceType !== projectObj.project.Ration.getSourceType();
+            return !(node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
         },
         billsParent: function (node) {
             return node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children.length > 0;
@@ -98,7 +99,6 @@ let MainTreeCol = {
         // CSL, 2017-11-28
         calcProgramName: function (node) {
             if (
-                node.sourceType === projectObj.project.VolumePrice.getSourceType() ||
                 node.sourceType === projectObj.project.Ration.getSourceType() ||
                 (node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children && node.source.children.length === 0 && projectObj.project.projSetting.billsCalcMode === billsPrice)
             ) {
@@ -109,13 +109,18 @@ let MainTreeCol = {
         },
 
         // CSL, 2017-11-28
-        type: function (node) {
-            if (node.sourceType === projectObj.project.VolumePrice.getSourceType()) {
+        subType: function (node) {
+            if (node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation){
                 let VPType = new GC.Spread.Sheets.CellTypes.ComboBox();
-                VPType.items(["人工","材料","机械","主材","设备"]);
+
+                if (node.data.type == rationType.volumePrice)
+                    VPType.items(["人工","材料","机械","主材","设备"])
+                else if (node.data.type == rationType.gljRation)
+                    VPType.items(["材料","主材","设备"]);
+
                 return VPType;
             };
-        }
+        },
      },
     getEvent: function (eventName) {
         let names = eventName.split('.');

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

@@ -31,7 +31,7 @@ decimalObj.decimal = function (field, node) {
                     return this['bills'][field] || this.process;
                 }
             }
-            else if(node.sourceType === projectObj.project.Ration.getSourceType() || node.sourceType === projectObj.project.VolumePrice.getSourceType()){
+            else if(node.sourceType === projectObj.project.Ration.getSourceType()){
                 return this['ration'][field] || this.process;
             }
             else if(node.sourceType === projectObj.project.GLJ.getSourceType()){

+ 21 - 31
web/building_saas/main/js/views/project_view.js

@@ -125,11 +125,17 @@ var projectObj = {
         else if (colSetting.data.field === 'programID') {
             return this.project.calcProgram.compiledTemplateMaps[editingText];
         }
+        else if (colSetting.data.field === 'subType') {
+            if (typeof(editingText) !== "number")
+                return volumePriceMaps[editingText]
+            else
+                return editingText;
+        }
         else {
             return this.checkCommonField(editingText, colSetting);
         }
     },
-    updateAndReCalculate: function (node, fieldName, value) {
+    /*updateAndReCalculate: function (node, fieldName, value) {
         let project = projectObj.project, calc = new BillsCalcHelper(project), nodes = [];
         let getNodes = function (node) {
             let cur = node, nodes = [];
@@ -172,7 +178,7 @@ var projectObj = {
         }
         this.mainController.refreshTreeNode(nodes, false);
         calc = null;
-    },
+    },*/
     updateBillsCode: function (node, value) {
         let project = projectObj.project;
         let stdMatchCode, formatCode, matchs;
@@ -267,9 +273,9 @@ var projectObj = {
             else if(fieldName ==='feeRate'){
                 project.FeeRate.updateFeeRateFromBills(value,node,fieldName);
             }
-            else if (fieldName === 'quantity' || fieldName === 'marketUnitFee' || fieldName === 'programID' || fieldName === 'type' || fieldName === 'calcBase'){
+            else if (fieldName === 'quantity' || fieldName === 'marketUnitFee' || fieldName === 'programID' || fieldName === 'subType' || fieldName === 'calcBase'){
                 if (fieldName === 'quantity') {
-                    if (value) {value = value.toDecimal(project.quantity_detail.getDecimal(node))};
+                    if (value) {value = value.toDecimal(decimalObj.decimal(fieldName,node))};
                    if(project.quantity_detail.quantityEditChecking(value,node,fieldName)){
                        node.data.isFromDetail=0;
                        project.quantity_detail.cleanQuantityDetail(node,true);
@@ -278,9 +284,9 @@ var projectObj = {
                        return;
                    }
                 } else if (fieldName === 'marketUnitFee') {
-                    if (value) {value = parseFloat(value).toDecimal(projectObj.project.Decimal.common.unitFee)};
+                    if (value) {value = parseFloat(value).toDecimal(decimalObj.decimal("unitPrice", node))};
                 } else if (fieldName === 'calcBase') {
-                    if (value) {value = parseFloat(value).toDecimal(projectObj.project.Decimal.common.totalFee)};
+                    if (value) {value = parseFloat(value).toDecimal(decimalObj.decimal("totalPrice", node))};
                 };
 
                 node.changed = true;
@@ -291,11 +297,11 @@ var projectObj = {
             else {
                 if (node.sourceType === project.Bills.getSourceType()) {
                     project.Bills.updateField(node.source, fieldName, value, true);
-                } else if (node.sourceType === project.Ration.getSourceType()) {
-                    project.Ration.updateField(node.source, fieldName, value, true);
-                } else if (node.sourceType === project.VolumePrice.getSourceType()) {
-                    project.VolumePrice.updateField(node.source, fieldName, value, true);
                 }
+                else if (node.sourceType === project.Ration.getSourceType()) {
+                    project.Ration.updateField(node.source, fieldName, value, true);
+                };
+
                 if (colSetting.data.wordWrap) {
                     info.sheet.autoFitRow(node.serialNo());
                 }
@@ -425,14 +431,13 @@ var projectObj = {
                         if (selected) {
                             if (            // CSL, 2017-11-28
                                 selected.sourceType === project.Ration.getSourceType() ||
-                                selected.sourceType === project.VolumePrice.getSourceType() ||
                                 (selected.sourceType === project.Bills.getSourceType() && selected.source.children.length === 0)
                                ) return false
                             else return true
                         } else return true
                     },
                     callback: function (key, opt) {
-                        ProjectController.addRation(project, controller);
+                        ProjectController.addRation(project, controller, rationType.ration);
                     }
                 },
                 "insertLJ": {
@@ -443,14 +448,13 @@ var projectObj = {
                         if (selected) {
                             if (            // CSL, 2017-11-28
                             selected.sourceType === project.Ration.getSourceType() ||
-                            selected.sourceType === project.VolumePrice.getSourceType() ||
                             (selected.sourceType === project.Bills.getSourceType() && selected.source.children.length === 0)
                             ) return false
                             else return true
                         } else return true
                     },
                     callback: function (key, opt) {
-                        ProjectController.addVolumePrice(project, controller);
+                        ProjectController.addRation(project, controller, rationType.volumePrice);
                     }
                 },
                 "spr1": '--------',
@@ -470,9 +474,6 @@ var projectObj = {
                             } else if (selected.sourceType === project.Ration.getSourceType()) {
                                 project.Ration.delete(selected.source);
                                 controller.delete();
-                            } else if (selected.sourceType === project.VolumePrice.getSourceType()) {
-                                project.VolumePrice.delete(selected.source);
-                                controller.delete();
                             };
                             projectObj.converseCalculateBills(parent);
                         }
@@ -523,9 +524,7 @@ $('#insert').click(function () {
     if (!selected || selected.sourceType === project.Bills.getSourceType()) {
         ProjectController.addBills(project, controller);
     } else if (selected.sourceType === project.Ration.getSourceType()) {
-        ProjectController.addRation(project, controller);
-    } else if (selected.sourceType === project.VolumePrice.getSourceType()) {
-        ProjectController.addVolumePrice(project, controller);
+        ProjectController.addRation(project, controller, selected.data.type);
     }
 });
 $('#delete').click(function () {
@@ -539,9 +538,6 @@ $('#delete').click(function () {
         } else if (selected.sourceType === project.Ration.getSourceType()) {
             project.Ration.delete(selected.source);
             controller.delete();
-        } else if (selected.sourceType === project.VolumePrice.getSourceType()) {
-            project.VolumePrice.delete(selected.source);
-            controller.delete();
         };
         projectObj.converseCalculateBills(parent);
     }
@@ -575,10 +571,7 @@ $('#upMove').click(function () {
     } else if (selected.sourceType === project.Ration.getSourceType()) {
         project.Ration.changePos(selected.source, selected.preSibling.source);
         controller.upMove();
-    } else if (selected.sourceType === project.VolumePrice.getSourceType()) {
-        project.VolumePrice.changePos(selected.source, selected.preSibling.source);
-        controller.upMove();
-    }
+    };
 });
 $('#downMove').click(function () {
     var controller = projectObj.mainController, project = projectObj.project;
@@ -591,10 +584,7 @@ $('#downMove').click(function () {
         } else if (selected.sourceType === project.Ration.getSourceType()) {
             project.Ration.changePos(selected.source, selected.nextSibling.source);
             controller.downMove();
-        } else if (selected.sourceType === project.VolumePrice.getSourceType()) {
-            project.VolumePrice.changePos(selected.source, selected.nextSibling.source);
-            controller.downMove();
-        }
+        };
     }
 });
 

+ 2 - 2
web/building_saas/main/js/views/std_ration_lib.js

@@ -82,7 +82,7 @@ var rationLibObj = {
         var select = $('#stdRationLibSelect'), rationCode = args.sheet.getText(args.row, 0);
         if (rationCode !== '') {
             CommonAjax.postRationLib('/rationRepository/api/getRationItem', {user_id: userID, rationLibId: select.val(), code: rationCode}, function (data) {
-                ProjectController.addRation(projectObj.project, projectObj.mainController, data);
+                ProjectController.addRation(projectObj.project, projectObj.mainController, rationType.ration, data);
             });
         }
     },
@@ -103,7 +103,7 @@ var rationLibObj = {
                         let rationCode = rationSelect.length > 0 ? rationSheet.getText(rationSelect[0].row, 0) : '';
                         if (rationCode !== '') {
                             CommonAjax.postRationLib('/rationRepository/api/getRationItem', {user_id: userID, rationLibId: select.val(), code: rationCode}, function (data) {
-                                ProjectController.addRation(projectObj.project, projectObj.mainController, data);
+                                ProjectController.addRation(projectObj.project, projectObj.mainController, rationType.ration, data);
                             });
                         }
                     }