Bläddra i källkod

特征及内容

zhongzewei 8 år sedan
förälder
incheckning
e4e6134841

+ 9 - 0
modules/main/controllers/bills_controller.js

@@ -39,6 +39,15 @@ module.exports = {
                 callback(req, res, err, message, null);
             }
         });
+    },
+    //zhong 2017-9-1
+    updateCharacterContent: function (req, res) {
+        let billId = req.body.billId,
+            updateObj = JSON.parse(req.body.updateObj),
+            txtObj = JSON.parse(req.body.txtObj);
+        billsData.updateCharacterContent(billId, updateObj, txtObj, function (err, message) {
+            callback(req, res, err, message, null);
+        });
     }
 
 };

+ 18 - 2
modules/main/models/bills.js

@@ -43,8 +43,8 @@ let billsSchema = new Schema({
     tenderTargetPrice: String, // Decimal
     tenderTargetUnitPrice: String, // Decimal
     tenderTargetUnitPrice: String, // Decimal
-    //工作内容
-    jobContentText: String, //清单工作内容列显示文本, 减少第一次拉时的循环次数
+    //工作内容//zhong 2017-8-31
+    jobContentText: String, //清单工作内容列显示文本, 减少第一次拉数据时的循环次数
     jobContent: [subSchema.jobContentSchema],
     //项目特征
     itemCharacterText: String,//清单项目特征列显示文本
@@ -114,6 +114,22 @@ class billsModel extends baseModel {
             callback(0, '', {lowID: lowID, highID: highID});
         });
     };
+    //zhong 2017-9-1
+    updateCharacterContent(billId, updateObj, txtObj) {
+        let updateSet = {};
+        updateSet[updateObj.field] = updateObj.updateArr;
+        if(txtObj && typeof txtObj !== 'undefined'){
+            updateSet[txtObj.field] = txtObj.text;
+        }
+       bills.update({ID: billId}, updateSet, function (err) {
+           if(err){
+               callback(1, '更新失败');
+           }
+           else{
+               callback(0, '更新成功');
+           }
+       });
+    };
 };
 
 module.exports = new billsModel();

+ 1 - 0
modules/main/routes/bills_route.js

@@ -9,6 +9,7 @@ module.exports = function (app) {
     billsRouter.post('/getData', billsController.getData);
     billsRouter.post('/getItemTemplate', billsController.getItemTemplate);
     billsRouter.post('/allocIDs', billsController.allocIDs);
+    billsRouter.post('/updateCharacterContent', billsController.updateCharacterContent)//特征及内容更新 zhong 2017-9-1
     app.use('/bills', billsRouter);
 };
 

+ 215 - 82
web/building_saas/main/js/views/character_content_view.js

@@ -2,6 +2,7 @@
  * Created by Zhong on 2017/8/31.
  * 特征及内容
  */
