Browse Source

补充工料机debug

zhongzewei 7 years ago
parent
commit
e41e4d9e36

+ 1 - 0
modules/complementary_glj_lib/models/schemas.js

@@ -6,6 +6,7 @@ import mongoose from "mongoose";
 let Schema = mongoose.Schema;
 let Schema = mongoose.Schema;
 let gjlComponentSchema = mongoose.Schema(
 let gjlComponentSchema = mongoose.Schema(
     {
     {
+       // module: String, //"stdGlj"标准工料机 "complementaryGlj"
         ID: Number,
         ID: Number,
         consumeAmt: Number
         consumeAmt: Number
     },
     },

+ 0 - 1
web/building_saas/complementary_glj_lib/html/tools-gongliaoji.html

@@ -132,7 +132,6 @@
                                   <input type="radio" class="glj-radio" name="glj" value="allGljs">所有工料机&nbsp;&nbsp;
                                   <input type="radio" class="glj-radio" name="glj" value="allGljs">所有工料机&nbsp;&nbsp;
                                   <input type="radio" class="glj-radio" name="glj" value="stdGljs">标准工料机&nbsp;&nbsp;
                                   <input type="radio" class="glj-radio" name="glj" value="stdGljs">标准工料机&nbsp;&nbsp;
                                   <input type="radio" class="glj-radio" name="glj" value="complementaryGljs">补充工料机&nbsp;&nbsp;
                                   <input type="radio" class="glj-radio" name="glj" value="complementaryGljs">补充工料机&nbsp;&nbsp;
-                                  <input type="radio" class="glj-radio" name="glj" value="selectedGljs">已选工料机机&nbsp;&nbsp;
                                  <!-- <div class="form-group"><input id="searchGlj" type="text" class="form-control-sm" placeholder="查询工料机"></div>-->
                                  <!-- <div class="form-group"><input id="searchGlj" type="text" class="form-control-sm" placeholder="查询工料机"></div>-->
                               </div>
                               </div>
                               <div class="modal-auto-height col-12" style="overflow: hidden" id="componentSheet">
                               <div class="modal-auto-height col-12" style="overflow: hidden" id="componentSheet">

+ 39 - 60
web/building_saas/complementary_glj_lib/js/components.js

@@ -20,10 +20,7 @@ let componentOprObj = {
             {headerName:"计量单位",headerWidth:80,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"计量单位",headerWidth:80,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"单价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
             {headerName:"单价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
             {headerName:"类型",headerWidth:80,dataCode:"gljType", dataType: "String",  hAlign: "center", vAlign: "center"}
             {headerName:"类型",headerWidth:80,dataCode:"gljType", dataType: "String",  hAlign: "center", vAlign: "center"}
-        ],
-        view: {
-            lockedCells: [1, 2, 3]
-        }
+        ]
     },
     },
     buildSheet: function (container) {
     buildSheet: function (container) {
         let me = componentOprObj;
         let me = componentOprObj;
@@ -32,24 +29,20 @@ let componentOprObj = {
         me.workBook.getSheet(0).setFormatter(-1, 1, "@", GC.Spread.Sheets.SheetArea.viewport);
         me.workBook.getSheet(0).setFormatter(-1, 1, "@", GC.Spread.Sheets.SheetArea.viewport);
         me.workBook.getSheet(0).options.isProtected = true;
         me.workBook.getSheet(0).options.isProtected = true;
         me.workBook.bind(GC.Spread.Sheets.Events.ButtonClicked, me.onButtonClicked);//复选框点击事件
         me.workBook.bind(GC.Spread.Sheets.Events.ButtonClicked, me.onButtonClicked);//复选框点击事件
-        //sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
         me.componentsBtnOpr($('#componentsConf'));
         me.componentsBtnOpr($('#componentsConf'));
         me.radiosChange();
         me.radiosChange();
-        //me.searchChange();
     },
     },
     onButtonClicked: function (sender, args) {
     onButtonClicked: function (sender, args) {
         let me = componentOprObj, re = repositoryGljObj;
         let me = componentOprObj, re = repositoryGljObj;
         let val = args.sheet.getValue(args.row, args.col);
         let val = args.sheet.getValue(args.row, args.col);
         let thisComponent = me.currentCache[args.row];
         let thisComponent = me.currentCache[args.row];
         thisComponent.isChecked = val;
         thisComponent.isChecked = val;
-        console.log(val);
         if(args.sheet.isEditing()){
         if(args.sheet.isEditing()){
             args.sheet.endEdit(true);
             args.sheet.endEdit(true);
         }
         }
         else{
         else{
             //维护选中组成物列表
             //维护选中组成物列表
             if(val === true){
             if(val === true){
-                //解决复选框编辑状态的暂时方法todo
                 let isExist = false;
                 let isExist = false;
                 for(let i = 0, len = me.selectedList.length; i < len; i++){
                 for(let i = 0, len = me.selectedList.length; i < len; i++){
                     if(me.selectedList[i].ID === thisComponent.ID){
                     if(me.selectedList[i].ID === thisComponent.ID){
@@ -68,7 +61,7 @@ let componentOprObj = {
                         break;
                         break;
                     }
                     }
                 }
                 }
-                if($("input[name='glj']:checked").val() === 'selectedGljs'){//radio为已选工料机时
+            /*    if($("input[name='glj']:checked").val() === 'selectedGljs'){//radio为已选工料机时
                     me.showGljList = [];
                     me.showGljList = [];
                     me.setShowGljList(me.selectedList, false);
                     me.setShowGljList(me.selectedList, false);
                     re.sortGlj(me.showGljList);
                     re.sortGlj(me.showGljList);
@@ -80,16 +73,17 @@ let componentOprObj = {
                     } else {
                     } else {
                         me.currentCache = me.getCache();
                         me.currentCache = me.getCache();
                     }
                     }
-                }
+                }*/
             }
             }
         }
         }
     },
     },
     setShowGljList: function (gljList, clearChecked) {
     setShowGljList: function (gljList, clearChecked) {
-        //初始为所有工料机,机械类型可添加机械组成物,混凝土,砂浆、配合比可添加普通材料
+        //初始为所有工料机,机械类型可添加机械组成物、机上人工,混凝土,砂浆、配合比可添加普通材料
+        let machineArr = [302, 303];
         let materialArr = [202, 203, 204];//混凝土、砂浆、配合比, 201普通材料
         let materialArr = [202, 203, 204];//混凝土、砂浆、配合比, 201普通材料
         let that = repositoryGljObj, me = componentOprObj;
         let that = repositoryGljObj, me = componentOprObj;
             for(let i = 0; i < gljList.length; i++){
             for(let i = 0; i < gljList.length; i++){
-                if(that.currentGlj.gljType === 301 && gljList[i].gljType === 302 ||
+                if(that.currentGlj.gljType === 301 && machineArr.indexOf(gljList[i].gljType) !== -1 ||
                     materialArr.indexOf(that.currentGlj.gljType) !== -1 && gljList[i].gljType === 201){
                     materialArr.indexOf(that.currentGlj.gljType) !== -1 && gljList[i].gljType === 201){
                     //去除与已添加的组成物重复的条目
                     //去除与已添加的组成物重复的条目
                     let isExist = false;
                     let isExist = false;
@@ -101,17 +95,13 @@ let componentOprObj = {
                     }
                     }
                     if(!isExist){
                     if(!isExist){
                         if(clearChecked){
                         if(clearChecked){
-                            gljList[i].isChecked = false;//切换的时候清空选择
+                            gljList[i].isChecked = false;
                         }
                         }
-                       /* if(isSelected){//已选择工料机显示
-                            if(gljList[i].isChecked === true){
-                                me.showGljList.push(gljList[i]);
-                            }
-                        }*/
-                   //     else{
-                            me.showGljList.push(gljList[i]);
-                      //  }
                     }
                     }
+                    else {
+                        gljList[i].isChecked = true;
+                    }
+                    me.showGljList.push(gljList[i]);
                 }
                 }
             }
             }
     },
     },
@@ -120,7 +110,7 @@ let componentOprObj = {
         let that = repositoryGljObj, me = componentOprObj;
         let that = repositoryGljObj, me = componentOprObj;
         $('#searchGlj').val('');//恢复搜索文本
         $('#searchGlj').val('');//恢复搜索文本
         //初始化组成物列表
         //初始化组成物列表
-        me.selectedList = [];
+        me.selectedList = that.currentComponent;
         //默认radio所有工料机
         //默认radio所有工料机
         if(typeof $("input[name='glj']:checked")[0] !== 'undefined'){
         if(typeof $("input[name='glj']:checked")[0] !== 'undefined'){
             $("input[name='glj']:checked")[0].checked = false;
             $("input[name='glj']:checked")[0].checked = false;
@@ -156,11 +146,6 @@ let componentOprObj = {
             else if(me.radiosSelected === 'complementaryGljs'){
             else if(me.radiosSelected === 'complementaryGljs'){
                 me.setShowGljList(re.complementaryGljList);
                 me.setShowGljList(re.complementaryGljList);
             }
             }
-            else if(me.radiosSelected === 'selectedGljs'){
-                /*me.setShowGljList(re.stdGljList, false, true);
-                me.setShowGljList(re.complementaryGljList, false, true);*/
-                me.setShowGljList(me.selectedList, false);
-            }
             re.sortGlj(me.showGljList);
             re.sortGlj(me.showGljList);
             //重新显示
             //重新显示
             me.showGljItems(me.showGljList, me.gljCurTypeId);
             me.showGljItems(me.showGljList, me.gljCurTypeId);
@@ -177,31 +162,7 @@ let componentOprObj = {
             }
             }
         });
         });
     },
     },
