云
16 小时以前 bef3d94968fc70667f3123cb23ee69550e08a5ca
src/views/crm/backlog/modules/receivable-audit-list.vue
@@ -7,13 +7,14 @@
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) {
@@ -24,7 +25,8 @@
  try {
    await updateReceivableStatus(row.id!, 20);
    message.success('审核成功');
    gridApi.query();
    await gridApi.query();
    emit('refresh');
  } finally {
    hideLoading();
  }
@@ -42,7 +44,11 @@
/** 打开合同详情 */
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({
@@ -50,7 +56,7 @@
    schema: [
      {
        fieldName: 'auditStatus',
        label: '合同状态',
        label: '审核状态',
        component: 'Select',
        componentProps: {
          allowClear: true,
@@ -70,6 +76,7 @@
          return await getReceivablePage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            sceneType: 1,
            ...formValues,
          });
        },
@@ -100,18 +107,26 @@
      </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>