浏览代码

报表模板节点结构变更

TonyKang 7 年之前
父节点
当前提交
3a98bb0e0c

+ 1 - 1
modules/all_models/tpl_tree_node.js

@@ -29,7 +29,7 @@ let TplNodeSchema = new Schema({
 
 let RptTplTreeSchema = new Schema({
     compilationId: String,  //编办的ObjectId
-    engineerId: Number,     //工程专业Id(参考 /modules/common/const/engineering.js)
+    // engineerId: Number,     //工程专业Id(参考 /modules/common/const/engineering.js)
     userId: String,        //用户名的object_id串
     properties: [],         //这是一个预留的属性,假定未来还会有不同的划分细节(如:招标/投标/清单 ... etc)
     name: String,           //显示名称

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

@@ -225,7 +225,7 @@ function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, custo
                     let printCom = JpcEx.createNew();
                     if (pageSize) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
                     //console.log("orientation: " + (orientation === 'null'));
-                    if (orientation !== 'null') rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = orientation;
+                    if (orientation !== null && orientation !== 'null') rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = orientation;
                     let defProperties = rptUtil.getReportDefaultCache();
                     if (customizeCfg) setupCustomizeCfg(customizeCfg, rptTpl, defProperties);
                     let dftOption = option||JV.PAGING_OPTION_NORMAL;

+ 7 - 6
modules/reports/controllers/rpt_tpl_controller.js

@@ -107,8 +107,7 @@ let mExport = {
         let params = JSON.parse(req.body.params),
             compilationId = params.compilationId,
             userId = params.userId,
-            sessionUserId = null,
-            engineerId = params.engineerId;
+            sessionUserId = null;
         let userIds = ["-100"];
         if (req.session.sessionUser && req.session.sessionUser.id) sessionUserId = req.session.sessionUser.id;
         if (userId !== null) {
@@ -125,7 +124,7 @@ let mExport = {
         if (!compilationId) {
             compilationId = req.session.sessionCompilation._id;
         }
-        rttFacade.findTplTree(compilationId, engineerId, userIds).then(function(result) {
+        rttFacade.findTplTree(compilationId, userIds).then(function(result) {
             if (result) {
                 callback(req,res,false,"", result);
             } else {
@@ -199,6 +198,7 @@ let mExport = {
         })
     },
     updateTopNodeName: function (req, res) {
+        //备注:因设计的更改,此方法将被放弃
         let params = JSON.parse(req.body.params),
             compilationId = params.compilationId, engineerId = params.engineerId,
             userId = params.userId,
@@ -219,12 +219,13 @@ let mExport = {
     },
     updateSubLevelOneNode: function (req, res) {
         let params = JSON.parse(req.body.params),
-            compilationId = params.compilationId, engineerId = params.engineerId,
+            compilationId = params.compilationId,
+            // engineerId = params.engineerId,
             userId = params.userId,
             subNode = params.subNode
         ;
-        if (req.session.sessionUser && req.session.sessionUser.id) userId = req.session.sessionUser.id;
-        let filter = {"compilationId": compilationId, "engineerId": engineerId, "userId": userId, "items.ID": subNode.ID, "$or": [{"isDeleted": null}, {"isDeleted": false}]};
+        if (req.session.sessionUser && req.session.sessionUser.id) userId = req.session.sessionUser.id; //备注:这段逻辑只会在前端有效,后端运维不会走到
+        let filter = {"compilationId": compilationId, "userId": userId, "items.ID": subNode.ID, "$or": [{"isDeleted": null}, {"isDeleted": false}]};
         let updateStatement = {$set: {"items.$": subNode}};
         rttFacade.updateTreeInDetail(filter, updateStatement).then(function (rst) {
             if (rst) {

+ 3 - 6
modules/reports/facade/rpt_tpl_tree_node_facade.js

@@ -11,7 +11,7 @@ const SYSTEM_USER_ID = -100;
 function validate(doc) {
     let rst = true;
     if (doc) {
-        if (!(doc.hasOwnProperty("compilationId") && doc.hasOwnProperty("engineerId") && doc.hasOwnProperty("userId"))) {
+        if (!(doc.hasOwnProperty("compilationId") && doc.hasOwnProperty("userId"))) {
             rst = false;
         }
     } else {
@@ -47,12 +47,9 @@ async function removeTreePhycically(compilationId, engineerId, userId) {
     return await rpt_tpl_tree_mdl.remove(filter);
 }
 
-async function findTplTree(compilationId, engineerIds, userIds) {
+async function findTplTree(compilationId, userIds) {
     //let filter = {"compilationId": compilationId, "engineerId": engineerIds, "userId": userIds};
-    let filter = {"compilationId": compilationId, "engineerId": engineerIds, "userId": userIds, "$or": [{"isDeleted": null}, {"isDeleted": false}]};
-    if (engineerIds instanceof Array) {
-        filter.engineerId = {$in: engineerIds};
-    }
+    let filter = {"compilationId": compilationId, "userId": userIds, "$or": [{"isDeleted": null}, {"isDeleted": false}]};
     if (userIds instanceof Array) {
         filter.userId = {$in: userIds};
     }

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

@@ -29,7 +29,8 @@ let demoPrjId = - 1;
 // let demoRptId = 279;
 // let demoRptId = 275; //测试模板-流水式
 // let demoRptId = 337; //19表
-let demoRptId = 361; //封1
+// let demoRptId = 361; //封1
+let demoRptId = 279; //表04
 let pagesize = "A4";
 //288: 11-2表(新)
 //279: 04
@@ -80,7 +81,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 - 0
web/building_saas/report/js/rpt_main.js

@@ -364,6 +364,7 @@ let rptControlObj = {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
             let urls = [];
             let orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
+            if (zTreeOprObj.checkedRptTplNodes.length > 1) orientation = null;
             for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
                 let orgRptName = tplNode.name;
                 let url =  "/report_api/getExcel/" + projectInfoObj.projectInfo.ID + "/" + tplNode.refId + "/" +

+ 3 - 0
web/building_saas/report/js/rpt_print.js

@@ -145,6 +145,7 @@ function buildText(destRst, cell, font, control, offsetX, offsetY, adjustY, canv
     let orgFontHeight = parseInt(font[JV.FONT_PROPS[JV.FONT_PROP_IDX_HEIGHT]]);
     let fontWeight = (font[JV.FONT_PROPS[JV.FONT_PROP_IDX_BOLD]] === 'T')?"bold":"normal";
     let fontStyle = (font[JV.FONT_PROPS[JV.FONT_PROP_IDX_ITALIC]] === 'T')?"italic":"normal";
+    let fontUnderline = (font[JV.FONT_PROPS[JV.FONT_PROP_IDX_UNDERLINE]] === 'T')?"underline":"normal";
     let left = parseInt(cell[JV.PROP_AREA][JV.PROP_LEFT]) + offsetX + 0.5,
         right = parseInt(cell[JV.PROP_AREA][JV.PROP_RIGHT]) + offsetX + 0.5,
         top = parseInt(cell[JV.PROP_AREA][JV.PROP_TOP]) + offsetY + adjustY,
@@ -204,6 +205,8 @@ function buildText(destRst, cell, font, control, offsetX, offsetY, adjustY, canv
         destRst.push("<text style='fill:black;font-family:" + font[JV.PROP_NAME] +
             ";font-weight:" + fontWeight +
             ";font-style:" + fontStyle +
+            ";text-decoration:" + fontUnderline +
+            // ";text-decoration:normal" +
             ";font-size:" + dftFontHeight + "pt' x='" +
             x +"' y='" + y + "' text-anchor='" + text_anchor + "' xml:space='preserve'>" + values[vidx] + "</text>");
     }