Browse Source

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

chenshilong 7 years ago
parent
commit
c4f4349f6e

+ 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!");
                     }

+ 31 - 12
web/building_saas/complementary_ration_lib/js/installation.js

@@ -13,9 +13,9 @@ let feeItemObj = {
     currentFeeItem: null,
     setting: {
         header:[
-            {headerName:"费用项",headerWidth:120,dataCode:"feeItem", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
-            {headerName:"费用类型",headerWidth:260,dataCode:"feeType", dataType: "String", hAlign: "center", vAlign: "center"},
-            {headerName:"记取位置",headerWidth:260,dataCode:"position", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"}
+            {headerName:"费用项",headerWidth:200,dataCode:"feeItem", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
+            {headerName:"费用类型",headerWidth:80,dataCode:"feeType", dataType: "String", hAlign: "center", vAlign: "center"},
+            {headerName:"记取位置",headerWidth:100,dataCode:"position", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"}
         ],
         view: {lockColumns: []},
         options: {
@@ -215,13 +215,13 @@ let feeRuleObj = {
     cache: [],
     setting: {
         header:[
-            {headerName:"编码",headerWidth:120,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
-            {headerName:"费用规则",headerWidth:240,dataCode:"rule", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
-            {headerName:"基数",headerWidth:120,dataCode:"base", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
-            {headerName:"费率(%)",headerWidth:120,dataCode:"feeRate", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"},
-            {headerName:"其中人工(%)",headerWidth:120,dataCode:"labour", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"},
-            {headerName:"其中材料(%)",headerWidth:120,dataCode:"material", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"},
-            {headerName:"其中机械(%)",headerWidth:120,dataCode:"machine", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center"}
+            {headerName:"编码",headerWidth:80,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center", span:{row: 0, rowCount: 2, colCount: 1}},
+            {headerName:"费用规则",headerWidth:280,dataCode:"rule", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center", span:{row: 0, rowCount: 2, colCount: 1}},
+            {headerName:"基数",headerWidth:140,dataCode:"base", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center", span:{row: 0, rowCount: 2, colCount: 1}},
+            {headerName:"费率(%)",headerWidth:70,dataCode:"feeRate", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center", span:{row: 0, rowCount: 2, colCount: 1}},
+            {headerName:"人工(%)",headerWidth:70,dataCode:"labour", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center", span:{row: 1, rowCount: 1, colCount: 1}},
+            {headerName:"材料(%)",headerWidth:70,dataCode:"material", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center", span:{row: 1, rowCount: 1, colCount: 1}},
+            {headerName:"机械(%)",headerWidth:70,dataCode:"machine", dataType: "String", formatter: "@", hAlign: "center", vAlign: "center", span:{row: 1, rowCount: 1, colCount: 1}}
         ],
         view: {lockColumns: []},
         options: {
@@ -242,12 +242,31 @@ let feeRuleObj = {
             workbook.options[opt] = opts[opt];
         }
     },
+    buildHeader: function () {
+        if(!this.sheet){
+            return;
+        }
+        this.sheet.suspendPaint();
+        this.sheet.suspendEvent();
+        let ch = GC.Spread.Sheets.SheetArea.colHeader;
+        this.sheet.setRowCount(2, ch);
+        for(let i = 0; i < this.setting.header.length; i++){
+            let header = this.setting.header[i];
+            this.sheet.addSpan(header.span.row, i, header.span.rowCount, header.span.colCount, ch);
+            this.sheet.setValue(header.span.row, i, header.headerName, ch);
+            if(header.dataCode === 'feeRate'){
+                this.sheet.addSpan(header.span.row, i + 1, 1, 3, ch);
+                this.sheet.setValue(header.span.row, i + 1, '其中', ch);
+            }
+        }
+        this.sheet.resumePaint();
+        this.sheet.resumeEvent();
+    },
     buildSheet: function () {
         if(!this.isDef(this.workBook)){
             this.workBook = sheetCommonObj.buildSheet($('#instFeeRuleSpread')[0], this.setting, 10);
-            console.log(`this.workBook`);
-            console.log(this.workBook);
             this.sheet = this.workBook.getActiveSheet();
+            this.buildHeader();
             this.setOptions(this.workBook, this.setting.options);
             this.bindEvents(this.sheet);
         }

+ 6 - 6
web/building_saas/complementary_ration_lib/js/repository_glj.js

@@ -42,12 +42,12 @@ repositoryGljObj = {
     distTypeTree: null,//add
     setting: {
         header:[
-            {headerName:"编码",headerWidth:120,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
-            {headerName:"名称",headerWidth:260,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
-            {headerName:"规格型号",headerWidth:260,dataCode:"specs", dataType: "String", hAlign: "left", vAlign: "center"},
-            {headerName:"单位",headerWidth:120,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
-            {headerName:"定额价",headerWidth:120,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
-            {headerName:"类型",headerWidth:120,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"}
+            {headerName:"编码",headerWidth:90,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
+            {headerName:"名称",headerWidth:200,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
+            {headerName:"规格型号",headerWidth:110,dataCode:"specs", dataType: "String", hAlign: "left", vAlign: "center"},
+            {headerName:"单位",headerWidth:60,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
+            {headerName:"定额价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
+            {headerName:"类型",headerWidth:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"}
         ],
         view:{
             comboBox:[

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

@@ -664,7 +664,7 @@ var Ration = {
             }
 
             if(node.data.quantityEXP=="GCLMXHJ"){//如果定额工程量是来自工程量明细
-                hintBox.infoBox('操作确认', '已有工程量明细,是否清空明细表,采用手工输入的表达式?', 2, function () {
+                hintBox.infoBox('操作确认', '已有工程量明细,是否清空明细表?', 2, function () {
                     node.data.isFromDetail=0;
                     project.quantity_detail.cleanQuantityDetail(node,true);
                     me.doContainUpdate(value,node);

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

@@ -76,6 +76,9 @@ let ConfirmModal = {
             if (!this.spread) {
                 this.spread = SheetDataHelper.createNewSpread($('#std_bills_unit_spread')[0], {sheetCount: 1});
                 this.spread.options.showScrollTip = GC.Spread.Sheets.ShowScrollTip.vertical;
+                this.spread.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (sender, args) {
+                    ConfirmModal.stdBillsUnit.okObj.click();
+                });
                 SheetDataHelper.loadSheetHeader(this.setting, this.spread.getActiveSheet());
             }
             let sheet = ConfirmModal.stdBillsUnit.spread.getActiveSheet();

+ 7 - 1
web/building_saas/main/js/views/glj_view.js

@@ -883,7 +883,13 @@ var gljOprObj = {
     filterLibGLJByType: function () {
         var me = this;
         var selected = me.sheetData[gljContextMenu.selectedRow];
-        me.gljLibSheetData = _.filter(me.gljLibSheetData, {'gljType': selected.type});
+        //当前人材机类型是“混凝土、砂浆、配合比、商品混凝土、商品砂浆”时,筛选的可替换的人材机类型应是“混凝土、或砂浆、或配合比、或商品混凝土、或商品砂浆”。
+        let materialTypes = [202, 203, 204, 205, 206];//除了普通材料
+        let filterTypes = materialTypes.includes(selected.type) ? materialTypes : [selected.type];
+        me.gljLibSheetData = _.filter(me.gljLibSheetData, function (data) {
+            return filterTypes.includes(data.gljType);
+        });
+        //me.gljLibSheetData = _.filter(me.gljLibSheetData, {'gljType': selected.type});
     },
     getComboData: function (gljDistType) {
         let me = this;

+ 1 - 2
web/building_saas/main/js/views/quantity_edit_view.js

@@ -184,7 +184,7 @@ let quantityEditObj = {
         let value = me.evalQuantityExp(quantityEXP,node);
         if(value!=='evalError'){
             if(node.data.hasOwnProperty('isFromDetail')&&node.data.isFromDetail==1){
-                hintBox.infoBox('操作确认', '已有工程量明细,是否清空明细表,采用手工输入的表达式?', 2, function () {
+                hintBox.infoBox('操作确认', '已有工程量明细,是否清空明细表?', 2, function () {
                     node.data.isFromDetail=0;
                     me.updateQuantityEXP(value,quantityEXP,node);
                 }, function () {
@@ -217,7 +217,6 @@ let quantityEditObj = {
         quantity_detail.cleanQuantityDetail(node,true);
         if(node.sourceType === ModuleNames.bills){
             quantity_detail.updateBillQuantity(value,node,quantityEXP,quantityEXP);
-            //me.updateBillQuantity(value,node,null,editingText);
         }else {
             quantity_detail.updateRationQuantity(value,node,quantityEXP,quantityEXP);
         }

+ 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>");
     }