Kaynağa Gözat

台账分解、台账修订,删除清单前提示

MaiXinRong 5 yıl önce
ebeveyn
işleme
5d3e4e5a81

+ 8 - 6
app/public/js/ledger.js

@@ -300,12 +300,14 @@ $(document).ready(function() {
                         count: count
                     }
                 };
-                postData(window.location.pathname + '/update', data, function (result) {
-                    const refreshNode = tree.loadPostData(result);
-                    for (const d of refreshNode.delete) pos.removeDatasByMasterId(d.id);
-                    self.refreshTree(sheet, refreshNode);
-                    self.refreshOperationValid(sheet);
-                    posOperationObj.loadCurPosData();
+                deleteAfterHint(function () {
+                    postData(window.location.pathname + '/update', data, function (result) {
+                        const refreshNode = tree.loadPostData(result);
+                        for (const d of refreshNode.delete) pos.removeDatasByMasterId(d.id);
+                        self.refreshTree(sheet, refreshNode);
+                        self.refreshOperationValid(sheet);
+                        posOperationObj.loadCurPosData();
+                    });
                 });
             }
         },

+ 42 - 27
app/public/js/revise.js

@@ -282,35 +282,50 @@ $(document).ready(() => {
                 }
             }
 
-            postData(window.location.pathname + '/update', {
-                postType: type,
-                postData: {
-                    id: node.ledger_id,
-                    count: type === 'add' ? addCount : count,
-                }
-            }, function (result) {
-                const refreshData = tree.loadPostData(result);
-                self.refreshTree(sheet, refreshData);
-                if (type === 'delete') {
-                    const sel = sheet.getSelections()[0];
-                    if (sel) {
-                        sheet.setSelection(sel.row, sel.col, 1, sel.colCount);
-                    }
-                } else if (['up-move', 'down-move'].indexOf(type) > -1) {
-                    const sel = sheet.getSelections()[0];
-                    if (sel) {
-                        sheet.setSelection(tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
-                        SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, tree.nodes.indexOf(node)]);
+            if (type === 'delete') {
+                deleteAfterHint(function () {
+                    postData(window.location.pathname + '/update', {
+                        postType: type,
+                        postData: {
+                            id: node.ledger_id,
+                            count: type === 'add' ? addCount : count,
+                        }
+                    }, function (result) {
+                        const refreshData = tree.loadPostData(result);
+                        self.refreshTree(sheet, refreshData);
+                        const sel = sheet.getSelections()[0];
+                        if (sel) {
+                            sheet.setSelection(sel.row, sel.col, 1, sel.colCount);
+                        }
+                        self.refreshOperationValid(sheet);
+                    });
+                });
+            } else {
+                postData(window.location.pathname + '/update', {
+                    postType: type,
+                    postData: {
+                        id: node.ledger_id,
+                        count: type === 'add' ? addCount : count,
                     }
-                } else if (type === 'add') {
-                    const sel = sheet.getSelections()[0];
-                    if (sel) {
-                        sheet.setSelection(tree.nodes.indexOf(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
-                        SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, tree.nodes.indexOf(refreshData.create[0])]);
+                }, function (result) {
+                    const refreshData = tree.loadPostData(result);
+                    self.refreshTree(sheet, refreshData);
+                    if (['up-move', 'down-move'].indexOf(type) > -1) {
+                        const sel = sheet.getSelections()[0];
+                        if (sel) {
+                            sheet.setSelection(tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
+                            SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, tree.nodes.indexOf(node)]);
+                        }
+                    } else if (type === 'add') {
+                        const sel = sheet.getSelections()[0];
+                        if (sel) {
+                            sheet.setSelection(tree.nodes.indexOf(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
+                            SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, tree.nodes.indexOf(refreshData.create[0])]);
+                        }
                     }
-                }
-                self.refreshOperationValid(sheet);
-            });
+                    self.refreshOperationValid(sheet);
+                });
+            }
         },
         /**
          * 编辑单元格响应事件

+ 1 - 0
app/view/ledger/explode_modal.ejs

@@ -405,3 +405,4 @@
 <% } %>
 <% include ../shares/merge_peg_modal.ejs %>
 <% include ../shares/import_excel_modal.ejs %>
+<% include ../shares/delete_hint_modal.ejs %>

+ 1 - 0
app/view/revise/info_modal.ejs

@@ -480,6 +480,7 @@
 <% } %>
 <% include ../shares/merge_peg_modal.ejs %>
 <% include ../shares/import_excel_modal.ejs %>
+<% include ../shares/delete_hint_modal.ejs %>
 <script>
     <% if (ctx.session.sessionUser.accountId === revise.uid && (revise.status === audit.status.uncheck || revise.status === audit.status.checkNo)) { %>
     const accountList = JSON.parse('<%- JSON.stringify(accountList) %>');

+ 28 - 0
app/view/shares/delete_hint_modal.ejs

@@ -0,0 +1,28 @@
+<!--删除节点确认-->
+<div class="modal fade" id="del-node" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">删除确认</h5>
+            </div>
+            <div class="modal-body">
+                <h6 id="del-node-hint">确认删除「当前节点及子项」?</h6>
+                <h6>删除后,数据无法恢复,请谨慎操作。</h6>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-sm btn-danger" id="del-node-ok" data-dismiss="modal">确定删除</button>
+                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    const deleteAfterHint = function (fun, hint = '') {
+        $('#del-node').modal('show');
+        $('#del-node-ok').bind('click', fun);
+        if (hint) $('#del-node-hint').html(hint);
+        $('#del-node').bind('hidden.bs.modal', function () {
+            $('#del-node-ok').unbind('click');
+        })
+    }
+</script>