zhongzewei 7 лет назад
Родитель
Сommit
3ac24b7797

+ 1 - 0
public/web/sheet/sheet_common.js

@@ -54,6 +54,7 @@ var sheetCommonObj = {
         sheet.setColumnCount(setting.header.length, spreadNS.SheetArea.viewport);
         sheet.options.colHeaderAutoTextIndex = 1;
         sheet.options.colHeaderAutoText = spreadNS.HeaderAutoText.numbers;
+        sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
         sheet.options.protectionOptions = {
             allowResizeRows: true,
             allowResizeColumns: true

+ 1 - 0
web/maintain/bills_lib/scripts/set_sheets.js

@@ -13,6 +13,7 @@ var setSheet = {
         spread.options.allowExtendPasteRange = isExtendPaste? true : false;
         spread.options.allowUserDragDrop = false;
         spread.getActiveSheet().options.allowCellOverflow = false;
+        spread.getActiveSheet().options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
         sheet.showRowOutline(false);
        // sheet.defaults.rowHeight = 30;
         setting.cols.forEach(function(col, colIdx){

+ 24 - 10
web/maintain/ration_repository/js/coe.js

@@ -96,10 +96,12 @@ let coeOprObj = {
             if(row < me.currentCoeList.length){
                 me.currentCoe = me.currentCoeList[row];
                 that.currentGljAdjList = me.currentCoe.coes;
+                that.buildDynamicComboBox(that.workSheet);
             }
             else{
                 me.currentCoe = null;
                 that.currentGljAdjList = [];
+                that.buildBaseCell(that.workSheet);
             }
             //refresh & show coes
             sheetCommonObj.cleanSheet(that.workSheet, that.setting, -1);
@@ -389,33 +391,45 @@ let gljAdjOprObj = {
         me.workSheet.options.isProtected = true;
         me.onDelOpr(me.workBook, me.setting);
         me.workSheet.clearSelection();
-        me.buildComboBox(me.workSheet);
         me.workSheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStart);
         me.workSheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
+        me.workSheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
         me.workSheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
         me.workSheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
     },
-    buildComboBox: function (sheet) {
+    buildBaseCell: function (sheet) {
         let me = gljAdjOprObj;
         sheet.suspendPaint();
         sheet.suspendEvent();
-        let comboType = new GC.Spread.Sheets.CellTypes.ComboBox();
-        comboType.items(me.setting.comboItems.coeType);
-        let comboOpr = new GC.Spread.Sheets.CellTypes.ComboBox();
-        comboOpr.items(me.setting.comboItems.operator);
-        sheet.getCell(-1, 0).cellType(comboType);
-        sheet.getCell(-1, 3).cellType(comboOpr);
+        let baseCell = GC.Spread.Sheets.CellTypes.Base();
+        sheet.getCell(-1, 0).cellType(baseCell);
+        sheet.getCell(-1, 3).cellType(baseCell);
         sheet.resumePaint();
         sheet.resumeEvent();
     },
+    buildDynamicComboBox: function (sheet) {
+        let me = gljAdjOprObj;
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        let dynamicCombo = sheetCommonObj.getDynamicCombo();
+        dynamicCombo.items(me.setting.comboItems.coeType);
+        let dynamicOprCombo = sheetCommonObj.getDynamicCombo();
+        dynamicOprCombo.items(me.setting.comboItems.operator);
+        sheet.getCell(-1, 0).cellType(dynamicCombo);
+        sheet.getCell(-1, 3).cellType(dynamicOprCombo);
+        sheet.resumePaint();
+        sheet.resumeEvent();
+    },
+    onEnterCell: function (sender, args) {
+        args.sheet.repaint();
+    },
     onEditStart: function (sender, args) {
         let me = gljAdjOprObj;
         if(!coeOprObj.currentCoe || args.row >= me.currentGljAdjList.length && args.col === 1
             || args.row < me.currentGljAdjList.length && args.col === 1 && me.currentGljAdjList[args.row].coeType !== '单个工料机'){
             args.cancel = true;
         }
-    }
-    ,
+    },
     onEditEnded: function (sender, args) {
         let me = gljAdjOprObj, isUpdate = false,
             dataCode = me.setting.header[args.col].dataCode;

+ 2 - 2
web/maintain/ration_repository/js/ration.js

@@ -551,8 +551,8 @@ let rationOprObj = {
                 sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
                 sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection);
                 //combo
-                sheetCommonObj.setStaticCombo(me.workBook.getActiveSheet(), 0, 2, cacheSection.length, rationUnits, 10, false);
-                sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), cacheSection.length, 2, me.workBook.getActiveSheet().getRowCount() - cacheSection.length, rationUnits, 10, false);
+                //sheetCommonObj.setStaticCombo(me.workBook.getActiveSheet(), 0, 2, cacheSection.length, rationUnits, 10, false);
+                sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 2, me.workBook.getActiveSheet().getRowCount(), rationUnits, 10, false);
                 if(me.mixDel === 1){
                     let row = me.workBook.getSheet(0).getSelections()[0].row;
                     if (cacheSection && row < cacheSection.length) {

+ 10 - 10
web/maintain/ration_repository/js/ration_assist.js

@@ -40,7 +40,7 @@ var rationAssistOprObj = {
         args.sheet.repaint();
         let cellType = args.sheet.getCellType(args.row, 5);
         if(cellType.typeName !== 'undefined' && cellType.typeName === '1'){
-            sheetCommonObj.setStaticCombo(args.sheet, 0, 5, 0, me.setting.comboItems, false);
+          //  sheetCommonObj.setStaticCombo(args.sheet, 0, 5, 0, me.setting.comboItems, false);
             sheetCommonObj.setDynamicCombo(args.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         }
     },
@@ -71,8 +71,8 @@ var rationAssistOprObj = {
             me.sheet.getParent().focus(true);
         });
         sheetCommonObj.cleanData(me.sheet, me.setting, -1);
-        sheetCommonObj.setStaticCombo(me.sheet, 0, 5, me.ration.rationAssList.length, me.setting.comboItems, false, false);
-        sheetCommonObj.setDynamicCombo(me.sheet, me.ration.rationAssList.length, 5, me.sheet.getRowCount() - me.ration.rationAssList.length, me.setting.comboItems, false, false);
+        //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, me.ration.rationAssList.length, me.setting.comboItems, false, false);
+        sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         sheetCommonObj.showData(me.sheet, me.setting, me.ration.rationAssList);
     },
 
@@ -119,8 +119,8 @@ var rationAssistOprObj = {
             me.sheet.getParent().focus(true);
         });
         sheetCommonObj.cleanData(me.sheet, me.setting, -1);
-        sheetCommonObj.setStaticCombo(me.sheet, 0, 5, assList.length, me.setting.comboItems, false, false);
-        sheetCommonObj.setDynamicCombo(me.sheet, assList.length, 5, me.sheet.getRowCount() - assList.length, me.setting.comboItems, false, false);
+        //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, assList.length, me.setting.comboItems, false, false);
+        sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         sheetCommonObj.showData(me.sheet, me.setting, assList);
     },
 
@@ -162,8 +162,8 @@ var rationAssistOprObj = {
                         workBook.focus(true);
                     });
                     sheetCommonObj.cleanData(me.sheet, me.setting, -1);
-                    sheetCommonObj.setStaticCombo(me.sheet, 0, 5, curCahe.length, me.setting.comboItems, false);
-                    sheetCommonObj.setDynamicCombo(me.sheet, curCahe.length, 5, me.sheet.getRowCount() - curCahe.length, me.setting.comboItems, false);
+                    //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, curCahe.length, me.setting.comboItems, false);
+                    sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false);
                     sheetCommonObj.showData(me.sheet, me.setting, curCahe);
                 }
             }