-    //实时模糊搜索
-    searchChange: function () {
-        let me = componentOprObj, re = repositoryGljObj;
-        let interval = null;
-        function search(){
-            console.log($('#searchGlj').val());
-        }
-        $('#searchGlj').focus(function () {
-            interval = setInterval(search, 500);
-        }).blur(function () {
-            clearInterval(interval);
-        });
-    },
-  /*  //切换分类树时,记住当前分类的选择, value = true、false、null
-    setComponentChecked: function (sheet) {
-        let me = componentOprObj;
-        for(let i = 0; i < sheet.getRowCount(); i ++){
-            if(sheet.getValue(i, 0) === true){//选择了
-                me.preCache[i].isChecked = true;
-            }
-            else if(sheet.getValue(i, 0) === false){//避免value为null
-                me.preCache[i].isChecked = false;
-            }
-        }
-    },*/
+
     //获得选择的组成物
     //获得选择的组成物
     getComponents: function () {
     getComponents: function () {
         let rst = [];
         let rst = [];
@@ -249,7 +210,8 @@ let componentOprObj = {
             sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
             sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
             sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, re.distTypeTree);
             sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, re.distTypeTree);
             me.workBook.getSheet(0).options.isProtected = true;
             me.workBook.getSheet(0).options.isProtected = true;
-            me.workBook.getSheet(0).setRowCount(cacheSection);
+            me.workBook.getSheet(0).setRowCount(cacheSection.length);
+            sheetOpr.setLockCols(me.workBook.getSheet(0), [4], true);
             cacheSection = null;
             cacheSection = null;
         }
         }
     },
     },