+//todo:清单库相关联的操作
 let contentOprObj = {
     workBook: null,
     currentCache: [],//按照serialNo排序
@@ -64,7 +65,8 @@ let contentOprObj = {
             me.refreshColData = true;
             contentTxt = me.getColData(me.currentCache);
         }
-        me.updateContent(me.currentCache, contentTxt);
+        let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
+        pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
     },
     downMove: function (rowIdx) {
         let me = contentOprObj;
@@ -79,7 +81,8 @@ let contentOprObj = {
             me.refreshColData = true;
             contentTxt = me.getColData(me.currentCache);
         }
-        me.updateContent(me.currentCache, contentTxt);
+        let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
+        pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
     },
     deleteContent: function (rowIdx) {
         let me = contentOprObj;
@@ -90,7 +93,8 @@ let contentOprObj = {
             me.refreshColData = true;
             contentTxt = me.getColData(me.currentCache);
         }
-        me.updateContent(me.currentCache, contentTxt);
+        let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
+        pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
     },
     //只有空行时才可以输入,即是新增时用,新增的空行只有输入了值,才保存
     onEditEnded: function (sender, args) {
@@ -98,14 +102,14 @@ let contentOprObj = {
         let preObj = me.currentCache.length > 0 ?  me.currentCache[me.currentCache.length - 1] : null;
         let contentTxt;
         if(args.editingText.toString().trim().length > 0){
-            let newObj = {content: args.editingText, isChecked: args.sheet.getValue(args.row, 1)};
+            let newObj = {content: args.editingText, isChecked: false};
             newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
             me.currentCache.push(newObj);
-            if(newObj.isChecked === true){//可能编辑内容前就打勾
+            /*if(newObj.isChecked === true){//可能编辑内容前就打勾
                 me.refreshColData = true;
                 contentTxt = me.getColData(me.currentCache);
-            }
-            me.updateContent(me.currentCache, contentTxt);
+            }*/
+            pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, null, contentOprObj);
         }
     },
     //复选框控制输出
@@ -119,9 +123,15 @@ let contentOprObj = {
             me.currentCache[args.row].isChecked = isChecked;
             me.refreshColData = true;
             contentTxt = me.getColData(me.currentCache);
-            me.updateContent(me.currentCache, contentTxt);
+            let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
+            pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
         }
         //else的情况就是新增
+        else{
+
+            //还没数据清空复选框
+            args.sheet.setValue(args.row, args.col, 0);
+        }
     },
     sortCache: function (cacheArr) {
         cacheArr.sort(function (a, b) {
@@ -135,24 +145,6 @@ let contentOprObj = {
             return rst;
         });
     },
-    updateContent: function (billId, updateArr, contentTxt) {
-        let me = contentOprObj;
-        $.ajax({
-            type: 'post',
-            url: '',
-            dataType: 'json',
-            data: {billId: billId, updateArr: updateArr, contentTxt: contentTxt},
-            success: function (result) {
-                if(!result.error){
-                    me.showContentData(me.workBook.getSheet(0), me.setting, me.currentCache);//刷新jobSpread
-                    if(me.refreshColData){
-                       // mainSheet.setvalue(contentTxt); //刷新输出显示
-                        me.refreshColData = false;
-                    }
-                }
-            }
-        });
-    },
     onContextmenuOpr: function () {//右键菜单
         let me = contentOprObj;
         $.contextMenu({
@@ -187,16 +179,18 @@ let contentOprObj = {
                         callback: function(){},
                         items: {
                             "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
+                                //插入空行
+                                me.workBook.getSheet(0).addRows(me.workBook.getSheet(0).getRowCount(), 1);
                             }},
                             "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
-                                //删除
-                                let deleteObj = me.currentCache[target.row];
+                                me.deleteContent(target.row);
                             }},
                             "upMove": {name: "上移", disabled: upDis, icon: "fa-arrow-up", callback: function (key, opt) {
+                                me.upMove(target.row);
 
                             }},
                             "downMove": {name: "下移", disabled: downDis, icon: "fa-arrow-down", callback: function (key, opt) {
-
+                                me.downMove(target.row);
                             }}
                         }
                     };
