index.vue
3.11 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
<div class="p-4">
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary">导出</a-button>
<FinanceEdit @register="registerFinanceEdit" />
<TrackEdit @register="registerTrackEdit" />
<InvoiceUpload @register="registerInvoiceUpload" />
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '财务编辑',
onClick: handleFinanceEdit.bind(null, record),
},
{
label: '跟单编辑',
onClick: handleTrackEdit.bind(null, record),
},
{
label: '发票上传',
onClick: handleInvoiceUpload.bind(null, record),
},
]"
:dropDownActions="[
{
label: '应付款提交',
onClick: handleDelete.bind(null, record),
},
{
label: '订单信息',
onClick: handleDelete.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
</div>
</template>
<script lang="ts" setup>
import { defineComponent } from 'vue';
import { BasicTable, useTable, BasicColumn, TableAction } from '/@/components/Table';
import { searchFormSchema, columns } from './pay.data';
import { demoListApi } from '/@/api/demo/table';
import TrackEdit from './TrackEdit.vue';
import FinanceEdit from './FinanceEdit.vue';
import InvoiceUpload from './InvoiceUpload.vue';
import { useDrawer } from '/@/components/Drawer';
import { useModal } from '/@/components/Modal';
const [registerFinanceEdit, { openDrawer: openFinanceEdit }] = useDrawer();
const [registerTrackEdit, { openDrawer: openTrackEdit }] = useDrawer();
const [registerInvoiceUpload, { openModal: openInvoiceUpload }] = useModal();
const [registerTable] = useTable({
title: '',
api: demoListApi,
columns: columns,
bordered: true,
rowKey: 'id',
rowSelection: {
type: 'checkbox',
},
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
},
useSearchForm: true,
showTableSetting: true,
showIndexColumn: false,
tableSetting: {
setting: false,
},
actionColumn: {
width: 260,
title: 'Action',
dataIndex: 'action',
// slots: { customRender: 'action' },
},
});
function handleFinanceEdit(record) {
console.log('点击了编辑', record);
openFinanceEdit(true, {
data: record,
});
}
function handleTrackEdit(record) {
console.log('点击了编辑', record);
openTrackEdit(true, {
data: record,
});
}
function handleInvoiceUpload(record) {
console.log('点击了编辑', record);
openInvoiceUpload(true, {
data: record,
});
}
function handleDelete(record) {
console.log('点击了编辑', record);
openTrackEdit(true, {
data: record,
});
}
</script>