asb_cloud_front/src/components/factory.js
2021-07-29 11:22:25 +05:00

26 lines
514 B
JavaScript

export const makeColumn = (title, key, other) => ({
title: title,
key: key,
dataIndex: key,
...other,
});
export const makeColumnsPlanFact = (title, keyPlan, keyFact, gruopOther) =>
{
let keyPlanLocal = keyPlan
let keyFactLocal = keyFact
if(!keyFact){
keyPlanLocal = keyPlan + 'Plan'
keyFactLocal = keyPlan + 'Fact'
}
return {
title: title,
...gruopOther,
children: [
makeColumn('план', keyPlanLocal),
makeColumn('факт', keyFactLocal),
]
}
}