| | |
| | | |
| | | import { Button, message } from 'ant-design-vue'; |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getReceivablePage, updateReceivableStatus } from '#/api/crm/receivable'; |
| | | import { useGridColumns } from '#/views/crm/receivable/data'; |
| | | |
| | | import { AUDIT_STATUS } from '../data'; |
| | | |
| | | const { push } = useRouter(); |
| | | const emit = defineEmits<{ refresh: [] }>(); |
| | | |
| | | /** 审核 */ |
| | | async function handleAudit(row: CrmReceivableApi.Receivable) { |
| | |
| | | try { |
| | | await updateReceivableStatus(row.id!, 20); |
| | | message.success('审核成功'); |
| | | gridApi.query(); |
| | | await gridApi.query(); |
| | | emit('refresh'); |
| | | } finally { |
| | | hideLoading(); |
| | | } |
| | |
| | | |
| | | /** 打开合同详情 */ |
| | | function handleContractDetail(row: CrmReceivableApi.Receivable) { |
| | | push({ name: 'CrmContractDetail', params: { id: row.contractId } }); |
| | | if (row.contractId) push({ name: 'CrmContractDetail', params: { id: row.contractId } }); |
| | | } |
| | | |
| | | function handleInvoiceDetail(row: CrmReceivableApi.Receivable) { |
| | | if (row.invoiceId) push({ name: 'CrmInvoiceDetail', params: { id: row.invoiceId } }); |
| | | } |
| | | |
| | | const [Grid, gridApi] = useVbenVxeGrid({ |
| | |
| | | schema: [ |
| | | { |
| | | fieldName: 'auditStatus', |
| | | label: '合同状态', |
| | | label: '审核状态', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | |
| | | return await getReceivablePage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | sceneType: 1, |
| | | ...formValues, |
| | | }); |
| | | }, |
| | |
| | | </Button> |
| | | </template> |
| | | <template #contractNo="{ row }"> |
| | | <Button type="link" @click="handleContractDetail(row)"> |
| | | {{ row.contractNo }} |
| | | <Button v-if="row.contractId" type="link" @click="handleContractDetail(row)"> |
| | | {{ row.contract?.no ?? row.contractNo ?? '—' }} |
| | | </Button> |
| | | <span v-else>—</span> |
| | | </template> |
| | | <template #invoiceNo="{ row }"> |
| | | <template v-if="row.invoice"> |
| | | <Button type="link" @click="handleInvoiceDetail(row)">{{ row.invoice.no }}</Button> |
| | | <span> / {{ row.invoice.invoiceNo ?? '—' }} / ¥{{ row.invoice.price ?? 0 }}</span> |
| | | </template> |
| | | <span v-else>—</span> |
| | | </template> |
| | | <template #actions="{ row }"> |
| | | <Button |
| | | v-if="row.auditStatus === 10" |
| | | type="link" |
| | | @click="handleAudit(row)" |
| | | > |
| | | 审核 |
| | | </Button> |
| | | <TableAction :actions="[{ |
| | | label: '审核', |
| | | type: 'link', |
| | | auth: ['crm:receivable:update'], |
| | | ifShow: row.auditStatus === 10, |
| | | onClick: handleAudit.bind(null, row), |
| | | }]" /> |
| | | </template> |
| | | </Grid> |
| | | </template> |