@@ -216,7 +210,7 @@ let characterOprObj = {
     setting: {
         header: [
             {headerName:"项目特征",headerWidth:160,dataCode:"character", dataType: "String", hAlign: "center", vAlign: "center"},
-            {headerName:"特征值",headerWidth:160,dataCode:"eigenvalue", dataType: "String", hAlign: "center", vAlign: "center"},
+            {headerName:"特征值",headerWidth:160,dataCode:"eigenvalue", dataType: "String", cellType: "comboBox", hAlign: "center", vAlign: "center"},
             {headerName:"输出",headerWidth:80,dataCode:"isChecked", cellType:"checkBox", hAlign: "center", vAlign: "center"}
         ]
     },
@@ -225,21 +219,37 @@ let characterOprObj = {
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.onContextmenuOpr();
-        //me.workBook.getSheet(0).setFormatter(-1, 0, "@", GC.Spread.Sheets.SheetArea.viewport);
-        //me.workBook.getSheet(0).options.isProtected = true;
-        //sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
     },
     //显示在itemSpread的数据
     showCharacterData: function (sheet, setting, datas) {
+        let me = characterOprObj;
         sheetCommonObj.showData(sheet, setting, datas);
         sheet.suspendPaint();
         sheet.suspendEvent();
         for(let i = 0, len = datas.length; i < len; i++){
+            let comboObj = me.getComboBox(datas[i]);
+            comboObj.combo.editable(false);//不可编辑
+            sheet.getCell(i, 1).cellType(comboObj.combo).value(typeof comboObj.selectedValue !== 'undefined' ? comboObj.selectedValue : '');
             sheet.getCell(i, 0).locked(true);
         }
         sheet.resumePaint();
         sheet.suspendEvent();
     },
+    //获得项目特征特征值comboBox
+    getComboBox: function (characterItem) {
+        let rst;
+        let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
+        let comboItems = [], eigenvalues = characterItem.eigenvalue;
+        for(let i = 0, len = eigenvalues.length; i < len; i++){
+            comboItems.push(eigenvalues[i].value);
+            if(eigenvalues[i].isSelected){
+                rst.selectedValue = eigenvalues[i].value;
+            }
+        }
+        combo.items(comboItems);
+        rst.combo = combo;
+        return rst;
+    },
     //显示到清单项目特征列的数据
     getColData: function (itemsArr) {
         let me = characterOprObj;
@@ -250,7 +260,7 @@ let characterOprObj = {
                 let eigenvalueStr = "";
                 let eigenvalue = itemsArr[i].eigenvalue;
                 for(let j = 0, vLen = eigenvalue.length; j < vLen; j++){
-                    if(eigenvalue[j].isSelected === true){
+                    if(eigenvalue[j].isSelected){
                         eigenvalueStr += eigenvalue[j].value;
                         break;
                     }
@@ -285,7 +295,8 @@ let characterOprObj = {
             me.refreshColData = true;
             characterTxt = me.getColData(me.currentCache);
         }
-        me.updateCharacter(me.currentCache, characterTxt);
+        let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
+        pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
     },
     downMove: function (rowIdx) {
         let me = characterOprObj;
@@ -300,9 +311,10 @@ let characterOprObj = {
             me.refreshColData = true;
             characterTxt = me.getColData(me.currentCache);
         }
-        me.updateCharacter(me.currentCache, characterTxt);
+        let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
+        pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
     },
-    deleteContent: function (rowIdx) {
+    deleteCharacter: function (rowIdx) {
         let me = characterOprObj, characterTxt;
         let deleteObj = me.currentCache[rowIdx];
         me.currentCache.splice(rowIdx, 1);
@@ -310,21 +322,80 @@ let characterOprObj = {
             me.refreshColData = true;
             characterTxt = me.getColData(me.currentCache);
         }
-        me.updateCharacter(me.currentCache, characterTxt);
+        let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
+        pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
     },
-    //只有空行时才可以输入,即是新增时用,新增的空行只有输入了值,才保存
-    onEditEnded: function (sender, args) {
+    onEditStart: function (sender, args) {
+        let me = characterOprObj;
+        if(args.col === 1){//改变选择的特征值
+            let selectedValue = args.sheet.getValue(args.row, 1);
+            if(selectedValue.toString().trim().length > 0){//当前有选择
+                me.currentSelectedValue = selectedValue;
+            }
+            else{
+                me.currentSelectedValue = null;
+            }
+        }
+    },
+    onEnterCell: function (sender, args) {
+        let me = characterOprObj;
+        if(me.addRow && me.addRow !== args.row && typeof me.currentCache[me.addRow] !== 'undefined'){//新增空行后,当编辑完空行后保存
+            pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, null, characterOprObj);
+        }
+    },
+    onEditEnded: function (sender, args) {//新增保存逻辑:勾选了复选框或者离开当前编辑行
         let me = characterOprObj, characterTxt;
-        let preObj = me.currentCache.length > 0 ?  me.currentCache[me.currentCache.length - 1] : null;
-        if(args.editingText.toString().trim().length > 0){
-            let newObj = {content: args.editingText, isChecked: args.sheet.getValue(args.row, 1)};
-            newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
-            me.currentCache.push(newObj);
-            if(newObj.isChecked === true){//可能编辑内容前就打勾
-                me.refreshColData = true;
-                characterTxt = me.getColData(me.currentCache);
+        //只有空行时才可以输入,即是新增时用,新增的空行只有输入了值,才保存
+        if(args.col === 0){
+            let preObj = me.currentCache.length > 0 ?  me.currentCache[me.currentCache.length - 1] : null;
+            if(args.editingText.toString().trim().length > 0){
+                let newObj = {character: args.editingText, isChecked: false};
+                newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
+                newObj.eigenvalue = [];
+                me.currentCache.push(newObj);
+            }
+        }
+        else if(args.col === 1){//改变特征值
+            if(me.addRow && me.addRow === args.row){//新增时用户向空特征值输入数据
+                if(args.editingText.toString().trim().length > 0){
+                    //只有项目特征列有数据,特征值才保存
+                    if(typeof me.currentCache[args.row] !== 'undefined'){
+                        let newValue = {value: args.editingText, isSelected: true};
+                        me.currentCache[args.row].eigenvalue.push(newValue);
+                    }
+                }
+            }
+            else{//平时选择
+                let eigenvalues = me.currentCache[args.row].eigenvalue;
+                let isValid = false;
+                //更新Selected
+                if(me.currentSelectedValue && me.currentSelectedValue !== args.editingText){
+                    for(let i = 0, len = eigenvalues.length; i < len; i++){
+                        if(eigenvalues[i].value === me.currentSelectedValue){
+                            eigenvalues[i].isSelected = false;
+                        }
+                        if(eigenvalues[i].value === args.editingText){
+                            eigenvalues[i].isSelected = true;
+                        }
+                    }
+                    isValid = true;
+                }
+                else if(!me.currentSelectedValue){
+                    for(let i = 0, len = eigenvalues.length; i < len; i++){
+                        if(eigenvalues[i].value === args.editingText){
+                            eigenvalues[i].isSelected = true;
+                            break;
+                        }
+                    }
+                    isValid = true;
+                }
+                if(isValid){
+                    me.refreshColData = true;
+                    characterTxt = me.getColData(me.currentCache);
+                    let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
+                    pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
+                }
             }
-            me.updateCharacter(me.currentCache, characterTxt);
         }
     },
     //复选框控制输出
@@ -338,37 +409,13 @@ let characterOprObj = {
             me.currentCache[args.row].isChecked = isChecked;
             me.refreshColData = true;
             characterTxt = me.getColData(me.currentCache);
-            me.updateCharacter(me.currentCache, characterTxt);
+            let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
+            pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
         }
         //else的情况就是新增
-    },
-    updateCharacter: function (billId, updateArr, characterTxt) {
-        let me = characterOprObj;
-        $.ajax({
-            type: 'post',
-            url: '',
-            dataType: 'json',
-            data: {billId: billId, updateArr: updateArr, characterTxt: characterTxt},
-            success: function (result) {
-                if(!result.error){
-                   /* me.currentCache.sort(function (a, b) {
-                        let rst = 0;
-                        if(a.serialNo > b.serialNo){
-                            rst = 1;
-                        }
-                        else if(a.serialNo < b.serialNo){
-                            rst = -1;
-                        }
-                        return rst;
-                    });
-                    me.showCharacterData(me.workBook.getSheet(0), me.setting, me.currentCache);//刷新jobSpread
-                    if(me.refreshColData){
-                        //me.showColData(me.currentCache);//刷新输出显示
-                        me.refreshColData = false;
-                    }*/
-                }
-            }
-        });
+        else{
+            args.sheet.setValue(args.row, args.col, 0);
+        }
     },
     onContextmenuOpr: function () {//右键菜单
         let me = characterOprObj;
@@ -404,15 +451,17 @@ let characterOprObj = {
                         callback: function(){},
                         items: {
                             "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
+                                me.workBook.getSheet(0).addRows(me.workBook.getSheet(0).getRowCount(), 1);
+                                me.addRow = me.workBook.getSheet(0).getRowCount() - 1;
                             }},
                             "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
-                                //删除
+                                me.deleteCharacter(target.row);
                             }},
                             "upMove": {name: "上移", disabled: upDis, icon: "fa-arrow-up", callback: function (key, opt) {
-
+                                me.upMove(target.row);
                             }},
                             "downMove": {name: "下移", disabled: downDis, icon: "fa-arrow-down", callback: function (key, opt) {
-
+                                me.downMove(target.row);
                             }}
                         }
                     };
@@ -423,4 +472,88 @@ let characterOprObj = {
             }
         });
     }
