asb_cloud_front/src/components/factory.ts

26 lines
565 B
TypeScript
Raw Normal View History

2021-07-29 11:38:09 +05:00
export const makeColumn = (title:string, key:string, other?:any) => ({
2021-07-29 11:22:25 +05:00
title: title,
key: key,
dataIndex: key,
...other,
})
2021-07-29 11:22:25 +05:00
2021-07-29 11:38:09 +05:00
export const makeColumnsPlanFact = (title:string, keyPlan:string, keyFact?:string, gruopOther?:any) =>
2021-07-29 11:22:25 +05:00
{
let keyPlanLocal = keyPlan
2021-07-29 11:38:09 +05:00
let keyFactLocal = keyFact ?? ''
2021-07-29 11:22:25 +05:00
if(!keyFact){
keyPlanLocal = keyPlan + 'Plan'
keyFactLocal = keyPlan + 'Fact'
}
return {
title: title,
...gruopOther,
children: [
makeColumn('план', keyPlanLocal),
makeColumn('факт', keyFactLocal),
]
}
}