diff --git a/packages/common/business_components/src/ui/excel_download/index.tsx b/packages/common/business_components/src/ui/excel_download/index.tsx index 48341bc12..034643f92 100644 --- a/packages/common/business_components/src/ui/excel_download/index.tsx +++ b/packages/common/business_components/src/ui/excel_download/index.tsx @@ -14,7 +14,7 @@ export const downloadExcel = ({ data, fileName = new Date().getTime().toString() //XLSX.write(workbook, { bookType: "xlsx", type: "binary" }); XLSX.writeFile(workbook, fileName + '.xlsx'); }; -export const filePicked=(oFile: File) =>{ +export const filePicked=(oFile: File, headerNum:number=0) =>{ // Create A File Reader HTML5 const reader = new FileReader(); @@ -31,7 +31,7 @@ export const filePicked=(oFile: File) =>{ // Obtain The Current Row As CSV const sheet = wb.Sheets[sheetName]; if (sheet) { - const jsonXls = XLSX.utils.sheet_to_json(sheet); + const jsonXls = XLSX.utils.sheet_to_json(sheet, {range:headerNum}); console.log(jsonXls); } else { console.error(`Sheet "${sheetName}" is undefined.`); diff --git a/packages/common/business_components/src/ui/table/HeadMakeColSpan.tsx b/packages/common/business_components/src/ui/table/HeadMakeColSpan.tsx index cedc0bd7f..dc859a55d 100644 --- a/packages/common/business_components/src/ui/table/HeadMakeColSpan.tsx +++ b/packages/common/business_components/src/ui/table/HeadMakeColSpan.tsx @@ -12,41 +12,53 @@ interface TableUpperProps { const HeadMakeColSpan = ({ upHeadList }: { upHeadList: TableUpperProps[] }) => { const maxRow = upHeadList.reduce((max, head) => Math.max(max, head.row || 0), 0); - return ( - <> - {Array.from({ length: maxRow + 1 }, (_, rowIndex) => ( - + + if(maxRow == 0){ + return ( + <> + {upHeadList.map((head: TableUpperProps) => { - if (head.row === rowIndex) { - return ( - - {head.title} - - ); - }else{ - return ( - - {head.title} - - ); - } - })} + return ( + + {head.title} + + ); + })} - ))} - - ); + + ); + }else{ + return ( + <> + {Array.from({ length: maxRow + 1 }, (_, rowIndex) => ( + + {upHeadList.map((head: TableUpperProps) => { + if (head.row === rowIndex) { + return ( + + {head.title} + + ); + } + })} + + ))} + + ); + } + } export { HeadMakeColSpan }; diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index 60c457544..45748fb37 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -52,12 +52,9 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr : <>}
- {children?children: {children ? children : } - } - {tableData.length > 0 ? tableData?.map((el: { [key: string]: any}, index) => (