|
@@ -22,6 +22,7 @@ $(function () {
|
|
|
level: 'level',
|
|
|
rootId: -1,
|
|
|
fullPath: 'full_path',
|
|
|
+ calcFields: ['plan_gcl', 'plan_tp', 'next_plan_gcl', 'next_plan_tp', 'end_plan_gcl', 'end_plan_tp', 'year_plan_gcl', 'year_plan_tp'],
|
|
|
};
|
|
|
const ledgerTree = createNewPathTree('filter', treeSetting);
|
|
|
|
|
@@ -38,8 +39,8 @@ $(function () {
|
|
|
{title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
{title: '本年计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'year_plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
{title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'year_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
- {title: '本年累计完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
- {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
+ {title: '本年累计完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'year_contract_qty', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
+ {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'year_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
{title: '本月计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
{title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
|
{title: '本期完成计量|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 70, type: 'Number', readOnly: true},
|
|
@@ -70,9 +71,11 @@ $(function () {
|
|
|
|
|
|
if (curScheduleStage && curScheduleStage.order) {
|
|
|
postData('/tender/' + getTenderId() + '/measure/stage/' + curScheduleStage.order + '/load', { filter: 'ledger' }, function (data) {
|
|
|
- const calcList = ['contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
|
|
|
+ const calcList = ['year_contract_qty', 'year_gather_tp',
|
|
|
+ 'contract_qty', 'end_gather_qty', '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'];
|
|
|
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'];
|
|
@@ -85,7 +88,7 @@ $(function () {
|
|
|
fullPath: 'full_path',
|
|
|
calcFields: calcList,
|
|
|
};
|
|
|
- baseLedgerTreeSetting.updateFields = ['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', '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);
|
|
@@ -113,11 +116,9 @@ $(function () {
|
|
|
node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
|
|
|
};
|
|
|
const baseLedgerTree = createNewPathTree('base', baseLedgerTreeSetting);
|
|
|
- const newLedgerList = setMonthToLedger(data.ledgerData, slmList, nextSlmList, endSlmList, yearSlmList);
|
|
|
- console.log(newLedgerList);
|
|
|
+ const newLedgerList = setMonthToLedger(data.ledgerData, slmList, nextSlmList, endSlmList, yearSlmList, curYearStageData);
|
|
|
baseLedgerTree.loadDatas(newLedgerList);
|
|
|
treeCalc.calculateAll(baseLedgerTree);
|
|
|
- console.log(baseLedgerTree);
|
|
|
for (const d of baseLedgerTree.nodes) {
|
|
|
if (!d.b_code) {
|
|
|
const one = _.find(selectedLedgerList, function (item) {
|
|
@@ -128,9 +129,8 @@ $(function () {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- console.log(ledgerTree);
|
|
|
ledgerTree.sortTreeNode(true);
|
|
|
- // console.log(ledgerTree);
|
|
|
+ treeCalc.calculateAll(ledgerTree);
|
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
|
|
|
}, null, true);
|
|
|
}
|
|
@@ -267,7 +267,7 @@ function setLeafData(tree) {
|
|
|
return newtree;
|
|
|
}
|
|
|
|
|
|
-function setMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm) {
|
|
|
+function setMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm, yearLedgerData) {
|
|
|
if (slm.length > 0) {
|
|
|
for(const s of slm) {
|
|
|
const index = _.findIndex(ledgerList, { 'ledger_id': s.lid });
|
|
@@ -304,6 +304,15 @@ function setMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (yearLedgerData.length > 0) {
|
|
|
+ for (const yl of yearLedgerData) {
|
|
|
+ const index = _.findIndex(ledgerList, {'id': yl.lid});
|
|
|
+ if (index && index !== -1) {
|
|
|
+ ledgerList[index].year_contract_qty = ZhCalc.add(yl.contract_qty, yl.qc_qty);
|
|
|
+ ledgerList[index].year_gather_tp = ZhCalc.add(yl.contract_tp, yl.qc_tp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return ledgerList;
|
|
|
}
|
|
|
const is_numeric = (value) => {
|