Просмотр исходного кода

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

chenshilong 4 лет назад
Родитель
Сommit
ec4767ac80

+ 10 - 1
modules/main/facade/project_facade.js

@@ -172,8 +172,17 @@ async function updateNodes(datas) {
     } else {
       task.updateOne = {
         filter: {},
-        update: _.cloneDeep(node.data)
+        update: {}//_.cloneDeep(node.data)
       };
+      for(let key in node.data){
+        if(key.indexOf('function(') !== -1) {//有时候会出现field里包含一串 function(e){if(e.length>0)... 这些东西,本地测试又不出现,所以这里先把这些field删除看看
+          delete node.data[key];
+        }else{
+          task.updateOne.update[key] = node.data[key];
+        }
+      }
+
+
       task.updateOne.filter[idFiled] = node.data[idFiled]; //现在复制项目也重新生成一个新的ID了,所以ID是唯一的
       delete task.updateOne.update[idFiled]; //防止误操作
     }

+ 15 - 0
modules/reports/routes/rpt_tpl_router_fe.js

@@ -7,6 +7,21 @@ let rptTplRouter = express.Router();
 const reportTplController = require("./../controllers/rpt_tpl_controller");
 
 module.exports = function (app) {
+    app.get('/printReport/:size',  function(req, res) {
+        if (!req.session.sessionUser.id) {
+            res.redirect('/login');
+        }
+        else {
+            let size = req.params.size;
+            res.render('building_saas//report/html/rpt_print.html',
+                {
+                    userAccount: req.session.userAccount,
+                    userID: req.session.sessionUser.id,
+                    size: size
+                }
+            );
+        }
+    });
     app.get('/rpt_print',  function(req, res) {
         if (!req.session.sessionUser.id) {
             res.redirect('/login');

+ 8 - 7
public/web/rpt_value_define.js

@@ -279,11 +279,12 @@ const JV = {
     ORIENTATION_LANDSCAPE: "LANDSCAPE",
     ORIENTATION_PORTRAIT_CHN: "纵向",
     ORIENTATION_LANDSCAPE_CHN: "横向",
-    SIZE_A3: [11.69, 16.54],
-    SIZE_A4: [8.27, 11.69],
-    SIZE_A5: [5.83, 8.27],
+    SIZE_A3: [11.693, 16.535],
+    SIZE_A4: [8.268, 11.693],
+    SIZE_A5: [5.827, 8.268],
+    SIZE_B4: [9.84, 13.898],
     SIZE_B5: [6.93, 9.84],
-    SIZE_LETTER: [8.5, 11.0],
+    SIZE_LETTER: [8.5, 11.0], // 美、加等国的A4规格
     SIZE_LEGAL: [8.5, 14.0],
     SIZE_16K: [7.75, 10.75],
     SIZE_EXECUTIVE: [7.25, 10.5],
@@ -315,9 +316,9 @@ const JV = {
     PAGE_SELF_DEFINE: "自定义",
     PAGE_SPECIAL_MERGE_POS: "page_merge_pos",
 
-    PAGES_SIZE_STR: ["A3", "A4", "A5", "B5", "LETTER", "LEGAL", "EXECUTIVE", "16K"],
-    PAGES_SIZE_IDX: [8, 9, 11, 13, 1, 5, 7, 93],
-    PAGES_SIZE: [[11.69, 16.54], [8.27, 11.69], [5.83, 8.27], [6.93, 9.84], [8.5, 11.0], [8.5, 14.0], [7.25, 10.5], [7.25, 10.5]],
+    PAGES_SIZE_STR: ['A3', 'A4', 'A5', 'B4', 'B5', 'LETTER', 'LEGAL', 'EXECUTIVE', '16K'],
+    PAGES_SIZE_IDX: [8, 9, 11, 12, 13, 1, 5, 7, 93],
+    PAGES_SIZE: [[11.693, 16.535], [8.268, 11.693], [5.827, 8.268], [9.84, 13.898], [6.93, 9.84], [8.5, 11.0], [8.5, 14.0], [7.25, 10.5], [7.25, 10.5]],
 
     HUNDRED_PERCENT : 100.0,
 

+ 1 - 0
public/web/tree_sheet/tree_sheet_helper.js

@@ -185,6 +185,7 @@ var TREE_SHEET_HELPER = {
                 }
                 if(colSetting.visible == false) return;//隐藏列不做其它操作
                 if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
+                    if(colSetting.data.field=="quantity") sheet.setFormatter(iRow, iCol, '@');//输入 % 号时会出现奇怪的现像, %一直追加在后面
                     cell.value(colSetting.data.getText(node));
                 } else if(['outPutMaxPrice', 'outPutLimitPrice'].includes(colSetting.data.field) && node.sourceType === projectObj.project.Bills.getSourceType()){//主要清单有三种状态,所以直接显示就好,不走最后的逻辑
                     cell.value(node.data[colSetting.data.field]===undefined?false:node.data[colSetting.data.field]);

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

@@ -58,7 +58,7 @@ ProjectGLJ.prototype.loadData = function (callback = null,error=null) {
 
 //更新项目工料机数据和缓存
 ProjectGLJ.prototype.refreshByDatas = function(datas){
-    this.datas = datas;
+    this.loadToCache(datas);
     this.calcQuantity();
 };
 

+ 6 - 4
web/building_saas/main/js/views/project_view.js

@@ -1112,6 +1112,8 @@ var projectObj = {
                         //将焦点行设置成原本的行,以插入定额
                         me.mainController.setTreeSelected(me.project.mainTree.items[orgRow]);
                     }
+                    /* 
+                    2021-04-26 只插入清单不插入定额  
                     //插入定额
                     me.project.Ration.addNewRation(null, rationType.ration, function () {
                         newRow = sheet.getActiveRowIndex();
@@ -1121,7 +1123,7 @@ var projectObj = {
                             newCol = codeCol;
                         }
                         sheet.setActiveCell(newRow, newCol);
-                    },true,null,false);
+                    },true,null,false); */
                 }
             }
             //在定额/量价/人材机的编码单元格回车,焦点应跳动至本行的工程量单元格
@@ -1139,7 +1141,7 @@ var projectObj = {
                 //如果其后有定额/量价/人材机(空行:编码为空不算),焦点应跳动至下一行定额/量价/人材机的工程量,不需处理
 
                 //如果其后没有定额/量价/人材机(空行也没有),则自动在其后插入一行定额空行,焦点跳动至定额空行的编码单元格
-                if(!nextSibling){
+              /*   if(!nextSibling){
                     let codeCol = colSettingObj.getColByField('code');
                     let codeVisible = colSettingObj.getVisible('code');
                     me.project.Ration.addNewRation(null, rationType.ration, function () {
@@ -1149,9 +1151,9 @@ var projectObj = {
                         }
                         sheet.setActiveCell(newRow, newCol);
                     }, true,null,false);
-                }
+                } */
                 //如果其后有定额空行,焦点跳动至定额空行的编码单元格
-                else if(nextSibling && !(isDef(nextSibling.data.code) && nextSibling.data.code.toString().trim() !== '')) {
+                if(nextSibling && !(isDef(nextSibling.data.code) && nextSibling.data.code.toString().trim() !== '')) {
                     let codeCol = colSettingObj.getColByField('code');
                     let codeVisible = colSettingObj.getVisible('code');
                     if(codeCol !== null && codeVisible !== false){

+ 57 - 9
web/building_saas/report/html/rpt_print.html

@@ -13,13 +13,37 @@
         page-break-before: auto;
         page-break-after: auto;
     }
-    @page {
-        size: A4 portrait;
-        margin-top: 0cm;
-        margin-bottom: 0cm;
-        margin-left: 0mm;
-        margin-right: 0mm
-    }
+    <% if(size === 'A4') { %>
+        @page {
+            size: A4 portrait;
+            margin-top: 0cm; margin-bottom: 0cm; margin-left: 0mm; margin-right: 0mm
+        }
+    <% } else if(size === 'A3') { %>
+        @page {
+            size: A3 portrait;
+            margin-top: 0cm; margin-bottom: 0cm; margin-left: 0mm; margin-right: 0mm
+        }
+    <% } else if(size === 'B4') { %>
+        @page {
+            size: B4 portrait;
+            margin-top: 0cm; margin-bottom: 0cm; margin-left: 0mm; margin-right: 0mm
+        }
+    <% } else if(size === 'B5') { %>
+        @page {
+            size: B5 portrait;
+            margin-top: 0cm; margin-bottom: 0cm; margin-left: 0mm; margin-right: 0mm
+        }
+    <% } else if(size === 'LETTER') { %>
+        @page {
+            size: LETTER portrait;
+            margin-top: 0cm; margin-bottom: 0cm; margin-left: 0mm; margin-right: 0mm
+        }
+    <% } else { %>
+        @page {
+            size: A4 portrait;
+            margin-top: 0cm; margin-bottom: 0cm; margin-left: 0mm; margin-right: 0mm
+        }
+    <% } %>
     @media print {
         body {
             margin-top: 0mm;
@@ -32,6 +56,13 @@
     div {page: page}
 </style>
 <!--
+    @page {
+        size: A4 portrait;
+        margin-top: 0cm;
+        margin-bottom: 0cm;
+        margin-left: 0mm;
+        margin-right: 0mm
+    }
     .printPage {
         page: page
     }
@@ -48,9 +79,26 @@
 <script type="text/javascript" src="/web/building_saas/report/js/jpc_output.js"></script>
 <script type="text/javascript" src="/web/building_saas/report/js/rpt_print.js"></script>
 <script type="text/javascript" src="/web/building_saas/report/js/rpt_preview_common.js"></script>
+<SCRIPT type="text/javascript">
+    const SCREEN_DPI = [];
+    function getScreenDPI() {
+        if (SCREEN_DPI.length === 0) {
+            if (window.screen.deviceXDPI != undefined) {
+                SCREEN_DPI.push(window.screen.deviceXDPI);
+                SCREEN_DPI.push(window.screen.deviceYDPI);
+            } else {
+                let tmpNode = document.createElement("DIV");
+                tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
+                document.body.appendChild(tmpNode);
+                SCREEN_DPI.push(parseInt(tmpNode.offsetWidth));
+                SCREEN_DPI.push(parseInt(tmpNode.offsetHeight));
+                tmpNode.parentNode.removeChild(tmpNode);
+            }
+        }
+        return SCREEN_DPI;
+    }
+</SCRIPT>
 <body onload="loading()" onbeforeunload="closing()">
     <canvas id="chkCanvas" style="display:none"></canvas>
 </body>
-<SCRIPT type="text/javascript">
-</SCRIPT>
 </html>

+ 0 - 26
web/building_saas/report/html/rpt_printA3.html

@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh-CN">
-<head>
-    <meta charset="UTF-8">
-    <title></title>
-</head>
-<style type="text/css">
-    .pageBreak {
-        page-break-before: auto;
-        page-break-after: auto;
-    }
-    @page {size: A3 portrait;}
-    body {page: page}
-    div {page: page}
-</style>
-<script type="text/javascript" src="/web/building_saas/report/js/jpc_output_value_define.js"></script>
-<script src="/lib/jquery/jquery-3.2.1.min.js"></script>
-<script type="text/javascript" src="/web/building_saas/report/js/jpc_output.js"></script>
-<script type="text/javascript" src="/web/building_saas/report/js/rpt_print.js"></script>
-<script type="text/javascript" src="/web/building_saas/report/js/rpt_preview_common.js"></script>
-<body onload="loading()" onbeforeunload="closing()">
-<canvas id="chkCanvas" style="display:none"></canvas>
-</body>
-<SCRIPT type="text/javascript">
-</SCRIPT>
-</html>

+ 6 - 4
web/building_saas/report/js/rpt_main.js

@@ -1031,10 +1031,9 @@ let rptControlObj = {
         rptTplObj.pdfFont['SmartSimsun'].push(fontProperty);
         if (rptTplObj.pdfFont['SmartSimsun'].length === 2) {
             me._hidePdfIniPage();
-            setTimeout(function(){
+            setTimeout(function() {
                 me.getPDFEx();
-            }, 20);
-            // me.getPDFEx();
+            }, 200); // 200毫秒足够关闭PDF初始化page了,另:不能直接把me.getPDFEx()作为函数放进来,否则容易冲突
         }
     },
     getPDFPre: function () {
@@ -1044,7 +1043,6 @@ let rptControlObj = {
             return;
         }
         if (rptTplObj.pdfFont['SmartSimsun'].length === 2) {
-            $.bootstrapLoading.start();
             me.getPDFEx();
         } else {
             // dynamicLoadJs('/lib/jspdf/SmartSimsun-normal.js', 'normal', me.getPdfFontCallback);
@@ -1071,6 +1069,7 @@ let rptControlObj = {
                 params.rpt_names = rpt_names;
                 params.isOneSheet = true;
                 params.rptName = projectObj.project.projectInfo.name;
+                $.bootstrapLoading.start();
                 CommonAjax.postEx("report_api/getMultiReports", params, WAIT_TIME_EXPORT, true,
                     function(result){
                         $.bootstrapLoading.end();
@@ -1114,6 +1113,7 @@ let rptControlObj = {
                     params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
                     params.custCfg = zTreeOprObj.reportPageCfg;
                     params.option = "normal";
+                    $.bootstrapLoading.start();
                     CommonAjax.postEx("report_api/getMultiReports", params, WAIT_TIME_EXPORT, true,
                         function(result){
                             $.bootstrapLoading.end();
@@ -1147,6 +1147,8 @@ let rptControlObj = {
                     }
                 }
             }
+        } else {
+            $.bootstrapLoading.end();
         }
     },
     firstPage: function(dom) {

+ 14 - 0
web/building_saas/report/js/rpt_preview_common.js

@@ -44,6 +44,19 @@ function loading() {
 function showPreviewData(svgArr, actAreaArr, scaleFactor, pageSize, orientation, orgPixelSize) {
     let orgHeight = 793, orgWidth = 1122;
     let DFT_MARGIN = 2;
+    getScreenDPI();
+    //*
+    const pi = JV.PAGES_SIZE_STR.indexOf(pageSize);
+    if (pi >= 0) {
+        const sizeArr = JV.PAGES_SIZE[pi];
+        orgHeight = Math.round(sizeArr[0] * SCREEN_DPI[0]);
+        orgWidth = Math.round(sizeArr[1] * SCREEN_DPI[1]);
+    } else if (pageSize.indexOf('自定义') >= 0) {
+        //自定义
+    } else {
+        //其他未定义size(urgly size)
+    }
+    /*/
     if (pageSize === 'A3') {
         orgHeight = 1122;
         orgWidth = 793 * 2;
@@ -52,6 +65,7 @@ function showPreviewData(svgArr, actAreaArr, scaleFactor, pageSize, orientation,
     } else {
         //其他size(LEGAL, 16K etc.)
     }
+    //*/
     let pageHeight = orgHeight * scaleFactor, pageWidth = orgWidth * scaleFactor;
     if (orientation === "纵向") {
         pageHeight = orgWidth * scaleFactor;

+ 6 - 5
web/building_saas/report/js/rpt_print.js

@@ -22,11 +22,12 @@ let rptPrintHelper = {
                     sessionStorage.pageSize = rptControlObj.getCurrentPageSize();
                     sessionStorage.orientation = rptControlObj.getCurrentOrientation();
                     sessionStorage.scaleFactor = 1;
-                    if (sessionStorage.pageSize === 'A3') {
-                        window.open('/rpt_printA3');
-                    } else {
-                        window.open('/rpt_print');
-                    }
+                    // if (sessionStorage.pageSize === 'A3') {
+                    //     window.open('/rpt_printA3');
+                    // } else {
+                    //     window.open('/rpt_print');
+                    // }
+                    window.open('/printReport/' + sessionStorage.pageSize);
                 },
                 function(failRst){
                     sessionStorage.currentPageData = null;

+ 3 - 3
web/building_saas/standard_interface/export/guangdong_zhongshan.js

@@ -923,12 +923,12 @@ INTERFACE_EXPORT = (() => {
           },
           {
             name: "Price",
-            value: b.tenderPrice,
+            value: b.marketPrice || '0',
             type: TYPE.DECIMAL
           },
           {
             name: "LimitedPrice",
-            value: b.tenderPrice,
+            value: b.marketPrice || '0',
             type: TYPE.DECIMAL
           },
           {
@@ -1119,7 +1119,7 @@ INTERFACE_EXPORT = (() => {
             },
             {
               name: "ChapterKind",
-              value: level,
+              value: level > 3 ? 3 : level,
             },
             {
               name: "CostKind",

+ 2 - 1
web/building_saas/standard_interface/import/guangdong_zhongshan.js

@@ -159,7 +159,8 @@ INTERFACE_IMPORT = (() => {
 
     function setUpBidEvaluation(b) { 
       return {
-        code: b._Code,
+        seq: b._Code,
+        code: b._Number,
         name: b._Name,
         specs: b.Specification,
         unit: b._Unit,

+ 28 - 1
web/over_write/js/guangxi_2021.js

@@ -305,7 +305,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
       },
       // 招标费 算法:按“指标建筑安装工程费”为基数,以累进办法计算。
       ZBF(tender) {
-          const baseFee = this['ZBJZAZGCF'](tender);
+          const baseFee = this['DEJZAZGCF'](tender);
           if (!tender) {
               calcBase.baseProgressiveFee = baseFee;
           }
@@ -413,6 +413,33 @@ function overwriteRationCalcBases() {
     };
 };
 
+if (typeof projectObj !== 'undefined') {
+    projectObj.isInsertEquipmentVisable = function (selected) {
+        return true;   //广西不管是预算或者工程量清单,都是显示   
+    }
+  }
+  
+
+if (typeof feeRateObject !== 'undefined') {
+    feeRateObject.feeRateSpecialHandle = function (subRate, value) {
+        let result = {};
+        if (subRate.name == "工地转移(km)" && value && value < 50) {//工地转移50km以内按50km算
+            result.valueKey = "50";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        if (subRate.name == "综合里程(km)" && value && value < 3) {//综合里程3km以内按3km算
+            result.valueKey = "3";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        if (subRate.name == "施工进出场(km)" && value && value < 5) {//施工进出场5km以内按3km算
+            result.valueKey = "5";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        return result;
+    }
+}
+
+
 (function overwriteFeeTypes() {
     if (typeof cpFeeTypes == 'undefined') return;
     cpFeeTypes = [

+ 21 - 0
web/over_write/js/guangxiyusuan_2021.js

@@ -230,6 +230,27 @@ function overwriteRationCalcBases() {
     };
 };
 
+if (typeof projectObj !== 'undefined') {
+    projectObj.isInsertEquipmentVisable = function (selected) {
+        return true;   //广西不管是预算或者工程量清单,都是显示   
+    }
+  }
+
+if (typeof feeRateObject !== 'undefined') {
+    feeRateObject.feeRateSpecialHandle = function (subRate, value) {
+        let result = {};
+        if (subRate.name == "工地转移(km)" && value && value < 50) {//工地转移50km以内按50km算
+            result.valueKey = "50";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        if (subRate.name == "综合里程(km)" && value && value < 5) {//综合里程5km以内按5km算
+            result.valueKey = "5";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        return result;
+    }
+}
+
 (function overwriteFeeTypes() {
     if (typeof cpFeeTypes == 'undefined') return;
     cpFeeTypes = [

+ 1 - 1
web/over_write/js/quanguo_2018.js

@@ -473,7 +473,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
 
 if (typeof projectObj !== 'undefined') {
   projectObj.isInsertEquipmentVisable = function (selected) {
-      return true;   //全国不管是预算或者工程量清单,都是隐藏   
+      return true;   //全国不管是预算或者工程量清单,都是显示   
   }
 }