Jelajahi Sumber

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

zhongzewei 7 tahun lalu
induk
melakukan
caff21ea98

+ 34 - 3
modules/reports/controllers/rpt_controller.js

@@ -264,6 +264,37 @@ module.exports = {
             callback(req, res, err, pageRst);
         });
     },
+    getMultiReports: function (req, res) {
+        let params = JSON.parse(req.body.params),
+            prj_id = params.prj_id,
+            rpt_ids = params.rpt_ids.split(','),
+            customizeCfg = params.custCfg,
+            option = params.option;
+        let user_id = req.session.sessionUser.id;
+        let parallelFucs = [];
+        let dftOption = option||JV.PAGING_OPTION_NORMAL;
+        for (let id of rpt_ids) {
+            parallelFucs.push((function (rpt_id) {
+                return function (cb) {
+                    getAllPagesCommon(user_id, prj_id, rpt_id, null, null, customizeCfg, dftOption, function (err, pageRst) {
+                        if(err){
+                            cb(err);
+                        }
+                        else{
+                            cb(null, pageRst);
+                        }
+                    })
+                }
+            })(parseInt(id)));
+        }
+        async.parallel(parallelFucs, function (err, pageRstArray) {
+            if (err) {
+                callback(req, res, '数据有误', null);
+            } else {
+                callback(req, res, err, pageRstArray);
+            }
+        })
+    },
 
     getReportAllPagesSvg: function (req, res) {
         let params = JSON.parse(req.body.params),
@@ -303,7 +334,7 @@ module.exports = {
                 rpt_xl_util.exportExcel(pageRst, pageSize, rptName, isOneSheet, null, function(newName){
                     res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                     let rptNameURI = encodeURI(rptName);
-                    res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".xlsx\"; filename*=utf-8''" + rptNameURI );
+                    res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".xlsx\"; filename*=utf-8''" + rptNameURI + '.xlsx' );
                     let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + newName + '.xlsx');
                     filestream.on('data', function(chunk) {
                         res.write(chunk);
@@ -347,7 +378,7 @@ module.exports = {
                 rpt_xl_util.exportExcelInOneBook(pageRstArray, pageSize, rptName, function(tmpFilePath){
                     res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                     let rptNameURI = encodeURI(rptName);
-                    res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".xlsx\"; filename*=utf-8''" + rptNameURI );
+                    res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".xlsx\"; filename*=utf-8''" + rptNameURI + '.xlsx');
                     let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + tmpFilePath + '.xlsx');
                     filestream.on('data', function(chunk) {
                         res.write(chunk);
@@ -462,7 +493,7 @@ module.exports = {
                 res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                 // res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".pdf");
                 let rptNameURI = encodeURI(rptName);
-                res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".pdf\"; filename*=utf-8''" + rptNameURI );
+                res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".pdf\"; filename*=utf-8''" + rptNameURI + ".pdf"  );
 
                 let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + newName + '.pdf');
                 filestream.on('data', function(chunk) {

+ 1 - 0
modules/reports/routes/report_router.js

@@ -26,6 +26,7 @@ module.exports =function (app) {
     //now is the real:
     rptRouter.post('/getReport', reportController.getReportAllPages);
     rptRouter.post('/getReportSvg', reportController.getReportAllPagesSvg);
+    rptRouter.post('/getMultiReports', reportController.getMultiReports);
     rptRouter.get('/getExcelInOneBook/:prj_id/:rpt_ids/:size/:rptName/:option', reportController.getExcelInOneBook);
     rptRouter.get('/getExcel/:prj_id/:rpt_id/:size/:orientation/:rptName/:isOneSheet/:option', reportController.getExcel);
     rptRouter.get('/getPDF/:prj_id/:rpt_id/:size/:orientation/:rptName', reportController.getPDF);

+ 7 - 5
modules/reports/rpt_component/jpc_ex.js

@@ -215,12 +215,14 @@ JpcExSrv.prototype.createNew = function(){
         }
     };
     JpcResult.executeFormulas = function(runType, $CURRENT_TEMPLATE, $CURRENT_DATA, $CURRENT_RPT) {
-        let me = this;
-        for (let i = 0; i < me.formulas.length; i++) {
-            if (me.formulas[i][JV.PROP_RUN_TYPE] === runType) {
-                let expression = me.formulas[i][JV.PROP_EXPRESSION];
+        let execFmlMe = this;
+        for (let execFmlIdx = 0; execFmlIdx < execFmlMe.formulas.length; execFmlIdx++) {
+            //remark: 搞这么复杂的变量名是为了防止与表达式起冲突(如循环变量i,j,k,容易造成变量冲突且不容易看出问题)
+            if (execFmlMe.formulas[execFmlIdx][JV.PROP_RUN_TYPE] === runType) {
+                let expression = execFmlMe.formulas[execFmlIdx][JV.PROP_EXPRESSION];
                 if (expression) {
-                    let $ME = me.formulas[i];
+                    let $ME = execFmlMe.formulas[execFmlIdx];
+                    // console.log("current expression idx: " + execFmlIdx);
                     // console.log(expression);
                     try {
                         eval(expression);

+ 4 - 2
modules/reports/util/rpt_excel_util.js

@@ -437,7 +437,8 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){
         for (let i = 0; i < stylesObj.fonts.length; i++) {
             let font = stylesObj.fonts[i];
             if (sheetFont) {
-                if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)
+                // if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)
+                if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.floor(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)
                     && font[JV.FONT_PROPS[3]] === sheetFont[JV.FONT_PROPS[3]] && font[JV.FONT_PROPS[5]] === sheetFont[JV.FONT_PROPS[5]]) {
                     hasFont = true;
                     rst = i;
@@ -450,7 +451,8 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){
         if (!hasFont) {
             let font = {};
             font[JV.FONT_PROPS[0]] = sheetFont[JV.FONT_PROPS[0]]; //font name
-            font.size = Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4);
+            // font.size = Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4);
+            font.size = Math.floor(sheetFont[JV.FONT_PROPS[1]] * 3 / 4);
             font.charset = 134;
             font.colorIdx = "8";
             font[JV.FONT_PROPS[3]] = sheetFont[JV.FONT_PROPS[3]]; //font bold

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

@@ -27,8 +27,9 @@ let fsUtil = require("../../../public/fsUtil");
 
 let demoPrjId = - 1;
 // let demoRptId = 279;
-let demoRptId = 275; //测试模板-流水式
+// let demoRptId = 275; //测试模板-流水式
 // let demoRptId = 337; //19表
+let demoRptId = 361; //封1
 let pagesize = "A4";
 //288: 11-2表(新)
 //279: 04
@@ -79,7 +80,7 @@ test('测试 - 测试模板啦: ', function (t) {
                     let maxPages = printCom.totalPages;
                     let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties);
                     if (pageRst) {
-                        // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult_测试模板.jsp");
+                        fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult_测试模板.jsp");
                     } else {
                         console.log("oh! no pages were created!");
                     }

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

@@ -63,7 +63,7 @@
                     <!--<a href="javascript:void(0)" class="btn btn-sm" title="复制" ><i class="fa fa-files-o" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)" class="btn btn-sm" title="剪切"><i class="fa fa-scissors" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)" class="btn btn-sm" title="粘贴"><i class="fa fa-clipboard" aria-hidden="true"></i></a>-->
-                 <!--   <a href="javascript:void(0)" class="btn btn-sm" id="insert" title="插入"><i class="fa fa-sign-in" aria-hidden="true"></i></a>-->
+                    <a href="javascript:void(0)" class="btn btn-sm" id="insertRation" title="插入定额"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)" class="btn btn-sm" id="delete" title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)" class="btn btn-sm" id="upLevel" title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
                     <a href="javascript:void(0)" class="btn btn-sm" id="downLevel" title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>

+ 28 - 0
web/building_saas/main/js/views/fee_rate_view.js

@@ -188,6 +188,33 @@ var feeRateObject={
         sheet.resumeEvent();
         sheet.resumePaint(false);
     },
+    locate: function(){   // CSL,2018.07.18
+        let sheet = feeRateObject.feeRateSpreads.getSheet(0);
+        let fID = calcProgramManage.getSelectionInfo().calcItem.feeRateID;
+        let rates = projectObj.project.FeeRate.getActivateFeeRate().rates;
+        let rowIdx = 0, pID = 0;
+
+        if (fID){
+            for (let i in rates) {
+                if (rates[i].ID == fID){
+                    rowIdx = parseFloat(i);
+                    pID = rates[i].ParentID;
+                    break;
+                };
+            }
+        };
+
+        for (let i in rates){
+            if (!rates[i].ParentID){
+                sheet.rowOutlines.setCollapsed(parseFloat(i), true);
+                if (rates[i].ID == pID)
+                    sheet.rowOutlines.setCollapsed(parseFloat(i), false);
+            };
+        };
+
+        sheet.setSelection(rowIdx, -1, 1, -1);
+        sheet.showRow(rowIdx, GC.Spread.Sheets.VerticalPosition.center);
+    },
     getTreeNodeCellType:function () {
         var ns = GC.Spread.Sheets;
         function TreeNodeCellType() {
@@ -1016,6 +1043,7 @@ $(function(){
         }
         feeRateObject.feeRateSelection=null;
         feeRateObject.showSelectTree(feeRateObject.feeRateSheet,feeRateObject.sheetSetting,projectObj.project.FeeRate.getActivateFeeRate().rates);
+        feeRateObject.locate();
     });
 
     $('#fee_rate_tree').on('hidden.bs.modal', function (e) {

+ 4 - 4
web/building_saas/main/js/views/glj_col.js

@@ -16,7 +16,7 @@ let gljCol = {
             {headerName: "定额价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right", decimalField: "glj.unitPrice"},
             {headerName: "调整价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right", decimalField: "glj.unitPrice"},
             {headerName: "市场价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right", decimalField: "glj.unitPrice"},
-            {headerName: "是否暂估", headerWidth: 65, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"
+            {headerName: "暂估", headerWidth: 65, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"
             }
         ],
         view: {
@@ -32,12 +32,12 @@ let gljCol = {
             {headerName: "规格型号", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String"},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
             {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
-            {headerName: "总消耗量", headerWidth: 130, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
+            {headerName: "总消耗量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
             {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
             {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
-            {headerName: "是否暂估", headerWidth: 60, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
-            {headerName: "主要材料", headerWidth: 60, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox'},
+            {headerName: "暂估", headerWidth: 60, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
+            {headerName: "主要\n材料", headerWidth: 60, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox'},
             {headerName: "供货方式", headerWidth: 80, dataCode: "supply", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:supplyComboMap},
             {headerName: "甲供数量", headerWidth: 100, dataCode: "supply_quantity", hAlign: "right", dataType: "Number",validator:"number",decimalField:'glj.quantity'},
             {headerName: "三材类别", headerWidth: 80, dataCode: "materialType", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:materialComboMap},

+ 18 - 18
web/building_saas/main/js/views/glj_view_contextMenu.js

@@ -11,35 +11,31 @@ var gljContextMenu = {
             selector: '#subSpread',
             build: this.onbuild,
             items: {
-                "delete_glj": {
-                    name: '删除人材机',
-                    icon: 'fa-remove',
+                "replace_glj": {
+                    name: '替换',
+                    icon: 'fa-sign-in',
                     disabled: function () {
                         var sheetData = gljOprObj.sheetData;
                         if(gljOprObj.isInstallationNode(projectObj.project.mainTree.selected)){
                             return true;
                         }
                         if(subSpread.getActiveSheetIndex()==0&&sheetData!=null&&sheetData.length>0&&gljContextMenu.selectedRow<sheetData.length){
-                            if( sheetData[gljContextMenu.selectedRow].isMixRatio==true){
+                            if(sheetData[gljContextMenu.selectedRow].isMixRatio==true){
                                 return true;
                             }
                             return false;
-                        }else {
-                            return true;
                         }
-
+                        return true;
                     },
                     callback: function () {
-                        var sheetData = gljOprObj.sheetData;
-                        var deleteRow = sheetData[gljContextMenu.selectedRow];
-                        projectObj.project.ration_glj.updataOrdelete(deleteRow);
+                        getGLJData('replace');
                     },
                     visible: function(key, opt){
                         return subSpread.getActiveSheet().name()=='ration_glj';
                     }
                 },
                 "add_glj": {
-                    name: '添加人材机',
+                    name: '添加',
                     icon: 'fa-sign-in',
                     disabled: function () {
                         var selected = projectObj.project.mainTree.selected;
@@ -65,31 +61,35 @@ var gljContextMenu = {
                         return subSpread.getActiveSheet().name()=='ration_glj';
                     }
                 },
-                "replace_glj": {
-                    name: '替换人材机',
-                    icon: 'fa-sign-in',
+                "delete_glj": {
+                    name: '删除',
+                    icon: 'fa-remove',
                     disabled: function () {
                         var sheetData = gljOprObj.sheetData;
                         if(gljOprObj.isInstallationNode(projectObj.project.mainTree.selected)){
                             return true;
                         }
                         if(subSpread.getActiveSheetIndex()==0&&sheetData!=null&&sheetData.length>0&&gljContextMenu.selectedRow<sheetData.length){
-                            if(sheetData[gljContextMenu.selectedRow].isMixRatio==true){
+                            if( sheetData[gljContextMenu.selectedRow].isMixRatio==true){
                                 return true;
                             }
                             return false;
+                        }else {
+                            return true;
                         }
-                        return true;
+
                     },
                     callback: function () {
-                        getGLJData('replace');
+                        var sheetData = gljOprObj.sheetData;
+                        var deleteRow = sheetData[gljContextMenu.selectedRow];
+                        projectObj.project.ration_glj.updataOrdelete(deleteRow);
                     },
                     visible: function(key, opt){
                         return subSpread.getActiveSheet().name()=='ration_glj';
                     }
                 },
                 "m_replace_glj": {
-                    name: '批量替换人材机',
+                    name: '批量替换',
                     icon: 'fa-sign-in',
                     disabled: function () {
                         let sheetData = gljOprObj.sheetData;

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

@@ -155,7 +155,8 @@ var projectObj = {
             }
             return false
         };
-        
+
+        setButtonValid(canInsertRationNode(selected), $('#insertRation'));
         setButtonValid(ifCanDelete(), $('#delete'));
         setButtonValid(canUpLevel(selected), $('#upLevel'));
         setButtonValid(canDownLevel(selected), $('#downLevel'));
@@ -423,7 +424,7 @@ var projectObj = {
         }  else if(calcTools.isGljRation(node)){
             gljOprObj.updateRationTypeGLJ(value,node,fieldName,editingText);
         } else if (value !== calcFees.getFee(node.data, fieldName)||fieldName == 'quantity') {//工程量需要进行转换,所以做特殊处理
-            if (fieldName === 'code' && !calcTools.isVolumePrice(node)) {
+            if (fieldName === 'code' && value != '' && !calcTools.isVolumePrice(node)) {
                 projectObj.updateCode(node, value);
             }
             else if(fieldName ==='feeRate'){
@@ -520,11 +521,14 @@ var projectObj = {
         let newV;
         if(node && node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
             && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== rationPrefix.none && fieldName === 'code'){
-            if(node.data.prefix === rationPrefix.complementary){
-                newV = orgV.replace(new RegExp('补'), '');
+/*            if(node.data.prefix === rationPrefix.complementary){
+                newV = orgV.replace(new RegExp(rationPrefix.complementary), '');
             }
             if(node.data.prefix === rationPrefix.borrow){
-                newV = orgV.replace(new RegExp('借'), '');
+                newV = orgV.replace(new RegExp(rationPrefix.borrow), '');
+            }*/
+            if(node.data.prefix){
+                newV = orgV.replace(new RegExp(node.data.prefix), '');
             }
             info.sheet.setValue(info.row, info.col, newV);
         }
@@ -541,6 +545,12 @@ var projectObj = {
         }
 
     },
+    onColumnWidthChanged: function (sender, info) {
+        projectObj.mainSpread.getActiveSheet().setColumnVisible(4, false);
+        projectObj.mainSpread.getActiveSheet().setColumnVisible(4, true);
+        projectObj.mainSpread.refresh();
+        projectObj.mainSpread.repaint();
+    },
     mainSpreadEditEnded: function (sender, info) {
         let project = projectObj.project;
         let node = project.mainTree.items[info.row];
@@ -577,7 +587,7 @@ var projectObj = {
                 let node = project.mainTree.items[changedCell.row];
                 let colSetting = setting.cols[changedCell.col];
                 let value = projectObj.checkSpreadEditingText(changedCell.text, colSetting)
-                if(colSetting.data.field=='code'&& node.sourceType == project.Ration.getSourceType()&&node.data.type==rationType.ration){//如果是更新定额的编码
+                if(colSetting.data.field=='code' && value != '' && node.sourceType == project.Ration.getSourceType()&&node.data.type==rationType.ration){//如果是更新定额的编码
                     updateRationCodes.push({'node':node,value:value});
                 }else {
                     projectObj.updateCellValue(node, value, colSetting,changedCell.text);
@@ -701,6 +711,7 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, that.msClipboardChanged);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, that.onButtonClick);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, that.onCellDoubleClick);
+                that.mainSpread.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, that.onColumnWidthChanged);
 
                 //let loadOtherStartTime = +new Date();
                 if(!projectReadOnly){
@@ -861,10 +872,7 @@ var projectObj = {
                     },
                     visible: function(key, opt){
                         var selected = project.mainTree.selected;
-                        if(selected){
-                          return canInsertRationNode(selected);
-                        }
-                       return false;
+                        return canInsertRationNode(selected);
                     }
                 },
                 "insertLJ": {
@@ -1994,14 +2002,33 @@ function ifCanDelete() {
 }
 
 function canInsertRationNode(selected) {//判断是否能插入定额、量价、定额类型工料机, false 不能,true能
+    if(!selected)
+        return false;
     let project = projectObj.project;
-    if(selected.sourceType == ModuleNames.bills&&selected.data.type == billType.DXFY){
+    if(selected.sourceType == ModuleNames.bills && selected.data.type == billType.DXFY){
         return false
     }else if(!(project.Bills.isMeasure(selected)||project.Bills.isFBFX(selected))){
         return false
-    }else {
+    }else if(selected.sourceType == ModuleNames.bills && selected.source.children.length > 0){
+        return false
+    }
+    else {
         return true
     }
+
+/*    if (selected) {// Vincent, 2018-01-02
+        if(selected.sourceType === project.Ration.getSourceType()){ // 焦点行是定额/量价/工料机,有效显示。
+            return false;
+        }else if(selected.sourceType === project.Bills.getSourceType()){
+            if(selected.data.type == billType.FX || selected.data.type == billType.BX){//焦点行是分项,有效显示。
+                return false
+            }
+            if(selected.data.type == billType.BILL && selected.source.children.length === 0){//焦点行是清单,且没有子项,有效显示。
+                return false
+            }
+        }
+    }
+    return true;*/
 }
 
 //导入类型(09表、广联达)

+ 3 - 3
web/building_saas/pm/html/project-management.html

@@ -326,11 +326,11 @@
                         <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="tender-engineering"><option value="">请选择工程专业</option></select>
                     </div>
                     <span class="form-text text-danger" id="engineering-info" style="display: none;">请选择工程专业</span>
-                    <div style="margin-top: 15px;" class="input-group">
+                    <div style="margin-top: 15px;" class="input-group" id="taxType_div">
                         <label style="margin-top: 8px;">计税方式</label>
                         <select style="margin-left: 5px; border-radius: .25rem;" class="form-control" id="taxType">
-                            <option value="1">一般计税</option>
-                            <option value="2">简易计税</option>
+                            <!--<option value="1">一般计税</option>
+                            <option value="2">简易计税</option>-->
                         </select>
                     </div>
                     <div style="margin-top: 15px;" class="input-group">

+ 42 - 15
web/building_saas/pm/js/pm_newMain.js

@@ -24,6 +24,10 @@ let fileType = {
     feeRateFile: 'FeeRateFile'
 };
 
+let taxTypeMap = {
+    1:"一般计税",
+    2:"简易计税"
+};
 
 const projTreeObj = {
     tree: null,
@@ -1087,7 +1091,7 @@ $(document).ready(function() {
     //选择计税方式
     $("#taxType").change(function () {
         $('#valuation-info').hide();
-        changeEngineering();
+        getStdCalcProgramFiles();
     });
 
 
@@ -1425,19 +1429,37 @@ $(document).ready(function() {
                 }
             }
 
-            if (Object.keys(currentLib).length <= 0) {
-                return false;
-            }
-            // 输出数据到页面
-            if (currentLib.fee_lib !== undefined && currentLib.fee_lib.length > 0) {
-                $("#tender-fee-rate").children("option").first().val("newFeeRate-"+currentLib.fee_lib[0].id);
+            if (Object.keys(currentLib).length > 0) {
+                // 输出数据到页面
+                if (currentLib.fee_lib !== undefined && currentLib.fee_lib.length > 0) {
+                    $("#tender-fee-rate").children("option").first().val("newFeeRate-"+currentLib.fee_lib[0].id);
+                }
+                $("#tender-engineering").parent().siblings('.hidden-area').slideDown('fast');
             }
-            $("#tender-engineering").parent().siblings('.hidden-area').slideDown('fast');
         }
+        setTaxGroupHtml();
         getStdCalcProgramFiles();
     }
 
 
+    function setTaxGroupHtml() {
+        let groups = getTaxGroupList();
+        let taxTypeArray = [];
+        let htmlString = "";
+        if(groups && groups.length > 0){
+            taxTypeArray = _.uniq(_.map(groups,'taxType'));
+        }
+        for(let t of taxTypeArray){
+             htmlString += "<option value='"+t+"'>"+taxTypeMap[t]+"</option>"
+        }
+        $('#taxType').html(htmlString);
+        if(taxTypeArray.length <2){
+            $('#taxType_div').hide();
+        }else {
+            $('#taxType_div').show();
+        }
+        console.log(taxTypeArray);
+    }
 
     function getStdCalcProgramFiles(){
         function getStdCPFilesHtml(taxGroups) {
@@ -1456,7 +1478,8 @@ $(document).ready(function() {
             };
             return result;
         };
-        let stdCPHtml = getStdCPFilesHtml(getTaxGroupList());
+        let taxType = $("#taxType").val();
+        let stdCPHtml = getStdCPFilesHtml(getTaxGroupList(taxType));
         $("#tender-calcProgram").html(stdCPHtml);
         if ($("#tender-calcProgram")[0].options.length > 1)
             $("#tender-calcProgram")[0].selectedIndex = 1;
@@ -1838,19 +1861,23 @@ function getEngineeringList(){
     return engineeringList;
 }
 
-function getTaxGroupList(){//getcalcProgramList
+
+
+function getTaxGroupList(type){//getcalcProgramList
     let egrs = getEngineeringList();
     let groupList = [];
     let egrID = $("#tender-engineering").val();
-    let taxType = $("#taxType").val();
     for(let egr of egrs) {
         if (egr.engineering_id == egrID && egr.lib) {
-            for(let group of egr.lib.tax_group){
-                if(group.taxType == taxType && group.program_lib){
-                    groupList.push(group);
+            if(type){//是否要过滤,如果这个参数不传,则返回整个数组;
+                for(let group of egr.lib.tax_group){
+                    if(group.taxType == type && group.program_lib){
+                        groupList.push(group);
+                    }
                 }
+            }else {
+                groupList = egr.lib.tax_group;
             }
-            break;
         }
     }
     return groupList;

+ 2 - 2
web/building_saas/report/html/rpt_main.html

@@ -43,13 +43,13 @@
                                 <div class="btn-group" role="group">
                                     <button id="btnRptOrientation" type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">纵向</button>
                                     <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
-                                        <a class="dropdown-item" id="hrefRptOrientation" onclick="zTreeOprObj.changeOrientation(this)">横向</a>
+                                        <a class="dropdown-item" id="hrefRptOrientation" style="cursor:pointer" onclick="zTreeOprObj.changeOrientation(this)">横向</a>
                                     </div>
                                 </div>
                                 <div class="btn-group" role="group">
                                     <button id="btnRptPageSize" type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">A4</button>
                                     <div class="dropdown-menu" aria-labelledby="btnGroupDrop2">
-                                        <a class="dropdown-item" id="hrefRptPageSize" onclick="zTreeOprObj.changePageSize(this)">A3</a>
+                                        <a class="dropdown-item" id="hrefRptPageSize" style="cursor:pointer" onclick="zTreeOprObj.changePageSize(this)">A3</a>
                                     </div>
                                 </div>
                             </div>

+ 52 - 65
web/building_saas/report/html/rpt_print.html

@@ -38,83 +38,70 @@
 <script type="text/javascript" src="/web/building_saas/report/js/rpt_print.js"></script>
 <SCRIPT type="text/javascript">
     function loading() {
-        if (sessionStorage.currentPageData) {
-            let pageData = JSON.parse(sessionStorage.currentPageData);
+        if (sessionStorage.multiRptsData) {
+            let multiRptData = JSON.parse(sessionStorage.multiRptsData);
             let scaleFactor = parseInt(sessionStorage.scaleFactor);
-            $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
-            let orgHeight = 793, orgWidth = 1122;
-            let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
-            if (sessionStorage.pageSize === 'A3') {
-                pageHeight = orgWidth * scaleFactor;
-                pageWidth = orgHeight * 2 * scaleFactor;
-                orgHeight = 1122;
-                orgWidth = 793 * 2;
-            } else if (sessionStorage.pageSize === '自定义') {
-                //自定义
-            }
-            if (sessionStorage.orientation === "纵向") {
-                let tmpInt = pageHeight;
-                pageHeight = pageWidth;
-                pageWidth = tmpInt;
-
-                tmpInt = orgWidth;
-                orgWidth = orgHeight;
-                orgHeight = tmpInt;
+            let svgArr = [];
+            for (let idx = 0; idx < multiRptData.length; idx++) {
+                let pageData = multiRptData[idx];
+                if (idx === 0) {
+                    $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
+                }
+                svgArr = svgArr.concat(rptPrintHelper.buildSvgArr(pageData, -30, -30));
             }
-
+            showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
+            window.print();
+        } else if (sessionStorage.currentPageData) {
+            let pageData = JSON.parse(sessionStorage.currentPageData);
+            let scaleFactor = parseInt(sessionStorage.scaleFactor);
             let svgArr = rptPrintHelper.buildSvgArr(pageData, -30, -30);
-            for (let i = 0; i < pageData.items.length; i++) {
-                let div = $('<div class="pageBreak"></div>');
-                div.append($(svgArr[i].join("")));
-                $("body").append(div);
-            }
-            $(document.body).find("div").each(function(index,element){
-                $(element).find("svg").each(function(cIdx,elementSvg){
-                    elementSvg.setAttribute('height', pageHeight);
-                    elementSvg.setAttribute('width', pageWidth);
-                });
-            });
+            $(document).attr("title", pageData[JV.NODE_PAGE_INFO][JV.NODE_MAIN_INFO_RPT_NAME]);
+            showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
             window.print();
-        } if (sessionStorage.currentPageSvgData) {
+        } else if (sessionStorage.currentPageSvgData) {
             let svgArr = JSON.parse(sessionStorage.currentPageSvgData);
             let scaleFactor = 1;
-            let orgHeight = 793, orgWidth = 1122;
-            let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
-            if (sessionStorage.pageSize === 'A3') {
-                pageHeight = orgWidth * scaleFactor;
-                pageWidth = orgHeight * 2 * scaleFactor;
-                orgHeight = 1122;
-                orgWidth = 793 * 2;
-            } else if (sessionStorage.pageSize === '自定义') {
-                //自定义
-            }
-            if (sessionStorage.orientation === "纵向") {
-                let tmpInt = pageHeight;
-                pageHeight = pageWidth;
-                pageWidth = tmpInt;
-
-                tmpInt = orgWidth;
-                orgWidth = orgHeight;
-                orgHeight = tmpInt;
-            }
-
-            for (let i = 0; i < svgArr.length; i++) {
-                let div = $('<div class="pageBreak"></div>');
-                div.append($(svgArr[i].join("")));
-                $("body").append(div);
-            }
-            $(document.body).find("div").each(function(index,element){
-                $(element).find("svg").each(function(cIdx,elementSvg){
-                    elementSvg.setAttribute('height', pageHeight);
-                    elementSvg.setAttribute('width', pageWidth);
-                });
-            });
+            showPreviewData(svgArr, scaleFactor, sessionStorage.pageSize, sessionStorage.orientation);
             window.print();
         } else {
             //alert("没有报表数据!");
         }
     }
 
+    function showPreviewData(svgArr, scaleFactor, pageSize, orientation) {
+        let orgHeight = 793, orgWidth = 1122;
+        let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
+        if (pageSize === 'A3') {
+            pageHeight = orgWidth * scaleFactor;
+            pageWidth = orgHeight * 2 * scaleFactor;
+            orgHeight = 1122;
+            orgWidth = 793 * 2;
+        } else if (pageSize === '自定义') {
+            //自定义
+        }
+        if (orientation === "纵向") {
+            let tmpInt = pageHeight;
+            pageHeight = pageWidth;
+            pageWidth = tmpInt;
+
+            tmpInt = orgWidth;
+            orgWidth = orgHeight;
+            orgHeight = tmpInt;
+        }
+
+        for (let i = 0; i < svgArr.length; i++) {
+            let div = $('<div class="pageBreak"></div>');
+            div.append($(svgArr[i].join("")));
+            $("body").append(div);
+        }
+        $(document.body).find("div").each(function(index,element){
+            $(element).find("svg").each(function(cIdx,elementSvg){
+                elementSvg.setAttribute('height', pageHeight);
+                elementSvg.setAttribute('width', pageWidth);
+            });
+        });
+    }
+
     function closing() {
         //
     }

+ 37 - 7
web/building_saas/report/js/rpt_print.js

@@ -4,15 +4,45 @@
 
 let rptPrintHelper = {
     preview: function () {
-        if (zTreeOprObj.currentRptPageRst) {
-            sessionStorage.currentPageData = JSON.stringify(zTreeOprObj.currentRptPageRst);
-            sessionStorage.pageSize = rptControlObj.getCurrentPageSize();
-            sessionStorage.orientation = rptControlObj.getCurrentOrientation();
-            sessionStorage.scaleFactor = 1;
-            window.open('/rpt_print');
+        if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
+            let rptIds = [];
+            let params = {};
+            params.custCfg = zTreeOprObj.reportPageCfg;
+            params.prj_id = projectInfoObj.projectInfo.ID;
+            for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
+                rptIds.push(tplNode.refId);
+            }
+            params.rpt_ids = rptIds.join(",");
+            CommonAjax.postEx("report_api/getMultiReports", params, 10000, true,
+                function(result){
+                    //sessionStorage.currentPageData = JSON.stringify(zTreeOprObj.currentRptPageRst);
+                    sessionStorage.multiRptsData = JSON.stringify(result);
+                    sessionStorage.pageSize = rptControlObj.getCurrentPageSize();
+                    sessionStorage.orientation = rptControlObj.getCurrentOrientation();
+                    sessionStorage.scaleFactor = 1;
+                    window.open('/rpt_print');
+                },
+                function(failRst){
+                    sessionStorage.currentPageData = null;
+                    console.log(failRst);
+                },
+                function(exceptionRst){
+                    sessionStorage.currentPageData = null;
+                    console.log(exceptionRst);
+                }
+            );
         } else {
-            sessionStorage.currentPageData = null;
+            //不可能的branch
         }
+        // if (zTreeOprObj.currentRptPageRst) {
+        //     sessionStorage.currentPageData = JSON.stringify(zTreeOprObj.currentRptPageRst);
+        //     sessionStorage.pageSize = rptControlObj.getCurrentPageSize();
+        //     sessionStorage.orientation = rptControlObj.getCurrentOrientation();
+        //     sessionStorage.scaleFactor = 1;
+        //     window.open('/rpt_print');
+        // } else {
+        //     sessionStorage.currentPageData = null;
+        // }
     },
     previewSvgData: function() {
         //