list.vue
1.91 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreateOrEdit(null)"> 新增公共接口 </a-button>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: '修改',
icon: 'clarity:note-edit-line',
onClick: handleCreateOrEdit.bind(null, record),
},
{
label: '删除',
icon: 'ant-design:delete-outlined',
color: 'error',
popConfirm: {
title: '是否确认删除',
confirm: handleDeleteOrBatchDelete.bind(null, record),
},
},
]"
/>
</template>
</BasicTable>
</div>
<PublicApiForm @register="registerDrawer" />
</template>
<script lang="ts" setup name="list">
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useDrawer } from '/@/components/Drawer';
import { columns, list } from './config';
import { PublicApiForm } from './index';
const [registerTable] = useTable({
// api: exportPage,
dataSource: list,
columns,
showIndexColumn: false,
clickToRowSelect: false,
showTableSetting: true,
bordered: true,
actionColumn: {
width: 200,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
fixed: 'right',
},
});
const [registerDrawer, { openDrawer }] = useDrawer();
const handleDeleteOrBatchDelete = (record) => {
console.log(record);
};
const handleCreateOrEdit = (record) => {
const isUpdate = record === null ? false : true;
const recordContent = record === null ? null : record;
openDrawer(true, {
isUpdate,
record: recordContent,
});
};
</script>