Преглед на файлове

Merge branch 'budget' of http://192.168.1.41:3000/SmartCost/ConstructionCost into budget

zhangweicheng преди 4 години
родител
ревизия
97b00e4e02

+ 1 - 1
modules/main/controllers/calc_program_controller.js

@@ -152,7 +152,7 @@ async function deleteTemplate(req, res) {
 
 async function saveGatherCalcPrograms(req, res) {
   let result = {};
-  calcProgramFacade.saveGatherCalcPrograms(req.body.data, function (err, msg) {
+  await calcProgramFacade.saveGatherCalcPrograms(req.body.data, function (err, msg) {
     if (err) {
       result.error = 1;
       result.data = 0;

+ 7 - 7
modules/main/facade/bill_facade.js

@@ -134,25 +134,25 @@ module.exports={
     // 获取单位工程ID 工程费用(费用汇总里的totalFee) 映射表
     getUnitsBudgetMap: async function (unitIDs) {
         const rst = {};
-        unitIDs.forEach(unitID => {
+        /* unitIDs.forEach(unitID => {
             rst[unitID] = 1000000;
-        });
-        /* const gatherData = await gatherModel.find({ projectID: { $in: unitIDs } }, '-_id projectID totalFee').lean();
+        }); */
+        const gatherData = await gatherModel.find({ projectID: { $in: unitIDs } }, '-_id projectID totalFee').lean();
         const gatherMap = {};
         gatherData.forEach(item => gatherMap[item.projectID] = item.totalFee || 0);
         unitIDs.forEach(unitID => {
             rst[unitID] = gatherMap[unitID] || 0;
-        }); */
+        });
         return rst;
     },
     // 获取设备购置费
     getUnitsEquipmentMap: async function (unitIDs) {
-        //return await equipmentFacade.getEquipmentTotalCost(unitIDs);
-        const rst = {};
+        /* const rst = {};
         unitIDs.forEach(unitID => {
             rst[unitID] = 5000;
         });
-        return rst;
+        return rst; */
+        return await equipmentFacade.getEquipmentTotalCost(unitIDs);
     },
     // 获取概算汇总初始化数据
     initialBudgetSummary: async function (constructionID) {

+ 4 - 4
modules/main/facade/calc_program_facade.js

@@ -58,8 +58,8 @@ async function getProjectCalcProgramFile(ID) {
 };
 
 async function getStdCalcProgramFile(libID) {
-    let stdCP = await stdCalcProgramsModel.findOne({ID:libID});
-    return stdCP;
+  let stdCP  = await stdCalcProgramsModel.findOne({ID:libID});
+  return stdCP;
 };
 
 // 统一的 getData() 方法供project调用
@@ -262,9 +262,9 @@ function deleteTemplate(dataObj, callback) {
     );
 };
 
-function saveGatherCalcPrograms(dataObj, callback) {
+async function saveGatherCalcPrograms(dataObj, callback) {
   dataObj = JSON.parse(dataObj);
-  gatherCalcProgramsModel.findOne({projectID: dataObj.projectID}, function (err, data) {
+  await gatherCalcProgramsModel.findOne({projectID: dataObj.projectID}, function (err, data) {
     if(data == null){ // 第一次保存,找不到
       let doc={
         projectID: dataObj.projectID,

+ 2 - 0
web/building_saas/budget-summary/js/budgetSummarySheet.js

@@ -684,6 +684,8 @@ const budgetSummaryObj = (() => {
   const init = async (constructionID) => {
     try {
       $.bootstrapLoading.start();
+      // 得先计算费用汇总(概算汇总计算基于费用汇总算出来的总金额)
+      await projectObj.project.calcProgram.getGatherFeeData();
       const { treeData, costGrowthRate, growthPeriod } = await ajaxPost('/bills/initialBudgetSummary', { constructionID });
       calcSetting.costGrowthRate = costGrowthRate;
       calcSetting.growthPeriod = growthPeriod;

+ 2 - 12
web/building_saas/main/js/models/calc_program.js

@@ -2894,9 +2894,7 @@ class CalcProgram {
     };
 
     //报表用取费类别汇总。调用:let obj = projectObj.project.calcProgram.getGatherFeeData();
-    getGatherFeeData(){
-      // $.bootstrapLoading.start();
-      // setTimeout(()=>{
+    async getGatherFeeData(){
         let rst = {projectID: projectObj.project.ID(), totalFee: 0, calcPrograms: []};
         let tpls = calcTools.getUsedTemplates();
 
@@ -2910,18 +2908,10 @@ class CalcProgram {
         let oldValue = projectObj.project.mainTree.items[0].data.totalFee;
         if (oldValue != rst.totalFee){
           projectObj.project.mainTree.items[0].data.totalFee = rst.totalFee;
-          $.bootstrapLoading.start();
-          CommonAjax.post("/calcProgram/saveGatherCalcPrograms", rst, function (data) {
-            // if(callback){
-            //   callback(data);
-            $.bootstrapLoading.end();
-            // }
-          });
+          await ajaxPost('/calcProgram/saveGatherCalcPrograms', rst);
         }
         console.log(rst);
         return rst;
-      // });
-      // $.bootstrapLoading.end();
     };
 };
 

+ 27 - 333
web/building_saas/main/js/views/gather_fees_view.js

@@ -50,10 +50,6 @@ let gatherFeesView = {
 
     buildSheet: function (){
         let me = this;
-        let obj = projectObj.project.calcProgram.getGatherFeeData();
-        me.datas = obj.calcPrograms;
-        $('#lblGatherFee').text(`费用汇总 ${obj.totalFee}`);
-
         if (me.mainSpread) {
             me.mainSpread.destroy();
             me.mainSpread = null;
@@ -62,31 +58,19 @@ let gatherFeesView = {
             me.detailSpread.destroy();
             me.detailSpread = null;
         };
-        me.mainSpread = sheetCommonObj.buildSheet($('#gfMainSpread')[0], me.mainSetting, me.datas.length);
+        // me.mainSpread = sheetCommonObj.buildSheet($('#gfMainSpread')[0], me.mainSetting, me.datas.length);
+        me.mainSpread = sheetCommonObj.buildSheet($('#gfMainSpread')[0], me.mainSetting, 1);
         me.mainSheet = me.mainSpread.getSheet(0);
         sheetCommonObj.spreadDefaultStyle(me.mainSpread);
-        me.detailSpread = sheetCommonObj.buildSheet($('#gfDetailSpread')[0], me.detailSetting, me.datas[0].calcItems.length);
+        // me.detailSpread = sheetCommonObj.buildSheet($('#gfDetailSpread')[0], me.detailSetting, me.datas[0].calcItems.length);
+        me.detailSpread = sheetCommonObj.buildSheet($('#gfDetailSpread')[0], me.detailSetting, 1);
         me.detailSheet = me.detailSpread.getSheet(0);
         sheetCommonObj.spreadDefaultStyle(me.detailSpread);
-        // let arr = projectObj.project.calcProgram.compiledFeeTypeNames.slice();
-        // arr.delete('暂估费');
-        // let fieldName = new GC.Spread.Sheets.CellTypes.ComboBox();
-        // fieldName.items(arr);
-        // me.detailSheet.getRange(-1, 4, -1, 1).cellType(fieldName);
-
         me.mainSheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onMainEnterCell);
         me.detailSheet.bind(GC.Spread.Sheets.Events.ValueChanged, me.onDetailValueChanged);
         me.detailSheet.bind(GC.Spread.Sheets.Events.RangeChanged, me.onRangeChanged);
         me.detailSheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onDetailEnterCell);
-        me.detailSheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
-        sheetCommonObj.showData(me.mainSheet, me.mainSetting, me.datas);
-        me.mainSheet.setRowCount(me.datas.length);
-
         me.detailSheet.name('gatherfee_detail');
-        // feeRateObject.setFeeRateCellCol(me.detailSheet, _.findIndex(me.detailSetting.header,{'dataCode':'feeRate'}));
-        sheetCommonObj.showData(me.detailSheet, me.detailSetting, me.datas[0].calcItems);
-        me.getfeeRateColor(me.datas[0].calcItems);
-        customRowHeader(me.detailSheet, me.datas[0].calcItems.length);
         if(!projectReadOnly){
             // me.loadMainContextMenu();
             // me.loadDetailContextMenu();
@@ -101,23 +85,22 @@ let gatherFeesView = {
             sheetCommonObj.disableSpread(me.mainSpread);
             sheetCommonObj.disableSpread(me.detailSpread);
         };
-
     },
-    getStdCalcProgramFiles: function(){
-        function getStdCPFilesHtml(stdCPLibs) {
-            let result = '<option value="">请选择计算程序标准库</option>';
-            if (stdCPLibs.length <= 0) {
-                return result;
-            };
-
-            for (let lib of stdCPLibs){
-                result += '<option value='+ lib.id +'>'+ lib.name +'</option>';
-            };
-            return result;
-        };
-
-        let stdCPHtml = getStdCPFilesHtml(projectObj.project.projectInfo.engineeringInfo.program_lib);
-        $("#calcProgramFileSelect").html(stdCPHtml);
+    showData: async function () {
+      $.bootstrapLoading.start();
+      let me = this;
+      let obj = await projectObj.project.calcProgram.getGatherFeeData();
+      me.datas = obj.calcPrograms;
+      $('#lblGatherFee').text(`费用汇总 ${obj.totalFee}`);
+      sheetCommonObj.showData(me.mainSheet, me.mainSetting, me.datas);
+      me.mainSheet.setRowCount(me.datas.length);
+      sheetCommonObj.showData(me.detailSheet, me.detailSetting, me.datas[0].calcItems);
+      me.getfeeRateColor(me.datas[0].calcItems);
+      customRowHeader(me.detailSheet, me.datas[0].calcItems.length);
+
+      let count = gatherFeesView.datas[gatherFeesView.mainSheet.getActiveRowIndex()].calcItems.length;
+      gatherFeesView.detailSheet.setRowCount(count, GC.Spread.Sheets.SheetArea.viewport);
+      $.bootstrapLoading.end();
     },
     onMainEnterCell: function(sender, args) {
         var me = gatherFeesView;
@@ -247,274 +230,7 @@ let gatherFeesView = {
         // let e = `ID:${c.ID} ${c.expression} ${c.dispExpr} ${c.dispExprUser} ${c.compiledExpr} ${c.custom}`;
         // projectObj.testDisplay('', e);
     },
-    onClipboardPasting: function (sender, args) {
-         args.cancel = true;
-    },
-    loadMainContextMenu: function () {
-        $.contextMenu({
-            selector: '#gfMainSpread',
-            build: function ($trigger, e) {
-                SheetDataHelper.safeRightClickSelection($trigger, e, gatherFeesView.mainSpread);
-            },
-            items: {
-                "copyTemplate": {
-                    name: "另存为",
-                    icon: 'copy',
-                    callback: function (key, opt) {
-                        $.bootstrapLoading.start();
-                        let template = gatherFeesView.getSelectionInfo().template;
-                        let idx = gatherFeesView.mainSpread.getActiveSheet().getActiveRowIndex();
-
-                        let newTemplate = {};
-                        newTemplate.ID = analyzer.templateMaxID() + 1;
-                        newTemplate.name = analyzer.templateNewName(template.name);
-                        newTemplate.custom = true;
-                        newTemplate.calcItems = [];
-                        $.extend(true, newTemplate.calcItems, template.calcItems);
-                        // 清理掉费率ID关联
-                        for (let ci of newTemplate.calcItems){
-                            if (ci.feeRateID || ci.feeRateID == null)
-                                delete ci.feeRateID;
-                        };
-
-                        let data = {
-                            'projectID': projectObj.project.ID(),
-                            'ID': newTemplate.ID,
-                            'name': newTemplate.name,
-                            'custom': newTemplate.custom,
-                            'calcItems': newTemplate.calcItems
-                        };
-
-                        gatherFeesView.addTemplate(data, function (rst) {
-                            if (rst){
-                                let ts = projectObj.project.calcProgram.templates;
-                                ts.push(newTemplate);
-                                projectObj.project.calcProgram.compileTemplateMaps();
-                                projectObj.project.calcProgram.compileTemplate(newTemplate);
-                                gatherFeesView.buildSheet();
-                                gatherFeesView.mainSheet.setSelection(ts.length - 1, 0, 1, 1);
-                                gatherFeesView.mainSheet.showRow(ts.length - 1, GC.Spread.Sheets.VerticalPosition.center);
-                                gatherFeesView.refreshDetailSheet();
-                                $.bootstrapLoading.end();
-                            }
-                        });
-                    }
-                },
-                "reNameTemplate": {
-                    name: "重命名...",
-                    icon: 'edit',
-                    disabled: function () {
-                        let custom = gatherFeesView.getSelectionInfo().template.custom;
-                        let canReName = custom ? custom : false;
-                        return !canReName;
-                    },
-                    callback: function (key, opt) {
-                        $.bootstrapLoading.start();
-                        let template = gatherFeesView.getSelectionInfo().template;
-                        let idx = gatherFeesView.mainSpread.getActiveSheet().getActiveRowIndex();
-
-                        let newName = '';
-                        hintBox.valueBox('重命名', template.name, function () {
-                            newName = hintBox.value;
-
-                            if (!newName){
-                                hintBox.error(`名称不能为空!`);
-                                return false;
-                            };
-
-                            if (newName == template.name) {
-                                $.bootstrapLoading.end();
-                                return;
-                            }
-
-                            if (analyzer.templateNameIsExist(newName)){
-                                hintBox.error(`“${newName}” 已存在,请重新输入!`);
-                                return false;
-                            };
-
-                            template.name = newName;
-                            let data = {
-                                'projectID': projectObj.project.ID(),
-                                'ID': template.ID,
-                                'name': template.name
-                            };
-                            gatherFeesView.updateTemplate(data, function (rst) {
-                                if (rst){
-                                    projectObj.project.calcProgram.compileTemplateMaps();
-                                    projectObj.mainController.refreshTreeNode(calcTools.getNodesByProgramID(template.ID));
-                                    sheetCommonObj.showData(gatherFeesView.mainSpread.getSheet(0), gatherFeesView.mainSetting, gatherFeesView.datas);
-                                    $.bootstrapLoading.end();
-                                }
-                            });
-                        });
-                    }
-                },
-                "spr1": '--------',
-                "deleteTemplate": {
-                    name: '删除',
-                    icon: 'fa-remove',
-                    disabled: function () {
-                        let custom = gatherFeesView.getSelectionInfo().template.custom;
-                        let canDelete = custom ? custom : false;
-                        return !canDelete;
-                    },
-                    callback: function () {
-                        $.bootstrapLoading.start();
-                        let template = gatherFeesView.getSelectionInfo().template;
-                        if (analyzer.templateIsUsed(template.ID)) {
-                            $.bootstrapLoading.end();
-                            hintBox.infoBox('系统提示', `计算模板“${template.name}”已被使用,不允许删除!`, 1);
-                            return;
-                        };
-                        hintBox.infoBox('系统提示', `确定要删除计算模板“${template.name}”吗?`, 2, cbYes);
-                        function cbYes() {
-                            let data = {
-                                'projectID': projectObj.project.ID(),
-                                'ID': template.ID
-                            };
-                            gatherFeesView.deleteTemplate(data, function (rst) {
-                                if (rst){
-                                    let idx = gatherFeesView.mainSheet.getActiveRowIndex();
-                                    projectObj.project.calcProgram.templates.splice(idx, 1);
-                                    projectObj.project.calcProgram.compileTemplateMaps();
-                                    gatherFeesView.buildSheet();
-                                    gatherFeesView.mainSheet.setSelection(idx - 1, 0, 1, 1);
-                                    gatherFeesView.mainSheet.showRow(idx - 1, GC.Spread.Sheets.VerticalPosition.center);
-                                    gatherFeesView.refreshDetailSheet();
-                                    $.bootstrapLoading.end();
-                                }
-                            });
-                        };
-                    }
-                }
-            }
-        });
-    },
-    loadDetailContextMenu: function () {
-        $.contextMenu({
-            selector: '#gfDetailSpread',
-            build: function ($triggerElement, event) {
-                SheetDataHelper.safeRightClickSelection($triggerElement, event, gatherFeesView.detailSpread);
-            },
-            items: {
-                "newCalcItem": {
-                    name: "插入行",
-                    icon: 'fa-sign-in',
-                    callback: function () {
-                        $.bootstrapLoading.start();
-                        let template = gatherFeesView.getSelectionInfo().template;
-                        let idx = gatherFeesView.detailSpread.getActiveSheet().getActiveRowIndex();
-
-                        let newItem = {};
-                        newItem.ID = analyzer.calcItemMaxID(template) + 1;
-                        // newItem.name = '新建';
-                        newItem.memo = '自定义';
-                        newItem.custom = true;
-                        newItem.expression = '0';                           // 这里必须得有值,否则程序内部公式解析会出现诸多问题
-                        template.calcItems.splice(idx + 1, 0, newItem);
-                        let data = {
-                            'projectID': projectObj.project.ID(),
-                            'ID': template.ID,
-                            'calcItems': template.calcItems
-                        };
-                        gatherFeesView.updateTemplate(data, function (rst) {
-                            if (rst){
-                                projectObj.project.calcProgram.compileTemplate(template);
-                                gatherFeesView.refreshDetailSheet();
-                                gatherFeesView.detailSpread.getActiveSheet().setSelection(idx + 1, 0, 1, 1);
-                                let relationNodes = calcTools.getNodesByProgramID(template.ID);
-                                projectObj.project.calcProgram.calcNodesAndSave(relationNodes);
-                            }
-                        });
-                        $.bootstrapLoading.end();
-                    }
-                },
-                "spr1": '--------',
-                "deleteCalcItem": {
-                    name: '删除行',
-                    icon: 'fa-remove',
-                    callback: function () {
-                        $.bootstrapLoading.start();
-                        let template = gatherFeesView.getSelectionInfo().template;
-                        let idx = gatherFeesView.detailSpread.getActiveSheet().getActiveRowIndex();
-                        let item = template.calcItems[idx];
-
-                        if (item.fieldName == 'common'){
-                            $.bootstrapLoading.end();
-                            hintBox.infoBox('系统提示', `费用类别为“工程造价”的行不允许删除!`, 1);
-                            return;
-                        };
 
-                        if (analyzer.calcItemIsUsed(template, item)){
-                            $.bootstrapLoading.end();
-                            let s = hintBox.font(item.tempUsed + 1);
-                            hintBox.infoBox('系统提示', `第 ${idx + 1} 行“${item.name}”已被第 ${s} 行引用,不允许删除!`, 1);
-                            delete item.tempUsed;
-                            return;
-                        };
-
-                        hintBox.infoBox('系统提示', `确定要删除计算规则“${item.name}”吗?`, 2, cbYes);
-                        function cbYes() {
-                            template.calcItems.splice(idx, 1);
-                            let data = {
-                                'projectID': projectObj.project.ID(),
-                                'ID': template.ID,
-                                'calcItems': template.calcItems
-                            };
-                            gatherFeesView.updateTemplate(data, function (rst) {
-                                if (rst){
-                                    projectObj.project.calcProgram.compileTemplate(template);
-                                    gatherFeesView.refreshDetailSheet();
-                                    let relationNodes = calcTools.getNodesByProgramID(template.ID);
-                                    projectObj.project.calcProgram.calcNodesAndSave(relationNodes);
-                                    $.bootstrapLoading.end();
-                                }
-                            });
-                        };
-                    }
-                }
-            }
-        });
-
-    },
-    saveCalcItem: function (data, callback) {//data
-        CommonAjax.post('/calcProgram/saveCalcItem', data,
-            function (result) {
-                if(callback){
-                    callback(result);
-                }
-            }
-        );
-    },
-    updateTemplate: function (data, callback) {
-        CommonAjax.post('/calcProgram/updateTemplate', data,
-            function (result) {
-                if(callback){
-                    callback(result);
-                }
-            }
-        );
-    },
-    addTemplate: function (data, callback) {
-        CommonAjax.post('/calcProgram/addTemplate', data,
-            function (result) {
-                if(callback){
-                    callback(result);
-                }
-            }
-        );
-    },
-    deleteTemplate: function (data, callback) {
-        $.bootstrapLoading.start();
-        CommonAjax.post('/calcProgram/deleteTemplate', data,
-            function (result) {
-                if(callback){
-                    callback(result);
-                }
-                $.bootstrapLoading.end();
-            }
-        );
-    },
     getSelectionInfo:function () {
         var templateIndex = this.mainSpread.getActiveSheet().getActiveRowIndex();
         var dIndex = this.detailSpread.getActiveSheet().getActiveRowIndex();
@@ -552,40 +268,18 @@ $(document).ready(function(){
         sessionStorage.setItem('mainTab', '#tab_gather_fees');
         $(e.relatedTarget.hash).removeClass('active');
         // 每次进来都要重新计算一次
-        // if (!gatherFeesView.mainSpread)
+        if (!gatherFeesView.mainSpread)
             gatherFeesView.buildSheet()
-        // else
-        //     gatherFeesView.mainSpread.refresh();
+        else
+            gatherFeesView.mainSpread.refresh();
 
-        let count = gatherFeesView.datas[gatherFeesView.mainSheet.getActiveRowIndex()].calcItems.length;
-        gatherFeesView.detailSheet.setRowCount(count, GC.Spread.Sheets.SheetArea.viewport);
+        gatherFeesView.showData();
     });
 
-    $("#calcProgramFileSelect").change(function() {
-        // 取标准库数据过来显示。
-        let libID = $(this).val();
-        if (libID == ''){
-            gatherFeesView.mainSpread.getSheet(0).setRowCount(0);
-            gatherFeesView.detailSpread.getSheet(0).setRowCount(0);
-            return false;
-        };
-
-        $.bootstrapLoading.start();
-        libID = parseFloat(libID);
-        let projectID = projectObj.project.ID();
-        CommonAjax.post('/calcProgram/updateTemplateFile', {"projectID": projectID, "libID": libID}, function (data) {
-            projectObj.project.calcProgram.datas.templates = data;
-            projectObj.project.calcProgram.compileAllTemps();
-            projectObj.project.calcProgram.calcAllNodesAndSave();
-            gatherFeesView.buildSheet();
-            $.bootstrapLoading.end();
-        });
-    });
-
-    $("#lblGatherFee").bind('click',function () {
-        gatherFeesView.buildSheet();
-        gatherFeesView.refreshDetailSheet();
-    });
+    // $("#lblGatherFee").bind('click',function () {
+    //     gatherFeesView.buildSheet();
+    //     gatherFeesView.refreshDetailSheet();
+    // });
 });
 
 

+ 40 - 3
web/building_saas/pm/js/pm_newMain.js

@@ -39,6 +39,28 @@ const FileKind = {
     tender: 1, //投标
     bid: 2  //招标
 };
+
+// 概算类型,对应可用工程专业
+const budgetEngineeringListMap = {
+    [commonConstants.BudgetType.BUILDING]: [
+        '房屋建筑工程',
+        '装配式钢结构建筑工程',
+        '装饰工程',
+        '构筑物',
+        '市政工程',
+        '机械(爆破)土石方工程',
+        '人工土石方工程',
+        '围墙工程',
+        '幕墙工程',
+        '安装工程',
+        '市政安装工程',
+    ],
+    [commonConstants.BudgetType.RAIL]: [
+        '城市轨道交通工程',
+        '城市轨道交通安装工程'
+    ],
+};
+
 let curTaxType = 1; //1:"一般计税",2:"简易计税"
 let curBudgetType = commonConstants.BudgetType.BUILDING;
 let curValutionType = 'bill',   //计价方式默认只有清单计价
@@ -372,8 +394,9 @@ const projTreeObj = {
             name: '导入招投标接口文件',
             icon: 'fa-cloud-upload',
             visible: function () {
-                const names = ['重庆定额(2018)', '广东定额(2018)'];
-                return compilationData && names.includes(compilationData.name);
+                return false;
+                /* const names = ['重庆定额(2018)', '广东定额(2018)'];
+                return compilationData && names.includes(compilationData.name); */
             },
             callback: function () {
                 $('#importInterface').modal('show');
@@ -2089,6 +2112,15 @@ $(document).ready(function() {
         changeEngineering();
     });
 
+    // 选择项目类型
+    $("input[name='budgetType-tender']").click(function () {
+        curBudgetType = +$(this).val();
+        const engineeringList = getEngineeringList();
+        const engineeringHtml = getEngineeringHtml(engineeringList);
+        $("#tender-engineering").html(engineeringHtml);
+        changeEngineering();
+    });
+
     //选择计价规则
     $("#valuation").change(function () {
         curValuation = $(this).val();
@@ -3655,6 +3687,7 @@ function setProjOptions(projs, selected){
     if(projs.length > 0){
         let firstProj = selected && selected.data.projType === projectType.project ? selected: projs[0];
         curTaxType = firstProj.data.property.taxType || 1;
+        curBudgetType = firstProj.data.property.budgetType || commonConstants.BudgetType.BUILDING;
         if (firstProj.data.property.valuationType) {
             curValutionType = firstProj.data.property.valuationType;
         }
@@ -3675,6 +3708,7 @@ function setProjOptions(projs, selected){
             $proj.attr("href", "javascript:void(0);");
             $proj.click(function () {
                 curTaxType = projs[i].data.property.taxType || 1;
+                curBudgetType = projs[i].data.property.budgetType || commonConstants.BudgetType.BUILDING;;
                 if (projs[i].data.property.valuationType) {
                     curValutionType = projs[i].data.property.valuationType;
                 }
@@ -3877,6 +3911,7 @@ function AddTender() {
 
         //let valuation = $("#valuation").val();
         let valuation = curValuation;   //跟建设项目一样的计价规则
+        debugger;
 
         let engineeringName = $("#tender-engineering").val();
         if (!engineeringName || engineeringName === '') {
@@ -4355,10 +4390,12 @@ function getEngineeringHtml(engineeringList) {
     if (engineeringList.length <= 0) {
         return result;
     }
+    console.log(engineeringList);
     let engLibNames = [];
     for(let i = 0; i < engineeringList.length; i++){
         let tmp = engineeringList[i];
-        if(engLibNames.includes(tmp.lib.name)){
+        const validEngNames = budgetEngineeringListMap[curBudgetType];
+        if(engLibNames.includes(tmp.lib.name) || !validEngNames.includes(tmp.lib.name)){
            continue;
         }
         result += `<option ${i === 0 ? 'selected' : ''} value="${tmp.lib.name}">${tmp.lib.name}</option>`;