-};
+};
+
+let pageCCOprObj = {
+    mainActiveCell: null,//mainSpread焦点单元格
+    //设置特征及内容currentCache
+    setCacheAndShow: function (node) {
+        let theCont = contentOprObj, theCha = characterOprObj;
+        theCont.currentCache = typeof node.data.jobContent !== 'undefined' ? node.data.jobContent : [];
+        theCha.currentCache = typeof node.data.itemCharacter !== 'undefined' ? node.data.itemCharacter : [];
+        this.showData(theCont.workBook.getSheet(0), theCont.setting, theCont.currentCache);
+        this.showData(theCha.workBook.getSheet(0), theCha.setting, theCha.currentCache);
+    },
+    //contentSpread、itemSpread展示数据用
+    showData: function(sheet, setting, data) {
+        let me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        sheet.clear(0, 0, sheet.getRowCount(), sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
+        for (let col = 0; col < setting.header.length; col++) {
+            var hAlign = "left", vAlign = "center";
+            if (setting.header[col].hAlign) {
+                hAlign = setting.header[col].hAlign;
+            } else if (setting.header[col].dataType !== "String"){
+                hAlign = "right";
+            }
+            vAlign = setting.header[col].vAlign?setting.header[col].vAlign:vAlign;
+            sheetCommonObj.setAreaAlign(sheet.getRange(-1, col, -1, 1), hAlign, vAlign);
+            if (setting.header[col].formatter) {
+                sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
+            }
+            for (let row = 0; row < data.length; row++) {
+                sheet.getCell(row, 0).locked(true);//locked
+                let val = data[row][setting.header[col].dataCode];
+                if(setting.header[col].cellType === "checkBox"){
+                    let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
+                    checkBox.isThreeState(false);
+                    sheet.getCell(row, col).cellType(checkBox).value(val);
+                }
+                else if(setting.header[col].cellType === 'comboBox'){
+                    let comboObj = characterOprObj.getComboBox(data[row]);
+                    comboObj.combo.editable(false);//不可编辑
+                    sheet.getCell(row, 1).cellType(comboObj.combo).value(typeof comboObj.selectedValue !== 'undefined' ? comboObj.selectedValue : '');
+                }
+                else{
+                    sheet.setValue(row, col, val, ch);
+                }
+            }
+        }
+        sheet.resumeEvent();
+        sheet.resumePaint();
+    },
+    clearData: function () {
+        let theCon = contentOprObj, theCha = characterOprObj;
+        sheetCommonObj.cleanSheet(theCon.workBook.getSheet(0), theCon.setting, -1);
+        sheetCommonObj.cleanSheet(theCha.workBook.getSheet(0), theCha.setting, -1);
+    },
+    //更新特征及内容数据
+    updateCharacterContent: function (billId, updateObj, txtObj, oprObj) {
+        let me = pageCCOprObj, updateCol;
+        if(txtObj){
+            updateCol = txtObj.field === 'itemCharacter' ? 4 : 5;//更新清单行特征列或内容列
+        }
+        else{
+            updateCol = null;
+        }
+        $.ajax({
+            type: 'post',
+            url: '/bills/updateCharacterContent',
+            dataType: 'json',
+            data: {billId: billId, updateObj: JSON.stringify(updateObj), txtObj: JSON.stringify(txtObj)},
+            success: function (result) {
+                if(!result.error){
+                    oprObj.addRow = null;
+                    me.showData(oprObj.workBook.getSheet(0), oprObj.setting, oprObj.currentCache);//刷新特征及内容Spread
+                    if(oprObj.refreshColData){
+                        if(updateCol){
+                            projectObj.mainSpread.getActiveSheet().setValue(me.mainActiveCell.row, updateCol, txtObj.text + ''); //刷新输出显示
+                        }
+                        oprObj.refreshColData = false;
+                    }
+                }
+            }
+        });
+    }
+}

+ 10 - 0
web/building_saas/main/js/views/project_view.js

@@ -167,6 +167,16 @@ var projectObj = {
                             calcProgramObj.clearData();
                         };
                     };
