浏览代码

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

chenshilong 7 年之前
父节点
当前提交
49bf35c54a

+ 11 - 3
modules/reports/rpt_component/jpc_flow_tab.js

@@ -51,7 +51,8 @@ JpcFlowTabSrv.prototype.createNew = function(){
         let private_inner_add_grp_rec = function(vi) {
             let hasFullGrp = true, couldBreak = false;
             for (let i = 0; i < grp_lines; i++) {
-                if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
+                // if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
+                if ( (vIdx.length + i ) >= maxRecPerPage) {
                     for (let j = i; j < grp_lines; j++) {
                         grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO].push(j);
                     }
@@ -105,7 +106,12 @@ JpcFlowTabSrv.prototype.createNew = function(){
                     if (private_inner_add_grp_rec(vi)) break;
                     if (couldBreak) break;
                 } else {
-                    if (private_normal_add_rec(vi)) break;
+                    //备注: 在有group的情况下,如果grpPageInfo[JV.PROP_SEG_GRP_IDX] 范围大于 grpSequenceInfo.length,则表示已经到最后了,不要再加空白数据了
+                    if (grpPageInfo[JV.PROP_SEG_GRP_IDX] < grpSequenceInfo.length) {
+                        if (private_normal_add_rec(vi)) break;
+                    } else {
+                        break;
+                    }
                 }
             } else {
                 if (private_normal_add_rec(vi)) break;
@@ -428,7 +434,9 @@ JpcFlowTabSrv.prototype.createNew = function(){
                         private_chk_handle_rec_amt(dv, false);
                     }
                     //再处理下半部分
-                    private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec - mixSplitPoint, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
+                    let restRecAmt = maxRowRec - me.dispValueIdxLst[me.dispValueIdxLst.length - 1].length; //备注:在一些极端条件下,mixSplitPoint这个分割点不合适处理下半部分数据,以实际生成的value-index数量为准
+                    // private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec - mixSplitPoint, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
+                    private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, restRecAmt, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
                     for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                         private_chk_handle_rec_amt(dv, true);
                     }

+ 10 - 7
test/unit/reports/test_cover_01.js

@@ -25,11 +25,13 @@ cfgCacheUtil.setupDftCache();
 let fsUtil = require("../../../public/fsUtil");
 
 let demoPrjId = - 1;
-let demoRptId = 223, pagesize = "A4";
+// let demoRptId = 223, pagesize = "A4";
+let demoRptId = 261, pagesize = "A4";
 
-demoPrjId = 1220; //QA:
+// demoPrjId = 1220; //QA:
+demoPrjId = 2260;
 //*
-let userId_Leng = "59cdf14a0034a1000ba52b97"; //小冷User Id 换成_id了
+let userId_Leng = "5acac1e885bf55000bd055ba"; //小冷User Id 换成_id了
 let userId_Dft = userId_Leng;
 /*/
  let userId_Dft = "595328da1934dc327cad08eb";
@@ -47,7 +49,7 @@ fs.readFile(__dirname.slice(0, __dirname.length - 18) + '/public/web/date_util.j
 });
 
 //*
-test('测试 - 打开模板: 封-1 ', function (t) {
+test('测试 - 打开模板: 封-3 ', function (t) {
     rptTplFacade.getRptTemplate(demoRptId).then(function(rptTpl) {
         let rptDataUtil = new rptDataExtractor();
         rptDataUtil.initialize(rptTpl._doc);
@@ -57,8 +59,9 @@ test('测试 - 打开模板: 封-1 ', function (t) {
         rptTplDataFacade.prepareProjectData(userId_Dft, demoPrjId, filter, function (err, msg, rawDataObj) {
             if (!err) {
                 try {
-                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.jsp");
+                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject_建筑封-3表.jsp");
                     let tplData = rptDataUtil.assembleData(rawDataObj);
+                    // fsUtil.writeObjToFile(tplData, "D:/GitHome/ConstructionCost/tmp/rptTplAssembledData_建筑封-3表.jsp");
                     //build the report
                     let printCom = JpcEx.createNew();
                     rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pagesize;
@@ -69,7 +72,7 @@ test('测试 - 打开模板: 封-1 ', function (t) {
                     let maxPages = printCom.totalPages;
                     let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties);
                     if (pageRst) {
-                        // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
+                        fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult_建筑封-3.jsp");
                     } else {
                         console.log("oh! no pages were created!");
                     }
@@ -96,7 +99,7 @@ test('close the connection', function (t) {
         mongoose.disconnect();
         t.pass('closing db connection');
         t.end();
-    }, 8000);
+    }, 1000);
     // mongoose.disconnect();
     // t.pass('closing db connection');
     // t.end();

+ 8 - 0
web/building_saas/complementary_ration_lib/html/anzhuang.html

@@ -13,6 +13,14 @@
     <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
     <link rel="stylesheet" href="/lib/jquery-contextmenu/jquery.contextMenu.css">
     <!--endinject-->
+    <style type="text/css">
+        .nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active{
+            border: 2px solid #ff6501;
+            color: #495057;
+            background-color: #fff;
+            border-bottom: 1px solid #fff;
+        }
+    </style>
 </head>
 
 <body>

+ 8 - 0
web/building_saas/complementary_ration_lib/html/dinge.html

@@ -13,6 +13,14 @@
     <link rel="stylesheet" href="/lib/jquery-contextmenu/jquery.contextMenu.css" type="text/css">
     <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.sc.css" type="text/css">
     <!--endinject-->
+    <style type="text/css">
+        .nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active{
+            border: 2px solid #ff6501;
+            color: #495057;
+            background-color: #fff;
+            border-bottom: 1px solid #fff;
+        }
+    </style>
 </head>
 <body>
 <div class="header">

+ 8 - 0
web/building_saas/complementary_ration_lib/html/fuzhu.html

@@ -12,6 +12,14 @@
     <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
     <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.sc.css" type="text/css">
     <!--endinject-->
+    <style type="text/css">
+        .nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active{
+            border: 2px solid #ff6501;
+            color: #495057;
+            background-color: #fff;
+            border-bottom: 1px solid #fff;
+        }
+    </style>
 </head>
 
 <body>

+ 6 - 0
web/building_saas/complementary_ration_lib/html/gongliao.html

@@ -16,6 +16,12 @@
     <!--endinject-->
     <style type="text/css">
         .ztree li span.button.add{margin-right:2px;background-position:-144px 0;vertical-align:top;*vertical-align:middle}
+        .nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active{
+            border: 2px solid #ff6501;
+            color: #495057;
+            background-color: #fff;
+            border-bottom: 1px solid #fff;
+        }
     </style>
 </head>
 

+ 16 - 11
web/building_saas/complementary_ration_lib/js/coe.js

@@ -20,17 +20,22 @@ var pageObj = {
             $(this).attr('href', "/complementaryRation/installation" + "?repository=" + getQueryString("repository"))
         });
         var libID = getQueryString("repository");
-        var libName = storageUtil.getSessionCache("RationGrp","repositoryID_" + libID);
-        if (libName) {
-            let $rationName = $(`<div id='rationname' class='navbar-text'>${libName}</div>`);
-            $('.header-logo').after($rationName);
-        };
-        this.gljLibID = storageUtil.getSessionCache("gljLib", "repositoryID_" + libID);
-        this.libID = libID;
-        coeOprObj.buildSheet($('#mainSpread')[0]);
-        gljAdjOprObj.buildSheet($('#contentSpread')[0]);
-        coeOprObj.getCoeList();
-        gljAdjOprObj.getGljItemsOcc();
+        let me = this;
+        CommonAjax.post('/complementaryRation/api/getRationLibs', {ids: [libID]}, function (rstData) {
+            if(rstData.length > 0){
+                let libName = rstData[0].dispName;
+                if (libName) {
+                    let $rationName = $(`<div id='rationname' class='navbar-text'>${libName}</div>`);
+                    $('.header-logo').after($rationName);
+                };
+                me.gljLibID = rstData[0].gljLib;
+                me.libID = libID;
+                coeOprObj.buildSheet($('#mainSpread')[0]);
+                gljAdjOprObj.buildSheet($('#contentSpread')[0]);
+                coeOprObj.getCoeList();
+                gljAdjOprObj.getGljItemsOcc();
+            }
+        });
 
     },
     showData: function(sheet, setting, data) {

+ 19 - 15
web/building_saas/complementary_ration_lib/js/installation.js

@@ -56,22 +56,26 @@ let feeItemObj = {
             this.setOptions(this.workBook, this.setting.options);
             this.bindEvents(this.sheet);
             this.rationRepId = parseInt(getQueryString("repository"));
-            let libName = storageUtil.getSessionCache("RationGrp","repositoryID_" + this.rationRepId);
-            if (libName) {
-                let $rationName = $(`<div id='rationname' class='navbar-text'>${libName}</div>`);
-                $('.header-logo').after($rationName);
-            }
-            //init sectionSpread
-            se.buildSheet();
-            //init feeRuleSpread
-            fr.buildSheet();
-            //init installation
-            this.getInstallation(this.rationRepId, function (rstData) {
-                me.cache = rstData;
-                sheetCommonObj.showData(me.sheet, me.setting, me.cache);
-                me.initSelection(me.cache[0]);
+            CommonAjax.post('/complementaryRation/api/getRationLibs', {ids: [this.rationRepId]}, function (rstData) {
+                if(rstData.length > 0){
+                    let libName = rstData[0].dispName;
+                    if (libName) {
+                        let $rationName = $(`<div id='rationname' class='navbar-text'>${libName}</div>`);
+                        $('.header-logo').after($rationName);
+                    }
+                    //init sectionSpread
+                    se.buildSheet();
+                    //init feeRuleSpread
+                    fr.buildSheet();
+                    //init installation
+                    me.getInstallation(me.rationRepId, function (rstData) {
+                        me.cache = rstData;
+                        sheetCommonObj.showData(me.sheet, me.setting, me.cache);
+                        me.initSelection(me.cache[0]);
+                    });
+                    //init batchSectionSpread
+                }
             });
-            //init batchSectionSpread
         }
     },
     bindEvents: function (sheet) {

+ 0 - 2
web/building_saas/complementary_ration_lib/js/main.js

@@ -7,9 +7,7 @@ let compleRationMain = {
         let scFunc = function (rstData) {
             $("#comple_ration_table").empty();
             for(let i = 0; i < rstData.length; i++){
-                storageUtil.setSessionCache("RationGrp","repositoryID_" + rstData[i].ID, rstData[i].dispName);
                 if(rstData[i].gljLib !== undefined && rstData[i].gljLib && rstData[i].gljLib != -1){
-                    storageUtil.setSessionCache("gljLib","repositoryID_" + rstData[i].ID, rstData[i].gljLib);
                     let id = rstData[i].ID;
                     let libName = rstData[i].dispName;
                     $("#comple_ration_table").append(

+ 22 - 20
web/building_saas/complementary_ration_lib/js/repository_glj.js

@@ -18,27 +18,29 @@ var pageOprObj = {
     rationLibName : null,
     rationLibId: null,
     initPage : function(container) {
-        var me = this, rationLibId = getQueryString("repository"),//获取定额库参数
-            rationLibName = storageUtil.getSessionCache("RationGrp","repositoryID_" + rationLibId);
+        var me = this, rationLibId = getQueryString("repository");//获取定额库参数
         me.rationLibId = rationLibId;
-        if (rationLibName) {
-            me.rationLibName = rationLibName;
-            let $rationName = $(`<div id='rationname' class='navbar-text'>${me.rationLibName}</div>`);
-            $('.header-logo').after($rationName);
-            repositoryGljObj.buildSheet(container);
-            //repositoryGljObj.getRationGljIds(rationLibId);
-            repositoryGljObj.getGljDistType(function () {
-                repositoryGljObj.currentRepositoryId = parseInt(rationLibId);
-                //引用的工料机库
-                let gljLibID = storageUtil.getSessionCache("gljLib", "repositoryID_" + rationLibId);
-                if(gljLibID && typeof gljLibID !== 'undefined'){
-                    repositoryGljObj.getGljTree(gljLibID, function () {
-                        repositoryGljObj.getGljItems(gljLibID);
-                    });
-                }
-                sheetCommonObj.shieldAllCells(repositoryGljObj.workBook.getSheet(0), repositoryGljObj.setting);
-            });
-        }
+        //getRationLibName
+        CommonAjax.post('/complementaryRation/api/getRationLibs', {ids: [rationLibId]}, function (rstData) {
+            if(rstData.length > 0){
+                me.rationLibName = rstData[0].dispName;
+                let $rationName = $(`<div id='rationname' class='navbar-text'>${me.rationLibName}</div>`);
+                $('.header-logo').after($rationName);
+                repositoryGljObj.buildSheet(container);
+                repositoryGljObj.getGljDistType(function () {
+                    repositoryGljObj.currentRepositoryId = parseInt(rationLibId);
+                    //引用的工料机库
+                    let gljLibID = rstData[0].gljLib;
+                    if(gljLibID && typeof gljLibID !== 'undefined'){
+                        repositoryGljObj.getGljTree(gljLibID, function () {
+                            repositoryGljObj.getGljItems(gljLibID);
+                        });
+                    }
+                    sheetCommonObj.shieldAllCells(repositoryGljObj.workBook.getSheet(0), repositoryGljObj.setting);
+                });
+            }
+        });
+
     }
 }
 repositoryGljObj = {

+ 1 - 0
web/building_saas/js/global.js

@@ -13,6 +13,7 @@ function autoFlashHeight(){
     //$(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
     $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-$('#stdSectionRations').height()-5);
     $('.main-content').width($(window).width()-$('.main-nav').width()-$('.main-side').width()-5);
+    $('#glj_tree_div .modal-content').width($(window).width() < 1020 + 20 ? $(window).width() - 20 : 1020);
     //$("#main .main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
     $("#billsSpread").height($(window).height()-headerHeight-toolsbarHeight-mainBottomContentHeight-1);
     $("#project_glj_sheet").height($(window).height()-headerHeight-toolsbarHeight-gljBottomContentHeight-25);

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

@@ -634,7 +634,7 @@
     <!--工料机选择窗口-->
     <div class="modal fade" id="glj_tree_div" data-backdrop="static">
         <div class="modal-dialog modal-lg" role="document" id="modalCon">
-            <div class="modal-content" style="width: 1020px;">
+            <div class="modal-content" style="width: 1020px; left:50%; transform: translate(-50%,0%);">
                 <div class="modal-header">
                     <h5 class="modal-title">请选择工料机</h5>
                     <button type="button" class="close" data-dismiss="modal" aria-label="Close">

+ 3 - 0
web/building_saas/main/js/views/glj_view_contextMenu.js

@@ -347,6 +347,9 @@ function getGLJData(actionType) {
         $.bootstrapLoading.end();
         console.log(+new Date());
         $("#glj_tree_div").modal({show:true});
+        setTimeout(function(){
+            gljOprObj.gljLibSpresd.refresh();
+        }, 200);
     })
 }
 

+ 11 - 7
web/building_saas/main/js/views/project_view.js

@@ -21,6 +21,7 @@ var projectObj = {
     },
     treeSelectedChanged: function (node) {
         let project = projectObj.project;
+        let mainSheet = projectObj.mainController.sheet;
         //设置选中行底色和恢复前选中行底色
         let refreshNodes = [node];
         if(!project.mainTree.preSelected){
@@ -478,16 +479,21 @@ var projectObj = {
     mainSpreadLeaveCell: function (sender, info) {
         let colSetting = projectObj.mainController.setting.cols[info.col];
         projectObj.lastCol = colSetting;
+        projectObj.lastCell = {row: info.row, col: info.col};
     },
     //repaint 动态下拉框
     mainSpreadEnterCell: function (sender, info) {
         let colSetting = projectObj.mainController.setting.cols[info.col];
         if(colSetting.data.field === 'unit' || (projectObj.lastCol&&projectObj.lastCol.data.field === 'unit')||colSetting.data.field ==='subType'
             || (projectObj.lastCol&&projectObj.lastCol.data.field === 'subType') || colSetting.data.field === 'programID' ||(projectObj.lastCol&&projectObj.lastCol.data.field === 'programID')){
-            /*let hideRowFilter =new GC.Spread.Sheets.Filter.HideRowFilter(info.sheet.getRange(-1, info.col, -1, 1));
-            info.sheet.rowFilter(hideRowFilter);
-            info.sheet.resumePaint();*/
-            info.sheet.repaint();
+            let rects = [];
+            rects.push(info.sheet.getCellRect(info.row, info.col));
+            if(projectObj.lastCell){
+                rects.push(info.sheet.getCellRect(projectObj.lastCell.row, projectObj.lastCell.col));
+            }
+            for(let rect of rects){
+                info.sheet.repaint(rect);
+            }
         }
     },
     mainSpreadEditStarting: function (sender, info) {
@@ -672,7 +678,6 @@ var projectObj = {
                 console.log(`时间——${endTime - startTime}`);
                 that.project.projectMarkChecking();//是否需要重新进行造价计算
                 installationFeeObj.engineeringTypeChecking();//检查是否安装工程
-                //初始需要触发一次点击表格事件,sheet.getAutoFitWidth值(获取单元格文本长度)才正确
                 autoFlashHeight();
                 projectObj.refreshMainSpread();
                 $.bootstrapLoading.end();
@@ -1246,13 +1251,12 @@ var projectObj = {
         TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
             for(let node of nodes){
                 if(node && node.serialNo()!= -1){
-                    //console.log(me.getNodeColorStyle(sheet, node).backColor);
                     sheet.getRange(node.serialNo(), -1, 1, -1).backColor(me.getNodeColorStyle(sheet, node).backColor);
                     //sheet.setStyle(node.serialNo(), -1, me.getNodeColorStyle(sheet, node));
                 }
             }
         });
-     
+
     },
     loadLockBillsButton:function () {
         if(projectInfoObj.projectInfo.property.lockBills == true){