|
@@ -1632,54 +1632,54 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- // 'remainCurPos': {
|
|
|
- // name: '填剩余量(计量单元)',
|
|
|
- // disabled: function (key, opt) {
|
|
|
- // const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- // return readOnly || !node || node.lock;
|
|
|
- // },
|
|
|
- // callback: function (key, opt) {
|
|
|
- // const sheet = spSpread.getActiveSheet();
|
|
|
- // const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- //
|
|
|
- // const data = { updateType: 'update', updateData: [] };
|
|
|
- // const posterity = stageTree.getPosterity(node);
|
|
|
- // posterity.unshift(node);
|
|
|
- // for (const p of posterity) {
|
|
|
- // if (p.children && p.children.length > 0) continue;
|
|
|
- // if (!p.b_code) continue;
|
|
|
- // const posRange = stagePos.ledgerPos[itemsPre + p.id] || [];
|
|
|
- // if (posRange.length === 0) continue;
|
|
|
- //
|
|
|
- // for (const pr of posRange) {
|
|
|
- // const qty = ZhCalc.sub(pr.quantity, pr.pre_contract_qty);
|
|
|
- // const differ = ZhCalc.sub(pr.quantity, pr.end_contract_qty);
|
|
|
- // if (differ) data.updateData.push({ pid: pr.id, contract_qty: qty, contract_expr: '' });
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (data.updateData.length === 0) {
|
|
|
- // toastr.warning('所选节点及子项已全部计量');
|
|
|
- // return;
|
|
|
- // }
|
|
|
- //
|
|
|
- // if (updateStage.length > 0) {
|
|
|
- // if (updateStage.length > 1000) {
|
|
|
- // toastr.warning('提交的数据太大,仅提交1000条数据');
|
|
|
- // updateStage.length = 1000;
|
|
|
- // }
|
|
|
- // postData(window.location.pathname + '/update', {pos: data}, function (result) {
|
|
|
- // const nodes = stageTree.loadPostStageData(result);
|
|
|
- // stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
- // if (detail) {
|
|
|
- // detail.loadStageLedgerUpdateData(result, nodes);
|
|
|
- // } else {
|
|
|
- // stageIm.loadUpdateLedgerData(result, nodes);
|
|
|
- // }
|
|
|
- // stageTreeSpreadObj.loadExprToInput(sheet);
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
+ 'remainCurPos': {
|
|
|
+ name: '填剩余量(计量单元)',
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ return readOnly || !node || node.lock;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ const sheet = spSpread.getActiveSheet();
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+
|
|
|
+ const data = { updateType: 'update', updateData: [] };
|
|
|
+ const posterity = stageTree.getPosterity(node);
|
|
|
+ posterity.unshift(node);
|
|
|
+ for (const p of posterity) {
|
|
|
+ if (p.children && p.children.length > 0) continue;
|
|
|
+ if (!p.b_code) continue;
|
|
|
+ const posRange = stagePos.ledgerPos[itemsPre + p.id] || [];
|
|
|
+ if (posRange.length === 0) continue;
|
|
|
+
|
|
|
+ for (const pr of posRange) {
|
|
|
+ const qty = ZhCalc.sub(pr.quantity, pr.pre_contract_qty);
|
|
|
+ const differ = ZhCalc.sub(pr.quantity, pr.end_contract_qty);
|
|
|
+ if (differ) data.updateData.push({ lid: pr.lid, pid: pr.id, contract_qty: qty, contract_expr: '' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (data.updateData.length === 0) {
|
|
|
+ toastr.warning('所选节点及子项已全部计量');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (updateStage.length > 0) {
|
|
|
+ if (updateStage.length > 1000) {
|
|
|
+ toastr.warning('提交的数据太大,仅提交1000条数据');
|
|
|
+ updateStage.length = 1000;
|
|
|
+ }
|
|
|
+ postData(window.location.pathname + '/update', {pos: data}, function (result) {
|
|
|
+ const nodes = stageTree.loadPostStageData(result);
|
|
|
+ stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
+ if (detail) {
|
|
|
+ detail.loadStageLedgerUpdateData(result, nodes);
|
|
|
+ } else {
|
|
|
+ stageIm.loadUpdateLedgerData(result, nodes);
|
|
|
+ }
|
|
|
+ stageTreeSpreadObj.loadExprToInput(sheet);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
'remainXmjQty': {
|
|
|
name: '填项目节数量',
|
|
|
callback: function(key, opt) {
|