Ver código fonte

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

zhangweicheng 6 anos atrás
pai
commit
a5b9bf9f51

+ 2 - 0
modules/all_models/compilation.js

@@ -49,6 +49,8 @@ let modelSchema = {
     name: String,
     //描述
     description: String,
+    //例题
+    example: [],
     //代码覆盖路径
     overWriteUrl:String,
     // 创建时间

+ 32 - 2
modules/complementary_ration_lib/models/compleRationModel.js

@@ -191,7 +191,36 @@ class CompleRatoinDao {
         for(let ration of stdRations){
             ration._doc.type = 'std';
         }
-        stdRations.sort(function (a, b) {
+        function sortByCode(arr) {
+            function recurCompare(a, b, index){
+                if (a[index] && !b[index]) {
+                    return 1;
+                } else if (!a[index] && b[index]) {
+                    return -1;
+                } else if (a[index] && b[index]) {
+                    let aV = a[index],
+                        bV = b[index];
+                    if (!isNaN(aV) && !isNaN(bV)) {
+                        aV = parseFloat(a[index]);
+                        bV = parseFloat(b[index]);
+                    }
+                    if (aV > bV) {
+                        return 1;
+                    } else if (aV < bV) {
+                        return -1;
+                    } else {
+                        return recurCompare(a, b, index + 1);
+                    }
+                }
+                return 0;
+            }
+            arr.sort(function (a, b) {
+                let aArr = a.code.split('-'),
+                    bArr = b.code.split('-');
+                return recurCompare(aArr, bArr, 0);
+            });
+        }
+        /*stdRations.sort(function (a, b) {
             let rst = 0;
             if(a.code > b.code){
                 rst = 1;
@@ -200,7 +229,8 @@ class CompleRatoinDao {
                 rst = -1;
             }
             return rst;
-        });
+        });*/
+        sortByCode(stdRations);
         for(let ration of stdRations){
             let hintsArr = [];
             let stdGljIds = [],

+ 28 - 6
modules/pm/controllers/pm_controller.js

@@ -259,7 +259,9 @@ module.exports = {
                 //拷贝补充定额模板数据
                 await sectionTreeDao.copyDataFromTemplate(request.session.sessionUser.id, compilationData._id);
                 //拷贝例题数据
-
+                if (sessionCompilation.example && sessionCompilation.example.length > 0) {
+                   await pm_facade.copyExample(request.session.sessionUser.id, sessionCompilation._id, sessionCompilation.example);
+                }
             }
         }
         // 清单计价
@@ -542,15 +544,20 @@ module.exports = {
     },
     receiveProjects: async function(req, res) {
         try {
-            let rst = {grouped: [], ungrouped: []};
+            let rst = {grouped: [], ungrouped: [], summaryInfo: null};
             let userID = req.session.sessionUser.id;
             let receiveProjects = await projectModel.find({
-                $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], compilation: req.session.sessionCompilation._id, 'shareInfo.userID': userID}, '-_id -property');
+                $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], compilation: req.session.sessionCompilation._id, 'shareInfo.userID': userID}, '-_id');
             //设置原项目用户信息
             if(receiveProjects.length > 0){
                 let orgUserIDs = [];
                 for(let proj of receiveProjects){
                     orgUserIDs.push(proj.userID);
+                    if (proj.projType === projType.tender) {
+                        //设置工程专业
+                        proj._doc.feeStandardName = proj.property.feeStandardName || '';
+                    }
+                    delete proj._doc.property;
                 }
                 orgUserIDs = Array.from(new Set(orgUserIDs));
                 let userObjIDs = [];
@@ -558,10 +565,24 @@ module.exports = {
                     userObjIDs.push(mongoose.Types.ObjectId(uID));
                 }
                 let orgUsersInfo = await userModel.find({_id: {$in : userObjIDs}});
+                //建设项目
+                let consProjIDs = [];
                 for(let proj of receiveProjects){
                     //获取分享项目子项
                     if (proj.projType !== projType.tender) {
                         proj._doc.children = await pm_facade.getPosterityProjects([proj.ID]);
+                        if (proj.projType === projType.project) {
+                            consProjIDs.push(proj.ID);
+                        }
+                        for (let projC of proj._doc.children) {
+                            if (projC.projType === projType.project) {
+                                consProjIDs.push(projC.ID);
+                            } else if (projC.projType === projType.tender) {
+                                //设置工程专业
+                                projC._doc.feeStandardName = projC.property.feeStandardName || '';
+                            }
+                            delete projC._doc.property;
+                        }
                     }
                     //设置分组,单位工程及单项工程分到未分组那
                     if (proj.projType === projType.tender || proj.projType === projType.engineering) {
@@ -578,10 +599,14 @@ module.exports = {
                         }
                     }
                 }
+                consProjIDs = Array.from(new Set(consProjIDs));
+                let summaryInfo = await pm_facade.getSummaryInfo(consProjIDs);
+                rst.summaryInfo = summaryInfo;
             }
             callback(req, res, 0, 'success', rst);
         }
         catch (err){
+            console.log(err);
             callback(req, res, 1, err, null);
         }
     },
