|
@@ -369,72 +369,70 @@ $(function () {
|
|
|
|
|
|
const huizongObj = {
|
|
|
setSjs: function (order) {
|
|
|
- postData('/tender/' + getTenderId() + '/measure/stage/' + order + '/load', { filter: 'ledger', comefrom: 'schedule' }, function (data) {
|
|
|
- postData('/tender/' + getTenderId() + '/schedule/stage/' + order + '/load', {}, function (data2) {
|
|
|
- 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'];
|
|
|
- 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'];
|
|
|
- const baseLedgerTreeSetting = {
|
|
|
- id: 'ledger_id',
|
|
|
- pid: 'ledger_pid',
|
|
|
- order: 'order',
|
|
|
- level: 'level',
|
|
|
- rootId: -1,
|
|
|
- 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.calcFun = function (node) {
|
|
|
- if (!node.children || node.children.length === 0) {
|
|
|
- node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
|
|
|
- node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
|
|
|
- node.end_contract_qty = ZhCalc.add(node.pre_contract_qty, node.contract_qty);
|
|
|
- node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
|
|
|
- node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
|
|
|
- }
|
|
|
- node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
|
|
|
- node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
|
|
|
- node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp);
|
|
|
- node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
|
|
|
- node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
|
|
|
- node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
|
|
|
- if (!node.children || node.children.length === 0) {
|
|
|
- if (node.end_contract_qty) {
|
|
|
- node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
|
|
|
- } else {
|
|
|
- node.end_correct_tp = node.end_gather_tp;
|
|
|
- }
|
|
|
+ postData('/tender/' + getTenderId() + '/schedule/stage/' + order + '/load', {filter: 'gcl' }, 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'];
|
|
|
+ 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'];
|
|
|
+ const baseLedgerTreeSetting = {
|
|
|
+ id: 'ledger_id',
|
|
|
+ pid: 'ledger_pid',
|
|
|
+ order: 'order',
|
|
|
+ level: 'level',
|
|
|
+ rootId: -1,
|
|
|
+ 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.calcFun = function (node) {
|
|
|
+ if (!node.children || node.children.length === 0) {
|
|
|
+ node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
|
|
|
+ node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
|
|
|
+ node.end_contract_qty = ZhCalc.add(node.pre_contract_qty, node.contract_qty);
|
|
|
+ node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
|
|
|
+ node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
|
|
|
+ }
|
|
|
+ node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
|
|
|
+ node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
|
|
|
+ node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp);
|
|
|
+ node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
|
|
|
+ node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
|
|
|
+ node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
|
|
|
+ if (!node.children || node.children.length === 0) {
|
|
|
+ if (node.end_contract_qty) {
|
|
|
+ node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
|
|
|
+ } else {
|
|
|
+ node.end_correct_tp = node.end_gather_tp;
|
|
|
}
|
|
|
- node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
|
|
|
- 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);
|
|
|
- };
|
|
|
- const baseLedgerTree = createNewPathTree('base', baseLedgerTreeSetting);
|
|
|
- const newLedgerList = setTpMonthToLedger(data.ledgerData, data2.slmList, data2.nextSlmList, data2.endSlmList, data2.yearSlmList, data2.curYearStageData);
|
|
|
- baseLedgerTree.loadDatas(newLedgerList);
|
|
|
- treeCalc.calculateAll(baseLedgerTree);
|
|
|
- const huizongTree = createNewPathTree('filter', huizongTreeSetting);
|
|
|
- for (const d of baseLedgerTree.nodes) {
|
|
|
- if (!d.b_code) {
|
|
|
- const one = _.find(selectedLedgerList, function (item) {
|
|
|
- return item === d.ledger_id;
|
|
|
- });
|
|
|
- if (one) {
|
|
|
- huizongTree.addData(d, showList);
|
|
|
- }
|
|
|
+ }
|
|
|
+ node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
|
|
|
+ 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);
|
|
|
+ };
|
|
|
+ const baseLedgerTree = createNewPathTree('base', baseLedgerTreeSetting);
|
|
|
+ const newLedgerList = setTpMonthToLedger(data.ledgerData, data.slmList, data.nextSlmList, data.endSlmList, data.yearSlmList, data.curYearStageData);
|
|
|
+ baseLedgerTree.loadDatas(newLedgerList);
|
|
|
+ treeCalc.calculateAll(baseLedgerTree);
|
|
|
+ const huizongTree = createNewPathTree('filter', huizongTreeSetting);
|
|
|
+ for (const d of baseLedgerTree.nodes) {
|
|
|
+ if (!d.b_code) {
|
|
|
+ const one = _.find(selectedLedgerList, function (item) {
|
|
|
+ return item === d.ledger_id;
|
|
|
+ });
|
|
|
+ if (one) {
|
|
|
+ huizongTree.addData(d, showList);
|
|
|
}
|
|
|
}
|
|
|
- huizongTree.sortTreeNode(true);
|
|
|
- treeCalc.calculateAll(huizongTree);
|
|
|
- console.log(huizongTree);
|
|
|
- SpreadJsObj.loadSheetData(huizongSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, huizongTree);
|
|
|
- }, null, true);
|
|
|
+ }
|
|
|
+ huizongTree.sortTreeNode(true);
|
|
|
+ treeCalc.calculateAll(huizongTree);
|
|
|
+ console.log(huizongTree);
|
|
|
+ SpreadJsObj.loadSheetData(huizongSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, huizongTree);
|
|
|
}, null, true);
|
|
|
},
|
|
|
dropDownHtml: function (order) {
|