@@ -181,13 +181,13 @@ var rationAssistOprObj = {
 
         if (ration == undefined || ration.rationAssList == undefined ||
             ration.rationAssList.length == 0){
-            sheetCommonObj.setStaticCombo(me.sheet, 0, 5, 0, me.setting.comboItems, false);
+            //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, 0, me.setting.comboItems, false);
             sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
             return;
         }
         else {
-            sheetCommonObj.setStaticCombo(me.sheet, 0, 5, ration.rationAssList.length, me.setting.comboItems, false);
-            sheetCommonObj.setDynamicCombo(me.sheet, ration.rationAssList.length, 5, me.sheet.getRowCount() - ration.rationAssList.length, me.setting.comboItems, false, false);
+            //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, ration.rationAssList.length, me.setting.comboItems, false);
+            sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         }
         sheetCommonObj.showData(me.sheet, me.setting, ration.rationAssList);
     }

+ 11 - 15
web/maintain/std_glj_lib/js/glj.js

@@ -194,21 +194,10 @@ let repositoryGljObj = {
     showGljItems: function(data, type) {
         let me = repositoryGljObj;
         if (me.workBook) {
-            //let cacheSection = [];
             let cacheSection = data;
-            /*let pArr = me.parentNodeIds["_pNodeId_" + type];
-            console.log(pArr);
-            for (let i = 0; i < data.length; i++) {
-                if (pArr && pArr.indexOf(data[i].gljClass) >= 0) {
-                    cacheSection.push(data[i]);
-                } else if (type == data[i].gljClass) {
-                    cacheSection.push(data[i]);
-                }
-            }*/
             sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
             sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree);
-            sheetCommonObj.setStaticCombo(me.workBook.getActiveSheet(), 0, 5, cacheSection.length, me.distTypeTree.comboDatas, false, 'text');
-            sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), cacheSection.length, 5, me.workBook.getActiveSheet().getRowCount() - cacheSection.length, me.distTypeTree.comboDatas, false, 'text');
+            sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 5, me.workBook.getActiveSheet().getRowCount(), me.distTypeTree.comboDatas, false, 'text');
             cacheSection = null;
         }
     },
