Explorar o código

Merge branch 'master' of http://192.168.1.12:3000/SmartCost/ConstructionCost

TonyKang %!s(int64=7) %!d(string=hai) anos
pai
achega
78e532ce82

+ 16 - 2
modules/pm/controllers/pm_controller.js

@@ -126,7 +126,7 @@ module.exports = {
             callback(req, res, err, message, data);
         });
     },
-    copyProjects: function (req, res) {
+ /*   copyProjects: function (req, res) {
         let data = JSON.parse(req.body.data);
         ProjectsData.copyUserProjects(req.session.sessionUser.id, req.session.sessionCompilation._id, data.updateData, function (err, message, data) {
             if (err === 0) {
@@ -135,7 +135,7 @@ module.exports = {
                 callback(req, res, err, message, null);
             }
         });
-    },
+    },*/
     rename: function (req, res) {
         let data = JSON.parse(req.body.data);
         ProjectsData.rename(req.session.sessionUser.id, req.session.sessionCompilation._id, data, function (err, message) {
@@ -402,5 +402,19 @@ module.exports = {
             result.message = err.message;
         }
         res.json(result);
+    },
+    copyProjects:async function (req, res) {
+        let result={
+            error:0
+        };
+        try {
+            let data = JSON.parse(req.body.data);
+            result.data = await pm_facade.copyProject(req.session.sessionUser.id, req.session.sessionCompilation._id,data);
+        }catch (err){
+            console.log(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        res.json(result);
     }
 };

+ 23 - 1
modules/pm/facade/pm_facade.js

@@ -13,10 +13,32 @@ let mixRatioModel = mongoose.model("mix_ratio");
 let unitPriceModel = mongoose.model("unit_price");
 import CounterModel from "../../glj/models/counter_model";
 
+
 module.exports={
-    moveProject:moveProject  
+    moveProject:moveProject,
+    copyProject:copyProject
 };
 
+async function copyProject(userID, compilationID,data) {;
+    console.log(userID);
+    console.log(compilationID);
+    console.log(data);
+
+    let p = Promise.all([getFeeRate(),getUnitfile()]);
+
+    return await p;
+
+}
+
+
+async function getFeeRate() {
+    return await feeRateFileModel.findOne({ID:"e7527fa0-3bd0-11e8-bced-7f72a1e036f0"});
+}
+
+async function getUnitfile() {
+    return await unitPriceFileModel.findOne({id:958});
+}
+
 async function moveProject(data) {
     data = JSON.parse(data);
     let projectMap = data.projectMap,feeRateMap = data.feeRateMap,unitPriceMap = data.unitPriceMap;

+ 1 - 2
modules/ration_glj/facade/ration_glj_facade.js

@@ -408,8 +408,7 @@ function getRationsByBill(datas) {
     return function (results, callback) {
         ration.find({
             projectID: datas.updateData.projectID,
-            billsItemID: datas.updateData.ID,
-            deleteInfo: null
+            billsItemID: datas.updateData.ID
         }, function (err, rations) {
             if (err) {
                 callback(err, '')

+ 0 - 1
modules/users/models/log_model.js

@@ -118,7 +118,6 @@ class LogModel extends BaseModel {
         if (ip === '127.0.0.1') {
             return '服务器本机访问';
         }
-
         let getData = {
             url: 'http://ip.taobao.com/service/getIpInfo.php?ip=' + ip,
             encoding: 'utf8'

+ 2 - 0
modules/users/models/sms_model.js

@@ -37,6 +37,7 @@ class SmsModel extends BaseModel {
                 // 请求接口
                 Request.post(postData, function (err, postResponse, body) {
                     if (err) {
+                        console.log('222');
                         throw '请求错误';
                     }
                     if (postResponse.statusCode !== 200) {
@@ -69,6 +70,7 @@ class SmsModel extends BaseModel {
                 // 请求接口
                 Request.post(postData, function (err, postResponse, body) {
                     if (err) {
+                        console.log('333');
                         throw '请求错误';
                     }
                     if (postResponse.statusCode !== 200) {

+ 1 - 0
modules/users/models/user_model.js

@@ -63,6 +63,7 @@ class UserModel extends BaseModel {
                 // 请求接口
                 Request.post(postData, function (err, postResponse, body) {
                     if (err) {
+                        console.log('111');
                         throw '请求错误';
                     }
                     if (postResponse.statusCode !== 200) {

+ 5 - 0
public/web/id_tree.js

@@ -630,6 +630,11 @@ var idTree = {
             let that = this;
             let success = false;
             delete that.nodes[that.prefix + node.getID()];//删除本身
+            if (node.parent) {//从父项的子节点中移除
+                node.parent.children.splice(node.siblingIndex(), 1);
+            } else {
+                this.roots.splice(node.siblingIndex(), 1);
+            }
             if(node.children.length>0){
                 if(node.preSibling){//子项变成前兄弟的子项
                     for(let c of node.children){

+ 1 - 1
web/building_saas/main/html/main.html

@@ -1012,7 +1012,7 @@
                 </div>
                 <div class="modal-body">
                     <div style="height: 100px" id="modifyFeeRuleSpread"><!--sjs ID设置此div--->
-                    </div>
+                </div>
                 </div>
                 <div class="modal-footer">
                     <button type="button" class="btn btn-secondary" id="modify_feeRule_concel" data-dismiss="modal">取消</button>

+ 5 - 0
web/building_saas/main/js/models/cache_tree.js

@@ -440,6 +440,11 @@ var cacheTree = {
             var me = this;
             if(node){
                 delete me.nodes[me.prefix + node.getID()];
+                if (node.parent) {//从父项的子节点中移除
+                    node.parent.children.splice(node.siblingIndex(), 1);
+                } else {
+                    this.roots.splice(node.siblingIndex(), 1);
+                }
                 if(node.children.length>0){
                     if(node.preSibling){//子项变成前兄弟的子项
                         for(let c of node.children){

+ 35 - 2
web/building_saas/main/js/models/calc_program.js

@@ -847,9 +847,8 @@ let analyzer = {
         return rst;
     },
     getCompiledExpr: function (expression, labourCoe) {   // labourCoe 是 str 类型
-        let me = analyzer;
         let rst = expression;
-        let atIDArr = me.getAtIDArr(rst);
+        let atIDArr = analyzer.getAtIDArr(rst);
         let IDArr = atIDArr.map(function (atID) {
             return atID.slice(1);
         });
@@ -863,6 +862,22 @@ let analyzer = {
         rst = rst.replace(/L/g, labourCoe);
         return rst;
     },
+    getStatement: function (expression, template) {
+        let rst = expression;
+        let atIDArr = analyzer.getAtIDArr(rst);
+        let IDArr = atIDArr.map(function (atID) {
+            return atID.slice(1);
+        });
+        for (var i = 0; i < atIDArr.length; i++) {
+            let patt = new RegExp(atIDArr[i]);
+            let val = projectObj.project.calcProgram.compiledTemplates[template.ID].compiledCalcItems[IDArr[i]].name;
+            rst = rst.replace(patt, val);
+        };
+        rst = rst.replace(/\[/g, "");
+        rst = rst.replace(/\]/g, "");
+        rst = rst.replace(/L/g, '人工系数');
+        return rst;
+    },
 
     calcItemMaxID: function(template){
         let MaxID = 0;
@@ -916,6 +931,24 @@ let analyzer = {
         if (projectObj.project.calcProgram.compiledTemplateMaps[name])
             return true
         else return false;
+    },
+    templateIsUsed: function (ID){
+        let nodes = projectObj.project.mainTree.items;
+        for (let node of nodes){
+              if (node.data && node.data.programID && node.data.programID == ID) {
+                  return true;
+              }
+        };
+        return false;
+    },
+    fieldNameIsUsed: function(template, fieldName){
+        let fieldNameEn = projectObj.project.calcProgram.compiledFeeTypeMaps[fieldName];
+        for (let item of template.calcItems){
+              if (item.fieldName == fieldNameEn){
+                  return true;
+              }
+        };
+        return false;
     }
 };
 

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

@@ -710,7 +710,7 @@ ProjectGLJ.prototype.getQuantityPerGLJ = function (ration_glj_list,rations,ratio
     let tech_sum = 0;//技术措施总消耗量
     for(let rg of ration_glj_list){
             let tem_ration = rationMap[rg.rationID];
-            let r_quantity = scMathUtil.roundForObj(tem_ration.quantity,q_decimal);
+            let r_quantity = tem_ration?scMathUtil.roundForObj(tem_ration.quantity,q_decimal):0;
             let glj_quantity = scMathUtil.roundForObj(rg.quantity, q_decimal);
             if(!r_quantity){
                 continue;

+ 5 - 0
web/building_saas/main/js/views/calc_base_view.js

@@ -192,6 +192,10 @@ let calcBaseView = {
             let calcItem = calcProgramManage.getSelectionInfo().calcItem;
             if (calcItem.dispExprUser) {
                 me.inputExpr.val(calcItem.dispExpr);
+                if (calcItem.dispExpr == '0'){
+                    me.inputExpr.focus();
+                    me.inputExpr.select();
+                }
             }
             let bnArr = Object.keys(rationCalcBases);
             let baseArr = [];
@@ -286,6 +290,7 @@ let calcBaseView = {
                         calcItem.dispExprUser = analyzer.getDispExprUser(expr, lc);
                         calcItem.expression = analyzer.getExpression(expr, template);
                         calcItem.compiledExpr = analyzer.getCompiledExpr(calcItem.expression, lc);
+                        calcItem.statement = analyzer.getStatement(calcItem.expression, template);
 
                         let data = {
                             'projectID': projectObj.project.ID(),

+ 91 - 67
web/building_saas/main/js/views/calc_program_manage.js

@@ -33,7 +33,7 @@ let calcProgramManage = {
         ],
         view:{
             comboBox:[],
-            lockColumns:[0,1,2,5,6],
+            lockColumns:[2,5],
             colHeaderHeight: CP_Col_Width.colHeader,
             rowHeaderWidth: CP_Col_Width.rowHeader
         }
@@ -59,9 +59,8 @@ let calcProgramManage = {
         me.detailSpread.getSheet(0).getRange(-1, 4, -1, 1).cellType(fieldName);
 
         me.mainSpread.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onMainEnterCell);
-        me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.CellChanged, me.onDetailCellChanged);
-        me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.EditEnded, me.onDetailEditEnded);
-        me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
+        me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.ValueChanged, me.onDetailValueChanged);
+        me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onDetailEnterCell);
 
         let mSheet = me.mainSpread.getSheet(0);
         sheetCommonObj.showData(mSheet, me.mainSetting, me.datas);
@@ -86,49 +85,63 @@ let calcProgramManage = {
         sheetCommonObj.showData(dSheet, me.detailSetting, dData);
         me.detailSpread.resumePaint();
     },
-    onDetailEditEnded: function(sender, args) {
+    onDetailValueChanged: function(sender, args) {
         $.bootstrapLoading.start();
-
         let me = calcProgramManage;
         let editInfo= me.getSelectionInfo();
-        if (me.detailSetting.header[args.col].dataCode == 'feeRate') {
+        let curCalcItem = editInfo.calcItem;
+        let dataCode = me.detailSetting.header[args.col].dataCode;
+
+        if (dataCode == 'feeRate') {
             projectObj.project.FeeRate.updateFeeRateFromCalc(args.editingText,editInfo);
-        }
-        else {
-            if (me.detailSetting.header[args.col].dataCode == 'displayFieldName') {
-                if (editInfo.calcItem.displayFieldName == args.editingText) {
-                    $.bootstrapLoading.end();
-                    return;
-                }
-                editInfo.calcItem.fieldName = projectObj.project.calcProgram.compiledFeeTypeMaps[args.editingText];
-                editInfo.calcItem.displayFieldName = args.editingText;    // 这句不入库,仅用于切换后再切换回来时界面正确显示
-            }
-            else if (me.detailSetting.header[args.col].dataCode == 'dispExprUser'){  // 除非直接改单元格,弹窗不会走这里
-                alert(editInfo.calcItem.dispExprUser);
+            $.bootstrapLoading.end();
+            return;
+        };
+
+        if (dataCode == 'displayFieldName') {
+            if (curCalcItem.displayFieldName == args.newValue) {
+                $.bootstrapLoading.end();
+                return;
             };
 
-            let data = {
-                'projectID': projectObj.project.ID(),
-                'templatesID': editInfo.template.ID,
-                'calcItem': editInfo.calcItem
+            if (analyzer.fieldNameIsUsed(me.getSelectionInfo().template, args.newValue)){
+                let sheet = me.detailSpread.getActiveSheet();
+                sheet.suspendEvent();
+                sheet.setValue(args.row, args.col, args.oldValue);
+                sheet.resumeEvent();
+                $.bootstrapLoading.end();
+                alert(`“${args.newValue}” 已被其它行使用,不允许重复选择!`);
+                return;
             };
-            me.saveCalcItem(data, function (rst) {
-                if (rst){
-                    projectObj.project.calcProgram.calcAllNodesAndSave();
-                    $.bootstrapLoading.end();
-                }
-            });
+
+            curCalcItem.fieldName = projectObj.project.calcProgram.compiledFeeTypeMaps[args.newValue];
         }
+        else if (dataCode == 'dispExprUser'){  // 除非直接改单元格,弹窗不会走这里
+            alert('用户修改dispExprUser值,触发onDetailEditEnded事件。');
+        };
+
+        curCalcItem[dataCode] = args.newValue;
+        let data = {
+            'projectID': projectObj.project.ID(),
+            'templatesID': editInfo.template.ID,
+            'calcItem': curCalcItem
+        };
+        me.saveCalcItem(data, function (rst) {
+            if (rst){
+                projectObj.project.calcProgram.calcAllNodesAndSave();
+            }
+        });
+        $.bootstrapLoading.end();
     },
-    onEnterCell: function (sender, args) {
-        let t = calcProgramManage.getSelectionInfo().template;
-        let c = calcProgramManage.getSelectionInfo().calcItem;
-        let lc = analyzer.calcItemLabourCoe(c);
-        c.dispExpr = analyzer.getDispExpr(c.expression, t);
-        c.dispExprUser = analyzer.getDispExprUser(c.dispExpr, lc);
-        c.compiledExpr = analyzer.getCompiledExpr(c.expression, lc);
-        let e = `ID:${c.ID} ${c.expression} ${c.dispExpr} ${c.dispExprUser} ${c.compiledExpr} ${c.custom}`;
-        projectObj.testDisplay('', e);
+    onDetailEnterCell: function (sender, args) {
+        // let t = calcProgramManage.getSelectionInfo().template;
+        // let c = calcProgramManage.getSelectionInfo().calcItem;
+        // let lc = analyzer.calcItemLabourCoe(c);
+        // c.dispExpr = analyzer.getDispExpr(c.expression, t);
+        // c.dispExprUser = analyzer.getDispExprUser(c.dispExpr, lc);
+        // c.compiledExpr = analyzer.getCompiledExpr(c.expression, lc);
+        // let e = `ID:${c.ID} ${c.expression} ${c.dispExpr} ${c.dispExprUser} ${c.compiledExpr} ${c.custom}`;
+        // projectObj.testDisplay('', e);
     },
     loadMainContextMenu: function () {
         $.contextMenu({
@@ -167,11 +180,9 @@ let calcProgramManage = {
                                 calcProgramManage.buildSheet();
                                 calcProgramManage.mainSpread.getActiveSheet().setSelection(ts.length - 1, 0, 1, 1);
                                 calcProgramManage.refreshDetailSheet();
-                                // projectObj.project.calcProgram.calcAllNodesAndSave();
-                                $.bootstrapLoading.end();
                             }
-                            else $.bootstrapLoading.end();
                         });
+                        $.bootstrapLoading.end();
                     }
                 },
                 "reNameTemplate": {
@@ -214,10 +225,9 @@ let calcProgramManage = {
                             if (rst){
                                 projectObj.project.calcProgram.compileTemplate(template);
                                 sheetCommonObj.showData(calcProgramManage.mainSpread.getSheet(0), calcProgramManage.mainSetting, calcProgramManage.datas);
-                                $.bootstrapLoading.end();
                             }
-                            else $.bootstrapLoading.end();
                         });
+                        $.bootstrapLoading.end();
                     }
                 },
                 "spr1": '--------',
@@ -231,9 +241,15 @@ let calcProgramManage = {
                     },
                     callback: function () {
                         $.bootstrapLoading.start();
+                        let template = calcProgramManage.getSelectionInfo().template;
+                        if (analyzer.templateIsUsed(template.ID)) {
+                            $.bootstrapLoading.end();
+                            alert(`计算模板“${template.name}”已被使用,不允许删除!`);
+                            return;
+                        }
                         let data = {
                             'projectID': projectObj.project.ID(),
-                            'ID': calcProgramManage.getSelectionInfo().template.ID
+                            'ID': template.ID
                         };
                         calcProgramManage.deleteTemplate(data, function (rst) {
                             if (rst){
@@ -243,11 +259,9 @@ let calcProgramManage = {
                                 calcProgramManage.buildSheet();
                                 calcProgramManage.mainSpread.getActiveSheet().setSelection(idx - 1, 0, 1, 1);
                                 calcProgramManage.refreshDetailSheet();
-                                // projectObj.project.calcProgram.calcAllNodesAndSave();
-                                $.bootstrapLoading.end();
                             }
-                            else $.bootstrapLoading.end();
                         });
+                        $.bootstrapLoading.end();
                     }
                 }
             }
@@ -264,15 +278,16 @@ let calcProgramManage = {
                     name: "插入行",
                     icon: 'fa-sign-in',
                     callback: function () {
+                        $.bootstrapLoading.start();
                         let template = calcProgramManage.getSelectionInfo().template;
                         let idx = calcProgramManage.detailSpread.getActiveSheet().getActiveRowIndex();
 
                         let newItem = {};
                         newItem.ID = analyzer.calcItemMaxID(template) + 1;
-                        newItem.name = '新建';
+                        // newItem.name = '新建';
                         newItem.memo = '自定义';
                         newItem.custom = true;
-                        newItem.expression = '0';
+                        newItem.expression = '0';                           // 这里必须得有值,否则程序内部公式解析会出现诸多问题
                         template.calcItems.splice(idx + 1, 0, newItem);
                         let data = {
                             'projectID': projectObj.project.ID(),
@@ -284,10 +299,10 @@ let calcProgramManage = {
                                 projectObj.project.calcProgram.compileTemplate(template);
                                 calcProgramManage.refreshDetailSheet();
                                 calcProgramManage.detailSpread.getActiveSheet().setSelection(idx + 1, 0, 1, 1);
-                                // projectObj.project.calcProgram.calcAllNodesAndSave();
-                                $.bootstrapLoading.end();
+                                projectObj.project.calcProgram.calcAllNodesAndSave();
                             }
                         });
+                        $.bootstrapLoading.end();
                     }
                 },
                 "spr1": '--------',
@@ -295,29 +310,38 @@ let calcProgramManage = {
                     name: '删除行',
                     icon: 'fa-remove',
                     callback: function () {
+                        $.bootstrapLoading.start();
                         let template = calcProgramManage.getSelectionInfo().template;
                         let idx = calcProgramManage.detailSpread.getActiveSheet().getActiveRowIndex();
                         let item = template.calcItems[idx];
 
+                        if (item.fieldName == 'common'){
+                            $.bootstrapLoading.end();
+                            alert(`费用类别为“工程造价”的行不允许删除!`);
+                            return;
+                        };
+
                         if (analyzer.calcItemIsUsed(template, item)){
+                            $.bootstrapLoading.end();
                             alert(`第 ${idx + 1} 行“${item.name}”已被第 ${item.tempUsed + 1} 行引用,不允许删除!`);
                             delete item.tempUsed;
-                        }
-                        else{
-                            template.calcItems.splice(idx, 1);
-                            let data = {
-                                'projectID': projectObj.project.ID(),
-                                'ID': template.ID,
-                                'calcItems': template.calcItems
-                            };
-                            calcProgramManage.updateTemplate(data, function (rst) {
-                                if (rst){
-                                    projectObj.project.calcProgram.compileTemplate(template);
-                                    calcProgramManage.refreshDetailSheet();
-                                    $.bootstrapLoading.end();
-                                }
-                            });
-                        }
+                            return;
+                        };
+
+                        template.calcItems.splice(idx, 1);
+                        let data = {
+                            'projectID': projectObj.project.ID(),
+                            'ID': template.ID,
+                            'calcItems': template.calcItems
+                        };
+                        calcProgramManage.updateTemplate(data, function (rst) {
+                            if (rst){
+                                projectObj.project.calcProgram.compileTemplate(template);
+                                calcProgramManage.refreshDetailSheet();
+                                projectObj.project.calcProgram.calcAllNodesAndSave();
+                            }
+                        });
+                        $.bootstrapLoading.end();
                     }
                 }
             }

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

@@ -433,10 +433,10 @@ var projectObj = {
             }
             else {
                 if (node.sourceType === project.Bills.getSourceType()) {
-                    project.Bills.updateField(node.source, fieldName, value, true);
+                    project.Bills.updateField(node.source, fieldName, value, false);
                 }
                 else if (node.sourceType === project.Ration.getSourceType()) {
-                    project.Ration.updateField(node.source, fieldName, value, true);
+                    project.Ration.updateField(node.source, fieldName, value);
                 };
 
                 if (colSetting.data.wordWrap) {
@@ -1536,11 +1536,12 @@ function changeMapToArray(map) {
 
 $('#deleteY').click(function () { //正常删除,级联删除子项
     let project = projectObj.project;
-    if(isSingleSelect()){
-        project.Bills.deleteSelectedNode();
+    project.Bills.deleteSelectedNodes();
+    /*if(isSingleSelect()){
+        project.Bills.deleteSelectedNode();//这个方法不用了,会出现异步删除干净的问题
     }else {
         project.Bills.deleteSelectedNodes();
-    }
+    }*/
 });
 
 $('#deleteN').click(function () {//不删除子项

+ 7 - 5
web/building_saas/pm/html/project-management.html

@@ -62,7 +62,7 @@
                         </div>
                     </div>
                     <ul class="nav nav-pills flex-column">
-                        <li class="nav-item">
+                        <li class="nav-item" data-toggle="tooltip" data-placement="right" data-original-title="全部">
                             <a class="nav-link active" href="#pm_all" role="tab" id="tab_pm_all" data-toggle="tab" data-placement="right" data-original-title="全部"><i class="fa fa-bars"></i></a>
                         </li>
                         <li class="nav-item">
@@ -77,7 +77,7 @@
                         <li class="nav-item">
                             <a class="nav-link" href="#"  data-toggle="tooltip" data-placement="right" data-original-title="归档"><i class="fa fa-book"></i></a>
                         </li>
-                        <li class="nav-item">
+                        <li class="nav-item" data-toggle="tooltip" data-placement="right" data-original-title="回收站">
                             <a class="nav-link" href="#pm_gc" id="tab_pm_gc" data-toggle="tab" data-placement="right" data-original-title="回收站"><i class="fa fa-trash"></i></a>
                         </li>
                     </ul>
@@ -443,7 +443,7 @@
 </div>
 <!--弹出复制到-->
 <div class="modal fade" id="copy-to-dialog" data-backdrop="static">
-    <div class="modal-dialog" role="document">
+    <div class="modal-dialog" style="max-width: 650px" role="document">
         <div class="modal-content">
             <div class="modal-header">
                 <h5 class="modal-title">复制到...</h5>
@@ -452,11 +452,13 @@
                 </button>
             </div>
             <div class="modal-body">
-                <ul id="treeDemo2" class="ztree"></ul>
+               <!-- <ul id="treeDemo2" class="ztree"></ul>-->
+                <div style="height: 500px" id="copyToSpread"><!--sjs ID设置此div--->
+                </div>
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                <a href="javacript:void(0);" class="btn btn-primary" id="copy-to-confirm">确定</a>
+                <a href="javacript:void(0);" class="btn btn-primary disabled" id="copy-to-confirm" >确定</a>
             </div>
         </div>
     </div>

+ 0 - 33
web/building_saas/pm/js/pm_ajax.js

@@ -87,39 +87,6 @@ var BeforeOpenProject = function (projId, updateData, callback) {
     });
 }
 
-var CommonAjax = {
-    get: function (url, data, cb, dataType) {
-        $.get(url, data, cb, dataType)
-    },
-    post: function (url, data, successCallback, errorCallback) {
-        $.ajax({
-            type: "POST",
-            url: url,
-            data: {'data': JSON.stringify(data)},
-            dataType: 'json',
-            cache: false,
-            timeout: 50000,
-            success: function (result) {
-                if (result.error === 0) {
-                    if (successCallback) {
-                        successCallback(result.data);
-                    }
-                } else {
-                    alert('error: ' + result.message);
-                    if (errorCallback) {
-                        errorCallback();
-                    }
-                }
-            },
-            error: function (jqXHR, textStatus, errorThrown) {
-                alert('url: ' + url + ' error ' + textStatus + " " + errorThrown);
-                if (errorCallback) {
-                    errorCallback();
-                }
-            }
-        });
-    }
-}
 
 function moveProjects(data,callback) {
     CommonAjax.post( '/pm/api/moveProject',data,callback)

+ 222 - 150
web/building_saas/pm/js/pm_newMain.js

@@ -27,6 +27,8 @@ let fileType = {
 const projTreeObj = {
     tree: null,
     workBook: null,
+    copyToWorkBook:null,
+    copySelected:null,
     preSelection: null,
     setting: {
         tree: {
@@ -58,6 +60,24 @@ const projTreeObj = {
             showDragDropTip:false
         }
     },
+    copyToSetting:{
+        header: [
+            {name: '工程列表', dataCode: 'name', width: 550, vAlign: 'center', hAlign: 'left'}
+        ],
+        //选中行颜色
+        style: {
+            defalutBackColor: 'White',
+            selectedColor: '#BBFFFF'
+        },
+        options: {
+            tabStripVisible:  false,
+            allowCopyPasteExcelStyle : false,
+            allowExtendPasteRange: false,
+            allowUserDragDrop : false,
+            allowUserDragFill: false,
+            scrollbarMaxAlign : true,
+            showDragDropTip:false
+        }},
     renderSheetFuc: function (sheet, fuc) {
         sheet.suspendPaint();
         sheet.suspendEvent();
@@ -96,13 +116,15 @@ const projTreeObj = {
         };
         me.renderSheetFuc(sheet, fuc);
     },
-    buildSheet: function () {
-        if(!this.workBook){
-            this.workBook = new GC.Spread.Sheets.Workbook($('#projSpread')[0], {sheetCount: 1});
-            this.setOptions(this.workBook, this.setting.options);
-            this.buildHeader(this.workBook.getActiveSheet(), this.setting.header);
-            this.bindEvent(this.workBook);
-        }
+    buildSheet: function (workBook,spreadID,setting) {//改成和复制项目spread共用
+        let newWorkBook = workBook;
+        if(!workBook){
+            newWorkBook = new GC.Spread.Sheets.Workbook($('#'+spreadID)[0], {sheetCount: 1});
+            this.setOptions(newWorkBook, setting.options);
+            this.buildHeader(newWorkBook.getActiveSheet(), setting.header);
+            this.bindEvent(newWorkBook);
+        }
+        return newWorkBook;
     },
     getSelStyle: function (backColor) {
         let style = new GC.Spread.Sheets.Style();
@@ -114,9 +136,9 @@ const projTreeObj = {
         return style;
     },
     //设置选中行底色
-    setSelStyle: function (sel, backColor) {
+    setSelStyle: function (sel, backColor,sheet) {
         let me = this;
-        let sheet = me.workBook.getSheet(0);
+        //let sheet = me.workBook.getSheet(0);
         me.renderSheetFuc(sheet, function () {
             let style = me.getSelStyle(backColor);
             /*sel.row = sel.row === -1 ? 0 : sel.row;*/
@@ -126,19 +148,30 @@ const projTreeObj = {
             }
         });
     },
-    initSelection: function (newSel, oldSel = null) {
+    initSelection: function (newSel, oldSel = null,sheet) {
         let me = this;
         let node = me.tree.items[newSel.row];
         //恢复底色
         if(oldSel){
-            me.setSelStyle(oldSel, me.setting.style.defalutBackColor);
+            me.setSelStyle(oldSel, me.setting.style.defalutBackColor,sheet);
         }
         //设置选中行底色
         if(newSel){
-            me.setSelStyle(newSel, me.setting.style.selectedColor);
+            me.setSelStyle(newSel, me.setting.style.selectedColor,sheet);
+        }
+        if(sheet.name()=="copyToSheet"){ //复制到
+            me.copySelected = node;
+            let canCopy = false;
+            if(node){
+                canCopy = node.data.projType == projectType.tender|| node.data.projType == projectType.engineering;
+            }
+            canCopy == true?$("#copy-to-confirm").removeClass("disabled"):$("#copy-to-confirm").addClass("disabled");
+            return;//如果是复制到表,不用做后面的操作
         }
         me.tree.selected = node;
         me.preSelection = newSel;
+        console.log("set main tree selected");
+        console.log(me.tree.selected);
         $(".tools-btn > a").not(".disabled").addClass("disabled");
         $("#add-engineering-btn").addClass("disabled");
         $('#add-tender-btn').removeClass('disabled');
@@ -171,7 +204,7 @@ const projTreeObj = {
     },
     onSelectionChanging: function (sender, args) {
         let me = projTreeObj;
-        me.initSelection(args.newSelections[0], args.oldSelections[0]);
+        me.initSelection(args.newSelections[0], args.oldSelections[0],args.sheet);
     },
     onDragDropBlock : function (sender,args) {//拖动移动项目位置
         let selected = projTreeObj.tree.selected;
@@ -180,6 +213,9 @@ const projTreeObj = {
         let rootProjectID = null;//记录建设项目ID
         //let updateObj = {project:[],feeRateFile:[],unitPriceFile:[]};
         args.cancel = true;//首先取消填充的动作
+        if(args.sheet.name()=="copyToSheet"){ //如果是复制到表,不用做后面的操作
+            return;
+        }
         if(selected.preSibling()!=null&&selected.preSibling() == targetNode){
             return;
         }
@@ -490,21 +526,23 @@ const projTreeObj = {
             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
         };
         TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
-            return {
-                x: x,
-                y: y,
-                row: context.row,
-                col: context.col,
-                cellStyle: cellStyle,
-                cellRect: cellRect,
-                sheetArea: context.sheetArea,
-                isReservedLocation: true
-            };
+            let info = {x: x, y: y, row: context.row, col: context.col, cellStyle: cellStyle, cellRect: cellRect, sheetArea: context.sheetArea};
+            let node = tree.items[info.row];
+            let offset = -1;
+            let centerX = info.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
+            let text = context.sheet.getText(info.row, info.col);
+            let value = context.sheet.getValue(info.row, info.col);
+            let acStyle = context.sheet.getActualStyle(info.row, info.col),
+                zoom = context.sheet.zoom();
+            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: context.sheet, row: info.row, col: info.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
+            if(info.x > centerX + halfBoxLength && info.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength){
+                info.isReservedLocation = true;
+            }
+            return info;
         };
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
             let offset = -1;
             let node = tree.items[hitinfo.row];
-            tree.selected = node;
             let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
             let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
             let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
@@ -516,40 +554,41 @@ const projTreeObj = {
             function withingClickArea(){
                 return hitinfo.x > centerX + halfBoxLength && hitinfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength;
             }
-            //建设项目,侧滑汇总
-            if(node.data.projType === projectType.project && withingClickArea()){
-                setDataToSideBar();
-                $(".slide-sidebar").animate({width:"800"}).addClass("open");
-                $('body').unbind('click');
-                setTimeout(function () {
-                    $("body").bind('click', function (event) {
-                        var e = event || window.event; //浏览器兼容性
-                        if (!$(event.target).is('a')) {
-                            var elem = event.target || e.srcElement;
-                            while (elem) { //循环判断至跟节点,防止点击的是div子元素
-                                if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
-                                    return false;
+            if(hitinfo.sheet.name() != "copyToSheet"){//如果是复制到sheet,不用执行
+                //建设项目,侧滑汇总
+                if(node.data.projType === projectType.project && withingClickArea()){
+                    setDataToSideBar();
+                    $(".slide-sidebar").animate({width:"800"}).addClass("open");
+                    $('body').unbind('click');
+                    setTimeout(function () {
+                        $("body").bind('click', function (event) {
+                            var e = event || window.event; //浏览器兼容性
+                            if (!$(event.target).is('a')) {
+                                var elem = event.target || e.srcElement;
+                                while (elem) { //循环判断至跟节点,防止点击的是div子元素
+                                    if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
+                                        return false;
+                                    }
+                                    elem = elem.parentNode;
                                 }
-                                elem = elem.parentNode;
+                                $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
                             }
-                            $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
-                        }
-                    });
-                }, 500);
-            }
-            //单项文件,进入造价书界面
-            else if(node.data.projType === projectType.tender && withingClickArea()){
-                let newTab = window.open('about:blank');
-                BeforeOpenProject(node.data.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
-                    let mainUrl = `/main?project=${node.data.ID}`;
-                    CommonAjax.get(mainUrl, [], function () {
-                        newTab.location.href = mainUrl;
+                        });
+                    }, 500);
+                }
+                //单项文件,进入造价书界面
+                else if(node.data.projType === projectType.tender && withingClickArea()){
+                    let newTab = window.open('about:blank');
+                    BeforeOpenProject(node.data.ID, {'fullFolder': GetFullFolder(node.parent)}, function () {
+                        let mainUrl = `/main?project=${node.data.ID}`;
+                        CommonAjax.get(mainUrl, [], function () {
+                            newTab.location.href = mainUrl;
+                        });
                     });
-                });
-                return;
+                    return;
+                }
+                if (!node || node.children.length === 0) { return; }
             }
-            if (!node || node.children.length === 0) { return; }
-
             if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
                 node.setExpanded(!node.expanded);
                 TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
@@ -569,15 +608,7 @@ const projTreeObj = {
             let canvasId = div.id + "vp_vp";
             let canvas = $(`#${canvasId}`)[0];
             //改变鼠标图案
-            let node = tree.items[hitInfo.row];
-            let offset = -1;
-            let centerX = hitInfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
-            let text = hitInfo.sheet.getText(hitInfo.row, hitInfo.col);
-            let value = hitInfo.sheet.getValue(hitInfo.row, hitInfo.col);
-            let acStyle = hitInfo.sheet.getActualStyle(hitInfo.row, hitInfo.col),
-                zoom = hitInfo.sheet.zoom();
-            let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitInfo.sheet, row: hitInfo.row, col: hitInfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
-            if (sheet && hitInfo.x > centerX + halfBoxLength && hitInfo.x < centerX + halfBoxLength + imgWidth + indent/2+3 + textLength) {
+            if (sheet && hitInfo.isReservedLocation) {
                 canvas.style.cursor='pointer';
                 return true;
             }else{
@@ -587,8 +618,8 @@ const projTreeObj = {
         };
         return new TreeNodeCellType();
     },
-    setCellValue: function (cell, node) {
-        const sheet = this.workBook.getActiveSheet();
+    setCellValue: function (cell, node,sheet) {
+        //const sheet = this.workBook.getActiveSheet();
         const {row, col} = cell;
         let dataCode = this.setting.header[col]['dataCode'];
         let value = '';
@@ -615,10 +646,11 @@ const projTreeObj = {
         }
         sheet.setValue(row, col, value);
     },
-    showTreeData: function (nodes, headers) {
+    showTreeData: function (nodes, headers,sheet) {
         let me = this;
-        let sheet = me.workBook.getActiveSheet();
+       // let sheet = me.workBook.getActiveSheet(); 为了共用
         let fuc = function(){
+            sheet.setRowCount(0);
             sheet.setRowCount(nodes.length);
             for(let i = 0; i < nodes.length; i++){
                 let treeNodeCell = me.getTreeNodeCell(me.tree);
@@ -626,7 +658,7 @@ const projTreeObj = {
                 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']]);
-                    me.setCellValue({row: i, col: j}, nodes[i]);
+                    me.setCellValue({row: i, col: j}, nodes[i],sheet);
                     let dataCode = headers[j].dataCode;
                     //sheet.setValue(i, j, nodes[i]['data'][dataCode]);
                 }
@@ -643,16 +675,16 @@ const projTreeObj = {
 
             if(_.isArray(nodes)){
                 for(let t of nodes){
-                    setSheetCellData(t);
+                    setSheetCellData(t,sheet);
                 }
             }else {
-                setSheetCellData(nodes);
+                setSheetCellData(nodes,sheet);
             }
         });
-        function setSheetCellData(n) {
+        function setSheetCellData(n,sheet) {
             let rIdx = me.tree.items.indexOf(n);
             for(let i = 0; i < header.length; i++){
-                me.setCellValue({row: rIdx, col: i}, n);
+                me.setCellValue({row: rIdx, col: i}, n,sheet);
             }
         }
 
@@ -697,11 +729,22 @@ const projTreeObj = {
         }
 
     },
+    initCopyToSpread:function () {
+        let me = this;
+        me.copyToWorkBook =  projTreeObj.buildSheet(me.copyToWorkBook,'copyToSpread',me.copyToSetting);
+        let sheet = me.copyToWorkBook.getActiveSheet();
+        sheet.options.isProtected = true;
+        sheet.name('copyToSheet');
+        me.showTreeData(me.tree.items, me.copyToSetting.header, sheet);
+        me.copySelected = null;
+        let initSel = sheet.getSelections()[0] ? sheet.getSelections()[0] : {row: 0, rowCount: 1};
+        projTreeObj.initSelection(initSel,null,sheet);
+    },
     insert: function (data, parent, next) {
         let node = this.tree.addNodeData(data, parent, next);
         this.addRow(node);
         let newSel = this.workBook.getSheet(0).getSelections()[0];
-        this.initSelection(newSel, this.preSelection);
+        this.initSelection(newSel, this.preSelection,this.workBook.getActiveSheet());
         return node;
     },
     addRow: function (node) {
@@ -728,7 +771,7 @@ const projTreeObj = {
         me.renderSheetFuc(sheet, function () {
             sheet.deleteRows(rIdx, count);
             sheet.setRowCount(me.tree.items.length);
-            me.initSelection({row: sheet.getActiveRowIndex(), rowCount: 1});
+            me.initSelection({row: sheet.getActiveRowIndex(), rowCount: 1},null,sheet);
         });
     },
     move: function (orgRow, newRow) {
@@ -753,7 +796,7 @@ const projTreeObj = {
             sheet.deleteRows(fromRow, rCout);
             sheet.addRows(newNode.serialNo(),rCout);
             let oldSelection = sheet.getSelections()[0];
-            me.initSelection({row: newNode.serialNo(), rowCount: oldSelection.rowCount}, oldSelection);
+            me.initSelection({row: newNode.serialNo(), rowCount: oldSelection.rowCount}, oldSelection,sheet);
             sheet.setSelection(newNode.serialNo(),oldSelection.col,oldSelection.rowCount,oldSelection.colCount);
             let children = newNode.getAllChildren();
             children.push(newNode);
@@ -1091,84 +1134,113 @@ $(document).ready(function() {
         $('#copy-to-dialog').modal('show');
     });
     // 复制到弹层替换
-    $('#copy-to-dialog').on('show.bs.modal', function () {
+  /*  $('#copy-to-dialog').on('show.bs.modal', function () {
         copytoZTree = ConvertTreeToZtree(projTreeObj.tree, $('#treeDemo2'), null);
+    });*/
+
+    $('#copy-to-dialog').on('shown.bs.modal', function () {
+        console.log('shown copy to ');
+        projTreeObj.initCopyToSpread();
+       // copytoZTree = ConvertTreeToZtree(projTreeObj.tree, $('#treeDemo2'), null);
     });
 
     // 复制到操作
     $("#copy-to-confirm").click(function() {
-        let dialog = $('#copy-to-dialog');
-        let target = GetTargetTreeNode($.fn.zTree.getZTreeObj('treeDemo2'));
-        let parent = null;
-        let next = null;
-        let pre = null;
-        let cur = projTreeObj.tree.selected;
-        if (!target) {
-            return false;
-        }
-        if (target.data.projType !== projectType.engineering) {
-            alert("请移动到单项工程中!");
-            return false;
-        }
-        if (target.data.projType !== projectType.tender && target.children.length !== 0 &&
-            target.firstChild().data.projType !== projectType.tender) {
-            dialog.modal('hide');
-        }
-
-        // 判断同级是否有同名
-        if (target.children.length > 0) {
-            for (let tmp in target.children) {
-                if (tmp === 0) {
-                    continue;
-                }
-                if (target.children[tmp].data.name === cur.data.name) {
-                    alert("对应单项工程中存在同名数据!");
-                    return false;
-                }
-            }
-        }
+        let originalNode = projTreeObj.tree.selected;
+        let toNode = projTreeObj.copySelected;
+        let parent = null,next = null;
+        if(toNode.data.projType == projectType.engineering){//复制为目标的子节点
+            parent = toNode;
+            next = toNode.nextSibling;
+        }else if(toNode.data.projType == projectType.tender){//复制为目标的后兄弟
+            
+        }
+
+/*        tem_parent = target;
+        tem_next = target.firstChild();
+        tem_parent = target.parent;
+        tem_next = target.nextSibling;*/
+
+
+        console.log(originalNode);
+        console.log(toNode);
+        CommonAjax.post('/pm/api/copyProjects',{ID:'test',user_id: userID},function () {
+            
+        })
+        
+     /*   let dialog = $('#copy-to-dialog');
+         let target = GetTargetTreeNode($.fn.zTree.getZTreeObj('treeDemo2'));
+         let parent = null;
+         let next = null;
+         let pre = null;
+         let cur = projTreeObj.tree.selected;
+         if (!target) {
+         return false;
+         }
+         if (target.data.projType !== projectType.engineering) {
+         alert("请移动到单项工程中!");
+         return false;
+         }
+         if (target.data.projType !== projectType.tender && target.children.length !== 0 &&
+         target.firstChild().data.projType !== projectType.tender) {
+         dialog.modal('hide');
+         }
+
+         // 判断同级是否有同名
+         if (target.children.length > 0) {
+         for (let tmp in target.children) {
+         if (tmp === 0) {
+         continue;
+         }
+         if (target.children[tmp].data.name === cur.data.name) {
+         alert("对应单项工程中存在同名数据!");
+         return false;
+         }
+         }
+         }
+
+         if (target.data.projType === projectType.tender) {
+         parent = target.parent;
+         next = target.nextSibling;
+         } else {
+         parent = target;
+         next = target.firstChild();
+         }
+
+         if (parent !== cur.parent || (next !== cur && next !== cur.nextSibling)){
+         CommonAjax.post('/pm/api/getNewProjectID', {count: 1, user_id: userID}, function (IDs) {
+         let typeInfo = {
+         updateType: 'copy',
+         projType: cur.data.projectType
+         };
+         let updateData = GetUpdateData(null, parent, next, cur.data.name, cur.data.property, IDs.lowID, typeInfo);
+         updateData.forEach(function (data) {
+         if (data.updateType === 'copy') {
+         data['srcProjectId'] = cur.id();
+         }
+         });
+         pre = GetNeedUpdatePreNode(parent, next);
+         if (pre) {
+         updateData = {};
+         updateData['updateType'] = 'update';
+         updateData['updateData'] = {};
+         updateData['updateData'][projTreeObj.tree.setting.tree.id] = pre.id();
+         updateData['updateData'][projTreeObj.tree.setting.tree.nid] = projTreeObj.tree.maxNodeId() + 1;
+         }
+         projTreeObj.tree.maxNodeId(IDs.lowID - 1);
+         CommonAjax.post('/pm/api/copyProjects', {updateData: updateData, user_id: userID}, function (data) {
+         dialog.modal('hide');
+         data.forEach(function (nodeData) {
+         if (nodeData.updateType === 'copy') {
+         projTreeObj.insert(nodeData.updateData, parent, next);
+         }
+         });
+         }, function () {
+         dialog.modal('hide');
+         });
+         });
+         }*/
 
-        if (target.data.projType === projectType.tender) {
-            parent = target.parent;
-            next = target.nextSibling;
-        } else {
-            parent = target;
-            next = target.firstChild();
-        }
-
-        if (parent !== cur.parent || (next !== cur && next !== cur.nextSibling)){
-            CommonAjax.post('/pm/api/getNewProjectID', {count: 1, user_id: userID}, function (IDs) {
-                let typeInfo = {
-                    updateType: 'copy',
-                    projType: cur.data.projectType
-                };
-                let updateData = GetUpdateData(null, parent, next, cur.data.name, cur.data.property, IDs.lowID, typeInfo);
-                updateData.forEach(function (data) {
-                    if (data.updateType === 'copy') {
-                        data['srcProjectId'] = cur.id();
-                    }
-                });
-                pre = GetNeedUpdatePreNode(parent, next);
-                if (pre) {
-                    updateData = {};
-                    updateData['updateType'] = 'update';
-                    updateData['updateData'] = {};
-                    updateData['updateData'][projTreeObj.tree.setting.tree.id] = pre.id();
-                    updateData['updateData'][projTreeObj.tree.setting.tree.nid] = projTreeObj.tree.maxNodeId() + 1;
-                }
-                projTreeObj.tree.maxNodeId(IDs.lowID - 1);
-                CommonAjax.post('/pm/api/copyProjects', {updateData: updateData, user_id: userID}, function (data) {
-                    dialog.modal('hide');
-                    data.forEach(function (nodeData) {
-                        if (nodeData.updateType === 'copy') {
-                            projTreeObj.insert(nodeData.updateData, parent, next);
-                        }
-                    });
-                }, function () {
-                    dialog.modal('hide');
-                });
-            });
-        }
     });
 
     // 选择工程专业后动态更改费率文件等数据
@@ -1212,12 +1284,12 @@ function init() {
        // projTreeObj.getShowData(datas);
         projTreeObj.tree = pmTree.createNew(projTreeObj.setting, datas);
         projTreeObj.tree.selected = projTreeObj.tree.items[0];
-        projTreeObj.buildSheet();
+        projTreeObj.workBook = projTreeObj.buildSheet(projTreeObj.workBook,'projSpread',projTreeObj.setting);
         projTreeObj.sumEngineeringCost();
-        projTreeObj.showTreeData(projTreeObj.tree.items, projTreeObj.setting.header);
+        projTreeObj.showTreeData(projTreeObj.tree.items, projTreeObj.setting.header, projTreeObj.workBook.getActiveSheet());
         //初始选择
         let initSel = projTreeObj.workBook.getSheet(0).getSelections()[0] ? projTreeObj.workBook.getSheet(0).getSelections()[0] : {row: 0, rowCount: 1};
-        projTreeObj.initSelection(initSel);
+        projTreeObj.initSelection(initSel,null,projTreeObj.workBook.getActiveSheet());
         $.bootstrapLoading.end();
     });
     engineering = engineeringList !== null && engineeringList !== undefined ? JSON.parse(engineeringList) : [];