|
@@ -19,8 +19,8 @@ const billsSpreadSetting = {
|
|
|
{title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 60, type: 'Number', },
|
|
|
],
|
|
|
extraCols: [
|
|
|
- {title: '%s|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty%s', hAlign: 2, width: 60, type: 'Number', },
|
|
|
- {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp%s', hAlign: 2, width: 60, type: 'Number', },
|
|
|
+ {title: '%s|数量', colSpan: '2|1', rowSpan: '1|1', field: '{%s}_qty{%d}', hAlign: 2, width: 60, type: 'Number', },
|
|
|
+ {title: '|金额', colSpan: '|1', rowSpan: '|1', field: '{%s}_tp{%d}', hAlign: 2, width: 60, type: 'Number', },
|
|
|
],
|
|
|
emptyRows: 3,
|
|
|
headRows: 2,
|
|
@@ -37,7 +37,7 @@ const posSpreadSetting = {
|
|
|
{title: '台账数量', colSpan: '1', rowSpan: '1', field: 'quantity', hAlign: 2, width: 60},
|
|
|
],
|
|
|
extraCols: [
|
|
|
- {title: '%s数量', colSpan: '1', rowSpan: '1', field: 'gather_qty%s', hAlign: 2, width: 60},
|
|
|
+ {title: '%s数量', colSpan: '1', rowSpan: '1', field: '{%s}_qty{%d}', hAlign: 2, width: 60},
|
|
|
],
|
|
|
emptyRows: 3,
|
|
|
headRows: 1,
|
|
@@ -52,10 +52,11 @@ const posSpreadSetting = {
|
|
|
function initSpreadSettingWithRoles(compareRoles) {
|
|
|
function setSpreadSettingCols(setting, fieldSufs, Roles) {
|
|
|
function addExtraCols(fieldSuf, Role) {
|
|
|
+ const sourceType = $('[name=compare-data]:checked').val();
|
|
|
for (const ec of setting.extraCols) {
|
|
|
const col = JSON.parse(JSON.stringify(ec));
|
|
|
col.title = _.replace(col.title, '%s', Role);
|
|
|
- col.field = _.replace(col.field, '%s', fieldSuf);
|
|
|
+ col.field = _.replace(_.replace(col.field, '{%s}', sourceType), '{%d}', fieldSuf);
|
|
|
setting.cols.push(col);
|
|
|
}
|
|
|
}
|
|
@@ -162,11 +163,8 @@ $(document).ready(() => {
|
|
|
}, null, true);
|
|
|
function loadPosData(iRow) {
|
|
|
const node = iRow ? billsSheet.zh_tree.nodes[iRow] : SpreadJsObj.getSelectObject(billsSheet);
|
|
|
- if (node) {
|
|
|
- SpreadJsObj.loadSheetData(posSheet, SpreadJsObj.DataType.Data, cPos.getLedgerPos(node.id));
|
|
|
- } else {
|
|
|
- SpreadJsObj.loadSheetData(posSheet, SpreadJsObj.DataType.Data, []);
|
|
|
- }
|
|
|
+ const posRange = node ? (cPos.getLedgerPos(node.id) || []) : [];
|
|
|
+ SpreadJsObj.loadSheetData(posSheet, SpreadJsObj.DataType.Data, posRange);
|
|
|
SpreadJsObj.resetTopAndSelect(posSheet);
|
|
|
}
|
|
|
billsSheet.bind(spreadNS.Events.SelectionChanged, function (e, info) {
|
|
@@ -183,16 +181,16 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ const compareStages = [];
|
|
|
$('#select-qi-ok').click(function () {
|
|
|
function refreshView () {
|
|
|
- const compareStages = [];
|
|
|
for (let order = 0, iLength = trs.length; order < iLength; order++) {
|
|
|
const tr = trs[order];
|
|
|
if ($('input', tr)[0].checked) {
|
|
|
compareStages.push(order + 1);
|
|
|
}
|
|
|
}
|
|
|
- //setLocalCache(cCacheKey, compareStages.join(','));
|
|
|
+ // setLocalCache(cCacheKey, compareStages.join(','));
|
|
|
initSpreadSettingWithRoles(compareStages);
|
|
|
SpreadJsObj.initSheet(billsSheet, billsSpreadSetting);
|
|
|
treeCalc.calculateAll(cTree);
|
|
@@ -214,10 +212,10 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/load', {stages: loadData}, function (result) {
|
|
|
for (const aData of result.stages) {
|
|
|
calculateStageLedgerData(aData.bills);
|
|
|
- cTree.loadMinorData(aData.bills, aData.order + '', ['gather_qty', 'gather_tp'], ['gather_tp']);
|
|
|
+ cTree.loadMinorData(aData.bills, aData.order + '', ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'gather_qty', 'gather_tp'], ['contract_tp', 'qc_tp', 'gather_tp']);
|
|
|
treeCalc.calculateAll(cTree);
|
|
|
calculateStagePosData(aData.pos);
|
|
|
- cPos.loadMinorData(aData.pos, aData.order + '', ['gather_qty']);
|
|
|
+ cPos.loadMinorData(aData.pos, aData.order + '', ['contract_qty', 'qc_qty', 'gather_qty']);
|
|
|
}
|
|
|
refreshView();
|
|
|
$('#select-qi').modal('hide');
|
|
@@ -268,4 +266,12 @@ $(document).ready(() => {
|
|
|
|
|
|
SpreadExcelObj.exportSimpleXlsxSheet(billsSpreadSetting, data, $('.sidebar-title').attr('data-original-title') + "-多期比较.xlsx");
|
|
|
});
|
|
|
+
|
|
|
+ $('[name=compare-data]').click(function () {
|
|
|
+ initSpreadSettingWithRoles(compareStages);
|
|
|
+ SpreadJsObj.reLoadSheetHeader(billsSheet);
|
|
|
+ SpreadJsObj.reloadColData(billsSheet, 7, compareStages.length * 2);
|
|
|
+ SpreadJsObj.reLoadSheetHeader(posSheet);
|
|
|
+ SpreadJsObj.reloadColData(posSheet, 2, compareStages.length);
|
|
|
+ })
|
|
|
});
|