Bladeren bron

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

MaiXinRong 7 jaren geleden
bovenliggende
commit
792db413fa

+ 2 - 2
public/web/sheet/sheet_common.js

@@ -246,8 +246,8 @@ var sheetCommonObj = {
     setDynamicCombo: function (sheet, beginRow, col, rowCount, items, itemsHeight, itemsType) {
         let me = this;
         sheet.suspendPaint();
+        let combo = me.getDynamicCombo();
         for(let i = 0, len = rowCount; i < len; i++){
-            let combo = me.getDynamicCombo();
             if(itemsHeight) combo.itemHeight(itemsHeight);
             if(itemsType === 'value') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
             else if(itemsType === 'text') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
@@ -258,8 +258,8 @@ var sheetCommonObj = {
     },
     setStaticCombo: function (sheet, beginRow, col, rowCount, items, itemsHeight, itemsType) {
         sheet.suspendPaint();
+        let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
         for(let i = 0, len = rowCount; i < len; i++){
-            let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
             if(itemsHeight) combo.itemHeight(itemsHeight);
             if(itemsType === 'value') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
             else if(itemsType === 'text') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);

+ 5 - 17
web/building_saas/complementary_glj_lib/js/components.js

@@ -27,12 +27,15 @@ let componentOprObj = {
         me.workBook = sheetOpr.buildSheet(container, me.setting, 30);
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.getSheet(0).setFormatter(-1, 1, "@", GC.Spread.Sheets.SheetArea.viewport);
-       // me.workBook.getSheet(0).options.isProtected = true;
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditStarting, me.onCellEditStart);
+        me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
         me.workBook.bind(GC.Spread.Sheets.Events.ButtonClicked, me.onButtonClicked);//复选框点击事件
         me.componentsBtnOpr($('#componentsConf'));
         me.radiosChange();
     },
+    onClipboardPasting: function (sender, args) {
+        args.cancel = true;
+    },
     onCellEditStart: function (sender, args) {
         args.cancel = true;
     },
@@ -65,19 +68,6 @@ let componentOprObj = {
                         break;
                     }
                 }
-            /*    if($("input[name='glj']:checked").val() === 'selectedGljs'){//radio为已选工料机时
-                    me.showGljList = [];
-                    me.setShowGljList(me.selectedList, false);
-                    re.sortGlj(me.showGljList);
-                    //重新显示
-                    me.showGljItems(me.showGljList, me.gljCurTypeId);
-                    if (re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]) {//更新cache
-                        me.currentOprParent = 1;
-                        me.currentCache = me.getParentCache(re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]);
-                    } else {
-                        me.currentCache = me.getCache();
-                    }
-                }*/
             }
         }
     },
