|
@@ -559,7 +559,50 @@ $(document).ready(() => {
|
|
|
info.cancel = !_.isEmpty(node.b_code);
|
|
|
break;
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ cut: function (sheet, sel, callback) {
|
|
|
+ if (!sheet || !sel) return;
|
|
|
+ if (sel.colCount >= sheet.zh_setting.cols.length) {
|
|
|
+ toastr.warning('请勿选中整行剪切');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const sortData = SpreadJsObj.getSortData(sheet), datas = [];
|
|
|
+ for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
|
|
|
+ const node = sortData[iRow];
|
|
|
+ if (node) {
|
|
|
+ const data = sheet.zh_tree.getNodeKeyData(node);
|
|
|
+ for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
+ const col = sheet.zh_setting.cols[iCol];
|
|
|
+ if (col.field === 'b_code' || col.field === 'sgfh_qty' || col.field === 'sgfh_tp' ||
|
|
|
+ col.field === 'sjcl_qty' || col.field === 'sjcl_tp' ||
|
|
|
+ col.field === 'qtcl_qty' || col.field === 'qtcl_tp') {
|
|
|
+ const lPos = pos.getLedgerPos(node.id);
|
|
|
+ if (lPos && lPos.length > 0) {
|
|
|
+ toastr.error('不可剪切');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const style = sheet.getStyle(iRow, iCol);
|
|
|
+ if (style.locked) {
|
|
|
+ toastr.error('不可剪切');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
+ data[colSetting.field] = null;
|
|
|
+ }
|
|
|
+ datas.push(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (datas.length > 0) {
|
|
|
+ callback();
|
|
|
+ postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
|
|
|
+ const refreshNode = sheet.zh_tree.loadPostData(result);
|
|
|
+ billsTreeSpreadObj.refreshTree(sheet, refreshNode);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
};
|
|
|
billsTreeSpreadObj.refreshOperationValid(billsSheet);
|
|
|
billsTreeSpreadObj.loadExprToInput(billsSheet);
|
|
@@ -619,6 +662,7 @@ $(document).ready(() => {
|
|
|
billsSpread.bind(spreadNS.Events.ClipboardPasting, billsTreeSpreadObj.clipboardPasting);
|
|
|
billsSpread.bind(spreadNS.Events.ClipboardPasted, billsTreeSpreadObj.clipboardPasted);
|
|
|
SpreadJsObj.addDeleteBind(billsSpread, billsTreeSpreadObj.deletePress);
|
|
|
+ SpreadJsObj.addCutEvents(billsSpread, billsTreeSpreadObj.cut);
|
|
|
let batchInsertObj;
|
|
|
// 右键菜单
|
|
|
$.contextMenu({
|