Explorar el Código

量价定额合并。

Chenshilong hace 7 años
padre
commit
3f809558c8

+ 1 - 1
config/gulpConfig.js

@@ -71,7 +71,7 @@ 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',

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

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

@@ -620,7 +620,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>
@@ -659,7 +660,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>
@@ -670,13 +671,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,

+ 23 - 11
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'
@@ -61,15 +61,27 @@ const subSheetIndex = {
 };
 
 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);
                     }

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

@@ -101,9 +101,12 @@ 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;   // 默认的量价类型为材料
             return newData;
         };
 
@@ -151,17 +154,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 +177,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') {

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

@@ -4,14 +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.indexOf('量') != 0)
-                    return volumePriceMaps[node.data.type];
+                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 '主';
             }
@@ -25,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
@@ -45,7 +49,7 @@ let MainTreeCol = {
             return node.sourceType === projectObj.project.Ration.getSourceType();
         },
         volumePrice: function (node) {
-            return node.sourceType === projectObj.project.VolumePrice.getSourceType();
+            return node.sourceType === (node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
         },
         non_bills: function (node) {
             return node.sourceType !== projectObj.project.Bills.getSourceType();
@@ -54,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.sourceType !== (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;
@@ -95,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)
             ) {
@@ -106,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()){

+ 12 - 28
web/building_saas/main/js/views/project_view.js

@@ -125,8 +125,8 @@ var projectObj = {
         else if (colSetting.data.field === 'programID') {
             return this.project.calcProgram.compiledTemplateMaps[editingText];
         }
-        else if (colSetting.data.field === 'type') {
-            if (editingText.indexOf('量') == 0)
+        else if (colSetting.data.field === 'subType') {
+            if (typeof(editingText) !== "number")
                 return volumePriceMaps[editingText]
             else
                 return editingText;
@@ -273,7 +273,7 @@ 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(project.quantity_detail.quantityEditChecking(value,node,fieldName)){
@@ -297,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());
                 }
@@ -431,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": {
@@ -449,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": '--------',
@@ -476,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);
                         }
@@ -529,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 () {
@@ -545,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);
     }
@@ -581,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;
@@ -597,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);
                             });
                         }
                     }