소스 검색

批量插入清单部位,无数据时不提交

MaiXinRong 5 년 전
부모
커밋
783e4354d9
1개의 변경된 파일11개의 추가작업 그리고 7개의 파일을 삭제
  1. 11 7
      app/public/js/ledger.js

+ 11 - 7
app/public/js/ledger.js

@@ -1861,14 +1861,18 @@ $(document).ready(function() {
                     insertData.batchType = (select.code && select.code !== '') ? 'child' : 'next';
                     insertData.id = ledgerTree.getNodeKey(select);
                     insertData.batchData = self.getBatchData();
-                    postData(window.location.pathname + '/update', {postType: 'batch-insert', postData: insertData}, function (data) {
-                        pos.updateDatas(data.pos);
-                        const result = ledgerTree.loadPostData(data.ledger);
-                        treeOperationObj.refreshTree(sheet, result);
-                        sheet.setSelection(result.create[0].index, sel.col, sel.rowCount, sel.colCount);
-                        treeOperationObj.refreshOperationValid(sheet);
+                    if (insertData.batchData.length > 0) {
+                        postData(window.location.pathname + '/update', {postType: 'batch-insert', postData: insertData}, function (data) {
+                            pos.updateDatas(data.pos);
+                            const result = ledgerTree.loadPostData(data.ledger);
+                            treeOperationObj.refreshTree(sheet, result);
+                            sheet.setSelection(result.create[0].index, sel.col, sel.rowCount, sel.colCount);
+                            treeOperationObj.refreshOperationValid(sheet);
+                            self.obj.modal('hide');
+                        }, null, true);
+                    } else {
                         self.obj.modal('hide');
-                    }, null, true);
+                    }
                 }
             });
         }