@@ -112,7 +102,7 @@ let componentOprObj = {
     //初始默认radio
     initRadio: function () {
         let that = repositoryGljObj, me = componentOprObj;
-        $('#searchGlj').val('');//恢复搜索文本
+        //$('#searchGlj').val('');//恢复搜索文本
         //初始化组成物列表
         me.selectedList = [].concat(that.currentComponent);
         //默认radio所有工料机
@@ -137,8 +127,6 @@ let componentOprObj = {
             let val = $("input[name='glj']:checked").val();
             me.radiosSelected = val;
             //选择改变,数据重新筛选显示
-            //清空选中的组成物列表
-            //me.selectedList = [];
             me.showGljList = [];
             if(me.radiosSelected === 'allGljs'){
                 me.setShowGljList(re.stdGljList);

+ 10 - 7
web/building_saas/complementary_glj_lib/js/glj.js

@@ -282,7 +282,6 @@ let repositoryGljObj = {
         //混凝土202、砂浆203、配合比204、机械3
         if(typeof info.oldSelections || info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
             let row = info.newSelections[0].row;
-            that.isLocked = true;
             sheetOpr.cleanSheet(that.workBook.getSheet(0), that.setting, -1);
             me.workBook.focus(true);
             me.currentComponent = [];
@@ -291,7 +290,6 @@ let repositoryGljObj = {
                 //标记当前工料机
                 me.currentGlj = me.currentCache[row];
                 if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
-                    that.isLocked = false;
                     //展示数据
                     if(me.currentGlj.component.length > 0){
                         me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
@@ -438,7 +436,6 @@ let repositoryGljObj = {
                                     }
                                 }
                             sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, 5);
-                            that.isLocked = me.allowComponent.indexOf(rObj.gljType) !== -1 ? false : true;
                         }
                         else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
                             //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
@@ -686,11 +683,12 @@ let repositoryGljObj = {
                             }
                         }
                     }
-                    tempObj.gljType = me.distTypeTree.comboDatas[i].value;
-                    tempObj.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
+                    tempObj.component = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.component : [];
                     if(me.allowComponent.indexOf(tempObj.gljType) !== -1){
-                        tempObj.basePrice = 0;
+                        tempObj.basePrice = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.basePrice : 0;
                     }
+                    tempObj.gljType = me.distTypeTree.comboDatas[i].value;
+                    tempObj.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
                     break;
                 }
             }
@@ -971,6 +969,12 @@ let repositoryGljObj = {
                         me.currentCache = me.getCache();
                     }
                     me.showGljItems(me.complementaryGljList, me.gljCurTypeId);
+                    //getCurrentGlj
+                    let row = me.workBook.getSheet(0).getSelections()[0].row;
+                    me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
+                    me.currentComponent = me.currentGlj ?  me.getCurrentComponent(me.currentGlj.component) : [];
+                    sheetOpr.cleanData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, -1);
+                    sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);
                 }
             },
             error:function(err){
@@ -1056,7 +1060,6 @@ let gljTypeTreeOprObj = {
             that = gljComponentOprObj,
             gljTypeId = treeNode.ID;
         me.gljCurTypeId = treeNode.ID;
-        that.isLocked = true;
         //消除新增到一半的数据
         me.addGljObj = null;
         //me.currentCache = me.getCache();

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

@@ -62,23 +62,23 @@ let gljComponentOprObj = {
                 let target = sheet.hitTest(x, y);
                 if(target.hitTestType === 3 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'){//在表格内
                     sheet.setActiveCell(target.row, target.col);
+                    //getCurrentGlj
+                    let thatRow = that.workBook.getSheet(0).getSelections()[0].row
+                    that.currentGlj = thatRow < that.currentCache.length ? that.currentCache[thatRow] : null;
+                    that.currentComponent = that.currentGlj ?  that.getCurrentComponent(that.currentGlj.component) : [];
                     //控制按钮是否可用
                     let insertDis = false,
                         delDis = false;
-                    if(me.isLocked){
+                    if(!(that.currentGlj && that.allowComponent.indexOf(that.currentGlj.gljType) !== -1)){
                         insertDis = true;
-                        delDis = true;
                     }
-                    if(typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length){//右键定位在有组成物的行,删除键才显示可用
+                    if(!that.currentGlj || typeof that.currentComponent === 'undefined' || (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
                         delDis = true;
                     }
                     return {
                         callback: function(){},
                         items: {
                             "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
-                                //getCurrentGlj
-                                let thatRow = that.workBook.getSheet(0).getSelections()[0].row;
-                                that.currentGlj = thatRow < that.currentCache.length ? that.currentCache[thatRow] : null;
                                 //默认radio所有工料机
                                 co.initRadio();
                                 co.gljCurTypeId = null;
@@ -348,7 +348,7 @@ let gljComponentOprObj = {
         let me = gljComponentOprObj;
         let maxCol = info.cellRange.col + info.cellRange.colCount - 1;
         //复制的列数超过正确的列数,不可复制
-        if(info.cellRange.col !== 4 || info.cellRange.colCount > 1){
+        if(info.cellRange.col !== 4 && info.cellRange.colCount > 1){
             args.cancel = true;
         }
     },