|
|
@@ -12,71 +12,6 @@ function getPasteHint (str, row = '') {
|
|
|
}
|
|
|
return returnObj;
|
|
|
}
|
|
|
-let show_node = false;
|
|
|
-function resetExTpTable() {
|
|
|
- $('#tj_ledger').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
- $('#tj_ledger').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
- $('#tj_ledger').children('td').eq(3).text(ZhCalc.add(ex_pre_tp, ZhCalc.round(ex_tp, materialExponentDecimal.tp)));
|
|
|
- $('#tj_ledger').children('td').eq(4).text(ZhCalc.add(ex_pre_tp_hs, ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp)));
|
|
|
- $('#total_set').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
- $('#total_set').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
- $('#total_set').children('td').eq(3).text(ZhCalc.add(ex_pre_tp, ZhCalc.round(ex_tp, materialExponentDecimal.tp)));
|
|
|
- $('#total_set').children('td').eq(4).text(ZhCalc.add(ex_pre_tp_hs, ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp)));
|
|
|
- if (exponent_nodes) {
|
|
|
- const materialExponentNodeSort = exponent_nodes ? ['-1'].concat(exponent_nodes.split(',')) : [];
|
|
|
- const map = Object.fromEntries(materialExponentNodeSort.map((v, i) => [v, i]));
|
|
|
- materialExponentNodeData = materialExponentNodeData.sort((a, b) => map[a.node] - map[b.node]);
|
|
|
- let html = '';
|
|
|
- for (const node of materialExponentNodeSort) {
|
|
|
- const mnList = _.filter(materialExponentNodeData, { node });
|
|
|
- const one_mn = mnList[0];
|
|
|
- let total_tp = 0;
|
|
|
- let total_tax_tp = 0;
|
|
|
- let total_pre_tp = one_mn.ex_pre_tp || 0;
|
|
|
- let total_pre_tp_hs = one_mn.ex_tax_pre_tp || 0;
|
|
|
- // 汇总
|
|
|
- for (const mn of mnList) {
|
|
|
- total_tp = ZhCalc.add(total_tp, mn.ex_tp ? mn.ex_tp : 0);
|
|
|
- total_tax_tp = ZhCalc.add(total_tax_tp, mn.ex_tax_tp ? mn.ex_tax_tp : 0);
|
|
|
- total_pre_tp = ZhCalc.add(total_pre_tp, mn.ex_tp ? mn.ex_tp : 0);
|
|
|
- total_pre_tp_hs = ZhCalc.add(total_pre_tp_hs, mn.ex_tax_tp ? mn.ex_tax_tp : 0);
|
|
|
- }
|
|
|
- const exprHtml = isStageSelf ? '' : `<a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="${one_mn.name}(${one_mn.code})价差:${one_mn.ex_expr ? one_mn.ex_expr : ''}"><i class="fa fa-question-circle-o"></i></a>`;
|
|
|
- html += `<tr id="tj_node_${node}">
|
|
|
- <td class="text-center">${one_mn.name}(${one_mn.code}) ${exprHtml}</td>
|
|
|
- <td class="text-center">${total_tp}</td>
|
|
|
- <td class="text-center">${total_tax_tp}</td>
|
|
|
- <td class="text-center">${total_pre_tp}</td>
|
|
|
- <td class="text-center">${total_pre_tp_hs}</td>
|
|
|
- </tr>`;
|
|
|
- // if (!show_node) {
|
|
|
- // show_node = true;
|
|
|
- // }
|
|
|
- }
|
|
|
- $('#tj_node').html(html);
|
|
|
- $('[data-toggle="tooltip"]').tooltip();
|
|
|
- }
|
|
|
- if (showStageExponent) {
|
|
|
- $('#total_stage').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
- $('#total_stage').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
- for (const ms of materialStageData) {
|
|
|
- if (!exponent_nodes) {
|
|
|
- $('.ex_expr_' + ms.order).attr('data-original-title', '第' + ms.order + '期价差:' + (ms.ex_expr ? ms.ex_expr : ''));
|
|
|
- }
|
|
|
- $('#tj_stage_' + ms.order).children('td').eq(1).text(ms.ex_tp ? ZhCalc.round(ms.ex_tp, materialExponentDecimal.tp) : '');
|
|
|
- $('#tj_stage_' + ms.order).children('td').eq(2).text(ms.ex_tax_tp ? ZhCalc.round(ms.ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
- }
|
|
|
- if (exponent_nodes) {
|
|
|
- for (const mn of materialExponentNodeData) {
|
|
|
- $('.ex_expr_node_' + mn.id).attr('data-original-title', mn.name + '价差:' + (mn.ex_expr ? mn.ex_expr : ''));
|
|
|
- $('#tj_node_' + mn.id).children('td').eq(1).text(mn.ex_tp ? ZhCalc.round(mn.ex_tp, materialExponentDecimal.tp) : '');
|
|
|
- $('#tj_node_' + mn.id).children('td').eq(2).text(mn.ex_tax_tp ? ZhCalc.round(mn.ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- $('#ex_expr').attr('data-original-title', '本期价差:' + (ex_expr ? ex_expr : ''));
|
|
|
- }
|
|
|
-}
|
|
|
$(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
const materialExponentSpread = SpreadJsObj.createNewSpread($('#material-exponent-spread')[0]);
|
|
|
@@ -142,6 +77,28 @@ $(document).ready(() => {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+ const stageTjSpread = SpreadJsObj.createNewSpread($('#stage-tj-spread')[0]);
|
|
|
+ const getTipText = function (data) {
|
|
|
+ if (!data || !data.tip) return '';
|
|
|
+
|
|
|
+ return data.tip;
|
|
|
+ };
|
|
|
+ const stageTjSpreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '计量期数', colSpan: '1', rowSpan: '2', field: 'order', hAlign: 0, width: 250, formatter: '@', cellType: 'delayTip', getTip: getTipText},
|
|
|
+ {title: '本期调差金额', colSpan: '1', rowSpan: '2', field: 'ex_tp', hAlign: 1, width: 200, type: 'Number'},
|
|
|
+ {title: '本期调差金额(建筑税)', colSpan: '1', rowSpan: '2', field: 'ex_tax_tp', hAlign: 1, width: 200, type: 'Number'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ readOnly: true,
|
|
|
+ };
|
|
|
+ SpreadJsObj.initSheet(stageTjSpread.getActiveSheet(), stageTjSpreadSetting);
|
|
|
+
|
|
|
const needUpdateArray = ['weight_num', 'm_price', 'remark'];
|
|
|
|
|
|
const materialExponentSpreadObj = {
|
|
|
@@ -990,6 +947,99 @@ $(document).ready(() => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ $('a', '[id=material-exponent-tab]').click(function() {
|
|
|
+ setTimeout(refreshRelaSpread, 100);
|
|
|
+ });
|
|
|
+
|
|
|
+ function refreshRelaSpread() {
|
|
|
+ stageTjSpread.refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ function resetExTpTable() {
|
|
|
+ $('#tj_ledger').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#tj_ledger').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#tj_ledger').children('td').eq(3).text(ZhCalc.add(ex_pre_tp, ZhCalc.round(ex_tp, materialExponentDecimal.tp)));
|
|
|
+ $('#tj_ledger').children('td').eq(4).text(ZhCalc.add(ex_pre_tp_hs, ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp)));
|
|
|
+ $('#total_set').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#total_set').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ $('#total_set').children('td').eq(3).text(ZhCalc.add(ex_pre_tp, ZhCalc.round(ex_tp, materialExponentDecimal.tp)));
|
|
|
+ $('#total_set').children('td').eq(4).text(ZhCalc.add(ex_pre_tp_hs, ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp)));
|
|
|
+ if (exponent_nodes) {
|
|
|
+ const materialExponentNodeSort = exponent_nodes ? ['-1'].concat(exponent_nodes.split(',')) : [];
|
|
|
+ const map = Object.fromEntries(materialExponentNodeSort.map((v, i) => [v, i]));
|
|
|
+ materialExponentNodeData = materialExponentNodeData.sort((a, b) => map[a.node] - map[b.node]);
|
|
|
+ let html = '';
|
|
|
+ for (const node of materialExponentNodeSort) {
|
|
|
+ const mnList = _.filter(materialExponentNodeData, { node });
|
|
|
+ const one_mn = mnList[0];
|
|
|
+ let total_tp = 0;
|
|
|
+ let total_tax_tp = 0;
|
|
|
+ let total_pre_tp = one_mn.ex_pre_tp || 0;
|
|
|
+ let total_pre_tp_hs = one_mn.ex_tax_pre_tp || 0;
|
|
|
+ // 汇总
|
|
|
+ for (const mn of mnList) {
|
|
|
+ total_tp = ZhCalc.add(total_tp, mn.ex_tp ? mn.ex_tp : 0);
|
|
|
+ total_tax_tp = ZhCalc.add(total_tax_tp, mn.ex_tax_tp ? mn.ex_tax_tp : 0);
|
|
|
+ total_pre_tp = ZhCalc.add(total_pre_tp, mn.ex_tp ? mn.ex_tp : 0);
|
|
|
+ total_pre_tp_hs = ZhCalc.add(total_pre_tp_hs, mn.ex_tax_tp ? mn.ex_tax_tp : 0);
|
|
|
+ }
|
|
|
+ const exprHtml = isStageSelf ? '' : `<a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="${one_mn.name}(${one_mn.code})价差:${one_mn.ex_expr ? one_mn.ex_expr : ''}"><i class="fa fa-question-circle-o"></i></a>`;
|
|
|
+ html += `<tr id="tj_node_${node}">
|
|
|
+ <td class="text-center">${one_mn.name}(${one_mn.code}) ${exprHtml}</td>
|
|
|
+ <td class="text-center">${total_tp}</td>
|
|
|
+ <td class="text-center">${total_tax_tp}</td>
|
|
|
+ <td class="text-center">${total_pre_tp}</td>
|
|
|
+ <td class="text-center">${total_pre_tp_hs}</td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ $('#tj_node').html(html);
|
|
|
+ $('[data-toggle="tooltip"]').tooltip();
|
|
|
+ }
|
|
|
+ if (showStageExponent) {
|
|
|
+ // $('#total_stage').children('td').eq(1).text(ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ // $('#total_stage').children('td').eq(2).text(ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ const stage_datas = [{
|
|
|
+ order: '合计',
|
|
|
+ ex_tp: ex_tp ? ZhCalc.round(ex_tp, materialExponentDecimal.tp) : 0,
|
|
|
+ ex_tax_tp: ex_tax_tp ? ZhCalc.round(ex_tax_tp, materialExponentDecimal.tp) : 0,
|
|
|
+ }];
|
|
|
+ for (const ms of materialStageData) {
|
|
|
+ if (!exponent_nodes) {
|
|
|
+ $('.ex_expr_' + ms.order).attr('data-original-title', '第' + ms.order + '期价差:' + (ms.ex_expr ? ms.ex_expr : ''));
|
|
|
+ }
|
|
|
+ // $('#tj_stage_' + ms.order).children('td').eq(1).text(ms.ex_tp ? ZhCalc.round(ms.ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ // $('#tj_stage_' + ms.order).children('td').eq(2).text(ms.ex_tax_tp ? ZhCalc.round(ms.ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ stage_datas.push({
|
|
|
+ order: ' 第' + ms.order + '期',
|
|
|
+ ex_tp: ms.ex_tp ? ZhCalc.round(ms.ex_tp, materialExponentDecimal.tp) : 0,
|
|
|
+ ex_tax_tp: ms.ex_tax_tp ? ZhCalc.round(ms.ex_tax_tp, materialExponentDecimal.tp) : 0,
|
|
|
+ tip: !exponent_nodes ? '第' + ms.order + '期价差:' + (ms.ex_expr ? ms.ex_expr : '') : '',
|
|
|
+ });
|
|
|
+ if (exponent_nodes) {
|
|
|
+ const mnList = _.filter(materialExponentNodeData, { ms_id: ms.id });
|
|
|
+ for (const mn of mnList) {
|
|
|
+ stage_datas.push({
|
|
|
+ order: ' ' + mn.name + '(' + mn.code + ')',
|
|
|
+ ex_tp: mn.ex_tp ? ZhCalc.round(mn.ex_tp, materialExponentDecimal.tp) : 0,
|
|
|
+ ex_tax_tp: mn.ex_tax_tp ? ZhCalc.round(mn.ex_tax_tp, materialExponentDecimal.tp) : 0,
|
|
|
+ tip: mn.name + '(' + mn.code + ')' + '价差:' + (mn.ex_expr ? mn.ex_expr : ''),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if (exponent_nodes) {
|
|
|
+ // for (const mn of materialExponentNodeData) {
|
|
|
+ // $('.ex_expr_node_' + mn.id).attr('data-original-title', mn.name + '价差:' + (mn.ex_expr ? mn.ex_expr : ''));
|
|
|
+ // $('#tj_node_' + mn.id).children('td').eq(1).text(mn.ex_tp ? ZhCalc.round(mn.ex_tp, materialExponentDecimal.tp) : '');
|
|
|
+ // $('#tj_node_' + mn.id).children('td').eq(2).text(mn.ex_tax_tp ? ZhCalc.round(mn.ex_tax_tp, materialExponentDecimal.tp) : '');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ SpreadJsObj.loadSheetData(stageTjSpread.getActiveSheet(), SpreadJsObj.DataType.Data, stage_datas);
|
|
|
+ } else {
|
|
|
+ $('#ex_expr').attr('data-original-title', '本期价差:' + (ex_expr ? ex_expr : ''));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$.divResizer({
|
|
|
select: '#right-spr',
|
|
|
callback: function () {
|
|
|
@@ -1009,6 +1059,7 @@ $(document).ready(() => {
|
|
|
const cutHeight2 = exponent_nodes ? getObjHeight($('#myTab2')) : 0;
|
|
|
$('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight - cutHeight2);
|
|
|
materialExponentSpread.refresh();
|
|
|
+ if (showStageExponent) stageTjSpread.refresh();
|
|
|
// const height = $('#material-exponent-spread').height();
|
|
|
setLocalCache('material_exponent2_' + materialID, height);
|
|
|
}
|
|
|
@@ -1035,6 +1086,7 @@ $(document).ready(() => {
|
|
|
showSideTools(tab.hasClass('active'));
|
|
|
}
|
|
|
materialExponentSpread.refresh();
|
|
|
+ if (showStageExponent) stageTjSpread.refresh();
|
|
|
});
|
|
|
// 根据浏览器记录展开收起
|
|
|
const cutHeight = isStageSelf ? getObjHeight($('#myTab')) : 0;
|
|
|
@@ -1048,6 +1100,7 @@ $(document).ready(() => {
|
|
|
$('#right-view').width(getLocalCache('material_exponent_' + materialID) + '%');
|
|
|
showSideTools(tab.hasClass('active'));
|
|
|
materialExponentSpread.refresh();
|
|
|
+ if (showStageExponent) stageTjSpread.refresh();
|
|
|
}
|
|
|
if (getLocalCache('material_exponent2_' + materialID)) {
|
|
|
// $('#material-exponent-spread').height(getLocalCache('material_exponent2_' + materialID));
|
|
|
@@ -1060,9 +1113,11 @@ $(document).ready(() => {
|
|
|
// var sjs1 = getObjHeight($('.sjs-height-1'));
|
|
|
// $(".bcontent-wrap").height($(window).height()-cHeader-sjs1-90+53);
|
|
|
materialExponentSpread.refresh();
|
|
|
+ if (showStageExponent) stageTjSpread.refresh();
|
|
|
} else {
|
|
|
$('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight - cutHeight2);
|
|
|
materialExponentSpread.refresh();
|
|
|
+ if (showStageExponent) stageTjSpread.refresh();
|
|
|
}
|
|
|
function getObjHeight(select) {
|
|
|
return select.length > 0 ? select.outerHeight(true) : 0;
|
|
|
@@ -1083,6 +1138,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
autoFlashHeight();
|
|
|
materialExponentSpread.refresh();
|
|
|
+ if (showStageExponent) stageTjSpread.refresh();
|
|
|
}
|
|
|
});
|
|
|
});
|