@@ -221,6 +210,7 @@ let repositoryGljObj = {
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditStarting, me.onCellEditStart);
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
+        me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.LeaveCell, me.onLeaveCell);
         me.workBook.getSheet(0).bind(GC.Spread.Sheets.Events.SelectionChanged, me.onSelectionChanged);
     },
     getCurrentComponent: function (gljComponent) {
@@ -304,7 +294,7 @@ let repositoryGljObj = {
             sheetCommonObj.cleanSheet(that.workBook.getSheet(0), that.setting, -1);
             me.workBook.focus(true);
             me.currentComponent = [];
-            that.workBook.getSheet(0).setRowCount(5);
+            that.workBook.getSheet(0).setRowCount(10);
             if(row < me.currentCache.length){
                 //标记当前工料机
                 me.currentGlj = me.currentCache[row];
@@ -323,9 +313,15 @@ let repositoryGljObj = {
             }
         }
     },
+    onLeaveCell: function (sender, args) {
+        let me = repositoryGljObj;
+        me.lastCol = args.col
+    },
     onEnterCell: function (sender, args) {
         let me = repositoryGljObj;
-        args.sheet.repaint();
+        if(me.setting.header[args.col].dataCode === 'gljType' || me.setting.header[me.lastCol].dataCode === 'gljType'){
+            args.sheet.repaint();
+        }
         me.cellRowIdx = args.row;
         let isHasData = false;
         if(me.addGljObj){
@@ -1106,7 +1102,7 @@ let gljTypeTreeOprObj = {
             gljTypeId = treeNode.ID;
         me.gljCurTypeId = treeNode.ID;
         me.addGljObj = null;
-        sheetCommonObj.cleanSheet(that.workBook.getSheet(0), that.setting, 5);
+        sheetCommonObj.cleanSheet(that.workBook.getSheet(0), that.setting, 10);
         if (me.parentNodeIds["_pNodeId_" + treeNode.ID]) {
             me.currentOprParent = 1;
             me.currentCache = me.getParentCache(me.parentNodeIds["_pNodeId_" + treeNode.ID]);