Bläddra i källkod

Merge branch 'budget' of http://192.168.1.41:3000/SmartCost/ConstructionCost into budget

chenshilong 4 år sedan
förälder
incheckning
96d110ef85

+ 6 - 6
config/config.js

@@ -9,7 +9,7 @@ module.exports = {
             user:'smartcost',
             pass:'smartcost3850888',
             auth: {
-                "authdb": "admin"
+                "authSource": "admin"
             },
             connectTimeoutMS: 100000,
             useMongoClient: true
@@ -23,7 +23,7 @@ module.exports = {
             user:'smartcost',
             pass:'smartcost3850888',
             auth: {
-                "authdb": "admin"
+                "authSource": "admin"
             },
             connectTimeoutMS: 100000,
             useMongoClient: true
@@ -37,7 +37,7 @@ module.exports = {
             user:'smartcost',
             pass:'smartcost3850888',
             auth: {
-                "authdb": "scConstruct"
+                "authSource": "scConstruct"
             },
             connectTimeoutMS: 20000,
             useMongoClient: true
@@ -49,7 +49,7 @@ module.exports = {
             user:'smartcost',
             pass:'SmartCost3850888',
             auth: {
-                "authdb": "admin"
+                "authSource": "admin"
             },
             connectTimeoutMS: 50000,
             useMongoClient: true
@@ -63,7 +63,7 @@ module.exports = {
             user:'smartcost',
             pass:'SmartCost3850888',
             auth: {
-                "authdb": "admin"
+                "authSource": "admin"
             },
             connectTimeoutMS: 100000,
             useMongoClient: true
@@ -76,7 +76,7 @@ module.exports = {
             user:'smartcost',
             pass:'SmartCost3850888',
             auth: {
-                "authdb": "admin"
+                "authSource": "admin"
             },
             connectTimeoutMS: 50000,
             useMongoClient: true

+ 4 - 3
public/web/sheet/sheet_common.js

@@ -707,12 +707,12 @@ var sheetCommonObj = {
                     var imageWidth = 25;
                     var imageX = x + w - imageWidth - imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
-                   /* 2020-12-16 这里原先是还原背景色的,发现不需要了,先观察 
+                   //2020-12-16 这里原先是还原背景色的,发现不需要了,先观察 
                     if (style.backColor) {
                         ctx.fillStyle = style.backColor;
                         ctx.fillRect(x, y, w, h);
                     } 
-                    */
+                   
                     ctx.drawImage(image, imageX, imageY, imageWidth, imageHeight);
                     ctx.beginPath();
                     ctx.arc(imageX + imageWidth / 2, imageY + imageHeight / 2, 1, 0, 360, false);
@@ -724,7 +724,8 @@ var sheetCommonObj = {
                     ctx.restore();
                     w = w - imageWidth - imageMagin;
                     //这里的左对齐的,当显示的字长度超过空白地方时,要改成右对齐
-                    if (style.hAlign == 0) {
+                    //如果是自动换行的,则不用右对齐
+                    if (style.hAlign == 0 && style.wordWrap !== true) {
                         if (value) {
                             let textWidth = ctx.measureText(value).width;
                             let spaceWidth = w;

+ 2 - 0
web/building_saas/budget-summary/js/budgetSummarySheet.js

@@ -684,6 +684,8 @@ const budgetSummaryObj = (() => {
   const init = async (constructionID) => {
     try {
       $.bootstrapLoading.start();
+      // 得先计算费用汇总(概算汇总计算基于费用汇总算出来的总金额)
+      await projectObj.project.calcProgram.getGatherFeeData();
       const { treeData, costGrowthRate, growthPeriod } = await ajaxPost('/bills/initialBudgetSummary', { constructionID });
       calcSetting.costGrowthRate = costGrowthRate;
       calcSetting.growthPeriod = growthPeriod;

+ 58 - 23
web/building_saas/main/js/views/select_FB_view.js

@@ -31,23 +31,50 @@ let selectFBObject = {
         }
         return null;
     },
+    showTreeData:function(roots){
+        let me = this;
+        let parentIDs = [];
+        let node = me.getSelectedNode();
+        if(node) parentIDs = me.getAllParentIDs(node);
+        this.datas = [];
+        for(let r of roots){
+            me.setDatas(r,parentIDs);
+        }
+        sheetCommonObj.showTreeData(me.spread.getSheet(0), me.setting, me.datas);
+        let row = me.getSelectedRow(node);
+        me.spread.getSheet(0).setSelection(row,0,1,1);
+        me.spread.getSheet(0).showRow(row, GC.Spread.Sheets.VerticalPosition.center);
+    },
+
     showData:function(){
+        let budgetType = projectObj.project.property.budgetType||commonConstants.BudgetType.BUILDING;
+        if(budgetType===commonConstants.BudgetType.BUILDING){//建筑安装工程显示清单树 显示定额章节树
+            this.showRationTree();
+        }else{//城市轨道交通工程 显示分部
+            this.showBillTree();
+        }
+    },
+    showRationTree:async function(){
+        let rationLibID = rationLibObj.getDefaultStdRationLibID();
+        if(!this.rationChapterTree){
+            $.bootstrapLoading.start();
+            let treeData = await ajaxPost('/complementaryRation/api/getRationTree', {userId: userID, rationRepId: rationLibID, type: 1});
+            this.rationChapterTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: false});
+            rationChapterTree.loadDatas(treeData);
+            $.bootstrapLoading.end();
+        }
+        if(this.rationChapterTree.roots.length >0){
+            this.showTreeData(this.rationChapterTree.roots[0].children);
+        }
+    },
+    showBillTree:function(){
         let me = selectFBObject;
-        billsGuidance.initBillsLibs(()=>{
-            let parentIDs = [];
-            let node = me.getSelectedNode();
-            if(node) parentIDs = me.getAllParentIDs(node);
-            this.datas = [];
-            for(let r of billsGuidance.bills.tree.roots){
-                selectFBObject.setDatas(r,parentIDs);
-            }
-            sheetCommonObj.showTreeData(me.spread.getSheet(0), me.setting, me.datas);
-            let row = me.getSelectedRow(node);
-            me.spread.getSheet(0).setSelection(row,0,1,1);
-            me.spread.getSheet(0).showRow(row, GC.Spread.Sheets.VerticalPosition.center);
+        billsGuidance.initBillsLibs(()=>{ 
+            me.showTreeData(billsGuidance.bills.tree.roots);
         });
     },
 
+
     getSelectedRow:function(node){
         let row = 0;//要选中的行;   
         if(node){
@@ -88,18 +115,26 @@ let selectFBObject = {
     },
 
 
-    setDatas:function(node,parentIDs){
-        if(node.children.length > 0){//过滤叶子节点
-            let nodeData = node.data;
-            let d = {
-                ID:nodeData.ID,
-                ParentID:nodeData.ParentID,
-                code:nodeData.code,
-                name:nodeData.name,
-                unit:nodeData.unit
+    setDatas:function(node,parentIDs){   
+        let budgetType = projectObj.project.property.budgetType||commonConstants.BudgetType.BUILDING;
+        let nodeData = node.data;
+        let d = {
+            ID:nodeData.ID,
+            ParentID:nodeData.ParentID,
+            code:nodeData.code,
+            name:nodeData.name,
+            unit:nodeData.unit
+        }
+        if(nodeData.name  && budgetType === commonConstants.BudgetType.BUILDING){
+            let index = nodeData.name.indexOf(' ');
+            if(index !== -1){
+                d.code = nodeData.name.substring(0,index);
+                d.name = nodeData.name.substring(index+1);
             }
-            if(parentIDs.includes(d.ID)) d.collapsed = false
-            this.datas.push(d);
+        }
+        if(parentIDs.includes(d.ID)) d.collapsed = false
+        this.datas.push(d);
+        if(node.children.length > 0){
             for(let c of node.children){
                 this.setDatas(c,parentIDs)
             }