diff --git a/src/components/factory.ts b/src/components/factory.ts index e53dbaa..95f9e28 100644 --- a/src/components/factory.ts +++ b/src/components/factory.ts @@ -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]), ] } } \ No newline at end of file