| | |
| | | /> |
| | | </PageWrapper> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, ref } from 'vue'; |
| | | <script lang="ts" setup> |
| | | import { ref } from 'vue'; |
| | | |
| | | import { ImpExcel, ExcelData } from '/@/components/Excel'; |
| | | import { BasicTable, BasicColumn } from '/@/components/Table'; |
| | | import { PageWrapper } from '/@/components/Page'; |
| | | import { ImpExcel, ExcelData } from '@/components/Excel'; |
| | | import { BasicTable, BasicColumn } from '@/components/Table'; |
| | | import { PageWrapper } from '@/components/Page'; |
| | | |
| | | export default defineComponent({ |
| | | components: { BasicTable, ImpExcel, PageWrapper }, |
| | | const tableListRef = ref< |
| | | { |
| | | title: string; |
| | | columns?: any[]; |
| | | dataSource?: any[]; |
| | | }[] |
| | | >([]); |
| | | |
| | | setup() { |
| | | const tableListRef = ref< |
| | | { |
| | | title: string; |
| | | columns?: any[]; |
| | | dataSource?: any[]; |
| | | }[] |
| | | >([]); |
| | | |
| | | function loadDataSuccess(excelDataList: ExcelData[]) { |
| | | tableListRef.value = []; |
| | | console.log(excelDataList); |
| | | for (const excelData of excelDataList) { |
| | | const { |
| | | header, |
| | | results, |
| | | meta: { sheetName }, |
| | | } = excelData; |
| | | const columns: BasicColumn[] = []; |
| | | for (const title of header) { |
| | | columns.push({ title, dataIndex: title }); |
| | | } |
| | | tableListRef.value.push({ title: sheetName, dataSource: results, columns }); |
| | | } |
| | | function loadDataSuccess(excelDataList: ExcelData[]) { |
| | | tableListRef.value = []; |
| | | console.log(excelDataList); |
| | | for (const excelData of excelDataList) { |
| | | const { |
| | | header, |
| | | results, |
| | | meta: { sheetName }, |
| | | } = excelData; |
| | | const columns: BasicColumn[] = []; |
| | | for (const title of header) { |
| | | columns.push({ title, dataIndex: title }); |
| | | } |
| | | |
| | | return { |
| | | loadDataSuccess, |
| | | tableListRef, |
| | | }; |
| | | }, |
| | | }); |
| | | tableListRef.value.push({ title: sheetName, dataSource: results, columns }); |
| | | } |
| | | } |
| | | </script> |