@@ -257,16 +219,33 @@ let componentOprObj = {
     componentsBtnOpr: function (conf) {//确定、取消、关闭按钮
     componentsBtnOpr: function (conf) {//确定、取消、关闭按钮
         let me = componentOprObj, that = gljComponentOprObj, re = repositoryGljObj;
         let me = componentOprObj, that = gljComponentOprObj, re = repositoryGljObj;
         conf.click(function () {
         conf.click(function () {
-           //添加选择添加的组成物
+            //添加选择添加的组成物
             let updateArr = [];
             let updateArr = [];
-            if(me.selectedList.length > 0){
-                for(let i = 0, len = me.selectedList.length; i < len; i++){
-                    re.currentGlj.component.push({ID: me.selectedList[i].ID, consumeAmt: 0});
+            let newComponent = [];
+            //re.currentGlj.component = [];
+            for(let i = 0, len = me.selectedList.length; i < len; i++){
+                let isExist = false;
+                for(let j = 0, jLen = re.currentGlj.component.length; j < jLen; j++){
+                    if(me.selectedList[i].ID === re.currentGlj.component[j].ID){
+                        newComponent.push({ID: me.selectedList[i].ID, consumeAmt: re.currentGlj.component[j].consumeAmt});
+                        isExist = true;
+                        break;
+                    }
+                }
+                if(!isExist){
+                    newComponent.push({ID: me.selectedList[i].ID, consumeAmt: 0});
                 }
                 }
-                updateArr.push(re.currentGlj);
-                that.updateComponent(updateArr);
+                //re.currentGlj.component.push({ID: me.selectedList[i].ID, consumeAmt: 0});
             }
             }
-
+            re.currentGlj.component = newComponent;
+            let gljBasePrc = that.reCalGljBasePrc(re.getCurrentComponent(re.currentGlj.component));
+            if(gljBasePrc !== re.currentGlj.basePrice){
+                re.currentGlj.basePrice = gljBasePrc;
+                re.reshowGljBasePrc(re.currentGlj);
+                //updateBasePrc.push({gljId: that.currentGlj.ID, gljType: that.currentGlj.gljType, basePrice: that.currentGlj.basePrice});
+            }
+            updateArr.push(re.currentGlj);
+            that.updateComponent(updateArr);
         });
         });
     }
     }
 };
 };

