|
@@ -34,7 +34,7 @@ $(function () {
|
|
|
node.year_contract_qty = ZhCalc.round(ZhCalc.div(node.year_gather_tp, node.dgn_price), 3);
|
|
|
node.contract_qty = ZhCalc.round(ZhCalc.div(node.gather_tp, node.dgn_price), 3);
|
|
|
},
|
|
|
- calcFields: ['plan_tp', 'next_plan_tp', 'end_plan_tp', 'year_plan_tp', 'total_price', 'end_gather_tp', 'year_gather_tp', 'gather_tp'],
|
|
|
+ calcFields: ['plan_tp', 'next_plan_tp', 'end_plan_tp', 'year_plan_tp', 'total_price', 'end_gather_tp', 'year_gather_tp', 'gather_tp', 'end_final_gather_tp'],
|
|
|
};
|
|
|
const ledgerTree = createNewPathTree('filter', treeSetting);
|
|
|
|
|
@@ -87,12 +87,14 @@ $(function () {
|
|
|
postData('/tender/' + getTenderId() + '/schedule/stage/' + curScheduleStage.order + '/load', {}, function (data) {
|
|
|
const calcList = ['year_gather_tp',
|
|
|
'contract_tp', 'qc_qty', 'qc_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
|
|
|
- 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp'];
|
|
|
+ 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp',
|
|
|
+ 'final_contract_tp', 'final_qc_tp', 'pre_final_contract_tp', 'pre_final_qc_tp', 'pre_final_gather_tp', 'final_gather_tp', 'end_final_gather_tp'];
|
|
|
const showList = ['plan_gcl', 'plan_tp', 'next_plan_gcl', 'next_plan_tp', 'end_plan_gcl', 'end_plan_tp', 'year_plan_gcl', 'year_plan_tp',
|
|
|
'year_contract_qty', 'year_gather_tp',
|
|
|
'contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'ledger_id', 'ledger_pid', 'order', 'level', 'tender_id', 'full_path',
|
|
|
'code', 'name', 'unit', 'dgn_qty1', 'dgn_qty2', 'dgn_price', 'quantity', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
|
|
|
- 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp'];
|
|
|
+ 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp',
|
|
|
+ 'final_contract_tp', 'final_qc_tp', 'pre_final_contract_tp', 'pre_final_qc_tp', 'pre_final_gather_tp', 'final_gather_tp', 'end_final_gather_tp'];
|
|
|
const baseLedgerTreeSetting = {
|
|
|
id: 'ledger_id',
|
|
|
pid: 'ledger_pid',
|
|
@@ -102,7 +104,7 @@ $(function () {
|
|
|
fullPath: 'full_path',
|
|
|
calcFields: calcList,
|
|
|
};
|
|
|
- baseLedgerTreeSetting.updateFields = ['year_contract_qty', 'year_gather_tp', 'contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr'];
|
|
|
+ baseLedgerTreeSetting.updateFields = ['year_contract_qty', 'year_gather_tp', 'contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'final_contract_tp', 'final_qc_tp', 'postil', 'used', 'contract_expr'];
|
|
|
baseLedgerTreeSetting.calcFun = function (node) {
|
|
|
if (!node.children || node.children.length === 0) {
|
|
|
node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
|
|
@@ -128,6 +130,10 @@ $(function () {
|
|
|
node.end_correct_percent = ZhCalc.mul(ZhCalc.div(node.end_correct_tp, node.end_final_tp), 100, 2);
|
|
|
node.final_dgn_price = ZhCalc.round(ZhCalc.div(node.end_gather_tp, ZhCalc.add(node.deal_dgn_qty1, node.c_dgn_qty1)), tenderInfo.decimal.up);
|
|
|
node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
|
|
|
+
|
|
|
+ node.pre_final_gather_tp = ZhCalc.add(node.pre_final_contract_tp, node.pre_final_qc_tp);
|
|
|
+ node.final_gather_tp = ZhCalc.add(node.final_contract_tp, node.final_qc_tp);
|
|
|
+ node.end_final_gather_tp = ZhCalc.add(node.pre_final_gather_tp, node.final_gather_tp);
|
|
|
};
|
|
|
const baseLedgerTree = createNewPathTree('base', baseLedgerTreeSetting);
|
|
|
const newLedgerList = setMonthToLedger(data.ledgerData, slmList, nextSlmList, endSlmList, yearSlmList, curYearStageData);
|
|
@@ -146,6 +152,7 @@ $(function () {
|
|
|
ledgerTree.sortTreeNode(true);
|
|
|
treeCalc.calculateAll(ledgerTree);
|
|
|
calcGatherTpAndUpdate(ledgerTree.nodes);
|
|
|
+ console.log(ledgerTree);
|
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
|
|
|
}, null, true);
|
|
|
}
|
|
@@ -222,15 +229,18 @@ $(function () {
|
|
|
function calcGatherTpAndUpdate(tree) {
|
|
|
if (tree.length > 0) {
|
|
|
let total_tp = 0;
|
|
|
+ let final_total_tp = 0;
|
|
|
for (const t of tree) {
|
|
|
if (t.is_leaf && t.gather_tp) {
|
|
|
total_tp = ZhCalc.add(total_tp, t.gather_tp);
|
|
|
+ final_total_tp = ZhCalc.add(final_total_tp, t.end_final_gather_tp);
|
|
|
}
|
|
|
}
|
|
|
console.log(curScheduleStage.tp, total_tp);
|
|
|
- if (curScheduleStage.tp !== total_tp) {
|
|
|
+ console.log(schedule.stage_sj_tp, final_total_tp);
|
|
|
+ if (curScheduleStage.tp !== total_tp || schedule.stage_sj_tp !== final_total_tp) {
|
|
|
// 更新计量总金额并更新金额模式总金额
|
|
|
- postData('/tender/' + getTenderId() + '/schedule/stage/save', { type: 'update_tp', postData: { tp: total_tp, order: curScheduleStage.order } }, function (data) {
|
|
|
+ postData('/tender/' + getTenderId() + '/schedule/stage/save', { type: 'update_tp', postData: { tp: total_tp, stage_sj_tpL: final_total_tp, order: curScheduleStage.order } }, function (data) {
|
|
|
console.log('总金额已更新');
|
|
|
})
|
|
|
}
|