|
@@ -43,12 +43,27 @@ const generateSpreadSetting = function(colSet, emptyBase, BaseSetCol, BaseSpread
|
|
|
}
|
|
|
return spreadSetting;
|
|
|
};
|
|
|
+const updateSpreadWithSpec = function(spreadSetting, specSetting) {
|
|
|
+ if (!specSetting) return;
|
|
|
+ for (const s of specSetting) {
|
|
|
+ for (const c of spreadSetting.cols) {
|
|
|
+ if (s.condition.value.indexOf(c[s.condition.key]) >= 0) {
|
|
|
+ this._.assignIn(c, s.update);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
const generateRelaSpread = function (colSetType, colSet) {
|
|
|
const baseSetCol = colSetType.indexOf('stage') > 0 ? SpreadConst.BaseSetCol.Stage : SpreadConst.BaseSetCol.Ledger;
|
|
|
const baseSpreadColSetting = colSetType.indexOf('stage') > 0 ? SpreadConst.BaseSpreadColSetting.Stage : SpreadConst.BaseSpreadColSetting.Ledger;
|
|
|
const billsSpread = generateSpreadSetting(colSet, SpreadConst.EmptySpreadSetting[colSetType].bills, baseSetCol, baseSpreadColSetting.bills);
|
|
|
const posSpread = generateSpreadSetting(colSet, SpreadConst.EmptySpreadSetting[colSetType].pos, baseSetCol, baseSpreadColSetting.pos, 'pos');
|
|
|
+ const spreadSpec = SpreadConst.SpreadSpec[colSetType];
|
|
|
+ if (spreadSpec) {
|
|
|
+ this.updateSpreadWithSpec(billsSpread, spreadSpec.bills);
|
|
|
+ this.updateSpreadWithSpec(posSpread, spreadSpec.pos);
|
|
|
+ }
|
|
|
return [billsSpread, posSpread];
|
|
|
};
|
|
|
|