zhangweicheng пре 6 година
родитељ
комит
0bcf8934a5

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

@@ -603,7 +603,10 @@ class GLJListModel extends BaseModel {
                     adjCoe:tmp.adjCoe,
                     original_code:tmp.code,
                     materialType: tmp.materialType,   //三材类别
-                    materialCoe: tmp.materialCoe
+                    materialCoe: tmp.materialCoe,
+                    materialIndexType: tmp.materialIndexType,
+                    materialIndexUnit: tmp.materialIndexUnit,
+                    materialIndexCoe: tmp.materialIndexCoe
                 };
                 gljInsertData.push(gljData);
             }

+ 3 - 0
modules/main/facade/ration_facade.js

@@ -456,6 +456,9 @@ async function addRationGLJ(std,newRation,compilation) {
                 newGLJ.adjCoe = std_glj.adjCoe;
                 newGLJ.materialType = std_glj.materialType;
                 newGLJ.materialCoe = std_glj.materialCoe;
+                newGLJ.materialIndexType = std_glj.materialIndexType;
+                newGLJ.materialIndexUnit = std_glj.materialIndexUnit;
+                newGLJ.materialIndexCoe = std_glj.materialIndexCoe;
                 newGLJ.createType = 'normal';
                 let info =  await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
                 newGLJ = ration_glj_facade.createNewRecord(info);

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

@@ -138,14 +138,14 @@ module.exports = {
         };
 
         // 清单:每文档doc只存储一条清单,每条清单都必须定位一次文档,无法合并处理
-        if (datas.bills.length > 0){
+        if (datas.bills && datas.bills.length > 0){
             for (let bill of datas.bills){
                 functions.push(updateFunc(billsModel, {projectID: datas.projectID, ID: bill.ID, deleteInfo: null}, bill));
             };
         };
 
         // 定额:每文档doc只存储一条定额,每条定额都必须定位一次文档,无法合并处理
-        if (datas.rations.length > 0){
+        if (datas.rations&& datas.rations.length > 0){
             for (let ration of datas.rations){
                 functions.push(updateFunc(rationsModel, {projectID: datas.projectID, ID: ration.ID, deleteInfo: null}, ration));
             };

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

@@ -596,6 +596,9 @@ function getGLJSearchInfo(ration_glj) {
         adjCoe: ration_glj.adjCoe,
         materialType:ration_glj.materialType,
         materialCoe:ration_glj.materialCoe,
+        materialIndexType:ration_glj.materialIndexType,
+        materialIndexUnit:ration_glj.materialIndexUnit,
+        materialIndexCoe:ration_glj.materialIndexCoe,
         from: ration_glj.from ? ration_glj.from : 'std'//std:标准工料机库, cpt:补充工料机库
     };
     let glj_type_object = glj_type_util.getStdGljTypeCacheObj();

+ 10 - 0
public/web/sheet/sheet_common.js

@@ -113,6 +113,7 @@ var sheetCommonObj = {
         let ch = GC.Spread.Sheets.SheetArea.viewport;
         let parentMap=_.groupBy(data, 'ParentID');
         let visibleMap = {};
+        let styleRow=[];
         sheet.suspendPaint();
         sheet.suspendEvent();
         for (let col = 0; col < setting.header.length; col++) {
@@ -127,6 +128,10 @@ var sheetCommonObj = {
             if (setting.header[col].formatter) {
                 sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
             }
+            if(setting.header[col].cellType === "comboBox"){
+                this.setComboBox(-1,col,sheet,setting.header[col].options,setting.header[col].editorValueType);
+            }
+
             for (let row = 0; row < data.length; row++) {
                 let val = data[row][setting.header[col].dataCode];
                 if(val&&setting.header[col].dataType === "Number"){
@@ -145,8 +150,12 @@ var sheetCommonObj = {
                     visibleMap[data[row].ID] = treeType.collapsed;
                     this.setRowVisible(data,row,visibleMap,sheet);
                 }
+                if(data[row].bgColour) styleRow.push(row)
             }
         }
+        for(let r of styleRow){
+            this.setRowStyle(r,sheet,data[r].bgColour);
+        }
         this.lockCells(sheet,setting);
         sheet.resumeEvent();
         sheet.resumePaint();
@@ -931,6 +940,7 @@ var sheetCommonObj = {
             offset += rectW;
             x = x + offset;//设置偏移
             w = w - offset;
+            if(datas[row].foreColor) style.foreColor = datas[row].foreColor;
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         // override getHitInfo to allow cell type get mouse messages

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

@@ -148,7 +148,7 @@
                       <% } %>
                       <a id="switchTznr" href="javascript:void(0);"  class="btn btn-light btn-sm"><i class="fa fa-eye" aria-hidden="true"></i> 显示特征</a>-->
                   </div>
-                <!--  <a href="javascript:void(0)" class="btn btn-light btn-sm" onclick="exportSEI('<%= projectData.property.rootProjectID%>')">导出经济指标</a>-->
+                  <a href="javascript:void(0)" class="btn btn-light btn-sm" onclick="exportSEI('<%= projectData.property.rootProjectID%>')">导出经济指标</a>
                   <div class="side-tabs">
                       <ul class="nav nav-tabs" role="tablist">
                          <!-- <li class="nav-item">

+ 29 - 0
web/building_saas/main/js/models/bills.js

@@ -213,6 +213,11 @@ var Bills = {
                     data.data.type = stdBillsData.type;//插入清单类型
                     //Vincent
                     data.data.billsLibId = stdBillsData.billsLibId;//添加清单库ID
+                    data.data.economicType = stdBillsData.economicType;//工程经济指标类别
+                    data.data.quantityIndexType = stdBillsData.quantityIndexType;//工程经济指标类别
+                    data.data.quantityIndexUnit = stdBillsData.quantityIndexUnit;//工程经济指标类别
+                    data.data.quantityIndexCoe = stdBillsData.quantityIndexCoe;//工程经济指标类别
+
                     //zhong
                     newData = data.data;
                 }
@@ -424,6 +429,12 @@ var Bills = {
                 node.data.ruleText = stdBillsData.ruleText;
                 // 说明(补注)
                 node.data.comments = stdBillsData.recharge;
+                node.data.economicType = stdBillsData.economicType;
+                node.data.quantityIndexType = stdBillsData.quantityIndexType;
+                node.data.quantityIndexUnit = stdBillsData.quantityIndexUnit;
+                node.data.quantityIndexCoe = stdBillsData.quantityIndexCoe;
+
+
                 // 工作内容
                /* node.data.jobContent = stdBillsData.jobContent;
                 node.data.jobContentText = stdBillsData.jobContentText;*/
@@ -617,6 +628,12 @@ var Bills = {
                 }
             }
         };
+        bills.prototype.getEngineeringCost = function () {//取项目工程造价;
+            let node =  this.getEngineeringCostNode(projectObj.mainController);
+            let totalFee = node && node.data.feesIndex && node.data.feesIndex.common?node.data.feesIndex.common.totalFee:0;
+            return totalFee;
+        };
+
         bills.prototype.getFBFXNode = function (controller) {//取分部分项工程节点
             let roots =  controller.tree.roots;
             for(let root of roots){
@@ -645,6 +662,18 @@ var Bills = {
            return techNode;
         };
 
+        bills.prototype.getOrgNode=function () {//取组织措施项目节点
+            let items = projectObj.project.mainTree.items;//所有节点;
+            let orgNode = null;
+            for(let item of items){
+                if(isFlag(item.data)&&item.data.flagsIndex.fixed.flag==fixedFlag.CONSTRUCTION_ORGANIZATION){
+                    orgNode = item;
+                    break;
+                }
+            }
+            return orgNode;
+        };
+
         bills.prototype.deleteSelectedNode=function(){//删除选中单行时的节点
             let controller = projectObj.mainController, project = projectObj.project;
             let selected = controller.tree.selected, parent = selected.parent;

+ 2 - 1
web/building_saas/main/js/models/cache_tree.js

@@ -475,8 +475,9 @@ var cacheTree = {
             }
             return success
         };
-        Tree.prototype.getAllSubNode = function (node,nodeArray) {
+        Tree.prototype.getAllSubNode = function (node,nodeArray,ignoreID) {
           for(let c of node.children){
+              if(ignoreID && c.data.ID == ignoreID) continue;
               nodeArray.push(c);
               this.getAllSubNode(c,nodeArray);
           }

+ 88 - 66
web/building_saas/main/js/models/exportSEIInterface.js

@@ -1,6 +1,93 @@
 /**
  * Created by zhang on 2019/5/20.
  */
+
+let exportUtil = {
+    setEngineerPriceIndex:function (tender,projectData) {
+        let priceIndex = {
+            name:"工程造价指标",
+            attrs:[],
+            children:[],
+        };
+        let fixMap = {};
+        let buildingArea = this.getBuildArea(tender.property.engineerFeatures); //tender.property.projectFeature?getItemValueBykey(tender.property.projectFeature,"buildingArea"):1;//建筑面积
+
+        for(let b of projectData.bills){
+            if(b.flags && b.flags.length > 0){
+                let f = _.find(b.flags,{"fieldName":"fixed"});
+                if(f) fixMap[f.flag] = this.getTotalFee(b);
+            }
+        }
+        //计算其他组织措施费 = 施工组织措施项目下的子项,除了  安全文明施工费、建设工程竣工档案编制费以外的项
+        let CONSTRUCTION_ORGANIZATION = fixMap[fixedFlag.CONSTRUCTION_ORGANIZATION]?fixMap[fixedFlag.CONSTRUCTION_ORGANIZATION]:0;
+        let SAFETY_CONSTRUCTION =  fixMap[fixedFlag.SAFETY_CONSTRUCTION]?fixMap[fixedFlag.SAFETY_CONSTRUCTION]:0;
+        let PROJECT_COMPLETE_ARCH_FEE =  fixMap[fixedFlag.PROJECT_COMPLETE_ARCH_FEE]? fixMap[fixedFlag.PROJECT_COMPLETE_ARCH_FEE]:0;
+        let other_org_fee = CONSTRUCTION_ORGANIZATION - SAFETY_CONSTRUCTION - PROJECT_COMPLETE_ARCH_FEE;
+        other_org_fee = other_org_fee >0 ?other_org_fee:0;
+        let engineerCost = fixMap[fixedFlag.ENGINEERINGCOST]?fixMap[fixedFlag.ENGINEERINGCOST]:1;
+        priceIndex.children.push(this.getFlag("分部分项工程费",fixMap[fixedFlag.SUB_ENGINERRING],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("技术措施费",fixMap[fixedFlag.CONSTRUCTION_TECH],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("安全文明施工费",fixMap[fixedFlag.SAFETY_CONSTRUCTION],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("建设工程竣工档案编制费",fixMap[fixedFlag.PROJECT_COMPLETE_ARCH_FEE],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("其他组织措施费",other_org_fee,engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("暂列金额",fixMap[fixedFlag.PROVISIONAL],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("专业工程暂估价",fixMap[fixedFlag.ENGINEERING_ESITIMATE],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("计日工",fixMap[fixedFlag.DAYWORK],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("总承包服务费",fixMap[fixedFlag.TURN_KEY_CONTRACT],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("索赔与现场签证",fixMap[fixedFlag.CLAIM_VISA],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("规费",fixMap[fixedFlag.CHARGE],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("税金",fixMap[fixedFlag.TAX],engineerCost,buildingArea));
+        priceIndex.children.push(this.getFlag("工程造价",fixMap[fixedFlag.ENGINEERINGCOST],engineerCost,buildingArea));
+        return priceIndex;
+    },
+    getTotalFee:function (b) {
+        let total = 0;
+        if(b.fees && b.fees.length > 0){
+            let common = _.find(b.fees,{"fieldName":"common"});
+            if(common) total = scMathUtil.roundForObj(common.totalFee,getDecimal("bills.totalPrice"))
+        }
+        return total;
+    },
+    getFlag: function (name,totalCost,engineerCost,buildingArea) {
+        totalCost = totalCost?totalCost:0;
+        let flag = {
+            name:name,
+            attrs:[
+                {name: "金额", value: scMathUtil.roundToString(totalCost,3)},
+                {name: "单方造价", value: scMathUtil.roundToString(exportUtil.calcUnitB(totalCost,buildingArea),2)},
+                {name: "占造价比例", value: scMathUtil.roundToString(totalCost/engineerCost * 100,2)},
+            ],
+        };
+        return flag;
+    },
+    getBuildArea:function (features) {
+        if(features){
+            let areas = [];
+            for(let f of features){
+                if(f.index == true && f.value && f.value !=="" && IsNumber(f.value)) areas.push(f.value);
+            }
+            return _.isEmpty(areas)?1:areas;
+        }
+        return 1
+    },
+    calcUnitB:function (total,building,coe,decimal = 3) {
+        if(Array.isArray(building)){
+            for(let b of building){
+                total = scMathUtil.roundForObj(total/b,6);
+            }
+        }else {
+            total = scMathUtil.roundForObj(total/building,6);
+        }
+        coe = coe?coe:1;
+        return scMathUtil.roundForObj(total*coe,decimal);
+    },
+    calUnitWidthCoe:function (total) {
+        let areas = exportUtil.getBuildArea(projectObj.project.property.engineerFeatures);
+        let f = _.find(projectObj.project.property.engineerFeatures,{index:true});
+        return f?exportUtil.calcUnitB(total,areas,f.coe):exportUtil.calcUnitB(total,areas);
+    }
+};
+
 async function exportSEI(projectID) {
 
     let tenderProjects = [];
@@ -100,76 +187,11 @@ async function exportSEI(projectID) {
             children:[],
         };
 
-        index.children.push(setEngineerPriceIndex(tender,projectData));
+        index.children.push(exportUtil.setEngineerPriceIndex(tender,projectData));
 
         return index;
     }
 
-    function setEngineerPriceIndex(tender,projectData) {
-        let priceIndex = {
-            name:"工程造价指标",
-            attrs:[],
-            children:[],
-        };
-        let fixMap = {};
-        let buildingArea =  tender.property.projectFeature?getItemValueBykey(tender.property.projectFeature,"buildingArea"):1;//建筑面积
-        buildingArea = buildingArea && buildingArea !=""? parseFloat(buildingArea):1;
-        for(let b of projectData.bills){
-            if(b.flags && b.flags.length > 0){
-                let f = _.find(b.flags,{"fieldName":"fixed"})
-                if(f) fixMap[f.flag] = getTotalFee(b);
-            }
-        }
-        //计算其他组织措施费 = 施工组织措施项目下的子项,除了  安全文明施工费、建设工程竣工档案编制费以外的项
-        let CONSTRUCTION_ORGANIZATION = fixMap[fixedFlag.CONSTRUCTION_ORGANIZATION]?fixMap[fixedFlag.CONSTRUCTION_ORGANIZATION]:0;
-        let SAFETY_CONSTRUCTION =  fixMap[fixedFlag.SAFETY_CONSTRUCTION]?fixMap[fixedFlag.SAFETY_CONSTRUCTION]:0;
-        let PROJECT_COMPLETE_ARCH_FEE =  fixMap[fixedFlag.PROJECT_COMPLETE_ARCH_FEE]? fixMap[fixedFlag.PROJECT_COMPLETE_ARCH_FEE]:0;
-        let other_org_fee = CONSTRUCTION_ORGANIZATION - SAFETY_CONSTRUCTION - PROJECT_COMPLETE_ARCH_FEE;
-        other_org_fee = other_org_fee >0 ?other_org_fee:0;
-
-
-        let engineerCost = fixMap[fixedFlag.ENGINEERINGCOST]?fixMap[fixedFlag.ENGINEERINGCOST]:1;
-         priceIndex.children.push(getFlag("分部分项工程费",fixMap[fixedFlag.SUB_ENGINERRING],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("技术措施费",fixMap[fixedFlag.CONSTRUCTION_TECH],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("安全文明施工费",fixMap[fixedFlag.SAFETY_CONSTRUCTION],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("建设工程竣工档案编制费",fixMap[fixedFlag.PROJECT_COMPLETE_ARCH_FEE],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("其他组织措施费",other_org_fee,engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("暂列金额",fixMap[fixedFlag.PROVISIONAL],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("专业工程暂估价",fixMap[fixedFlag.ENGINEERING_ESITIMATE],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("计日工",fixMap[fixedFlag.DAYWORK],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("总承包服务费",fixMap[fixedFlag.TURN_KEY_CONTRACT],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("索赔与现场签证",fixMap[fixedFlag.CLAIM_VISA],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("规费",fixMap[fixedFlag.CHARGE],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("税金",fixMap[fixedFlag.TAX],engineerCost,buildingArea));
-         priceIndex.children.push(getFlag("工程造价",fixMap[fixedFlag.ENGINEERINGCOST],engineerCost,buildingArea));
-
-
-        return priceIndex;
-
-    }
-
-    function getTotalFee(b) {
-        let total = 0;
-        if(b.fees && b.fees.length > 0){
-            let common = _.find(b.fees,{"fieldName":"common"});
-            if(common) total = scMathUtil.roundForObj(common.totalFee,getDecimal("bills.totalPrice"))
-        }
-        return total;
-    }
-
-    function getFlag(name,totalCost,engineerCost,buildingArea) {
-        totalCost = totalCost?totalCost:0;
-        let flag = {
-            name:name,
-            attrs:[
-                {name: "金额", value: scMathUtil.roundToString(totalCost,3)},
-                {name: "单方造价", value: scMathUtil.roundToString(totalCost/buildingArea,3)},
-                {name: "占造价比例", value: scMathUtil.roundToString(totalCost/engineerCost * 100,3)},
-            ],
-        };
-        return flag;
-    }
-
     async function setGLJSummy(tender,projectData) {
 
         let gljs = {

+ 9 - 1
web/building_saas/main/js/models/project.js

@@ -463,7 +463,13 @@ var PROJECT = {
             }
 
         };
-
+        project.prototype.updateNodesAndRefresh=function (datas,callback) {
+            let me = this;
+            this.updateNodes(datas,function () {
+                let nodes = me.updateNodesCache(datas);
+                if(callback) callback(nodes);
+            })
+        };
 
         project.prototype.updateNodes = function (datas,callback) {
           /*  let datas = [
@@ -484,9 +490,11 @@ var PROJECT = {
                     }
                 }
             ]*/
+          $.bootstrapLoading.start();
             CommonAjax.post("/project/updateNodes",datas,function (data) {
                 if(callback){
                     callback(data);
+                    $.bootstrapLoading.end();
                 }
             })
         };

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

@@ -537,6 +537,9 @@ ProjectGLJ.prototype.addMixRatio = function(selections,callback){
                 repositoryId:glj.repositoryId,
                 materialType:glj.materialType,
                 materialCoe:glj.materialCoe,
+                materialIndexType:glj.materialIndexType,
+                materialIndexUnit:glj.materialIndexUnit,
+                materialIndexCoe:glj.materialIndexCoe
             };
             if (glj.hasOwnProperty("compilationId")) {
                 pglj.from = "cpt";

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

@@ -584,6 +584,9 @@ let ration_glj = {
                         adjCoe: glj.adjCoe,
                         materialType:glj.materialType,
                         materialCoe:glj.materialCoe,
+                        materialIndexType:glj.materialIndexType,
+                        materialIndexUnit:glj.materialIndexUnit,
+                        materialIndexCoe:glj.materialIndexCoe,
                         repositoryId: glj.repositoryId
                     };
                     if(pEngineer) new_glj.programID = pEngineer;
@@ -663,6 +666,9 @@ let ration_glj = {
                 createType: 'add',
                 materialType:glj.materialType,
                 materialCoe:glj.materialCoe,
+                materialIndexType:glj.materialIndexType,
+                materialIndexUnit:glj.materialIndexUnit,
+                materialIndexCoe:glj.materialIndexCoe,
                 repositoryId: glj.repositoryId
             };
             if (glj.hasOwnProperty("compilationId")) {
@@ -766,6 +772,9 @@ let ration_glj = {
             oldData.repositoryId = glj.repositoryId;
             oldData.materialType = glj.materialType;
             oldData. materialCoe =  glj.materialCoe;
+            oldData. materialIndexType =  glj.materialIndexType;
+            oldData. materialIndexUnit =  glj.materialIndexUnit;
+            oldData. materialIndexCoe =  glj.materialIndexCoe;
             if (glj.hasOwnProperty("compilationId")) {
                 oldData.from = "cpt";
                 if (glj.code.indexOf('-') != -1) {//这条工料机是用户通过修改包称、规格、型号等保存到补充工料机库的
@@ -830,6 +839,9 @@ let ration_glj = {
                 repositoryId: glj.repositoryId,
                 materialType: glj.materialType,   //三材类别
                 materialCoe: glj.materialCoe,
+                materialIndexType: glj.materialIndexType,
+                materialIndexUnit: glj.materialIndexUnit,
+                materialIndexCoe: glj.materialIndexCoe,
                 projectID: oldData.projectID
             };
             if (glj.hasOwnProperty("compilationId")) {

+ 500 - 2
web/building_saas/main/js/views/index_view.js

@@ -19,14 +19,92 @@ let indexObj= {
         ],
         view:{ lockColumns: [0]}
     },
+    engineerCostSetting:{
+        header: [
+            {headerName: "名称", headerWidth: 200, dataCode: "name", dataType: "String"},
+            {headerName: "金额", headerWidth: 160, dataCode: "cost", dataType: "String", hAlign: "right"},
+            {headerName: "单方造价", headerWidth: 160, dataCode: "unitCost", dataType: "String", hAlign: "right"},
+            {headerName: "占造价比例", headerWidth: 160, dataCode: "per", dataType: "String", hAlign: "right"}
+        ],
+        view:{ lockColumns: ["name","cost","unitCost","per"]}
+    },
+    mainMaterialSetting:{
+        header: [
+            {headerName: "名称", headerWidth: 200, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 200, dataCode: "unit", dataType: "String"},
+            {headerName: "综合单价", headerWidth: 160, dataCode: "unitPrice", dataType: "String", hAlign: "right"},
+            {headerName: "数量", headerWidth: 160, dataCode: "quantity", dataType: "String", hAlign: "right"},
+            {headerName: "单方指标", headerWidth: 160, dataCode: "unitIndex", dataType: "String", hAlign: "right"}
+        ],
+        view:{ lockColumns: ["name","unit","unitPrice","quantity","unitIndex"]}
+    },
+    economicSetting:{
+        header: [
+            {headerName: "分部分项", headerWidth: 200, dataCode: "name", dataType: "String"},
+            {headerName: "分部工程造价", headerWidth: 160, dataCode: "cost", dataType: "String", hAlign: "right"},
+            {headerName: "单方指标", headerWidth: 160, dataCode: "unitCost", dataType: "String", hAlign: "right"},
+            {headerName: "占造价比例", headerWidth: 160, dataCode: "per", dataType: "String", hAlign: "right"}
+        ],
+        view:{ lockColumns: ["name","cost","unitCost","per"]}
+    },
+    quantitySetting:{
+        header: [
+            {headerName: "名称", headerWidth: 200, dataCode: "name", dataType: "String"},
+            {headerName: "工程量指标", headerWidth: 160, dataCode: "quantity", dataType: "String", hAlign: "right"},
+            {headerName: "单位", headerWidth: 160, dataCode: "quantityIndexUnit", dataType: "String", hAlign: "center"}
+        ],
+        view:{ lockColumns: ["name","quantity","quantityIndexUnit"]}
+    },
+    materialSetting:{
+        header: [
+            {headerName: "编码", headerWidth: 80, dataCode: "code", dataType: "String"},
+            {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
+            {headerName: "规格型号", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String",cellType:'tipsCell'},
+            {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
+            {headerName: "数量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
+            {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "市场价合价", headerWidth: 120, dataCode: "totalPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "工料指标", headerWidth: 120, dataCode: "materialIndexType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[]},
+            {headerName: "工料指标单位", headerWidth: 150, dataCode: "materialIndexUnit", hAlign: "center", dataType: "String"},
+            {headerName: "单位转换系数", headerWidth: 150, dataCode: "materialIndexCoe", hAlign: "center", dataType: "String",validator:"number"}
+        ],
+        view: {
+            lockColumns: ["code","name","specs","unit","marketPrice","quantity","materialIndexUnit"]
+        }
+    },
+    ecoQuantitySetting:{
+        header: [
+            {headerName: "编码", headerWidth: 200, dataCode: "code", dataType: "String"},
+            {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
+            {headerName: "工程量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
+            {headerName: "综合单价", headerWidth: 70, dataCode: "unitFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "综合合价", headerWidth: 120, dataCode: "totalFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "工程经济指标类别", headerWidth: 120, dataCode: "economicType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[]},
+            {headerName: "工程量指标类别", headerWidth: 150, dataCode: "quantityIndexType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[]},
+            {headerName: "工程量指标单位", headerWidth: 150, dataCode: "quantityIndexUnit", hAlign: "center", dataType: "String"},
+            {headerName: "单位转换系数", headerWidth: 150, dataCode: "quantityIndexCoe", hAlign: "center", dataType: "String",validator:"number"}
+        ],
+        view: {
+            lockColumns: ["code","name","unit","quantity","unitFee","totalFee","quantityIndexUnit"]
+        }
+    },
     engineerInfoDatas:[],
     engineerFeatureDatas:[],
+    materialDatas:[],
+    ecoQuantityDatas:[],
     initSpread:function () {
         if(!this.spread){
             this.spread = SheetDataHelper.createNewSpread($("#indexSpread")[0],8);
             sheetCommonObj.spreadDefaultStyle(this.spread);
             this.initEngineerInfoSheet();
             this.initEngineerFeatureSheet();
+            this.initEngineerCostSheet();
+            this.initMainMaterialSheet();
+            this.initEconomicSheet();
+            this.initQuantitySheet();
+            this.initEcoQuantitySheet();
+            this.initMaterialSheet();
         }
        // disableRightMenu("glj_from_sheet",this.spread);
         if(projectReadOnly){
@@ -58,17 +136,72 @@ let indexObj= {
                         name:f.name,
                         value:f.value,
                         ParentID:f.ParentID,
+                        required:f.required,
                         collapsed:false
                     };
+                    if(f.required == true) tem.foreColor = "#ff2a23";
                     datas.push(tem);
                 }
             }
             return datas;
         }
     },
+    initEngineerCostSheet:function () {
+        let sheet = this.spread.getSheet(2);
+        sheetCommonObj.initSheet(sheet,this.engineerCostSetting,30);
+        sheet.name('engineerCost');
+        //sheet.setRowHeight(0, 36, 1);
+    },
+    initMainMaterialSheet:function () {
+        let sheet = this.spread.getSheet(3);
+        this.setHeaderUnit(this.mainMaterialSetting,"unitIndex");
+        sheetCommonObj.initSheet(sheet,this.mainMaterialSetting,30);
+        sheet.name('mainMaterial');
+        //sheet.setRowHeight(0, 36, 1);
+    },
+    initEconomicSheet:function () {
+        let sheet = this.spread.getSheet(4);
+        sheetCommonObj.initSheet(sheet,this.economicSetting,30);
+        sheet.name('economic');
+        //sheet.setRowHeight(0, 36, 1);
+    },
+    initQuantitySheet:function () {
+        let sheet = this.spread.getSheet(5);
+        this.setHeaderUnit(this.quantitySetting,"quantity");
+        sheetCommonObj.initSheet(sheet,this.quantitySetting,30);
+        sheet.name('quantity');
+    },
+    initEcoQuantitySheet:function () {
+        let sheet = this.spread.getSheet(6);
+        this.setComboOptions(projectObj.project.property.economics,this.ecoQuantitySetting,"economicType");
+        this.setComboOptions(projectObj.project.property.mainQuantities,this.ecoQuantitySetting,"quantityIndexType");
+        sheetCommonObj.initSheet(sheet,this.ecoQuantitySetting,1);
+        sheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onEcoQuantityValueChange);
+        sheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onEcoQuantityRangeChange);
+        sheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onSelectionChange);
+        sheet.name('ecoQuantity');
+    },
+    initMaterialSheet:function () {
+        let sheet = this.spread.getSheet(7);
+        this.setComboOptions(projectObj.project.property.materials,this.materialSetting,"materialIndexType");
+        sheetCommonObj.initSheet(sheet,this.materialSetting,30);
+        sheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onSelectionChange);
+        sheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onMaterialChange);
+        sheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMaterialRangeChange);
+        sheet.name('material');
+
+    },
     showDatas:function(){
-        if(this.nav_text == "工程信息指标") this.showEngineerInfo();
-        if(this.nav_text == "工程特征指标") this.showEngineerFeature();
+        let me = indexObj;
+        if(me.nav_text == "工程信息指标") me.showEngineerInfo();
+        if(me.nav_text == "工程特征指标") me.showEngineerFeature();
+        if(me.nav_text == "工程造价指标") me.showEngineerCost();
+        if(me.nav_text == "主要工料指标") me.showMainMaterial();
+        if(me.nav_text == "主要经济指标") me.showEconomic();
+        if(me.nav_text == "主要工程量指标") me.showQuantity();
+        if(me.nav_text == "设置主要经济、工程量指标") me.showEcoQuantity();
+        if(me.nav_text == "设置主要工料指标") me.showMaterial();
+
     },
     showEngineerInfo:function () {
         this.spread.setActiveSheetIndex(0);
@@ -108,8 +241,373 @@ let indexObj= {
             }
         }
     },
+    showEngineerCost:function () {
+        this.spread.setActiveSheetIndex(2);
+        let sheet = this.spread.getActiveSheet();
+        let costDatas = getEngineerCostData();
+        sheetCommonObj.showData(sheet, this.engineerCostSetting,costDatas);
+        sheet.setRowCount(costDatas.length);
+        function getEngineerCostData() {
+            let datas = [];
+            let priceIndex = exportUtil.setEngineerPriceIndex({property:projectObj.project.property},{bills:projectObj.project.Bills.datas});
+            for(let c of priceIndex.children){
+                let tem = {
+                    name:c.name,
+                    cost:parseFloat(c.attrs[0].value),
+                    unitCost:parseFloat(c.attrs[1].value),
+                    per:parseFloat(c.attrs[2].value)
+                }
+                datas.push(tem);
+            }
+            return datas;
+        }
+    },
+    showMainMaterial:function(){
+        this.spread.setActiveSheetIndex(3);
+        let sheet = this.spread.getActiveSheet();
+        let mainDatas = this.getMainMaterialDatas();
+        sheetCommonObj.showData(sheet, this.mainMaterialSetting,mainDatas);
+        sheet.setRowCount(mainDatas.length);
+    },
+    showEconomic:function () {
+        this.spread.setActiveSheetIndex(4);
+        let sheet = this.spread.getActiveSheet();
+        let economicDatas = this.getEconomicDatas();
+        sheetCommonObj.showData(sheet, this.economicSetting,economicDatas);
+        sheet.setRowCount(economicDatas.length);
+    },
+    showQuantity:function () {
+        this.spread.setActiveSheetIndex(5);
+        let sheet = this.spread.getActiveSheet();
+        let quantityDatas = this.getQuantityDatas();
+        sheetCommonObj.showData(sheet, this.quantitySetting,quantityDatas);
+        sheet.setRowCount(quantityDatas.length);
+    },
+    getQuantityDatas:function () {
+        let datas = [];
+        let mainQuantities = projectObj.project.property.mainQuantities;
+        let bills = this.getIndexBillsData({});
+        let billsGroup = _.groupBy(bills,'quantityIndexType');
+        if(!mainQuantities) return datas;
+        for(let m of mainQuantities){
+            let tem = {
+                name : m.name,
+                quantityIndexUnit:m.unit,
+                quantity:0
+            };
+            if(billsGroup[m.name]) setQuantities(billsGroup[m.name],tem);
+
+            datas.push(tem);
+        }
+
+        function setQuantities(items,data) {
+            let quantity = 0;
+            for (let i of items){
+                let coe = i.quantityIndexCoe && i.quantityIndexCoe!=""?parseFloat(i.quantityIndexCoe):1;
+                i.quantity = scMathUtil.roundForObj(parseFloat(i.quantity)*coe,getDecimal("process"));
+                quantity = scMathUtil.roundForObj(quantity +  i.quantity,getDecimal("process"));
+            }
+            data.quantity = exportUtil.calUnitWidthCoe(quantity);
+        }     
+        
+        return datas;
+    },
+    getEconomicDatas:function () {
+        let datas = [];
+        let economics = projectObj.project.property.economics;
+        let bills = this.getIndexBillsData({});
+        let billsGroup = _.groupBy(bills,'economicType');
+        let totalFee = projectObj.project.Bills.getEngineeringCost();
+        if(!economics) return datas;
+        for(let e of economics){
+            let tem = {
+                name:e.name,
+                cost:0,
+                unitCost:0,
+                per:0
+            };
+            if(billsGroup[e.name]) setEconomics(billsGroup[e.name],totalFee,tem);
+            datas.push(tem);
+        }
+        function setEconomics(items,engineerCost,data) {
+            let cost = 0;
+            let priceDe = getDecimal("bills.totalPrice");
+            for(let i of items){
+                i.totalFee =  scMathUtil.roundForObj(i.totalFee,priceDe);
+                cost = scMathUtil.roundForObj(cost + i.totalFee,getDecimal("process"));
+            }
+            data.cost = scMathUtil.roundForObj(cost,priceDe);
+            data.unitCost = exportUtil.calUnitWidthCoe(data.cost);
+            data.per = engineerCost?scMathUtil.roundForObj(data.cost/engineerCost * 100,2):0;
+        }
+
+        return datas;
+    },
+
+    getMainMaterialDatas:function () {
+        let datas = [];
+        let materials = projectObj.project.property.materials;
+        let gljList = projectObj.project.projectGLJ.datas.gljList;
+        let materialGroup = _.groupBy(gljList,'materialIndexType');
+        if(!materials) return datas;
+        for(let m of materials){
+            let tem = {
+                name:m.name,
+                unit:m.unit,
+                unitPrice:0,
+                quantity:0,
+                unitIndex:0
+            };
+            if(materialGroup[m.name]) setMainMaterial(materialGroup[m.name],tem);
+            datas.push(tem);
+        }
+
+
+        function setMainMaterial(gljs,data) {
+            let quantity = 0 ,unitPrice=0;
+            for(let g of gljs){
+                if(!g.quantity || g.quantity=="") continue;
+                let tem = {};
+                gljOprObj.setGLJPrice(tem,g);
+                let materialIndexCoe = g.materialIndexCoe?scMathUtil.roundForObj(g.materialIndexCoe,getDecimal("process")):1;
+                let t_quantity = scMathUtil.roundForObj(g.quantity * materialIndexCoe,getDecimal("process"));
+                quantity = scMathUtil.roundForObj(t_quantity + quantity,getDecimal("process"));
+                let temPrice = scMathUtil.roundForObj(g.quantity * tem.marketPrice,getDecimal("process"));
+                unitPrice = scMathUtil.roundForObj(temPrice + unitPrice,getDecimal("process"));
+            }
+            data.quantity = scMathUtil.roundForObj(quantity,2);
+            if(data.quantity) data.unitPrice = scMathUtil.roundForObj(unitPrice/data.quantity,2);
+            data.unitIndex = exportUtil.calUnitWidthCoe(data.quantity);
+        }
+
+        return datas;
+    },
+    showEcoQuantity:function () {
+        let parentMap = {};
+        this.spread.setActiveSheetIndex(6);
+        let sheet = this.spread.getActiveSheet();
+        let sel = sheet.getSelections()[0];
+        let oldData = sel.row<this.ecoQuantityDatas.length?this.ecoQuantityDatas[sel.row]:"";
+        this.ecoQuantityDatas = this.getIndexBillsData(parentMap);
+        sheet.setRowCount(0);
+        sheet.setRowCount(this.ecoQuantityDatas.length);
+        sheetCommonObj.showTreeData(sheet, this.ecoQuantitySetting,this.ecoQuantityDatas);
+        sel.row = oldData?_.findIndex(this.ecoQuantityDatas,{'ID':oldData.ID}):'';
+        sheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
+
+        for(let row =0 ;row < this.ecoQuantityDatas.length;row ++){//锁定父清单
+            if(parentMap[this.ecoQuantityDatas[row].ID]) sheet.getRange(row,-1 -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
+        }
+    },
+    getIndexBillsData:function (parentMap,old) {
+        let datas = [],allNodes=[];
+        let controller = projectObj.mainController, project = projectObj.project;
+        let  FBFX = project.Bills.getFBFXNode(controller);
+        if(FBFX){
+            allNodes.push(FBFX);
+            controller.tree.getAllSubNode(FBFX.source,allNodes);
+        }
+        let org = project.Bills.getOrgNode();
+        let mNode = project.Bills.getMeasureNode(controller);
+        if(mNode){
+            allNodes.push(mNode);
+            controller.tree.getAllSubNode(mNode.source,allNodes,org?org.data.ID:null);
+        }
+        for(let a of allNodes){
+            let d = a.data;
+            let tem = {
+                ID:d.ID,
+                ParentID:d.ParentID,
+                code:d.code,
+                name:d.name,
+                unit:d.unit,
+                quantity:d.quantity,
+                totalFee:d.feesIndex && d.feesIndex.common && d.feesIndex.common.totalFee?d.feesIndex.common.totalFee:0,
+                unitFee:d.feesIndex && d.feesIndex.common && d.feesIndex.common.unitFee?d.feesIndex.common.unitFee:0,
+                economicType:d.economicType,
+                quantityIndexType:d.quantityIndexType,
+                quantityIndexUnit:d.quantityIndexUnit,
+                quantityIndexCoe:d.quantityIndexCoe,
+                collapsed:false
+            };
+            parentMap[d.ParentID] = tem;
+            datas.push(tem);
+        }
+        for(let td of datas){
+            if(parentMap[td.ID]){
+                td.economicType = "";
+                td.quantityIndexType = "";
+                td.quantityIndexUnit = "";
+                td.quantityIndexCoe = "";
+            }
+        }
+        return datas;
+
+    },
+    showMaterial:function(){
+        this.spread.setActiveSheetIndex(7);
+        let sheet = this.spread.getActiveSheet();
+        let sel = sheet.getSelections()[0];
+        let oldData = sel.row<this.materialDatas.length?this.materialDatas[sel.row]:"";
+        this.materialDatas = getMaterialData();
+        sheetCommonObj.showData(sheet, this.materialSetting,this.materialDatas );
+        sheet.setRowCount(this.materialDatas .length);
+
+        sel.row = oldData?_.findIndex(this.materialDatas,{'id':oldData.id}):'';
+        sheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
+        function getMaterialData() {
+            let datas = [];
+            let gljList = projectObj.project.projectGLJ.datas.gljList;
+            gljList = _.filter(gljList,function(item){
+                return item.quantity !== 0 && item.quantity !== '0'
+            });
+            gljList = sortProjectGLJ(gljList);
+            for(let glj of gljList){
+                let tem = {
+                    id:glj.id,
+                    code:glj.code,
+                    name:glj.name,
+                    specs:glj.specs,
+                    unit:glj.unit,
+                    type:glj.type,
+                    quantity:glj.quantity,
+                    materialIndexType:glj.materialIndexType,
+                    materialIndexUnit:glj.materialIndexUnit,
+                    materialIndexCoe:glj.materialIndexCoe
+                };
+                gljOprObj.setGLJPrice(tem,glj);
+                tem.totalPrice = scMathUtil.roundForObj(tem.marketPrice * glj.quantity,getDecimal("glj.unitPrice"))
+                datas.push(tem);
+            }
+            return datas;
+        }
+
+    },
+    setComboOptions:function (property,setting,field) {
+        if(!property) return;
+        let options = [];
+        for(let p of property){
+            options.push(p.name);
+        }
+        let h = _.find(setting.header,{dataCode:field});
+        if(h) h.options = options;
+    },
     onSelectionChange:function (sender, args) {
         args.sheet.repaint();
+    },
+    onEcoQuantityValueChange:function (sender,info) {
+        let value = info.newValue;
+        let dataCode = indexObj.ecoQuantitySetting.header[info.col].dataCode;
+        if(!info.newValue){
+            return;
+        }
+        if (value&&!sheetCommonObj.checkData(info.col,indexObj.ecoQuantitySetting, value)) {
+            alert('输入的数据类型不对,请重新输入!');
+            return indexObj.showDatas();
+        }
+        let recode = indexObj.ecoQuantityDatas[info.row];
+        let data = indexObj.getEcoQuantityUpdateData(recode,dataCode,value);
+        projectObj.project.updateNodesAndRefresh([data],indexObj.showDatas)
+    },
+
+
+    onMaterialChange:function (sender,info) {
+        let value = info.newValue,updateMap = {};
+        let dataCode = indexObj.materialSetting.header[info.col].dataCode;
+        if(!info.newValue){
+            return;
+        }
+        if (value&&!sheetCommonObj.checkData(info.col,indexObj.materialSetting, value)) {
+            alert('输入的数据类型不对,请重新输入!');
+            return indexObj.showDatas();
+        }
+        let recode = indexObj.materialDatas[info.row];
+        let data = indexObj.getMaterialUpdateData(recode,dataCode,value);
+        if(!data) return indexObj.showDatas() ;
+        updateMap[recode.id] = data;
+        projectObj.project.projectGLJ.batchUpdateGLJProperty(updateMap,indexObj.showDatas);
+
+    },
+    onEcoQuantityRangeChange:function (sender,info) {
+        let nodes = [];
+        for(let c of info.changedCells){
+            let dataCode = indexObj.ecoQuantitySetting.header[c.col].dataCode;
+            let value= info.sheet.getCell(c.row, c.col).text();
+            if (value&&!sheetCommonObj.checkData(c.col,indexObj.ecoQuantitySetting, value)) {
+                alert('输入的数据类型不对,请重新输入!');
+                return indexObj.showDatas();
+            }
+            let recode = indexObj.ecoQuantityDatas[c.row];
+            let data = indexObj.getEcoQuantityUpdateData(recode,dataCode,value);
+            if(data) nodes.push(data);
+        }
+        if(_.isEmpty(nodes)) return indexObj.showDatas();
+        projectObj.project.updateNodesAndRefresh(nodes,indexObj.showDatas)
+    },
+    onMaterialRangeChange:function (sender,info) {
+        let updateMap = {};
+        for(let c of info.changedCells){
+            let value=  info.sheet.getCell(c.row, c.col).text();
+            let recode = indexObj.materialDatas[c.row];
+            let tem = indexObj.getMaterialUpdateData(recode,value);
+            if(tem) updateMap[recode.id] = tem;
+        }
+        if(_.isEmpty(updateMap)) return indexObj.showDatas();
+        projectObj.project.projectGLJ.batchUpdateGLJProperty(updateMap,indexObj.showDatas);
+    },
+    getEcoQuantityUpdateData:function (recode,dataCode,newValue) {
+        let tem = {
+            type:ModuleNames.bills,
+            data:{ID:recode.ID}
+        };
+        tem.data[dataCode] = newValue;
+        if(!recode) return null;
+        if(dataCode == "quantityIndexType"){
+            let mainQuantities = projectObj.project.property.mainQuantities;
+            if (!mainQuantities) return null;
+            let m =  _.find(mainQuantities,{name:newValue});
+            if(!m) return null;
+            tem.data["quantityIndexUnit"] = m.unit;
+            tem.data["quantityIndexCoe"] = recode.unit == m.unit? 1:null;
+        }
+        if(dataCode == "economicType"){//这里就主要查找输入是否是下列选项中的一个,值已经在上面设置了
+            let economics = projectObj.project.property.economics;
+            if (!economics) return null;
+            let m =  _.find(economics,{name:newValue});
+            if(!m) return null;
+        }
+        return tem;
+
+    },
+    getMaterialUpdateData:function (recode,dataCode,newValue) {
+        let data = {};
+        data[dataCode] = newValue;
+        if(dataCode == "materialIndexType"){
+            let materials = projectObj.project.property.materials;
+            if (!materials) return null;
+            if(!recode) return null;
+            let m =  _.find(materials,{name:newValue});
+            if(!m) return null;
+            data["materialIndexUnit"] = m.unit;
+            data["materialIndexCoe"] =  recode.unit == m.unit ?1: null;
+            if(recode.name == "水泥" && m.name == "水泥")  data["materialIndexCoe"] = 0.001;
+        }
+        return data
+    },
+    getIndexUnit:function () {
+        let features  = projectObj.project.property.engineerFeatures;
+        if(features){
+            for(let f of features){
+                if(f.index == true && f.indexUnit && f.indexUnit!="") return f.indexUnit;
+            }
+        }
+        return null;
+    },
+    setHeaderUnit:function (setting,dataCode) {
+      let header = _.find(setting.header,{dataCode:dataCode});
+      let unit = this.getIndexUnit();
+      if(!unit || !header )return;
+      header.headerName +=`(${unit})`
     }
 };
 

+ 10 - 8
web/building_saas/main/js/views/material_adjust_view.js

@@ -134,9 +134,9 @@ let materialAdjustObj = {
         sheetCommonObj.showData(this.priceCoeSheet, this.priceCoeSetting,this.priceCoeDatas);
         this.priceCoeSheet.setRowCount(this.priceCoeDatas.length);
     },
-    getPirceInfoDatas:function(){
+    getPirceInfoDatas:function(projectGLJList){
         let datas = [];
-        let gljList = this.filterAdjustGlj();
+        let gljList = this.filterAdjustGlj(projectGLJList);
         gljList = sortProjectGLJ(gljList);
         for(let glj of gljList){
             datas.push(getInfoObject(glj));
@@ -150,18 +150,20 @@ let materialAdjustObj = {
             return data;
         }
     },
-    filterAdjustGlj:function () {
-        let gljList = projectObj.project.projectGLJ.datas.gljList;
+    filterAdjustGlj:function (projectGLJList) {
+        let gljList = projectGLJList?projectGLJList:projectObj.project.projectGLJ.datas.gljList;
         let field =  $("#adjustType").val() == "priceInfo"?"is_info_adjust":"is_coe_adjust";
         return _.filter(gljList,function (item) {
             return item.quantity !== 0 && item.quantity !== '0' && item[field] ===1
         });
     },
-    getPriceCoeDatas:function () {
+    getPriceCoeDatas:function (projectGLJList,totalFee) {
         let datas = [];
-        let node =  projectObj.project.Bills.getEngineeringCostNode(projectObj.mainController);
-        let totalFee = node && node.data.feesIndex && node.data.feesIndex.common?node.data.feesIndex.common.totalFee:0;
-        let gljList = this.filterAdjustGlj();
+        if(!gljUtil.isDef(totalFee)){
+            let node =  projectObj.project.Bills.getEngineeringCostNode(projectObj.mainController);
+            totalFee = node && node.data.feesIndex && node.data.feesIndex.common?node.data.feesIndex.common.totalFee:0;
+        }
+        let gljList = this.filterAdjustGlj(projectGLJList);
          gljList = sortProjectGLJ(gljList);
         for(let glj of gljList){
             datas.push(getCoeObject(glj,totalFee));