From 7763f23f3224a0f609c4c483351edd656b0dfb26 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期一, 26 十月 2026 16:49:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0

---
 src/views/crm/saleQuotation/index.vue |   59 ++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/src/views/crm/saleQuotation/index.vue b/src/views/crm/saleQuotation/index.vue
index 9a221d3..9b0f50f 100644
--- a/src/views/crm/saleQuotation/index.vue
+++ b/src/views/crm/saleQuotation/index.vue
@@ -15,10 +15,13 @@
   getSaleQuotationPage,
 } from '#/api/crm/saleQuotation';
 import { $t } from '#/locales';
+import { downloadContractWord } from '#/utils/contract-document';
 
 import type { CrmSaleQuotationAiApi } from '#/api/crm/saleQuotation/ai';
 
-import { nextTick, ref } from 'vue';
+import { computed, nextTick, ref } from 'vue';
+
+import { isAiEnable } from '@vben/hooks';
 
 import { QUOTATION_STATUS, useGridColumns, useGridFormSchema } from './data';
 import Form from './modules/form.vue';
@@ -107,10 +110,37 @@
     async onOk() {
       const contractId = await convertSaleQuotationToContract(row.id!);
       message.success('杞悎鍚屾垚鍔�');
+      gridApi.query();
+      try {
+        await downloadContractWord(contractId);
+      } catch {
+        message.warning('鍚堝悓宸插垱寤猴紝鏂囦欢涓嬭浇澶辫触锛屽彲鍦ㄥ悎鍚岃鎯呬腑閲嶆柊涓嬭浇');
+      }
       push({ name: 'CrmContractDetail', params: { id: contractId } });
     },
   });
 }
+
+/** 宸ュ叿鏍忔寜閽細璇嗗埆褰曞叆鍙� AI 鎬诲紑鍏虫帶鍒� */
+const toolbarActions = computed(() => [
+  {
+    label: $t('ui.actionTitle.create', ['鎶ヤ环鍗�']),
+    type: 'primary' as const,
+    icon: ACTION_ICON.ADD,
+    auth: ['crm:sale-quotation:create'],
+    onClick: handleCreate,
+  },
+  ...(isAiEnable()
+    ? [
+        {
+          label: '璇嗗埆褰曞叆',
+          type: 'default' as const,
+          auth: ['crm:sale-quotation:create'],
+          onClick: handleOcrCreate,
+        },
+      ]
+    : []),
+]);
 
 const [Grid, gridApi] = useVbenVxeGrid({
   formOptions: {
@@ -149,23 +179,7 @@
     <OcrUpload ref="ocrUploadRef" @success="handleOcrSuccess" />
     <Grid>
       <template #toolbar-tools>
-        <TableAction
-          :actions="[
-            {
-              label: $t('ui.actionTitle.create', ['鎶ヤ环鍗�']),
-              type: 'primary',
-              icon: ACTION_ICON.ADD,
-              auth: ['crm:sale-quotation:create'],
-              onClick: handleCreate,
-            },
-            {
-              label: '璇嗗埆褰曞叆',
-              type: 'default',
-              auth: ['crm:sale-quotation:create'],
-              onClick: handleOcrCreate,
-            },
-          ]"
-        />
+        <TableAction :actions="toolbarActions" />
       </template>
       <template #name="{ row }">
         <Button type="link" @click="handleDetail(row)">
@@ -218,6 +232,13 @@
               ifShow: !!row.contractId,
             },
             {
+              label: '涓嬭浇鍚堝悓',
+              type: 'link',
+              auth: ['crm:contract:query'],
+              onClick: () => downloadContractWord(row.contractId!, row.contractNo),
+              ifShow: !!row.contractId,
+            },
+            {
               label: $t('common.delete'),
               type: 'link',
               danger: true,
@@ -233,4 +254,4 @@
       </template>
     </Grid>
   </Page>
-</template>
\ No newline at end of file
+</template>

--
Gitblit v1.9.3