+                    //zhong 2017-9-1 特征及内容
+                    if(pageCCOprObj.active){
+                        pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];//mainSpread焦点单元格
+                        if(node.sourceType === that.project.Bills.getSourceType()){
+                            //pageCCOprObj.setCacheAndShow(node);
+                        }
+                        else{
+                            //pageCCOprObj.clearData();
+                        }
+                    }
                 });
 
                 that.mainSpread.bind(GC.Spread.Sheets.Events.EditEnded, that.mainSpreadEditEnded);

+ 17 - 2
web/building_saas/main/js/views/sub_view.js

@@ -11,6 +11,7 @@ $("#jobSpread").width($("#subSpread").width() *0.5* 0.4);
 $("#itemSpread").width($("#subSpread").width() *0.5 - $("#jobSpread").width()-20);
 contentOprObj.buildSheet($("#jobSpread")[0]);
 characterOprObj.buildSheet($("#itemSpread")[0]);
+pageCCOprObj.active = false;
 
 // 工料机
 gljOprObj.initSheet(subSpread.getSheet(0));
@@ -32,10 +33,9 @@ SheetDataHelper.protectdSheet(subSpread.getSheet(3));
 
 
 $("#linkGLJ").click(function(){
-/*    $('#subSpread').css("display", "");
-    $("#tzjnrCon").css("display", "none");*/
     $("#tzjnrCon").hide();//控制显示subSpread,隐藏特征及内容spread
     $("#subSpread").show();
+    pageCCOprObj.active = false;
     subSpread.setActiveSheetIndex(0);
     $.contextMenu( 'destroy', "#subSpread" );
     gljContextMenu.loadGLJSpreadContextMenu();
@@ -46,6 +46,7 @@ $("#linkGLJ").click(function(){
 $("#linkFZDE").click(function(){
     $("#tzjnrCon").hide();
     $("#subSpread").show();
+    pageCCOprObj.active = false;
     subSpread.setActiveSheetIndex(1);
     $.contextMenu( 'destroy', "#subSpread" );
     // for test
@@ -55,6 +56,7 @@ $("#linkFZDE").click(function(){
 $("#linkFZTJ").click(function(){
     $("#tzjnrCon").hide();
     $("#subSpread").show();
+    pageCCOprObj.active = false;
     subSpread.setActiveSheetIndex(2);
     $.contextMenu( 'destroy', "#subSpread" );
     // for test
@@ -64,6 +66,7 @@ $("#linkFZTJ").click(function(){
 $("#linkGCLMX").click(function(){
     $("#tzjnrCon").hide();
     $("#subSpread").show();
+    pageCCOprObj.active = false;
     subSpread.setActiveSheetIndex(3);
     $.contextMenu( 'destroy', "#subSpread" );
     gljContextMenu.loadQuantityDetailMenu();
@@ -74,6 +77,7 @@ $("#linkGCLMX").click(function(){
 $("#linkJSCX").click(function(){        // 计算程序
     $("#tzjnrCon").hide();
     $("#subSpread").show();
+    pageCCOprObj.active = false;
     subSpread.setActiveSheetIndex(4);
     calcProgramObj.initSheet(subSpread.getSheet(4));
     let sel = projectObj.mainController.tree.selected;
@@ -88,6 +92,7 @@ $("#linkJSCX").click(function(){        // 计算程序
 $("#linkFXSM").click(function(){
     $("#tzjnrCon").hide();
     $("#subSpread").show();
+    pageCCOprObj.active = false;
     subSpread.setActiveSheetIndex(5);
     // for test
     subSpread.getActiveSheet().setValue(0, 0, "分项说明");
@@ -96,6 +101,7 @@ $("#linkFXSM").click(function(){
 $("#linkDESM").click(function(){
     $("#tzjnrCon").hide();
     $("#subSpread").show();
+    pageCCOprObj.active = false;
     subSpread.setActiveSheetIndex(6);
     // for test
     subSpread.getActiveSheet().setValue(0, 0, "定额说明");
@@ -105,6 +111,15 @@ $("#linkDESM").click(function(){
 $("#linkTZJNR").click(function () {
     $("#subSpread").hide();
     $("#tzjnrCon").show();
+    pageCCOprObj.active = true;
+    let selectedNode = projectObj.mainController.tree.selected;
+    pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
+    if(selectedNode && selectedNode.sourceType === projectObj.project.Bills.getSourceType()){
+        //pageCCOprObj.setCacheAndShow(selectedNode);
+    }
+    else{
+        //pageCCOprObj.clearData();
+    }
 });
 function SubActiveSheetNameIs(sheetName){
     let rst = subSpread.getActiveSheet().name() == sheetName;