|
@@ -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);
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 编辑单元格响应事件
|