|
@@ -265,13 +265,56 @@ $(function () {
|
|
|
}
|
|
|
},
|
|
|
deletePress: function (sheet) {
|
|
|
- return;
|
|
|
+ if (!sheet.zh_setting || sheet.zh_setting.readOnly) return;
|
|
|
+ if (sheet.zh_setting && sheet.zh_tree) {
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!sel) return;
|
|
|
+ if(sel.rowCount > 1 || sel.colCount > 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const col = sheet.zh_setting.cols[sel.col];
|
|
|
+ const orgValue = select[col.field];
|
|
|
+ if (!orgValue) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const yearmonth = col.field.split('_')[0];
|
|
|
+ const modes = col.field.split('_')[1];
|
|
|
+ if(col.readOnly === true || !select.is_leaf || mode[modes] !== schedule.mode) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let plan_gcl = 0;
|
|
|
+ let plan_tp = 0;
|
|
|
+ select[col.field] = 0;
|
|
|
+ const updateData = {
|
|
|
+ lid: select.ledger_id,
|
|
|
+ yearmonth,
|
|
|
+ plan_gcl,
|
|
|
+ plan_tp,
|
|
|
+ };
|
|
|
+ postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
|
|
|
+ if (modes === 'tp') {
|
|
|
+ select[yearmonth + '_gcl'] = plan_gcl;
|
|
|
+ } else {
|
|
|
+ select[yearmonth + '_tp'] = plan_tp;
|
|
|
+ }
|
|
|
+ const nodes = treeCalc.calculateParent(sheet.zh_tree, select);
|
|
|
+ const refreshNode = ledgerTree.loadPostData({update: nodes});
|
|
|
+ ledgerSpreadObj.refreshTree(sheet, refreshNode);
|
|
|
+ },function () {
|
|
|
+ select[col.field] = orgValue;
|
|
|
+ const nodes = treeCalc.calculateParent(sheet.zh_tree, select);
|
|
|
+ const refreshNode = ledgerTree.loadPostData({update: nodes});
|
|
|
+ ledgerSpreadObj.refreshTree(sheet, refreshNode);
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
clipboardPasted(e, info) {
|
|
|
const hint = {
|
|
|
cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
|
|
|
numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
|
|
|
};
|
|
|
+ console.log(info);
|
|
|
const range = info.cellRange;
|
|
|
if (range.rowCount > 1 || range.colCount > 1) {
|
|
|
toastMessageUniq(hint.cellError);
|