forked from ddrilling/asb_cloud_front
components factory update
This commit is contained in:
parent
56583ccefb
commit
79452f06db
@ -5,22 +5,31 @@ export const makeColumn = (title:string, key:string, other?:any) => ({
|
||||
...other,
|
||||
})
|
||||
|
||||
export const makeColumnsPlanFact = (title:string, keyPlan:string, keyFact?:string, groupOther?:any) =>
|
||||
export const makeColumnsPlanFact = (title:string, key:string|string[], gruopOther?:any, columsOther?:any|any[]) =>
|
||||
{
|
||||
let keyPlanLocal = keyPlan
|
||||
let keyFactLocal = keyFact ?? ''
|
||||
let keyPlanLocal = key
|
||||
let keyFactLocal = key
|
||||
|
||||
if(!keyFact){
|
||||
keyPlanLocal = keyPlan + 'Plan'
|
||||
keyFactLocal = keyPlan + 'Fact'
|
||||
if(key instanceof Array){
|
||||
keyPlanLocal = key[0]
|
||||
keyFactLocal = key[1]
|
||||
}else{
|
||||
keyPlanLocal = key + 'Plan'
|
||||
keyFactLocal = key + 'Fact'
|
||||
}
|
||||
|
||||
let columsOtherLoacl :any[2]
|
||||
if(columsOther instanceof Array)
|
||||
columsOtherLoacl = [columsOther[0], columsOther[1]]
|
||||
else
|
||||
columsOtherLoacl = [columsOther, columsOther]
|
||||
|
||||
return {
|
||||
title: title,
|
||||
...groupOther,
|
||||
children: [
|
||||
makeColumn('план', keyPlanLocal),
|
||||
makeColumn('факт', keyFactLocal),
|
||||
...gruopOther,
|
||||
children: [
|
||||
makeColumn('план', keyPlanLocal, columsOtherLoacl[0]),
|
||||
makeColumn('факт', keyFactLocal, columsOtherLoacl[1]),
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user