|
@@ -49,6 +49,14 @@ $(document).ready(() => {
|
|
const getStackedBarTip = function (data) {
|
|
const getStackedBarTip = function (data) {
|
|
return data.stackedBarTips.join('\n');
|
|
return data.stackedBarTips.join('\n');
|
|
};
|
|
};
|
|
|
|
+ const comparePhase = [
|
|
|
|
+ { key: 'gu', name: '投资估算', dgn1: 'gu_dgn_qty1', dgn2: 'gu_dgn_qty2', tp: 'gu_tp'},
|
|
|
|
+ { key: 'gai', name: '设计概算', dgn1: 'gai_dgn_qty1', dgn2: 'gai_dgn_qty2', tp: 'gai_tp'},
|
|
|
|
+ { key: 'yu', name: '施工图预算', dgn1: 'yu_dgn_qty1', dgn2: 'yu_dgn_qty2', tp: 'yu_tp'},
|
|
|
|
+ { key: 'zb', name: '招标预算', dgn1: 'zb_dgn_qty1', dgn2: 'zb_dgn_qty2', tp: 'zb_tp'},
|
|
|
|
+ { key: 'tz', name: '台账', dgn1: 'dgn_qty1', dgn2: 'dgn_qty2', tp: 'total_price'},
|
|
|
|
+ { key: 'final', name: '预估决算', dgn1: 'final_dgn_qty1', dgn2: 'final_dgn_qty2', tp: 'final_tp'},
|
|
|
|
+ ];
|
|
const spreadSetting = {
|
|
const spreadSetting = {
|
|
cols: [
|
|
cols: [
|
|
{title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 150, formatter: '@', cellType: 'tree'},
|
|
{title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 150, formatter: '@', cellType: 'tree'},
|
|
@@ -73,8 +81,8 @@ $(document).ready(() => {
|
|
{title: '|经济指标', colSpan: '|1', rowSpan: '|1', field: 'final_dgn_price', hAlign: 2, width: 80, type: 'Number', bc_type: 'number', visible: false},
|
|
{title: '|经济指标', colSpan: '|1', rowSpan: '|1', field: 'final_dgn_price', hAlign: 2, width: 80, type: 'Number', bc_type: 'number', visible: false},
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'final_tp', hAlign: 2, width: 80, type: 'Number', bc_type: 'number', visible: false},
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'final_tp', hAlign: 2, width: 80, type: 'Number', bc_type: 'number', visible: false},
|
|
{title: '数据对比', colSpan: '1', rowSpan: '2', field: 'stackedBar', hAlign: 0, width: 300, cellType: 'stackedBar', stackedBarCover: false, bc_type: 'grid', visible: false, getTip: getStackedBarTip},
|
|
{title: '数据对比', colSpan: '1', rowSpan: '2', field: 'stackedBar', hAlign: 0, width: 300, cellType: 'stackedBar', stackedBarCover: false, bc_type: 'grid', visible: false, getTip: getStackedBarTip},
|
|
- {title: '增幅%|数量1/数量2', colSpan: '2|1', rowSpan: '1|1', field: 'grow_dgn_qty', hAlign: 2, width: 80},
|
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'grow_tp', hAlign: 2, width: 80, type: 'Number'},
|
|
|
|
|
|
+ {title: '增幅%|数量1/数量2', colSpan: '2|1', rowSpan: '1|1', field: 'compare_dgn_qty', hAlign: 2, width: 80},
|
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'compare_tp', hAlign: 2, width: 80, type: 'Number'},
|
|
],
|
|
],
|
|
emptyRows: 0,
|
|
emptyRows: 0,
|
|
headRows: 2,
|
|
headRows: 2,
|
|
@@ -91,6 +99,27 @@ $(document).ready(() => {
|
|
sjsSettingObj.setFxTreeStyle(spreadSetting, sjsSettingObj.FxTreeStyle.jz);
|
|
sjsSettingObj.setFxTreeStyle(spreadSetting, sjsSettingObj.FxTreeStyle.jz);
|
|
let sfSelect;
|
|
let sfSelect;
|
|
const compareObj = {
|
|
const compareObj = {
|
|
|
|
+ comparePhase1: 'gai',
|
|
|
|
+ comparePhase2: 'final',
|
|
|
|
+ getCompareSelectHtml() {
|
|
|
|
+ const html = [];
|
|
|
|
+ for (const cp of comparePhase) {
|
|
|
|
+ html.push(`<option value="${cp.key}">${cp.name}</option>`);
|
|
|
|
+ }
|
|
|
|
+ return html.join('');
|
|
|
|
+ },
|
|
|
|
+ initCompare() {
|
|
|
|
+ const selectHtml = this.getCompareSelectHtml();
|
|
|
|
+ $('#compare1').html(selectHtml);
|
|
|
|
+ $('#compare2').html(selectHtml);
|
|
|
|
+ },
|
|
|
|
+ getCompareHint(phase1, phase2) {
|
|
|
|
+ if (!phase1) phase1 = this.comparePhase1;
|
|
|
|
+ if (!phase2) phase2 = this.comparePhase2;
|
|
|
|
+ const cp1 = comparePhase.find(x => { return x.key === phase1; });
|
|
|
|
+ const cp2 = comparePhase.find(x => { return x.key === phase2; });
|
|
|
|
+ return `增减幅度=(${cp2.name}-${cp1.name})/${cp1.name}*100%`;
|
|
|
|
+ },
|
|
curFinalId() {
|
|
curFinalId() {
|
|
return this.finalInfo ? this.finalInfo.id : undefined;
|
|
return this.finalInfo ? this.finalInfo.id : undefined;
|
|
},
|
|
},
|
|
@@ -233,6 +262,7 @@ $(document).ready(() => {
|
|
const expandTag = getLocalCache('revise-compare-level');
|
|
const expandTag = getLocalCache('revise-compare-level');
|
|
if (expandTag) compareObj.expand(compareTree, expandTag);
|
|
if (expandTag) compareObj.expand(compareTree, expandTag);
|
|
this.calcStackedBar(compareTree);
|
|
this.calcStackedBar(compareTree);
|
|
|
|
+ this.reCalculateCompareData(compareTree);
|
|
SpreadJsObj.loadSheetData(compareSheet, SpreadJsObj.DataType.Tree, compareTree);
|
|
SpreadJsObj.loadSheetData(compareSheet, SpreadJsObj.DataType.Tree, compareTree);
|
|
},
|
|
},
|
|
loadFinalData(result, msg) {
|
|
loadFinalData(result, msg) {
|
|
@@ -251,9 +281,28 @@ $(document).ready(() => {
|
|
const expandTag = getLocalCache('revise-compare-level');
|
|
const expandTag = getLocalCache('revise-compare-level');
|
|
if (expandTag) compareObj.expand(finalTree, expandTag);
|
|
if (expandTag) compareObj.expand(finalTree, expandTag);
|
|
this.calcStackedBar(finalTree);
|
|
this.calcStackedBar(finalTree);
|
|
|
|
+ this.reCalculateCompareData(finalTree);
|
|
SpreadJsObj.loadSheetData(compareSheet, SpreadJsObj.DataType.Tree, finalTree);
|
|
SpreadJsObj.loadSheetData(compareSheet, SpreadJsObj.DataType.Tree, finalTree);
|
|
if (sfSelect) sfSelect.reloadSelect(this.finalInfo.tender);
|
|
if (sfSelect) sfSelect.reloadSelect(this.finalInfo.tender);
|
|
},
|
|
},
|
|
|
|
+ reCalculateCompareData(calcTree) {
|
|
|
|
+ const tree = calcTree || compareSheet.zh_tree;
|
|
|
|
+ if (!tree) return;
|
|
|
|
+
|
|
|
|
+ const cp1 = comparePhase.find(x => { return x.key === this.comparePhase1; });
|
|
|
|
+ const cp2 = comparePhase.find(x => { return x.key === this.comparePhase2; });
|
|
|
|
+ treeCalc.calculateAll(tree, function(node) {
|
|
|
|
+ node.compare_dgn_qty1 = node[cp1.dgn1] ? ZhCalc.mul(ZhCalc.div(ZhCalc.sub(node[cp2.dgn1], node[cp1.dgn1]), node[cp1.dgn1], 4), 100) : 0;
|
|
|
|
+ node.compare_dgn_qty2 = node[cp1.dgn2] ? ZhCalc.mul(ZhCalc.div(ZhCalc.sub(node[cp2.dgn1], node[cp1.dgn1]), node[cp1.dgn1], 4), 100) : 0;
|
|
|
|
+ node.compare_dgn_qty = node.compare_dgn_qty1
|
|
|
|
+ ? (node.compare_dgn_qty2 ? node.compare_dgn_qty1 + '/' + node.compare_dgn_qty2 : node.compare_dgn_qty1)
|
|
|
|
+ : (node.compare_dgn_qty2 ? '/' + node.compare_dgn_qty2 : '');
|
|
|
|
+ node.compare_tp = node[cp1.tp] ? ZhCalc.mul(ZhCalc.div(ZhCalc.sub(node[cp2.tp], node[cp1.tp]), node[cp1.tp], 4), 100) : 0;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ const index = spreadSetting.cols.findIndex(x => { return x.field === 'compare_dgn_qty'});
|
|
|
|
+ SpreadJsObj.reloadColData(compareSheet, index, 2);
|
|
|
|
+ },
|
|
loadCacheData(){
|
|
loadCacheData(){
|
|
let stackedBarCache = getLocalCache(stackedBarKey);
|
|
let stackedBarCache = getLocalCache(stackedBarKey);
|
|
if (stackedBarCache === null) stackedBarCache = 'gai_tp,total_price,final_tp';
|
|
if (stackedBarCache === null) stackedBarCache = 'gai_tp,total_price,final_tp';
|
|
@@ -295,6 +344,7 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
compareObj.loadCacheData();
|
|
compareObj.loadCacheData();
|
|
|
|
+ compareObj.initCompare();
|
|
SpreadJsObj.initSheet(compareSheet, spreadSetting);
|
|
SpreadJsObj.initSheet(compareSheet, spreadSetting);
|
|
|
|
|
|
function compareCode(str1, str2, symbol = '-') {
|
|
function compareCode(str1, str2, symbol = '-') {
|
|
@@ -517,4 +567,27 @@ $(document).ready(() => {
|
|
Cookies.set(ckColSetting, JSON.stringify(customDisplay), 30*24*60*60*1000);
|
|
Cookies.set(ckColSetting, JSON.stringify(customDisplay), 30*24*60*60*1000);
|
|
$('#row-view').modal('hide');
|
|
$('#row-view').modal('hide');
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ $('#compare-set').on('show.bs.modal', function() {
|
|
|
|
+ $('#compare1').val(compareObj.comparePhase1);
|
|
|
|
+ $('#compare2').val(compareObj.comparePhase2);
|
|
|
|
+ $('#compare-active-hint').html(compareObj.getCompareHint());
|
|
|
|
+ });
|
|
|
|
+ $('#compare1').change(() => {
|
|
|
|
+ const phase1 = $('#compare1').val();
|
|
|
|
+ const phase2 = $('#compare2').val();
|
|
|
|
+ $('#compare-active-hint').html(compareObj.getCompareHint(phase1, phase2));
|
|
|
|
+ });
|
|
|
|
+ $('#compare2').change(() => {
|
|
|
|
+ const phase1 = $('#compare1').val();
|
|
|
|
+ const phase2 = $('#compare2').val();
|
|
|
|
+ $('#compare-active-hint').html(compareObj.getCompareHint(phase1, phase2));
|
|
|
|
+ });
|
|
|
|
+ $('#compare-set-ok').click(() => {
|
|
|
|
+ compareObj.comparePhase1 = $('#compare1').val();
|
|
|
|
+ compareObj.comparePhase2 = $('#compare2').val();
|
|
|
|
+ $('#compare-hint').html(compareObj.getCompareHint());
|
|
|
|
+ compareObj.reCalculateCompareData();
|
|
|
|
+ $('#compare-set').modal('hide');
|
|
|
|
+ })
|
|
});
|
|
});
|