From a2d9fcb259621829bf4ec9680b5dbeac95ab5805 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 15 十月 2026 16:19:54 +0800
Subject: [PATCH] fix(crm): 销售目标达成分析默认查当前季度

---
 src/views/crm/backlog/modules/receivable-audit-list.vue |   56 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/src/views/crm/backlog/modules/receivable-audit-list.vue b/src/views/crm/backlog/modules/receivable-audit-list.vue
index 83aeff5..de37fe4 100644
--- a/src/views/crm/backlog/modules/receivable-audit-list.vue
+++ b/src/views/crm/backlog/modules/receivable-audit-list.vue
@@ -5,22 +5,31 @@
 
 import { useRouter } from 'vue-router';
 
-import { Button } from 'ant-design-vue';
+import { Button, message } from 'ant-design-vue';
 
-import { useVbenVxeGrid } from '#/adapter/vxe-table';
-import { getReceivablePage } from '#/api/crm/receivable';
+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: [] }>();
 
-/** 鏌ョ湅瀹℃壒 */
-function handleProcessDetail(row: CrmReceivableApi.Receivable) {
-  push({
-    name: 'BpmProcessInstanceDetail',
-    query: { id: row.processInstanceId },
+/** 瀹℃牳 */
+async function handleAudit(row: CrmReceivableApi.Receivable) {
+  const hideLoading = message.loading({
+    content: '瀹℃牳涓�...',
+    duration: 0,
   });
+  try {
+    await updateReceivableStatus(row.id!, 20);
+    message.success('瀹℃牳鎴愬姛');
+    await gridApi.query();
+    emit('refresh');
+  } finally {
+    hideLoading();
+  }
 }
 
 /** 鎵撳紑鍥炴璇︽儏 */
@@ -35,15 +44,19 @@
 
 /** 鎵撳紑鍚堝悓璇︽儏 */
 function handleContractDetail(row: CrmReceivableApi.Receivable) {
-  push({ name: 'CrmContractDetail', params: { id: row.contractId } });
+  if (row.contractId) push({ name: 'CrmContractDetail', params: { id: row.contractId } });
 }
 
-const [Grid] = useVbenVxeGrid({
+function handleInvoiceDetail(row: CrmReceivableApi.Receivable) {
+  if (row.invoiceId) push({ name: 'CrmInvoiceDetail', params: { id: row.invoiceId } });
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
   formOptions: {
     schema: [
       {
         fieldName: 'auditStatus',
-        label: '鍚堝悓鐘舵��',
+        label: '瀹℃牳鐘舵��',
         component: 'Select',
         componentProps: {
           allowClear: true,
@@ -63,6 +76,7 @@
           return await getReceivablePage({
             pageNo: page.currentPage,
             pageSize: page.pageSize,
+            sceneType: 1,
             ...formValues,
           });
         },
@@ -93,12 +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 type="link" @click="handleProcessDetail(row)">鏌ョ湅瀹℃壒</Button>
+      <TableAction :actions="[{
+        label: '瀹℃牳',
+        type: 'link',
+        auth: ['crm:receivable:update'],
+        ifShow: row.auditStatus === 10,
+        onClick: handleAudit.bind(null, row),
+      }]" />
     </template>
   </Grid>
 </template>

--
Gitblit v1.9.3