|
|
@@ -2,20 +2,27 @@
|
|
|
<div class="container">
|
|
|
<a-card class="general-card" title="">
|
|
|
<a-table
|
|
|
- row-key="id"
|
|
|
+ row-key="name"
|
|
|
:loading="loading"
|
|
|
:pagination="pagination"
|
|
|
:columns="(cloneColumns as TableColumnData[])"
|
|
|
:data="renderData"
|
|
|
:bordered="false"
|
|
|
:size="size"
|
|
|
- @page-change="onPageChange"
|
|
|
>
|
|
|
<template #index="{ rowIndex }">
|
|
|
{{
|
|
|
rowIndex + 1 + (pagination.pageIndex - 1) * pagination.personNumber
|
|
|
}}
|
|
|
</template>
|
|
|
+ <template #picture="{ record }">
|
|
|
+ <div :key="record.id">
|
|
|
+ <a-image
|
|
|
+ width="100"
|
|
|
+ src="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/a8c8cdb109cb051163646151a4a5083b.png~tplv-uwbnlip3yd-webp.webp"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
</a-card>
|
|
|
</div>
|
|
|
@@ -27,54 +34,70 @@
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
import useLoading from '@/hooks/loading';
|
|
|
import { Pagination } from '@/types/global';
|
|
|
- import { queryPolicyList, PolicyRecord, PolicyParams } from '@/api/list';
|
|
|
import { queryRecordList } from '@/api/record';
|
|
|
- import type { RecordParams } from '@/api/record';
|
|
|
+ import type { RecordParams, DataList } from '@/api/record';
|
|
|
+ import { useIntervalFn } from '@vueuse/core';
|
|
|
|
|
|
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 renderData = ref<DataList[]>([]);
|
|
|
const cloneColumns = ref<Column[]>([
|
|
|
{
|
|
|
- title: 'Name',
|
|
|
+ title: t('recordList.columns.index'),
|
|
|
+ dataIndex: 'index',
|
|
|
+ slotName: 'index',
|
|
|
+ ellipsis: true,
|
|
|
+ tooltip: true,
|
|
|
+ width: 60,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('recordList.columns.time'),
|
|
|
+ dataIndex: 'time',
|
|
|
+ ellipsis: true,
|
|
|
+ tooltip: true,
|
|
|
+ width: 180,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('recordList.columns.picture'),
|
|
|
+ dataIndex: 'picture',
|
|
|
+ slotName: 'picture',
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('recordList.columns.name'),
|
|
|
dataIndex: 'name',
|
|
|
ellipsis: true,
|
|
|
tooltip: true,
|
|
|
- width: 100,
|
|
|
},
|
|
|
{
|
|
|
- title: 'Salary',
|
|
|
- dataIndex: 'salary',
|
|
|
+ title: t('recordList.columns.nameCh'),
|
|
|
+ dataIndex: 'nameCh',
|
|
|
},
|
|
|
{
|
|
|
- title: 'Address',
|
|
|
- dataIndex: 'address',
|
|
|
+ title: t('recordList.columns.company'),
|
|
|
+ dataIndex: 'company',
|
|
|
ellipsis: true,
|
|
|
- width: 150,
|
|
|
},
|
|
|
{
|
|
|
- title: 'Email',
|
|
|
- dataIndex: 'email',
|
|
|
+ title: t('recordList.columns.Position'),
|
|
|
+ dataIndex: 'Position',
|
|
|
ellipsis: true,
|
|
|
tooltip: { position: 'left' },
|
|
|
- width: 200,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('recordList.columns.id'),
|
|
|
+ dataIndex: 'id',
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('recordList.columns.result'),
|
|
|
+ dataIndex: 'result',
|
|
|
+ ellipsis: true,
|
|
|
},
|
|
|
]);
|
|
|
-
|
|
|
const size = ref<SizeProps>('medium');
|
|
|
|
|
|
const basePagination: Pagination = {
|
|
|
@@ -91,14 +114,10 @@
|
|
|
try {
|
|
|
queryRecordList(params).then((res) => {
|
|
|
console.log('res', res);
|
|
|
- // renderData.value = res.data.list;
|
|
|
- // pagination.current = params.current;
|
|
|
- // pagination.total = res.data.total;
|
|
|
+ renderData.value = res.data;
|
|
|
+ pagination.pageIndex = params.pageIndex;
|
|
|
+ pagination.personNumber = res.total;
|
|
|
});
|
|
|
- // 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 {
|
|
|
@@ -106,15 +125,10 @@
|
|
|
}
|
|
|
};
|
|
|
fetchData();
|
|
|
- const search = () => {
|
|
|
- fetchData({
|
|
|
- ...basePagination,
|
|
|
- ...formModel.value,
|
|
|
- } as unknown as RecordParams);
|
|
|
- };
|
|
|
- const onPageChange = (pageIndex: number) => {
|
|
|
- fetchData({ ...basePagination, pageIndex });
|
|
|
- };
|
|
|
+ const { pause, resume, isActive } = useIntervalFn(() => {
|
|
|
+ /* your function */
|
|
|
+ fetchData();
|
|
|
+ }, 50000);
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|