index.vue
3.53 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
110
111
112
113
114
115
116
117
118
<template>
<div class="p-4">
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleInvoiceAnalysis">收款单分析</a-button>
<FinanceEdit @register="registerFinanceEdit" />
<InvoiceAnalysis @register="registerInvoiceAnalysis" />
<TrackEdit @register="registerTrackEdit" />
<InvoiceDetail @register="registerInvoiceDetail" />
</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: handleCommit.bind(null, record),
},
]"
:dropDownActions="[
{
label: '订单信息',
onClick: handleInvoiceDetail.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 './receive.data';
import FinanceEdit from './FinanceEdit.vue';
import TrackEdit from './TrackEdit.vue';
import InvoiceAnalysis from './InvoiceAnalysis.vue';
import InvoiceDetail from './InvoiceDetail.vue';
import { useDrawer } from '/@/components/Drawer';
import { getInvoice, deleteInvoice, commit } from '@/api/project/invoice';
import { useModal } from '/@/components/Modal';
import { FilePptOutlined } from '@ant-design/icons-vue';
import { icon } from 'ant-design-vue';
const [registerInvoiceAnalysis, { openModal: openInvoiceAnalysis }] = useModal();
const [registerFinanceEdit, { openDrawer: openFinanceEdit }] = useDrawer();
const [registerTrackEdit, { openDrawer: openTrackEdit }] = useDrawer();
const [registerInvoiceDetail, { openDrawer: openInvoiceDetail }] = useDrawer();
const [registerTable] = useTable({
title: '',
api: getInvoice,
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: 330,
title: 'Action',
dataIndex: 'action',
// slots: { customRender: 'action' },
},
});
function handleFinanceEdit(record) {
openFinanceEdit(true, {
data: record,
});
}
function handleTrackEdit(record) {
openTrackEdit(true, {
data: record,
});
}
function handleDelete(record) {
const id: string[] = Array.isArray(record.id) ? record.id : [record.id];
deleteInvoice({ ids: id });
}
function handleCommit(record) {
commit({ id: record.id });
}
function handleInvoiceDetail(record) {
openInvoiceDetail(true, {
data: record,
});
}
function handleInvoiceAnalysis(record) {
openInvoiceAnalysis(true, {
data: record,
});
}
</script>