@@ -591,9 +616,6 @@ module.exports = {
             let compilation = req.session.sessionCompilation._id;
             let query = data.query;
             query.compilation = compilation;
-            console.log(`compilation===============================`);
-            console.log(compilation);
-            console.log(query);
             let options = data.options;
             let projects = await projectModel.find(query, options);
             callback(req, res, 0, 'success', projects);

+ 76 - 5
modules/pm/facade/pm_facade.js

@@ -26,6 +26,7 @@ let quantityDetailModel = mongoose.model('quantity_detail');
 
 let featureLibModel =  mongoose.model("std_project_feature_lib");
 let scMathUtil = require('../../../public/scMathUtil').getUtil();
+let counter = require('../../../public/counter/counter');
 import CounterModel from "../../glj/models/counter_model";
 import moment from 'moment';
 import billsFlags from '../../common/const/bills_fixed';
@@ -41,6 +42,7 @@ const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
 module.exports={
     moveProject:moveProject,
     copyProject:copyProject,
+    copyExample: copyExample,
     getSummaryInfo: getSummaryInfo,
     getSummaryInfoByTender: getSummaryInfoByTender,
     getConstructionProject: getConstructionProject,
@@ -51,9 +53,78 @@ module.exports={
     isShare: isShare,
 };
 
-//拷贝父级项目
-async function copyParent(){
-
+//拷贝例题项目
+//@param {String}userID {Array}projIDs拷贝的例题项目ID(建设项目、文件夹)@return {Boolean}
+async function copyExample(userID, compilation, projIDs){
+    let allProjs = [],
+        IDMapping = {},
+        projMapping = {};
+    //例题项目不可为单项工程、单位工程、只能是建设项目、文件夹,否则不自动新建例题项目(这里不报错,让用户没有感觉)
+    let parentExample = await projectModel.find({ID: {$in: projIDs}, $or: notDeleted});
+    if (parentExample.length === 0) {
+        return false;
+    }
+    allProjs = allProjs.concat(parentExample);
+    for (let i = 0; i < parentExample.length; i++) {
+        let data = parentExample[i];
+        if (data.projType === projectType.tender || data.projType === projectType.engineering) {
+            return false;
+        }
+        //设置成顶节点,最后一个节点设置成末节
+        data.ParentID = -1;
+        if (i === parentExample.length - 1) {
+            data.NextSiblingID = -1;
+        }
+    }
+    //获取所有的子项目
+    let posterityProjs = await getPosterityProjects(projIDs);
+    allProjs = allProjs.concat(posterityProjs);
+    let projCounter = await counter.counterDAO.getIDAfterCountSync(counter.moduleName.project, allProjs.length);
+    //旧ID与新ID映射
+    for (let i = 0; i < allProjs.length; i++) {
+        let data = allProjs[i];
+        let newID = projCounter.sequence_value - (allProjs.length - 1) + i;
+        IDMapping[data.ID] = newID;
+        projMapping[newID] = data;
+    }
+    //return;
+    //设置新的树结构数据
+    let newDate = new Date(),
+        parentBulks = [];
+    for (let data of allProjs) {
+        let orgID = data.ID;
+        data.ID = IDMapping[data.ID];
+        data.ParentID = IDMapping[data.ParentID] ? IDMapping[data.ParentID] : -1;
+        data.NextSiblingID = IDMapping[data.NextSiblingID] ? IDMapping[data.NextSiblingID] : -1;
+        data.createDateTime = newDate;
+        data.userID = userID;
+        data.compilation = compilation;
+        data.shareInfo = [];
+        if (data.projType !== projectType.tender) {
+            let newData = _.cloneDeep(data._doc);
+            delete newData._id;
+          //  await projectModel.create(newData);
+            parentBulks.push({insertOne: {document: newData}});
+        } else {
+            //拷贝单位工程
+            let rootProjectID = projMapping[data.ParentID].ParentID;
+            let projectMap = {
+                copy: {
+                    document: {userID: userID, ID: orgID, NextSiblingID: data.NextSiblingID, ParentID: data.ParentID, name: data.name, shareInfo: [],
+                                compilation: compilation, fileVer: data.fileVer, projType: data.projType, property: {rootProjectID: rootProjectID}}
+                }
+            };
+            await copyProject(userID, compilation, {projectMap}, data.ID);
+        }
+    }
+    //最末顶层项目(兼容测试时已存在有项目,正常用户第一次进费用定额,该费用定额不存在项目)
+    let lastProj = await projectModel.findOne({userID: userID, compilation: compilation, ParentID: -1, NextSiblingID: -1, $or: notDeleted});
+    if (lastProj) {
+        parentBulks.push({updateOne: {filter: {ID: lastProj.ID}, update: {$set: {NextSiblingID: parentExample[0].ID}}}});
+    }
+    //拷贝父级文件
+    await projectModel.bulkWrite(parentBulks);
+    return true;
 }
 
 async function copyProject(userID, compilationID,data,newProjectID = null) {
@@ -733,13 +804,13 @@ async function getProjectFeature(libID,feeStandardName){
     }
 }
 
-//获取文件下所有子项目
+//获取projectIDs文件下所有子项目(不包括projectIDs本身)
 async function getPosterityProjects(projectIDs) {
     let rst = [];
     async function getProjects(IDs) {
         if (IDs.length > 0) {
             let newIDs = [];
-            let projs = await projectModel.find({ParentID: {$in: IDs}, $or: notDeleted}, '-_id -property');
+            let projs = await projectModel.find({ParentID: {$in: IDs}, $or: notDeleted}, '-_id');
             for (let proj of projs) {
                 rst.push(proj);
                 newIDs.push(proj.ID);

+ 1 - 1
modules/reports/util/rpt_construct_data_util.js

@@ -270,7 +270,7 @@ class Rpt_Data_Extractor {
                 setupFunc($PROJECT.SUMMARY, `ConstructDetail`, {"data": rawDataObj.ConstructDetail});
             }
             if (rawDataObj.Segment) {
-                setupMainFunc($PROJECT.SUMMARY, `Segment`, rawDataObj.Construct);
+                setupMainFunc($PROJECT.SUMMARY, `Segment`, rawDataObj.Segment);
             }
             if (rawDataObj.SegmentDetail) {
                 setupFunc($PROJECT.SUMMARY, `SegmentDetail`, {"data": rawDataObj.SegmentDetail});

BIN
public/static/uploadExample.xlsx


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

@@ -39,6 +39,8 @@
         let userAccount = '<%- userAccount %>';
         let userID = '<%- userID %>';
         let projectReadOnly = JSON.parse('<%- projectReadOnly %>');
+        const G_SHOW_BLOCK_LIB = true;
+//        const G_SHOW_BLOCK_LIB = false;
     </script>
 </head>
 
@@ -126,12 +128,15 @@
                          <!-- <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsTab' relaPanel="#qd">清单规则</a>
                           </li>-->
-                          <li class="nav-item">
+                          <li class="nav-item" id = "li_stdRationTab">
                               <a class="nav-link px-3" href="javascript:void(0)" id="stdRationTab" relaPanel="#de">定额库</a>
                           </li>
-<!--                          <li class="nav-item">
-                              <a class="nav-link px-3" href="javascript:void(0)" id="blockLibTab" relaPanel="#kmbk">块模板库</a>
-                          </li>-->
+                          <script>
+                              if (G_SHOW_BLOCK_LIB){
+                                  $("#li_stdRationTab").after('<li class="nav-item"> <a class="nav-link px-3" href="javascript:void(0)" ' +
+                                      'id="blockLibTab" relaPanel="#kmbk">块模板库</a></li>');
+                              }
+                          </script>
                       </ul>
                   </div>
               </div>
@@ -521,9 +526,9 @@
                               <div class="tab-pane" id="kmbk">
                                   <div class="tools-bar-height-d container-fluid">
                                       <div class="p-1 row">
-                                          <button id="btn_block_collapse" class="btn btn-primary btn-sm" type="button">展开/折叠</button>
+                                          <!--<button id="btn_block_collapse" class="btn btn-primary btn-sm" type="button">展开/折叠</button>-->
                                           <button id="btn_block_newFolder" class="btn btn-primary btn-sm" type="button">新建分类</button>
-                                          <button id="btn_block_newSubFolder" class="btn btn-warning btn-sm" type="button">新建子类</button>
+                                          <!--<button id="btn_block_newSubFolder" class="btn btn-warning btn-sm" type="button">新建块</button>-->
                                       </div>
                                   </div>
                                   <div class="top-content" style="overflow: hidden">
@@ -1464,7 +1469,7 @@
                     <div id="uploadSheets"></div>
                 </div>
                 <div class="modal-footer">
-                    <button style="margin-right: 245px;" type="button" class="btn btn-primary" id="uploadExample">示例</button>
+                    <button style="margin-right: 215px;" type="button" class="btn btn-primary" id="uploadExample">下载示例</button>
                     <a href="javascript:void(0);" class="btn btn-primary" id="importConfirm">确定导入</a>
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                 </div>

+ 3 - 1
web/building_saas/main/js/models/calc_base.js

@@ -1779,10 +1779,12 @@ let calcBase = {
             node.changed = true;
         }
         catch (err){
-            console.log(err);
             if(typeof err === 'object'){
                 err = '表达式不正确'
             }
+            if (node) {
+                err = `第${node.serialNo() + 1}行${err}`;
+            }
             alert(err);
         }
     }

+ 39 - 23
web/building_saas/main/js/views/block_lib.js

@@ -38,14 +38,13 @@ var blockLibObj = {
         $.bootstrapLoading.start();
         let me = this;
         me.mainDatas = [
-            {ID: 1, ParentID: -1, NextSiblingID: 8, name: '我的块模板库1', type: 0},
-            {ID: 2, ParentID: 1, NextSiblingID: 3, name: '分类1', type: 1},
-            {ID: 3, ParentID: 1, NextSiblingID: -1, name: '分类2', type: 1},
-            {ID: 4, ParentID: 2, NextSiblingID: 5, name: '子类A', type: 1},
-            {ID: 5, ParentID: 2, NextSiblingID: -1, name: '子类B', type: 1},
-            {ID: 6, ParentID: 4, NextSiblingID: 7, name: '块1', type: 2},
-            {ID: 7, ParentID: 4, NextSiblingID: -1, name: '块2', type: 2},
-            {ID: 8, ParentID: -1, NextSiblingID: -1, name: '我的块模板库2', type: 0}
+            {ID: 2, ParentID: -1, NextSiblingID: 3, name: '分类2', type: 1},
+            {ID: 3, ParentID: -1, NextSiblingID: -1, name: '分类3', type: 1},
+            {ID: 6, ParentID: 2, NextSiblingID: 7, name: '块1', type: 2},
+            {ID: 7, ParentID: 2, NextSiblingID: -1, name: '块2', type: 2},
+            {ID: 52, ParentID: -1, NextSiblingID: 53, name: '分类52', type: 1},
+            {ID: 55, ParentID: -1, NextSiblingID: -1, name: '分类55', type: 1},
+            {ID: 88, ParentID: 52, NextSiblingID: -1, name: '块88', type: 2}
         ];
 
         if (me.mainSpread) {
@@ -53,6 +52,7 @@ var blockLibObj = {
             me.mainSpread = null;
         };
         me.mainSpread = SheetDataHelper.createNewSpread($('#div_block_tree')[0]);
+        // me.mainSpread = TREE_SHEET_HELPER.createNewSpread($('#div_block_tree')[0]);
         me.mainSheet = me.mainSpread.getSheet(0);
         me.mainSheet.name('blockLibSheet');
         sheetCommonObj.spreadDefaultStyle(me.mainSpread);
@@ -284,22 +284,40 @@ var blockLibObj = {
         };
         return new TreeCell();
     },
-    insert: function (insertType){    // 1 后兄弟; 2 孩子。
+    newNode: function (nodeType, nodeName){     // 1 分类  2 块文件
         let tree = blockLibObj.mainTree;
+        let pID = -1, nID = -1;
         let select = tree.selected;
-        if (!select) select = tree.items[0];
-        let pID = (insertType == 1) ? select.getParentID() : select.getID();
-        let nID = (insertType == 1) ? select.getNextSiblingID() : -1;
-        let newNode = tree.insert(pID, nID);
-
-        if (!newNode.parent){
-            newNode.data.type = 0;
-            newNode.data.name = '我的块模板库';
-        }
-        else{
+        let newNode = null;
+        if (nodeType == 1){
+            if (!select) {
+                nID = -1;
+            }
+            else if (select.data.type == 1){
+                nID = select.getNextSiblingID();
+            }
+            else if (select.data.type == 2){
+                nID = select.parent.getNextSiblingID();
+            };
+            newNode = tree.insert(pID, nID);
             newNode.data.type = 1;
             newNode.data.name = '分类';
         }
+        else if (nodeType == 2) {
+            if (!select) {
+                pID = tree.items[0].getID();
+            }
+            else if (select.data.type == 1){
+                pID = select.getID();
+            }
+            else if (select.data.type == 2){
+                pID = select.getParentID();
+                nID = select.getNextSiblingID();
+            };
+            newNode = tree.insert(pID, nID);
+            newNode.data.type = 2;
+            newNode.data.name = nodeName;
+        }
 
         tree.selected = newNode;
 
@@ -327,11 +345,9 @@ $(document).ready(function(){
         }
     });
     $('#btn_block_newFolder').on('click', function (){
-        blockLibObj.insert(1);
+        blockLibObj.newNode(1);
     });
-
     $('#btn_block_newSubFolder').on('click', function (){
-        blockLibObj.insert(2);
+        blockLibObj.newNode(2);
     });
-
 });

+ 21 - 1
web/building_saas/main/js/views/project_view.js

@@ -37,7 +37,8 @@ var projectObj = {
         if($('#linkComments').hasClass('active')){
             subViewObj.loadComments(node);
         }
-        gljOprObj.mainTreeSelectedChange = gljOprObj.selectedNodeId != node.getID();
+        let nodeID = node ? node.getID() : null;
+        gljOprObj.mainTreeSelectedChange = gljOprObj.selectedNodeId != nodeID;
         if(init) subObj.initNavItem(node);
        /*
        2018-11-9 在NavItem里设置了默认显示的item,在里执行了click这个操作所以这两个操作不用重复执行了
@@ -1497,6 +1498,25 @@ var projectObj = {
                     visible: function(key, opt){//2018-11-15 暂时隐藏
                         return false
                     }
+                },
+                "createBlocks":{
+                    name:'生成组价模板',
+                    icon: 'fa-edit',
+                    disabled:function (key,opt) {
+                        let selected = project.mainTree.selected;
+                        return selected.sourceType != ModuleNames.bills;
+                    },
+                    callback:function(){
+                        if (!$("#kmbk").is(":visible")){
+                            $('#blockLibTab').click()
+                        };
+                        let selected = project.mainTree.selected;
+                        let name = selected.data.code + ' ' + selected.data.name + ' ' + selected.data.unit;
+                        blockLibObj.newNode(2, name);
+                    },
+                    visible: function(key, opt){
+                        return G_SHOW_BLOCK_LIB;
+                    }
                 }
             }
         });

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

@@ -62,6 +62,9 @@ let subObj = {
      /*   1、造价书选中行类别是“大项费用”、“分部”、“分项”、“清单”时,显示按钮“工程量明细”、“计算程序”、“特征及内容”,默认打开“计算程序”。
           2、选中行类别是“定额”、“量价”、“人材机”时,显示按钮“人材机”、“子目换算”、“工程量明细”、“计算程序”、“安装增加费”,默认打开“人材机”。
      */
+        if (!node) {
+            return;
+        }
         $('.sub-item').removeClass('active');
         if(node.sourceType == ModuleNames.ration){
             //GLJ_div //ZMHS_div

+ 1 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -1143,7 +1143,7 @@ $(document).ready(function() {
     //列宽随着屏幕改变
     $(window).resize(function () {
         sheetCommonObj.setColumnWidthByRate(getWorkBookWidth(), gcTreeObj.workBook, gcTreeObj.setting.header);
-        sheetCommonObj.setColumnWidthByRate(getWorkBookWidth(), pmShare.spreadObj.workBook, pmShare.headers);
+        //sheetCommonObj.setColumnWidthByRate(getWorkBookWidth(), pmShare.spreadObj.workBook, pmShare.headers);
 
     });
 

+ 49 - 9
web/building_saas/pm/js/pm_share.js

@@ -16,6 +16,7 @@ const pmShare = (function () {
     //操作类型
     const oprType = {copy: 'copy', cancel: 'cancel'};
     let tree = null;
+    const treeCol = 0;
     const treeSetting = {
         tree: {
             id: 'ID',
@@ -26,11 +27,20 @@ const pmShare = (function () {
         }
     };
     const headers = [
-        {name: '工程列表', dataCode: 'name', width: 0.55, rateWidth: 0.55, vAlign: 'center', hAlign: 'left'},
-        {name: '由...分享', dataCode: 'from', width: 0.15, rateWidth: 0.15, vAlign: 'center', hAlign: 'left'},
-        {name: '分享给...', dataCode: 'to', width: 0.15, rateWidth: 0.15, vAlign: 'center', hAlign: 'left'},
-        {name: '拷贝工程', dataCode: 'copy', width: 0.075, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
-        {name: '清除', dataCode: 'cancel', width: 0.075, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
+        {name: '工程列表', dataCode: 'name', width: 300, rateWidth: 0.55, vAlign: 'center', hAlign: 'left'},
+        {name: '由...分享', dataCode: 'from', width: 100, rateWidth: 0.15, vAlign: 'center', hAlign: 'left'},
+        {name: '拷贝工程', dataCode: 'copy', width: 100, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
+        {name: '清除', dataCode: 'cancel', width: 100, rateWidth: 0.075, vAlign: 'center', hAlign: 'left'},
+        {name: '工程造价', dataCode: 'engineeringCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '分部分项合计', dataCode: 'subEngineering', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '措施项目合计', dataCode: 'measure', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '其他项目合计', dataCode: 'other', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '规费', dataCode: 'charge', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '税金', dataCode: 'tax', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '占造价比例(%)', dataCode: 'rate', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '建筑面积', dataCode: 'buildingArea', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '单方造价', dataCode: 'perCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0.00'},
+        {name: '工程专业', dataCode: 'feeStandardName', width: 100, vAlign: 'center', hAlign: 'left'},
     ];
     const spreadOpts = {
         workBook: {
@@ -107,9 +117,9 @@ const pmShare = (function () {
         let fuc = function () {
             sheet.setColumnCount(headers.length);
             sheet.setRowHeight(0, 40, GC.Spread.Sheets.SheetArea.colHeader);
-            let spreadWidth = getWorkBookWidth();
+            //let spreadWidth = getWorkBookWidth();
             for(let i = 0, len = headers.length; i < len; i++){
-                sheet.setColumnWidth(i, spreadWidth * headers[i].width, GC.Spread.Sheets.SheetArea.colHeader);
+                sheet.setColumnWidth(i, headers[i].width, GC.Spread.Sheets.SheetArea.colHeader);
                 if(headers[i].formatter){
                     sheet.setFormatter(-1, i, headers[i].formatter);
                 }
@@ -559,7 +569,7 @@ const pmShare = (function () {
             sheet.setRowCount(nodes.length);
             for(let i = 0; i < nodes.length; i++){
                 let treeNodeCell = getTreeNodeCell(tree);
-                sheet.getCell(i, 0).cellType(treeNodeCell);
+                sheet.getCell(i, treeCol).cellType(treeNodeCell);
                 for(let j = 0; j < headers.length; j++){
                     sheet.getRange(-1, j, -1, 1).hAlign(GC.Spread.Sheets.HorizontalAlign[headers[j]['hAlign']]);
                     sheet.getRange(-1, j, -1, 1).vAlign(GC.Spread.Sheets.VerticalAlign[headers[j]['vAlign']]);
@@ -592,7 +602,7 @@ const pmShare = (function () {
                             sheet.getCell(i, j).cellType(getInteractionCell());
                         }
                     }
-                    sheet.setValue(i, j, nodes[i].data[dataCode] ? nodes[i].data[dataCode] : '');
+                    sheet.setValue(i, j, nodes[i].data[dataCode] !== null && typeof nodes[i].data[dataCode] !== 'undefined' ? nodes[i].data[dataCode] : '');
                 }
             }
         };
@@ -640,6 +650,32 @@ const pmShare = (function () {
             }
         }
     }
+    //给项目设置汇总信息
+    //@param {Array}projs {Object}summaryInfo
+    function setSummaryInfo(grouped, summaryInfo) {
+        let allDatas = [];
+        for (let data of grouped) {
+            allDatas.push(data);
+            if (data.children && data.children.length > 0) {
+                allDatas = allDatas.concat(data.children);
+            }
+        }
+        for(let proj of allDatas){
+            let summaryProj = summaryInfo[proj.ID];
+            if(summaryProj){
+                proj.engineeringCost = summaryProj.engineeringCost;
+                proj.subEngineering = summaryProj.subEngineering;
+                proj.measure = summaryProj.measure;
+                proj.safetyConstruction = summaryProj.safetyConstruction;
+                proj.other = summaryProj.other;
+                proj.charge = summaryProj.charge;
+                proj.tax = summaryProj.tax;
+                proj.rate = summaryProj.rate;
+                proj.buildingArea = summaryProj.buildingArea;
+                proj.perCost = summaryProj.perCost;
+            }
+        }
+    }
     //获取可成树的数据
     //@param {Array}datas @return {Array}
     function getTreeDatas(groupedDatas, ungroupedDatas){
@@ -706,7 +742,10 @@ const pmShare = (function () {
             // 排序 --分享的文件按照时间先后顺序排序,分享文件下的子文件,按照原本树结构显示,不需要排序
             sortByDate(rstData.grouped);
             sortByDate(rstData.ungrouped);
+            //设置汇总信息
+            setSummaryInfo(rstData.grouped, rstData.summaryInfo);
             let treeDatas = getTreeDatas(rstData.grouped, rstData.ungrouped);
+            console.log(treeDatas);
             tree = pmTree.createNew(treeSetting, treeDatas);
             console.log(tree);
             tree.selected = tree.items[0];
@@ -715,6 +754,7 @@ const pmShare = (function () {
             let initSel = spreadObj.sheet.getSelections()[0] ? spreadObj.sheet.getSelections()[0] : {row: 0, rowCount: 1};
             initSelection(initSel);
             autoFlashHeight();
+            spreadObj.sheet.frozenColumnCount(4);
             spreadObj.workBook.refresh();
             $.bootstrapLoading.end();
         });

+ 1 - 1
web/building_saas/report/js/rpt_main.js

@@ -69,7 +69,7 @@ let zTreeOprObj = {
                     for (let i = items.length - 1; i >= 0; i--) {
                         if (!(items[i].released) && items[i].nodeType === 2) {
                             items.splice(i, 1);
-                        } else if(items[i].hasOwnProperty('flags') && items[i].flags['taxType'] == projectInfoObj.projectInfo.property.taxType ) {
+                        } else if(items[i].hasOwnProperty('flags') && parseInt(items[i].flags['taxType']) !== parseInt(projectInfoObj.projectInfo.property.taxType)) {
                             items.splice(i, 1);
                         } else {
                             if (items[i].items && items[i].items.length > 0) {

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

@@ -442,7 +442,7 @@ if(typeof baseFigureTemplate !== 'undefined'){
 //增加清单基数分类估价项目、去除分类税前工程造价
 if(typeof $ !== 'undefined' && $('#cbClassList')){
     $('#cbClassList').find('li:eq(8)').remove();
-    let $li = $('<li class="p-1"><a id="cb_GJXM" href="javascript:void(0);">估价项目</a></li>');
+    let $li = $('<li class="py-1"><a id="cb_GJXM" href="javascript:void(0);">估价项目</a></li>');
     $li.insertAfter($('#cbClassList').find('li:eq(4)'));
 }
 if (typeof calcBaseView !== 'undefined') {