소스 검색

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost into 1.0.0_online

zhangweicheng 7 년 전
부모
커밋
c9cb248cf8

+ 6 - 1
modules/reports/controllers/rpt_controller.js

@@ -255,7 +255,12 @@ function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, custo
                         printCom.initialize(rptTpl);
                         printCom.analyzeData(rptTpl, tplData, defProperties, dftOption, outputType);
                         let maxPages = printCom.totalPages;
-                        let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
+                        let pageRst = null;
+                        if (maxPages > 0) {
+                            pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
+                        } else {
+                            pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
+                        }
                         if (pageRst) {
                             // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
                             cb(null, pageRst);

+ 39 - 1
public/web/treeDataHelper.js

@@ -18,7 +18,7 @@ let tree_Data_Helper = {
             return tmpNodeRst;
         };
         let private_buildNodeData = function(parentItem, idArr, treeLevel, tbID) {
-            let iter = [], nextNode = private_getStartNode(idArr);
+            let iter = [], nextNode = private_getStartNode(idArr), pushedIds = [];
             while (nextNode !== null && nextNode !== undefined ) {
                 if (parentItem) {
                     parentItem[CHILDREN_NODE].push(nextNode);
@@ -26,6 +26,7 @@ let tree_Data_Helper = {
                     rst.push(nextNode);
                 }
                 iter.push(nextNode);
+                pushedIds.push(nextNode[NODE_ID]);
                 nextNode[TOP_BILL_ID] = tbID;
                 if (parentItem === null) {
                     nextNode[TOP_BILL_ID] = nextNode[NODE_ID];
@@ -40,7 +41,44 @@ let tree_Data_Helper = {
                 }
                 if (addLevel) nextNode[TREE_LEVEL] = treeLevel;
                 nextNode = tmpNodes[prefix + nextNode[NEXT_ID]];
+                if (nextNode === null || nextNode === undefined) {
+                    //备注: 考虑到实际数据的健壮性,有些节点会掉链子,需要用 parentItem[SUB_ID] 比对已经加上的节点,如发现加上的节点数量不够,那就得在这里补充上去
+                    if (parentItem) {
+                        if (parentItem[SUB_ID].length > iter.length) {
+                            for (let subId of parentItem[SUB_ID]) {
+                                if (pushedIds.indexOf(subId) < 0) {
+                                    let restNode = tmpNodes[prefix + subId];
+                                    if (addLevel) restNode[TREE_LEVEL] = treeLevel;
+                                    restNode[TOP_BILL_ID] = tbID;
+                                    parentItem[CHILDREN_NODE].push(restNode);
+                                    iter.push(restNode);
+                                }
+                            }
+                        }
+                    } else {
+                        if (idArr.length > iter.length) {
+                            for (let topId of idArr) {
+                                if (pushedIds.indexOf(topId) < 0) {
+                                    let restNode = tmpNodes[prefix + topId];
+                                    if (addLevel) restNode[TREE_LEVEL] = treeLevel;
+                                    restNode[TOP_BILL_ID] = restNode[NODE_ID];
+                                    if (restNode.flags && restNode.flags.length > 0) {
+                                        for (let flag of restNode.flags) {
+                                            if (flag.fieldName === "fixed") {
+                                                restNode[TOP_BILL_ID] = flag.flag;
+                                                break;
+                                            }
+                                        }
+                                    }
+                                    rst.push(restNode);
+                                    iter.push(restNode);
+                                }
+                            }
+                        }
+                    }
+                }
             }
+            pushedIds = [];
             for (let i = 0; i < iter.length; i++) {
                 let rtbID = tbID;
                 if (parentItem === null) {

+ 2 - 2
test/unit/reports/test_tpl_09.js

@@ -25,10 +25,10 @@ cfgCacheUtil.setupDftCache();
 let fsUtil = require("../../../public/fsUtil");
 
 let demoPrjId = - 1;
-let demoRptId = 232, pagesize = "A4";
+let demoRptId = 444, pagesize = "A4";
 
 // demoPrjId = 720; //QA: DW3
-demoPrjId = 2260; //QA:
+demoPrjId = 4563; //QA:
 //*/
 // let userId_Leng = "59cdf14a0034a1000ba52b97"; //小冷User Id 换成_id了
 let userId_Leng = "5acac1e885bf55000bd055ba";

+ 2 - 2
web/building_saas/glj/html/project_glj.html

@@ -29,8 +29,8 @@
                 <li class="nav-item"><a class="nav-link" href="javascript:void(0)" id="ZYCL">主要材料</a></li>
             </ul>
         </div>
-        <div class="main-content col p-0" id="project-glj-main">
-            <div class="top-content" id="projectGljTop">
+        <div class="main-content col p-0" id="project-glj-main" style="overflow: hidden;">
+            <div class="top-content" id="projectGljTop" style="overflow: hidden">
                 <div class="main-data-top" style="width: 100% " id="project_glj_sheet">
                 </div>
             </div>

+ 7 - 3
web/building_saas/main/html/main.html

@@ -152,7 +152,7 @@
                               <a class="nav-link px-3 right-nav-link"  href="javascript:void(0)" id = 'locateTab' relaPanel="#locate">查找定位</a>
                           </li>-->
                           <li class="nav-item">
-                              <a class="nav-link px-1 right-nav-link" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">清单规则</a>
+                              <a class="nav-link px-1 right-nav-link" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">标准清单</a>
                           </li>
                          <!-- <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsTab' relaPanel="#qd">清单规则</a>
@@ -440,12 +440,16 @@
                                       <div class="container-fluid" id="qdjl" role="tabpanel">
                                           <div class="row p-0" style="background: #efefef">
                                               <div class="col-6 p-0">
+                                                  <div id="qdjlTools" style="width: calc(100% - 5px); border-bottom: solid 1px lightgrey">
+                                                      <a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary px-1 m-1">应用选项</a>
+                                                      <a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary px-1">应用单条</a>
+                                                  </div>
                                                   <div class="main-data-bottom ovf-hidden" id="elfItems">
                                                   </div>
                                               </div>
                                               <div class="col-6 p-1">
-                                                  <p class="mt-3"><a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary">应用选项</a></p>
-                                                  <p><a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary">应用单条</a></p>
+                                                  <!--<p class="mt-3"><a id="elfInsertRation" href="javascript:void(0);" class="btn btn-sm btn-primary">应用选项</a></p>
+                                                  <p><a id="elfInsertSingle" href="javascript:void(0)" class="btn btn-sm btn-primary">应用单条</a></p>-->
                                               </div>
                                           </div>
                                       </div>

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

@@ -64,7 +64,7 @@ function getMainResizeEles() {
         min: 180,
         max: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-180-5`,
         notTopSpread: 0,
-        notBottomSpread: $('#bottom_div ul').height(),
+        notBottomSpread: $('#bottom_div ul').height() + $('#qdjlTools').height(),
         totalHeight: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-5`
     };
     return mainResizeEles;

+ 29 - 18
web/building_saas/pm/js/pm_newMain.js

@@ -3810,14 +3810,13 @@ $('#share-confirm').click(function(){
         $('#shareToInfo').height(tbodyTotalHeight);
         $('#shareToInfo').append($tr);
         //更新缓存
-       // if (shareSeleted.data.shareInfo.length === 0) {
-            shareSeleted.data.shareInfo = shareSeleted.data.shareInfo.concat(shareData);
-            let sheet = projTreeObj.workBook.getSheet(0);
-            projTreeObj.renderSheetFuc(sheet, function () {
-                sheet.invalidateLayout();
-                sheet.repaint();
-            });
-       // }
+        shareSeleted.data.shareInfo = shareSeleted.data.shareInfo.concat(shareData);
+        let sheet = projTreeObj.workBook.getSheet(0);
+        projTreeObj.renderSheetFuc(sheet, function () {
+            sheet.invalidateLayout();
+            sheet.repaint();
+        });
+        bindCancelShareCheck(shareSeleted);
         $.bootstrapLoading.end();
         $('#shareFindDiv').hide();
         $('#share-confirm').addClass('disabled');
@@ -3826,16 +3825,6 @@ $('#share-confirm').click(function(){
         $('#share-confirm').removeClass('disabled');
     });
 });
-//允许拷贝
-/*$('#allowCopy').change(function () {
-    let checked = $(this).prop('checked');
-    if(checked){
-        $('#allowCopyHint').show();
-    }
-    else{
-        $('#allowCopyHint').hide();
-    }
-});*/
 
 //批量替换文件,切换建设项目
 $('#otherProject').change(function(){
@@ -3916,6 +3905,28 @@ function setShareToModal(selected){
         $('#shareToInfo').height(tbodyTotalHeight);
         let infoHtml = infoArr.join('');
         $('#shareToInfo').html(infoHtml);
+        bindCancelShareCheck(selected);
+    });
+}
+//取消分享的勾选操作
+//@param {Object}selected(选中项目节点) @return {void}
+function bindCancelShareCheck(selected) {
+    $('#shareToInfo input[value="cancelShare"]').unbind('click');
+    $('#shareToInfo input[value="cancelShare"]').click(function () {
+        let index = $(this).parent().parent().index() - 1,
+            $coo = $(this).parent().prev().children(),
+            $copy = $(this).parent().prev().prev().children();
+        let isCancel = $(this).prop('checked');
+        if (isCancel) {//取消分享,取消拷贝、协作勾选
+            $coo.prop('checked', false);
+            $copy.prop('checked', false);
+        } else {//取消取消分享,恢复原本的拷贝、协作勾选状态
+            let shareData = selected.data.shareInfo[index];
+            if (shareData) {
+                $coo.prop('checked', shareData.allowCooperate);
+                $copy.prop('checked', shareData.allowCopy);
+            }
+        }
     });
 }
 //更新项目分享信息

+ 4 - 1
web/building_saas/report/js/jpc_output.js

@@ -376,7 +376,10 @@ let JpcCanvasOutput = {
         ctx.fillRect(10 + me.offsetX,size[1] + me.offsetY,size[0],10);
     },
     getReportSizeInPixel: function(rptTpl, resolution) {
-        let rst = rptTpl[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE].slice(0);
+        let rst = [8.27, 11.69];
+        if (rptTpl && rptTpl[JV.NODE_PAGE_INFO] && rptTpl[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE]) {
+            rst = rptTpl[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE].slice(0);
+        }
         rst[0] = Math.round(resolution[0] * rst[0]);
         rst[1] = Math.round(resolution[0] * rst[1]);
         return rst;

+ 7 - 3
web/building_saas/report/js/rpt_main.js

@@ -258,10 +258,11 @@ let zTreeOprObj = {
         hintBox.waitBox();
         CommonAjax.postEx("report_api/getReport", params, 15000, true,
             function(result){
+                hintBox.unWaitBox();
                 let pageRst = result;
-                if (pageRst) {
+                let canvas = document.getElementById("rptCanvas");
+                if (pageRst && pageRst.items && pageRst.items.length > 0) {
                     me.resetAfter(pageRst);
-                    let canvas = document.getElementById("rptCanvas");
                     me.currentRptPageRst = pageRst;
                     me.maxPages = pageRst.items.length;
                     me.currentPage = 1;
@@ -274,7 +275,10 @@ let zTreeOprObj = {
                         canvas.height = size[1] + 50;
                     }
                     me.showPage(1, canvas);
-                    hintBox.unWaitBox();
+                } else {
+                    //返回了无数据表
+                    JpcCanvasOutput.cleanCanvas(canvas);
+                    JpcCanvasOutput.drawPageBorder(me.currentRptPageRst, canvas, getScreenDPI());
                 }
             }, function(err){
                 hintBox.unWaitBox();