|
@@ -1,80 +0,0 @@
|
|
|
-<script lang="ts" setup>
|
|
|
|
|
-import { TableColumn } from './types'
|
|
|
|
|
-
|
|
|
|
|
-const props = defineProps<{
|
|
|
|
|
- data: any[]
|
|
|
|
|
- columns: TableColumn[]
|
|
|
|
|
- loading: boolean
|
|
|
|
|
- showPagination?: boolean
|
|
|
|
|
- total?: number
|
|
|
|
|
- pageNo?: number
|
|
|
|
|
- pageSize?: number
|
|
|
|
|
-}>()
|
|
|
|
|
-
|
|
|
|
|
-const { pageNo, pageSize, columns } = toRefs(props)
|
|
|
|
|
-
|
|
|
|
|
-const emits = defineEmits(['sortfn', 'handleQuery', 'handleSizeChange', 'handleCurrentChange'])
|
|
|
|
|
-</script>
|
|
|
|
|
-
|
|
|
|
|
-<template>
|
|
|
|
|
- <div class="flex flex-col h-full bg-white dark:bg-[#1d1e1f] shadow rounded-lg">
|
|
|
|
|
- <div class="flex-1 relative">
|
|
|
|
|
- <el-auto-resizer class="absolute">
|
|
|
|
|
- <template #default="{ width, height }">
|
|
|
|
|
- <el-table
|
|
|
|
|
- :data="data"
|
|
|
|
|
- v-loading="loading"
|
|
|
|
|
- stripe
|
|
|
|
|
- class="absolute"
|
|
|
|
|
- :max-height="height"
|
|
|
|
|
- :height="height"
|
|
|
|
|
- show-overflow-tooltip
|
|
|
|
|
- :width="width"
|
|
|
|
|
- scrollbar-always-on
|
|
|
|
|
- border
|
|
|
|
|
- >
|
|
|
|
|
- <template v-for="col in columns" :key="col.key">
|
|
|
|
|
- <el-table-column
|
|
|
|
|
- :align="col.align"
|
|
|
|
|
- :fixed="col.fixed"
|
|
|
|
|
- :label="col.label"
|
|
|
|
|
- :prop="col.prop"
|
|
|
|
|
- :min-width="col.minWidth"
|
|
|
|
|
- resizable
|
|
|
|
|
- v-if="col.children && col.children.length > 0"
|
|
|
|
|
- >
|
|
|
|
|
- <template v-for="child in col.children" :key="child.key">
|
|
|
|
|
- <el-table-column
|
|
|
|
|
- :align="child.align"
|
|
|
|
|
- :fixed="col.fixed"
|
|
|
|
|
- :label="col.label"
|
|
|
|
|
- :prop="col.prop"
|
|
|
|
|
- :min-width="col.minWidth"
|
|
|
|
|
- resizable
|
|
|
|
|
- >
|
|
|
|
|
- <template #header> </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-auto-resizer>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div v-show="showPagination" class="h-10 mt-4 flex items-center justify-end">
|
|
|
|
|
- <el-pagination
|
|
|
|
|
- size="default"
|
|
|
|
|
- v-model:current-page="pageNo"
|
|
|
|
|
- v-model:page-size="pageSize"
|
|
|
|
|
- :background="true"
|
|
|
|
|
- :page-sizes="[10, 20, 30, 50, 100]"
|
|
|
|
|
- :total="total"
|
|
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
- @size-change="emits('handleSizeChange')"
|
|
|
|
|
- @current-change="emits('handleCurrentChange')"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-</template>
|
|
|
|
|
-
|
|
|
|
|
-<style scoped></style>
|
|
|