+ 12 - 8
web/building_saas/complementary_glj_lib/js/glj.js

@@ -182,7 +182,7 @@ let repositoryGljObj = {
                     cacheSection.push(data[i]);
                     cacheSection.push(data[i]);
                 }
                 }
             }
             }
-            sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+            sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
             sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree);
             sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree);
 
 
             cacheSection = null;
             cacheSection = null;
@@ -335,19 +335,19 @@ let repositoryGljObj = {
                 let focusToCol;
                 let focusToCol;
                 function getFocusToCol (me){
                 function getFocusToCol (me){
                     if(!me.addGljObj[me.setting.header[0].dataCode]){
                     if(!me.addGljObj[me.setting.header[0].dataCode]){
-                        $('#alertGljTxt').text('编号不能为空,是否取消增加工料机?');
+                        $('#alertGljTxt').text('编号不能为空,继续增加工料机?');
                         return 0;
                         return 0;
                     }
                     }
                     else if(!me.addGljObj[me.setting.header[1].dataCode]){
                     else if(!me.addGljObj[me.setting.header[1].dataCode]){
-                        $('#alertGljTxt').text('名称不能为空,是否取消增加工料机?');
+                        $('#alertGljTxt').text('名称不能为空,继续增加工料机?');
                         return 1;
                         return 1;
                     }
                     }
                     else if(!me.addGljObj[me.setting.header[3].dataCode]){
                     else if(!me.addGljObj[me.setting.header[3].dataCode]){
-                        $('#alertGljTxt').text('计量单位不能为空,是否取消增加工料机?');
+                        $('#alertGljTxt').text('计量单位不能为空,继续增加工料机?');
                         return 3;
                         return 3;
                     }
                     }
                     else if(!me.addGljObj[me.setting.header[5].dataCode]){
                     else if(!me.addGljObj[me.setting.header[5].dataCode]){
-                        $('#alertGljTxt').text('类型不能为空,是否取消增加工料机?');
+                        $('#alertGljTxt').text('类型不能为空,继续增加工料机?');
                         return 5;
                         return 5;
                     }
                     }
                     else {
                     else {
@@ -362,7 +362,7 @@ let repositoryGljObj = {
                     $('#gljAlertBtn').click();
                     $('#gljAlertBtn').click();
                     //me.workBook.getSheet(0).options.isProtected = true;
                     //me.workBook.getSheet(0).options.isProtected = true;
                     sheetOpr.lockAllCells(args.sheet);
                     sheetOpr.lockAllCells(args.sheet);
-                    $('#aleCanceBtn').click(function () {
+                    $('#aleConfBtn').click(function () {
                         // me.workBook.getSheet(0).options.isProtected = false;
                         // me.workBook.getSheet(0).options.isProtected = false;
                         sheetOpr.unLockAllCells(args.sheet);
                         sheetOpr.unLockAllCells(args.sheet);
                         sheetOpr.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
                         sheetOpr.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
@@ -374,11 +374,13 @@ let repositoryGljObj = {
                         sheetOpr.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
                         sheetOpr.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
                     });
                     });
-                    $('#aleConfBtn').click(function () {
+                    $('#aleCanceBtn').click(function () {
                         // me.workBook.getSheet(0).options.isProtected = false;
                         // me.workBook.getSheet(0).options.isProtected = false;
                         sheetOpr.unLockAllCells(args.sheet);
                         sheetOpr.unLockAllCells(args.sheet);
                         sheetOpr.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
                         sheetOpr.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
                         me.addGljObj = null;
                         me.addGljObj = null;
+                        me.workBook.getSheet(0).suspendPaint();
+                        me.workBook.getSheet(0).suspendEvent();
                         for(let col=0; col<me.setting.header.length; col++){
                         for(let col=0; col<me.setting.header.length; col++){
                             let field = me.setting.header[col].dataCode;
                             let field = me.setting.header[col].dataCode;
                             if(field === 'gljType'){
                             if(field === 'gljType'){
@@ -393,6 +395,8 @@ let repositoryGljObj = {
                             }
                             }
                         }
                         }
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, 0);
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, 0);
+                        me.workBook.getSheet(0).resumePaint();
+                        me.workBook.getSheet(0).resumeEvent();
                     });
                     });
                 }
                 }
             }
             }
@@ -1052,7 +1056,7 @@ let gljTypeTreeOprObj = {
         //消除新增到一半的数据
         //消除新增到一半的数据
         me.addGljObj = null;
         me.addGljObj = null;
         //me.currentCache = me.getCache();
         //me.currentCache = me.getCache();
-        sheetOpr.cleanSheet(that.workBook.getSheet(0), that.setting, 5);
+        sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, 5);
         that.workBook.getSheet(0).getRange(-1, 0 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
         that.workBook.getSheet(0).getRange(-1, 0 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
         that.workBook.getSheet(0).getRange(-1, 4 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
         that.workBook.getSheet(0).getRange(-1, 4 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
         me.workBook.getSheet(0).getRange(-1, 6 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
         me.workBook.getSheet(0).getRange(-1, 6 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);

+ 3 - 3
web/building_saas/complementary_glj_lib/js/gljComponent.js

@@ -23,7 +23,7 @@ let gljComponentOprObj = {
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.getSheet(0).setFormatter(-1, 0, "@", GC.Spread.Sheets.SheetArea.viewport);
         me.workBook.getSheet(0).setFormatter(-1, 0, "@", GC.Spread.Sheets.SheetArea.viewport);
         me.workBook.getSheet(0).options.isProtected = true;
         me.workBook.getSheet(0).options.isProtected = true;
-        sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+        sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
 
 
         me.onContextmenuOpr();//右键菜单
         me.onContextmenuOpr();//右键菜单
         me.gljComponentDelOpr();
         me.gljComponentDelOpr();
@@ -468,11 +468,11 @@ let gljComponentOprObj = {
             success: function (result) {
             success: function (result) {
                 if(!result.error){
                 if(!result.error){
                         that.currentComponent =  that.getCurrentComponent(result.data[0].component);
                         that.currentComponent =  that.getCurrentComponent(result.data[0].component);
-                        sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+                        sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
                         sheetOpr.showData(me.workBook.getSheet(0), me.setting, that.currentComponent);
                         sheetOpr.showData(me.workBook.getSheet(0), me.setting, that.currentComponent);
                 }
                 }
                 else{
                 else{
-                    sheetOpr.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+                    sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
                 }
                 }
                 $('#componentsCacnel').click();
                 $('#componentsCacnel').click();
             }
             }

+ 25 - 2
web/building_saas/complementary_glj_lib/js/sheetOpr.js

@@ -80,6 +80,14 @@ let sheetOpr = {
         sheet.resumeEvent();
         sheet.resumeEvent();
         sheet.resumePaint();
         sheet.resumePaint();
     },
     },
+    cleanData: function(sheet, setting, rowCount) {
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        sheet.clear(-1, 0, -1, setting.header.length, GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
+        if (rowCount > 0) sheet.setRowCount(rowCount);
+        sheet.resumeEvent();
+        sheet.resumePaint();
+    },
     setAreaAlign: function(area, hAlign, vAlign){
     setAreaAlign: function(area, hAlign, vAlign){
         if (!(hAlign) || hAlign === "left") {
         if (!(hAlign) || hAlign === "left") {
             area.hAlign(GC.Spread.Sheets.HorizontalAlign.left);
             area.hAlign(GC.Spread.Sheets.HorizontalAlign.left);
@@ -324,11 +332,15 @@ let sheetOpr = {
         sheet.resumeEvent();
         sheet.resumeEvent();
     },
     },
     unLockAllCells: function (sheet) {
     unLockAllCells: function (sheet) {
+        sheet.suspendPaint();
+        sheet.suspendEvent();
         let defaultStyle = new GC.Spread.Sheets.Style();
         let defaultStyle = new GC.Spread.Sheets.Style();
         defaultStyle.locked = false;
         defaultStyle.locked = false;
         sheet.setDefaultStyle(defaultStyle, GC.Spread.Sheets.SheetArea.viewport);
         sheet.setDefaultStyle(defaultStyle, GC.Spread.Sheets.SheetArea.viewport);
         sheet.setStyle(-1, 0, defaultStyle);
         sheet.setStyle(-1, 0, defaultStyle);
         sheet.options.isProtected = false;
         sheet.options.isProtected = false;
+        sheet.resumePaint();
+        sheet.resumeEvent();
     },
     },
     lockAllCells: function (sheet) {
     lockAllCells: function (sheet) {
         sheet.suspendPaint();
         sheet.suspendPaint();
@@ -344,13 +356,13 @@ let sheetOpr = {
         sheet.resumeEvent();
         sheet.resumeEvent();
     },
     },
     lockSomeCodes: function (sheet, beginRow, endRow) {
     lockSomeCodes: function (sheet, beginRow, endRow) {
+        sheet.suspendPaint();
+        sheet.suspendEvent();
         let defaultStyle = new GC.Spread.Sheets.Style();
         let defaultStyle = new GC.Spread.Sheets.Style();
         defaultStyle.locked = false;
         defaultStyle.locked = false;
         sheet.setDefaultStyle(defaultStyle, GC.Spread.Sheets.SheetArea.viewport);
         sheet.setDefaultStyle(defaultStyle, GC.Spread.Sheets.SheetArea.viewport);
         let style = new  GC.Spread.Sheets.Style();
         let style = new  GC.Spread.Sheets.Style();
         style.locked = true;
         style.locked = true;
-        sheet.suspendPaint();
-        sheet.suspendEvent();
         for(let i = beginRow; i < endRow; i++){
         for(let i = beginRow; i < endRow; i++){
             sheet.setStyle(i, 0, style);
             sheet.setStyle(i, 0, style);
         }
         }
@@ -358,6 +370,17 @@ let sheetOpr = {
         sheet.resumePaint();
         sheet.resumePaint();
         sheet.resumeEvent();
         sheet.resumeEvent();
     },
     },
+    setLockCols: function (sheet, cols, locked) {
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        for(let i = 0, len = cols.length; i < len; i++){
+            for(let row = 0, rLen = sheet.getRowCount(); row < rLen; row++){
+                sheet.getCell(row, cols[i]).locked(locked);
+            }
+        }
+        sheet.resumePaint();
+        sheet.resumeEvent();
+    },
     lockCodeCells: function (sheet, rowCount) {
     lockCodeCells: function (sheet, rowCount) {
         let sheetRowCount = sheet.getRowCount();
         let sheetRowCount = sheet.getRowCount();
         let defaultStyle = new GC.Spread.Sheets.Style();
         let defaultStyle = new GC.Spread.Sheets.Style();