Преглед изворни кода

1. 插入标准清单后,定位节点出错
2. 台账分解,判断公式问题

MaiXinRong пре 5 година
родитељ
комит
812b0b7053
1 измењених фајлова са 18 додато и 14 уклоњено
  1. 18 14
      app/public/js/ledger.js

+ 18 - 14
app/public/js/ledger.js

@@ -404,21 +404,25 @@ $(document).ready(function() {
                     }
                 }
                 // 获取更新数据
-                if (info.editingText) {
-                    const num = _.toNumber(info.editingText);
-                    if (num) {
-                        data[col.field] = num;
-                    } else {
-                        try {
-                            data[col.field] = math.evaluate(transExpr(info.editingText));
-                        } catch(err) {
-                            toastr.error('输入的表达式非法');
-                            SpreadJsObj.reLoadRowData(info.sheet, info.row);
-                            return;
+                if (col.type === 'Number') {
+                    if (info.editingText) {
+                        const num = _.toNumber(info.editingText);
+                        if (num) {
+                            data[col.field] = num;
+                        } else {
+                            try {
+                                data[col.field] = math.evaluate(transExpr(info.editingText));
+                            } catch(err) {
+                                toastr.error('输入的表达式非法');
+                                SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                                return;
+                            }
                         }
+                    } else {
+                        data[col.field] = null;
                     }
                 } else {
-                    data[col.field] = null;
+                    data[col.field] = info.editingText;
                 }
                 // 更新至服务器
                 postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
@@ -1614,7 +1618,7 @@ $(document).ready(function() {
                 }, function (result) {
                     const refreshNode = mainTree.loadPostData(result);
                     treeOperationObj.refreshTree(mainSheet, refreshNode);
-                    sheet.setSelection(refreshNode.create[0].index, sel.col, sel.rowCount, sel.colCount);
+                    mainSheet.setSelection(refreshNode.create[0].index, sel.col, sel.rowCount, sel.colCount);
                     treeOperationObj.refreshOperationValid(mainSheet);
                 });
             });
@@ -1679,7 +1683,7 @@ $(document).ready(function() {
                     const refreshData = mainTree.loadPostData(result);
                     treeOperationObj.refreshTree(mainSheet, refreshData);
                     const sel = mainSheet.getSelections()[0];
-                    sheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
+                    mainSheet.setSelection(refreshData.create[0].index, sel.col, sel.rowCount, sel.colCount);
                     treeOperationObj.refreshOperationValid(mainSheet);
                 });
             });