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,
|
...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 keyPlanLocal = key
|
||||||
let keyFactLocal = keyFact ?? ''
|
let keyFactLocal = key
|
||||||
|
|
||||||
if(!keyFact){
|
if(key instanceof Array){
|
||||||
keyPlanLocal = keyPlan + 'Plan'
|
keyPlanLocal = key[0]
|
||||||
keyFactLocal = keyPlan + 'Fact'
|
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 {
|
return {
|
||||||
title: title,
|
title: title,
|
||||||
...groupOther,
|
...gruopOther,
|
||||||
children: [
|
children: [
|
||||||
makeColumn('план', keyPlanLocal),
|
makeColumn('план', keyPlanLocal, columsOtherLoacl[0]),
|
||||||
makeColumn('факт', keyFactLocal),
|
makeColumn('факт', keyFactLocal, columsOtherLoacl[1]),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user