|
|
@@ -0,0 +1,126 @@
|
|
|
+<template>
|
|
|
+ <div class="container">
|
|
|
+ <a-card class="general-card" title="">
|
|
|
+ <a-table
|
|
|
+ row-key="id"
|
|
|
+ :loading="loading"
|
|
|
+ :pagination="pagination"
|
|
|
+ :columns="(cloneColumns as TableColumnData[])"
|
|
|
+ :data="renderData"
|
|
|
+ :bordered="false"
|
|
|
+ :size="size"
|
|
|
+ @page-change="onPageChange"
|
|
|
+ >
|
|
|
+ <template #index="{ rowIndex }">
|
|
|
+ {{ rowIndex + 1 + (pagination.current - 1) * pagination.pageSize }}
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </a-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" name="RecordListPage" setup>
|
|
|
+ import { computed, ref, reactive, watch, nextTick } from 'vue';
|
|
|
+ import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
|
|
+ import { useI18n } from 'vue-i18n';
|
|
|
+ import useLoading from '@/hooks/loading';
|
|
|
+ import { Pagination } from '@/types/global';
|
|
|
+ import { queryPolicyList, PolicyRecord, PolicyParams } from '@/api/list';
|
|
|
+
|
|
|
+ type SizeProps = 'mini' | 'small' | 'medium' | 'large';
|
|
|
+ type Column = TableColumnData & { checked?: true };
|
|
|
+
|
|
|
+ const generateFormModel = () => {
|
|
|
+ return {
|
|
|
+ number: '',
|
|
|
+ name: '',
|
|
|
+ contentType: '',
|
|
|
+ filterType: '',
|
|
|
+ createdTime: [],
|
|
|
+ status: '',
|
|
|
+ };
|
|
|
+ };
|
|
|
+ const { loading, setLoading } = useLoading(true);
|
|
|
+ const { t } = useI18n();
|
|
|
+ const renderData = ref<PolicyRecord[]>([]);
|
|
|
+ const formModel = ref(generateFormModel());
|
|
|
+ const cloneColumns = ref<Column[]>([
|
|
|
+ {
|
|
|
+ title: 'Name',
|
|
|
+ dataIndex: 'name',
|
|
|
+ ellipsis: true,
|
|
|
+ tooltip: true,
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'Salary',
|
|
|
+ dataIndex: 'salary',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'Address',
|
|
|
+ dataIndex: 'address',
|
|
|
+ ellipsis: true,
|
|
|
+ width: 150,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'Email',
|
|
|
+ dataIndex: 'email',
|
|
|
+ ellipsis: true,
|
|
|
+ tooltip: { position: 'left' },
|
|
|
+ width: 200,
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+
|
|
|
+ const size = ref<SizeProps>('medium');
|
|
|
+
|
|
|
+ const basePagination: Pagination = {
|
|
|
+ current: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ };
|
|
|
+ const pagination = reactive({
|
|
|
+ ...basePagination,
|
|
|
+ });
|
|
|
+ const fetchData = async (
|
|
|
+ params: PolicyParams = { current: 1, pageSize: 20 }
|
|
|
+ ) => {
|
|
|
+ setLoading(true);
|
|
|
+ try {
|
|
|
+ // const { data } = await queryPolicyList(params);
|
|
|
+ // renderData.value = data.list;
|
|
|
+ // pagination.current = params.current;
|
|
|
+ // pagination.total = data.total;
|
|
|
+ } catch (err) {
|
|
|
+ // you can report use errorHandler or other
|
|
|
+ } finally {
|
|
|
+ setLoading(false);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ fetchData();
|
|
|
+ const search = () => {
|
|
|
+ fetchData({
|
|
|
+ ...basePagination,
|
|
|
+ ...formModel.value,
|
|
|
+ } as unknown as PolicyParams);
|
|
|
+ };
|
|
|
+ const onPageChange = (current: number) => {
|
|
|
+ fetchData({ ...basePagination, current });
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="less">
|
|
|
+ .container {
|
|
|
+ padding: 10px;
|
|
|
+
|
|
|
+ :deep(.arco-list-content) {
|
|
|
+ overflow-x: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.arco-card-meta-title) {
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .general-card {
|
|
|
+ padding-top: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|