Browse Source

剪切不成功问题

MaiXinRong 5 years ago
parent
commit
d72d1e7e40
2 changed files with 4 additions and 3 deletions
  1. 2 1
      app/public/js/ledger.js
  2. 2 2
      app/public/js/spreadjs_rela/spreadjs_zh.js

+ 2 - 1
app/public/js/ledger.js

@@ -745,6 +745,7 @@ $(document).ready(function() {
             SpreadJsObj.saveTopAndSelect(info.sheet, ckBillsSpread);
             SpreadJsObj.saveTopAndSelect(info.sheet, ckBillsSpread);
         },
         },
         cut: function (sheet, sel, callback) {
         cut: function (sheet, sel, callback) {
+            sheet = ledgerSpread.getActiveSheet();
             if (!sheet || !sel) return;
             if (!sheet || !sel) return;
             if (sel.colCount >= sheet.zh_setting.cols.length) {
             if (sel.colCount >= sheet.zh_setting.cols.length) {
                 toastr.warning('请勿选中整行剪切');
                 toastr.warning('请勿选中整行剪切');
@@ -780,9 +781,9 @@ $(document).ready(function() {
             }
             }
 
 
             if (datas.length > 0) {
             if (datas.length > 0) {
+                callback();
                 postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
                 postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
                     const refreshNode = sheet.zh_tree.loadPostData(result);
                     const refreshNode = sheet.zh_tree.loadPostData(result);
-                    callback();
                     treeOperationObj.refreshTree(sheet, refreshNode);
                     treeOperationObj.refreshTree(sheet, refreshNode);
                 });
                 });
             }
             }

+ 2 - 2
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -90,11 +90,11 @@ const SpreadJsObj = {
     addCutEvents: function (spread, fun) {
     addCutEvents: function (spread, fun) {
         const cut = spreadNS.Commands.cut.execute;
         const cut = spreadNS.Commands.cut.execute;
         spreadNS.Commands.cut.execute = function (context, options, isUndo) {
         spreadNS.Commands.cut.execute = function (context, options, isUndo) {
-            const self = this, sheet = context.getActiveSheet();
+            const sheet = context.getActiveSheet();
             const sels = sheet.getSelections();
             const sels = sheet.getSelections();
             const sel = sels ? sels[0] : null;
             const sel = sels ? sels[0] : null;
             if (sel) {
             if (sel) {
-                return fun(sheet,  sel, function () {
+                return fun(sheet, sel, function () {
                     cut(context, options, isUndo);
                     cut(context, options, isUndo);
                 });
                 });
             }
             }