Browse Source

工料机库单位debug

zhongzewei 7 years ago
parent
commit
fdfcbf341c

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

@@ -51,6 +51,7 @@ let gljSchema = new Schema({
     code: String,
     name: String,
     specs: String,
+    unit: String,
     basePrice: Number,
     gljClass: Number,
     gljType: Number,

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

@@ -64,6 +64,14 @@ var sheetCommonObj = {
             sheet.setColumnWidth(i, setting.header[i].headerWidth?setting.header[i].headerWidth:100);
         }
     },
+    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();
+    },
     cleanSheet: function(sheet, setting, rowCount) {
         sheet.suspendPaint();
         sheet.suspendEvent();

+ 22 - 19
web/maintain/std_glj_lib/js/glj.js

@@ -191,7 +191,8 @@ let repositoryGljObj = {
                     cacheSection.push(data[i]);
                 }
             }
-            sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+            //sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+            sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
             sheetCommonObj.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree);
 
             cacheSection = null;
@@ -413,7 +414,6 @@ let repositoryGljObj = {
             rObj = sheetCommonObj.combineRowData(me.workBook.getSheet(0), me.setting, args.row, me),
             updateArr = [], addArr = [], updateBasePrcArr = [];
         me.editingRowIdx = args.row;
-        console.log(rObj);
         rObj.basePrice = rObj.basePrice ? rObj.basePrice : 0;
         //更新
         if (me.currentEditingGlj["ID"]) {
@@ -695,19 +695,20 @@ let repositoryGljObj = {
             }
             if(!isExsit) isValid = false;
         }
-        //
-        pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? that.round(parseFloat(pasteObj.basePrice), 2) :
-            me.currentCache[rowIdx].basePrice;
-        if(pasteObj.basePrice !== me.currentCache[rowIdx].basePrice){
-            reCalBasePrc = true;
-            tempObj.basePrice = pasteObj.basePrice;
-            let updateGljs = me.getUpdateGljs(tempObj, false);
-            if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
-                for(let i = 0; i < updateGljs.updateArr.length; i++){
-                    rst.updateGlj.push(updateGljs.updateArr[i]);
-                }
-                for(let i = 0; i < updateGljs.updateBasePrcArr.length; i++){
-                    rst.updateBasePrcArr.push(updateGljs.updateBasePrcArr[i]);
+        if(typeof pasteObj.basePrice !== 'undefined'){
+            pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? that.round(parseFloat(pasteObj.basePrice), 2) :
+                me.currentCache[rowIdx].basePrice;
+            if(pasteObj.basePrice !== me.currentCache[rowIdx].basePrice){
+                reCalBasePrc = true;
+                tempObj.basePrice = pasteObj.basePrice;
+                let updateGljs = me.getUpdateGljs(tempObj, false);
+                if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
+                    for(let i = 0; i < updateGljs.updateArr.length; i++){
+                        rst.updateGlj.push(updateGljs.updateArr[i]);
+                    }
+                    for(let i = 0; i < updateGljs.updateBasePrcArr.length; i++){
+                        rst.updateBasePrcArr.push(updateGljs.updateBasePrcArr[i]);
+                    }
                 }
             }
         }
@@ -783,9 +784,11 @@ let repositoryGljObj = {
                 for(let i = 0; i < items.length; i++){
                     let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
                     if(updateObj && typeof updateObj.updateGlj !== 'undefined'){
-                        updateArr = updateObj.updateGlj;
+                        //updateArr = updateObj.updateGlj;
+                        updateArr = updateArr.concat(updateObj.updateGlj);
                         if(typeof updateObj.updateBasePrc !== 'undefined'){
-                            updateBasePrcArr = updateObj.updateBasePrc;
+                            //updateBasePrcArr = updateObj.updateBasePrc;
+                            updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrc);
                         }
                     }
                     else{
@@ -798,9 +801,9 @@ let repositoryGljObj = {
                 for(let i = 0; i < updateCount; i++){
                     let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
                     if(updateObj && typeof updateObj.updateGlj !== 'undefined'){
-                        updateArr = updateObj.updateGlj;
+                        updateArr = updateArr.concat(updateObj.updateGlj);
                         if(typeof updateObj.updateBasePrc !== 'undefined'){
-                            updateBasePrcArr = updateObj.updateBasePrc;
+                            updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrc);
                         }
                     }
                     else{

+ 3 - 1
web/maintain/std_glj_lib/js/gljComponent.js

@@ -397,7 +397,9 @@ let gljComponentOprObj = {
                 if(result.data.length > 0){
                     if(result.data[0]){
                         that.currentComponent =  that.getCurrentComponent(result.data[0].component);
-                        sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+                        me.workBook.getSheet(0).getSelections()[0]
+                        //sheetCommonObj.cleanSheet(me.workBook.getSheet(0), me.setting, -1);
+                        sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
                         sheetCommonObj.showData(me.workBook.getSheet(0), me.setting, that.currentComponent);
                     }
                 }