Table.vue
1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<script lang="ts" setup>
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
import { callStatisticsPage } from '/@/api/application/record';
import { columns } from '../config';
import { PageEnum } from '/@/enums/pageEnum';
import { useGo } from '/@/hooks/web/usePage';
const { t } = useI18n();
const go = useGo();
const [registerTable] = useTable({
immediate: true,
api: callStatisticsPage,
columns,
showIndexColumn: false,
clickToRowSelect: false,
showTableSetting: false,
useSearchForm: false,
bordered: true,
rowKey: 'name',
actionColumn: {
width: 200,
title: t('common.actionText'),
dataIndex: 'action',
slots: { customRender: 'action' },
fixed: 'right',
},
});
const handleViewDetail = (record) => {
if (!record.name) return;
go(PageEnum.APPLICATION_RECORD + '?name=' + encodeURIComponent(String(record.name)));
};
</script>
<template>
<div>
<BasicTable :clickToRowSelect="false" @register="registerTable">
<template #action="{ record }">
<TableAction
:actions="[
{
label: t('common.viewText'),
icon: 'ant-design:eye-outlined',
onClick: handleViewDetail.bind(null, record),
},
]"
/>
</template>
</BasicTable>
</div>
</template>