From c88ddec455babe8ed28649320caeb5d805d2f213 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期日, 25 十月 2026 12:02:23 +0800
Subject: [PATCH] feat(core): 添加AI功能开关控制
---
src/views/crm/saleQuotation/index.vue | 46 +++++++++++++++++++++++++++-------------------
1 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/src/views/crm/saleQuotation/index.vue b/src/views/crm/saleQuotation/index.vue
index 13297ae..bebca59 100644
--- a/src/views/crm/saleQuotation/index.vue
+++ b/src/views/crm/saleQuotation/index.vue
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { ActionItem } from '#/adapter/vxe-table';
import type { CrmSaleQuotationApi } from '#/api/crm/saleQuotation';
import { useRouter } from 'vue-router';
@@ -15,6 +16,7 @@
getSaleQuotationPage,
} from '#/api/crm/saleQuotation';
import { $t } from '#/locales';
+import { isAiFeatureEnabled } from '#/utils/features';
import type { CrmSaleQuotationAiApi } from '#/api/crm/saleQuotation/ai';
@@ -52,6 +54,24 @@
function handleOcrSuccess(data: CrmSaleQuotationAiApi.OcrResultVO) {
nextTick(() => {
formModalApi.setData({ ocrData: data } as any).open();
+ });
+}
+
+const toolbarActions: ActionItem[] = [
+ {
+ label: $t('ui.actionTitle.create', ['鎶ヤ环鍗�']),
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ auth: ['crm:sale-quotation:create'],
+ onClick: handleCreate,
+ },
+];
+if (isAiFeatureEnabled) {
+ toolbarActions.push({
+ label: 'AI 璇嗗埆褰曞叆',
+ type: 'default',
+ auth: ['crm:sale-quotation:create'],
+ onClick: handleOcrCreate,
});
}
@@ -146,26 +166,14 @@
<template>
<Page auto-content-height>
<FormModal @success="handleRefresh" />
- <OcrUpload ref="ocrUploadRef" @success="handleOcrSuccess" />
+ <OcrUpload
+ v-if="isAiFeatureEnabled"
+ 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: 'AI 璇嗗埆褰曞叆',
- type: 'default',
- auth: ['crm:sale-quotation:create'],
- onClick: handleOcrCreate,
- },
- ]"
- />
+ <TableAction :actions="toolbarActions" />
</template>
<template #name="{ row }">
<Button type="link" @click="handleDetail(row)">
@@ -233,4 +241,4 @@
</template>
</Grid>
</Page>
-</template>
\ No newline at end of file
+</template>
--
Gitblit v1.9.3