Browse Source

清单模板复制粘贴

zhangweicheng 7 năm trước cách đây
mục cha
commit
f28a51fda4

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 12557 - 0
web/users/js/lib/lodash.js


+ 3 - 0
web/users/js/main_tree_col.js

@@ -34,6 +34,9 @@ let MainTreeCol = {
         },
         marketPrice: function (node) {
 
+        },
+        feeRate:function (node) {
+            
         }
 
     },

+ 23 - 15
web/users/js/template.js

@@ -269,7 +269,7 @@ $(document).ready(function () {
             let flagField = fieldName.split('.');
             data.data.flags.push({fieldName: flagField[1],flag: value});
         } else {
-            if(valueType == 'Number') value = parseInt(value);
+            if(value && valueType == 'Number') value = parseInt(value);
             setFee(data.data, fieldName, value);
         }
     };
@@ -316,7 +316,7 @@ $(document).ready(function () {
                 let flagField = fieldName.split('.');
                 data.data.flags.push({fieldName: flagField[1], flag: info.editingText});
             } else {
-                if(valueType == 'Number') value = parseInt(info.editingText);
+                if(value && valueType == 'Number') value = parseInt(info.editingText);
                 setFee(data.data, fieldName, value);
             }
             var updateData = [data];
@@ -342,18 +342,6 @@ $(document).ready(function () {
                 for (iCol = 0; iCol < info.cellRange.colCount; iCol++) {
                     curCol = info.cellRange.col + iCol;
                     value = info.sheet.getText(curRow, curCol);
-                   /* curCol = info.cellRange.col + iCol;
-                    fieldName = controller.setting.cols[curCol].data.field;
-                    valueType = controller.setting.cols[curCol].data.type;
-                    value = info.sheet.getText(curRow, curCol);
-                    if (/flagsIndex/.test(fieldName)) {
-                        data.data.flags = [];
-                        let flagField = fieldName.split('.');
-                        data.data.flags.push({fieldName: flagField[1],flag: value});
-                    } else {
-                        if(valueType == 'Number') value = parseInt(value);
-                        setFee(data.data, fieldName, value);
-                    }*/
                     setUpdateData(node,data,curCol,value,controller.setting);
                 }
                 datas.push(data);
@@ -367,7 +355,27 @@ $(document).ready(function () {
         });
     });
     billsSpread.bind(GC.Spread.Sheets.Events.RangeChanged, function (e,info) {
-        console.log(info);
+        let datas = [];
+        let changGroup = _.groupBy(info.changedCells,'row');
+        for(let row in changGroup){
+            let node = controller.tree.items[row];
+            if (node) {
+                let data = {type: 'update', data: {ID: node.getID()}};
+                for (let cell of changGroup[row]) {
+                    let value = info.sheet.getText(cell.row, cell.col);
+                    if(value=="") value = null;
+                    setUpdateData(node,data,cell.col,value,controller.setting);
+                }
+                datas.push(data);
+            }
+        }
+        CommonAjax.post(updateUrl, datas, function (data) {
+            RefreshBillsData(data);
+            controller.showTreeData();
+        }, function () {
+            controller.showTreeData();
+        });
+
     });
     tree.loadDatas(templateData);
     controller.showTreeData();

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
web/users/views/layout/layout.html