|
@@ -16,9 +16,6 @@ const billsCompareField = [
|
|
|
const posCompareField = [
|
|
|
'name', 'position', 'sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'quantity'
|
|
|
];
|
|
|
-const compareColor = {
|
|
|
- add: '#D9EDF7'
|
|
|
-}
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
let searchLedger;
|
|
@@ -27,7 +24,10 @@ $(document).ready(() => {
|
|
|
const billsSpread = SpreadJsObj.createNewSpread($('#bills-spread')[0]);
|
|
|
const billsSheet = billsSpread.getActiveSheet();
|
|
|
sjsSettingObj.setFxTreeStyle(billsSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
|
|
|
- if (thousandth) sjsSettingObj.setTpThousandthFormat(billsSpreadSetting);
|
|
|
+ if (thousandth) {
|
|
|
+ sjsSettingObj.setTpThousandthFormat(billsSpreadSetting);
|
|
|
+ sjsSettingObj.setTpColsThousandthFormat(billsSpreadSetting.extraCols);
|
|
|
+ }
|
|
|
billsSpreadSetting.getColor = function (sheet, data, row, col, defaultColor) {
|
|
|
// 增
|
|
|
if (data.differ.indexOf('add') >= 0) return '#cce5ff';
|
|
@@ -52,7 +52,11 @@ $(document).ready(() => {
|
|
|
const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
|
|
|
const posSheet = posSpread.getActiveSheet();
|
|
|
sjsSettingObj.setGridSelectStyle(posSpreadSetting);
|
|
|
- if (thousandth) sjsSettingObj.setTpThousandthFormat(posSpreadSetting);
|
|
|
+ if (thousandth) {
|
|
|
+ sjsSettingObj.setTpThousandthFormat(posSpreadSetting);
|
|
|
+ sjsSettingObj.setTpColsThousandthFormat(posSpreadSetting.extraCols);
|
|
|
+ }
|
|
|
+
|
|
|
posSpreadSetting.getColor = function (sheet, data, row, col, defaultColor) {
|
|
|
// 增
|
|
|
if (data.differ.indexOf('add') >= 0) return '#cce5ff';
|
|
@@ -75,7 +79,11 @@ $(document).ready(() => {
|
|
|
full_path: 'full_path',
|
|
|
rootId: -1,
|
|
|
keys: ['id', 'tender_id', 'ledger_id'],
|
|
|
- calcFields: ['sgfh_tp', 'sjcl_tp', 'qtcl_tp', 'total_price'],
|
|
|
+ calcFields: [
|
|
|
+ 'org_sgfh_tp', 'org_sjcl_tp', 'org_qtcl_tp', 'org_total_price', 'org_deal_tp',
|
|
|
+ 'new_sgfh_tp', 'new_sjcl_tp', 'new_qtcl_tp', 'new_total_price', 'new_deal_tp',
|
|
|
+ 'contract_tp', 'qc_tp', 'end_contract_tp', 'end_qc_tp'
|
|
|
+ ],
|
|
|
findNode: function (tree, node, parent) {
|
|
|
const sameId = tree.datas.find(x => {return x.id === node.id});
|
|
|
if (sameId) {
|
|
@@ -199,6 +207,18 @@ $(document).ready(() => {
|
|
|
treeSetting.calcFields.push('deal_tp');
|
|
|
}
|
|
|
treeSetting.calcFun = function (node) {
|
|
|
+ if (!node.children || node.children.length === 0) {
|
|
|
+ // node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
|
|
|
+ // node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
|
|
|
+ node.end_contract_qty = ZhCalc.add(node.contract_qty, node.pre_contract_qty);
|
|
|
+ node.end_qc_qty = ZhCalc.add(node.qc_qty, node.pre_qc_qty);
|
|
|
+ // node.end_gather_qty = ZhCalc.add(node.end_contract_qty, node.end_qc_qty);
|
|
|
+ }
|
|
|
+ // node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
|
|
|
+ // node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
|
|
|
+ node.end_contract_tp = ZhCalc.add(node.contract_tp, node.pre_contract_tp);
|
|
|
+ node.end_qc_tp = ZhCalc.add(node.qc_tp, node.pre_qc_tp);
|
|
|
+ // node.end_gather_tp = ZhCalc.add(node.end_contract_tp, node.end_qc_tp);
|
|
|
node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
|
|
|
};
|
|
|
const billsTree = createNewPathTree('compare', treeSetting);
|
|
@@ -256,6 +276,7 @@ $(document).ready(() => {
|
|
|
orgLedger.pos.loadDatas(result.pos);
|
|
|
|
|
|
billsTree.loadCompareData(reviseLedger, orgLedger);
|
|
|
+ treeCalc.calculateAll(billsTree);
|
|
|
SpreadJsObj.loadSheetData(billsSheet, SpreadJsObj.DataType.Tree, billsTree);
|
|
|
|
|
|
posSpreadObj.loadCurPosData();
|
|
@@ -394,5 +415,47 @@ $(document).ready(() => {
|
|
|
}
|
|
|
});
|
|
|
})('a[name=showLevel]', billsSheet);
|
|
|
+
|
|
|
+ // 加载计量数据
|
|
|
+ $('#load-stage-ok').click(function (x) {
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/revise/load', {filter: 'stageBills;stagePos'}, function (result) {
|
|
|
+ const col = billsSpreadSetting.cols.length;
|
|
|
+ billsSpreadSetting.cols = billsSpreadSetting.cols.concat(billsSpreadSetting.extraCols);
|
|
|
+ SpreadJsObj.reinitSheetHeader(billsSheet);
|
|
|
+ for (const b of result.stageBills) {
|
|
|
+ const node = billsTree.nodes.find(x => {return x.id === b.lid});
|
|
|
+ if (!node) continue;
|
|
|
+
|
|
|
+ for (const f of ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'pre_contract_qty', 'pre_contract_tp', 'pre_qc_qty', 'pre_qc_tp']) {
|
|
|
+ node[f] = b[f];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ treeCalc.calculateAll(billsTree);
|
|
|
+ SpreadJsObj.reloadColData(billsSheet, col, billsSpreadSetting.extraCols.length);
|
|
|
+
|
|
|
+ posSpreadSetting.cols = posSpreadSetting.cols.concat(posSpreadSetting.extraCols);
|
|
|
+ SpreadJsObj.reinitSheetHeader(posSheet);
|
|
|
+ // todo 加载并计算计量单元期数据
|
|
|
+ for (const p of result.stagePos) {
|
|
|
+ const node = billsTree.nodes.find(x => {return x.id === p.lid});
|
|
|
+ if (!node) continue;
|
|
|
+ const pos = node.pos.find(x => {return x.id === p.pid});
|
|
|
+ if (!pos) continue;
|
|
|
+
|
|
|
+ pos.contract_qty = p.contract_qty;
|
|
|
+ pos.qc_qty = p.qc_qty;
|
|
|
+ //pos.gather_qty = ZhCalc.add(pos.contract_qty, pos.qc_qty);
|
|
|
+ pos.pre_contract_qty = p.pre_contract_qty;
|
|
|
+ pos.pre_qc_qty = p.pre_qc_qty;
|
|
|
+ //pos.pre_gather_qty = ZhCalc.add(pos.pre_contract_qty, pos.pre_qc_qty);
|
|
|
+ pos.end_contract_qty = ZhCalc.add(pos.contract_qty, pos.pre_contract_qty);
|
|
|
+ pos.end_qc_qty = ZhCalc.add(pos.qc_qty, pos.pre_qc_qty);
|
|
|
+ //pos.end_gather_qty = ZhCalc.add(pos.gather_qty, pos.pre_gather_qty);
|
|
|
+ }
|
|
|
+ posSpreadObj.loadCurPosData();
|
|
|
+ //$('[data-target=#load-stage]').hide();
|
|
|
+ $('#load-stage').modal('hide');
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
|