From d39232a91f7b96d89876ed999b6e223a9bee9b82 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 22 十月 2026 13:09:04 +0800
Subject: [PATCH] feat(ai): 添加AI功能总开关及智能体导入功能
---
src/views/erp/purchase/invoice/index.vue | 56 +-
src/views/crm/saleQuotation/index.vue | 43 +
.env | 3
src/packages/effects/hooks/src/use-app-config.ts | 5
src/views/mes/qc/components/ai-assistant.vue | 3
src/views/mes/qc/report/template/designer/index.vue | 6
vite.config.ts | 6
src/views/mes/pro/workorder/modules/form.vue | 2
src/api/mdm/item/agent.ts | 264 +++++++++++++
src/store/auth.ts | 21 +
src/views/basicData/mdm/index.vue | 94 +++-
src/views/basicData/mdm/modules/agent-import.vue | 610 ++++++++++++++++++++++++++++++++
src/views/dashboard/analytics/index.vue | 3
src/views/mes/qc/components/ai-suggest.vue | 8
src/router/routes/modules/ai.ts | 7
15 files changed, 1,045 insertions(+), 86 deletions(-)
diff --git a/.env b/.env
index bba56ab..3b574c1 100644
--- a/.env
+++ b/.env
@@ -19,6 +19,9 @@
# 鏂囨。鍦板潃鐨勫紑鍏�
VITE_APP_DOCALERT_ENABLE=true
+# AI 鍔熻兘鎬诲紑鍏筹細false 鏃堕殣钘忔墍鏈� AI 鍏ュ彛锛圓I 妯″潡鑿滃崟銆丱CR銆侀娴嬨�佹櫤鑳藉垽瀹氥�佹櫤鑳戒綋瀵煎叆锛�
+VITE_APP_AI_ENABLE=true
+
# 鐧惧害缁熻
VITE_APP_BAIDU_CODE = e98f2eab6ceb8688bc6d8fc5332ff093
diff --git a/src/api/mdm/item/agent.ts b/src/api/mdm/item/agent.ts
new file mode 100644
index 0000000..e51594e
--- /dev/null
+++ b/src/api/mdm/item/agent.ts
@@ -0,0 +1,264 @@
+import type { InternalAxiosRequestConfig } from '@vben/request';
+
+import { RequestClient } from '@vben/request';
+import { useAccessStore } from '@vben/stores';
+
+import { requestClient } from '#/api/request';
+
+/**
+ * Python 鏅鸿兘浣撴湇鍔′笉鍦� /admin-api 涓嬶紝寮�鍙戞湡鐢� Vite 浠g悊 /agent-api 杞彂鍒� 127.0.0.1:8091銆�
+ * 璇ユ湇鍔$洿鎺ヨ繑鍥炰笟鍔� JSON锛屼笉浣跨敤 CommonResult 鍖呰锛屽洜姝ゅ崟鐙缓瀹㈡埛绔��
+ */
+const agentRequestClient = new RequestClient({
+ baseURL: '/agent-api',
+ responseReturn: 'body',
+ timeout: 120_000,
+});
+
+agentRequestClient.addRequestInterceptor({
+ fulfilled: (config: InternalAxiosRequestConfig) => {
+ const token = useAccessStore().accessToken;
+ if (token) {
+ config.headers.Authorization = `Bearer ${token}`;
+ }
+ return config;
+ },
+});
+
+export namespace MdmAgentImportApi {
+ export type RowAction = 'CREATE' | 'SKIP' | 'BLOCKED';
+ export type RowStatus = 'SUCCESS' | 'FAILED' | 'SKIPPED' | 'UNKNOWN';
+
+ export interface Evidence {
+ sheet: string;
+ row: number;
+ column: string;
+ raw: string;
+ }
+
+ export interface Candidate {
+ candidate_id: string;
+ source_sha256: string;
+ values: Record<string, string>;
+ evidence: Record<string, Evidence>;
+ issues: string[];
+ }
+
+ export interface Issue {
+ code?: string;
+ field?: string;
+ message: string;
+ retryable?: boolean;
+ }
+
+ export interface Resolved {
+ category_id?: number;
+ category_name?: string;
+ unit_measure_id?: number;
+ unit_measure_name?: string;
+ }
+
+ export interface PreflightRow {
+ candidate_id: string;
+ row_no?: number;
+ code?: string;
+ name?: string;
+ action: RowAction;
+ resolved?: Resolved;
+ blockers?: Issue[];
+ warnings?: Issue[];
+ target_item_id?: number;
+ }
+
+ export interface Preflight {
+ preflight_hash: string;
+ source: {
+ attachment_id: number;
+ session_id?: number;
+ source_sha256: string;
+ proposal_revision?: string;
+ };
+ policy: {
+ update_allowed: boolean;
+ mes_sync_allowed: boolean;
+ max_rows: number;
+ };
+ summary: {
+ total: number;
+ create: number;
+ skip: number;
+ blocked: number;
+ };
+ can_commit: boolean;
+ side_effects: string[];
+ rows: PreflightRow[];
+ blocking_items: Issue[];
+ }
+
+ export interface Correction {
+ candidate_id: string;
+ field: 'categoryCode' | 'code' | 'name' | 'specification' | 'unitMeasureCode';
+ value: string;
+ reason: string;
+ }
+
+ export interface ReceiptRow {
+ candidate_id: string;
+ row_no?: number;
+ code?: string;
+ name?: string;
+ action: 'CREATE' | 'SKIP';
+ status: RowStatus;
+ target_item_id?: number;
+ target_version?: string;
+ error_code?: string;
+ error_message?: string;
+ retryable?: boolean;
+ }
+
+ export interface Receipt {
+ command_id: string;
+ idempotency_key: string;
+ status: 'FAILED' | 'PARTIAL_FAILED' | 'RUNNING' | 'SUCCEEDED' | 'UNKNOWN';
+ attachment_id: number;
+ session_id?: number;
+ source_sha256: string;
+ preflight_hash: string;
+ proposal_hash?: string;
+ summary: {
+ total: number;
+ success: number;
+ failed: number;
+ skipped: number;
+ unknown: number;
+ };
+ error_code?: string;
+ error_message?: string;
+ rows: ReceiptRow[];
+ create_time?: string;
+ completed_time?: string;
+ }
+
+ export interface ImportState {
+ task_id: string;
+ attachment_id: string;
+ filename: string;
+ source_sha256: string;
+ candidates: Candidate[];
+ issues: Array<Issue & { candidate_id?: string; candidate_ids?: string[] }>;
+ revision: number;
+ status: string;
+ preflight?: Preflight;
+ preflight_hash?: string;
+ proposal?: Record<string, unknown>;
+ proposal_hash?: string;
+ command_id?: string;
+ receipt?: Receipt;
+ last_error?: string;
+ }
+
+ export interface ReviewInterrupt {
+ type: string;
+ revision: number;
+ issues: Array<Issue & { candidate_id?: string; candidate_ids?: string[] }>;
+ candidates: Candidate[];
+ preflight: {
+ hash?: string;
+ can_commit: boolean;
+ summary?: Preflight['summary'];
+ blocking_items: Issue[];
+ needs_attention: PreflightRow[];
+ };
+ last_error?: string;
+ notice?: string;
+ }
+
+ export interface PublicState {
+ state: ImportState;
+ interrupts: ReviewInterrupt[];
+ }
+
+ export interface ReviewReq {
+ expected_revision: number;
+ action: 'cancel' | 'confirm' | 'revise';
+ corrections?: Correction[];
+ expected_preflight_hash?: string;
+ expected_proposal_hash?: string;
+ }
+}
+
+/** 鍒涘缓琛ュ綍浼氳瘽锛圝ava锛� */
+export function createImportSession() {
+ return requestClient.post<number>('/agent/bridge/import-sessions');
+}
+
+/** 缁戝畾闄勪欢鍒拌ˉ褰曚細璇濓紝杩斿洖 attachmentId锛圝ava锛� */
+export function bindImportAttachment(sessionId: number, blobId: number) {
+ return requestClient.post<number>(
+ `/agent/bridge/import-sessions/${sessionId}/attachments`,
+ { blobId },
+ );
+}
+
+/** 鍒涘缓鏅鸿兘浣撳鍏ヤ换鍔″苟瑙﹀彂瑙f瀽涓庨妫�锛圥ython锛� */
+export function startMaterialImport(attachmentId: number) {
+ return agentRequestClient.post<MdmAgentImportApi.PublicState>(
+ '/v1/material-imports',
+ { attachment_id: String(attachmentId) },
+ );
+}
+
+/** 璇诲彇浠诲姟褰撳墠鐘舵�侊紙Python锛� */
+export function getMaterialImportTask(taskId: string) {
+ return agentRequestClient.get<MdmAgentImportApi.PublicState>(
+ `/v1/material-imports/${taskId}`,
+ );
+}
+
+/** 淇鎴栫‘璁わ紙Python锛� */
+export function reviewMaterialImport(
+ taskId: string,
+ data: MdmAgentImportApi.ReviewReq,
+) {
+ return agentRequestClient.post<MdmAgentImportApi.PublicState>(
+ `/v1/material-imports/${taskId}/review`,
+ data,
+ );
+}
+
+/** 鏌ヨ鎻愪氦鍥炴墽锛圥ython锛� */
+export function getMaterialImportReceipt(taskId: string) {
+ return agentRequestClient.get<MdmAgentImportApi.Receipt>(
+ `/v1/material-imports/${taskId}/receipt`,
+ );
+}
+
+interface AgentErrorDetail {
+ error_code?: string;
+ message?: string;
+}
+
+/** 浠� Python 閿欒鍝嶅簲涓彁鍙栧彲璇绘枃妗� */
+export function agentImportErrorMessage(error: unknown): string {
+ const err = error as
+ | { data?: unknown; message?: string; response?: { data?: unknown } }
+ | undefined;
+ const body = (err?.response?.data ?? err?.data) as
+ | AgentErrorDetail
+ | string
+ | undefined;
+ const detail =
+ typeof body === 'string'
+ ? body
+ : ((body as { detail?: unknown } | undefined)?.detail ?? body);
+ if (typeof detail === 'string') {
+ return detail;
+ }
+ const info = detail as AgentErrorDetail | undefined;
+ if (info?.message) {
+ return info.error_code
+ ? `${info.message}锛�${info.error_code}锛塦
+ : info.message;
+ }
+ return err?.message || '鏅鸿兘浣撴湇鍔¤姹傚け璐�';
+}
diff --git a/src/packages/effects/hooks/src/use-app-config.ts b/src/packages/effects/hooks/src/use-app-config.ts
index 4320741..b13b229 100644
--- a/src/packages/effects/hooks/src/use-app-config.ts
+++ b/src/packages/effects/hooks/src/use-app-config.ts
@@ -46,3 +46,8 @@
export function isDocAlertEnable(): boolean {
return import.meta.env.VITE_APP_DOCALERT_ENABLE !== 'false';
}
+
+/** AI 鍔熻兘鎬诲紑鍏筹細鍏抽棴鍚庨殣钘忔墍鏈� AI 鍏ュ彛锛堟ā鍧楄彍鍗曘�丱CR銆侀娴嬨�佹櫤鑳藉垽瀹氥�佹櫤鑳戒綋瀵煎叆绛夛級 */
+export function isAiEnable(): boolean {
+ return import.meta.env.VITE_APP_AI_ENABLE !== 'false';
+}
diff --git a/src/router/routes/modules/ai.ts b/src/router/routes/modules/ai.ts
index dc66c49..51a9f00 100644
--- a/src/router/routes/modules/ai.ts
+++ b/src/router/routes/modules/ai.ts
@@ -1,6 +1,9 @@
import type { RouteRecordRaw } from 'vue-router';
-const routes: RouteRecordRaw[] = [
+import { isAiEnable } from '@vben/hooks';
+
+/** AI 鎬诲紑鍏冲叧闂椂鏁寸粍璺敱涓嶆敞鍐岋紝閬垮厤閫氳繃鍦板潃鏍忕洿鎺ヨ闂� */
+const routes: RouteRecordRaw[] = isAiEnable() ? [
{
path: '/ai',
name: 'Ai',
@@ -108,6 +111,6 @@
},
],
},
-];
+] : [];
export default routes;
diff --git a/src/store/auth.ts b/src/store/auth.ts
index c2b1dd6..2e28670 100644
--- a/src/store/auth.ts
+++ b/src/store/auth.ts
@@ -6,6 +6,7 @@
import { useRouter } from 'vue-router';
import { LOGIN_PATH } from '@vben/constants';
+import { isAiEnable } from '@vben/hooks';
import { preferences } from '@vben/preferences';
import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores';
@@ -22,6 +23,22 @@
} from '#/api';
import { $t } from '#/locales';
import { automaticApproval, loadAuditPolicy } from '#/store/audit-policy';
+
+/** AI 鎬诲紑鍏冲叧闂椂锛岃繛鍚� /ai 妯″潡鑿滃崟涓�骞堕殣钘� */
+function filterAiMenus<T extends { children?: T[]; path?: string }>(
+ menus: T[],
+): T[] {
+ return menus
+ .filter((menu) => {
+ const path = menu.path?.replace(/^\//, '');
+ return !(path === 'ai' || path?.startsWith('ai/'));
+ })
+ .map((menu) =>
+ menu.children?.length
+ ? { ...menu, children: filterAiMenus(menu.children) }
+ : menu,
+ );
+}
export const useAuthStore = defineStore('auth', () => {
const accessStore = useAccessStore();
@@ -168,7 +185,9 @@
userStore.setUserInfo(authPermissionInfo.user);
userStore.setUserRoles(authPermissionInfo.roles);
// accessStore
- accessStore.setAccessMenus(authPermissionInfo.menus);
+ accessStore.setAccessMenus(
+ isAiEnable() ? authPermissionInfo.menus : filterAiMenus(authPermissionInfo.menus),
+ );
accessStore.setAccessCodes(authPermissionInfo.permissions);
return authPermissionInfo;
}
diff --git a/src/views/basicData/mdm/index.vue b/src/views/basicData/mdm/index.vue
index af385ba..b31f503 100644
--- a/src/views/basicData/mdm/index.vue
+++ b/src/views/basicData/mdm/index.vue
@@ -5,6 +5,8 @@
import { computed, ref } from 'vue';
+import { isAiEnable } from '@vben/hooks';
+
import { confirm, Page, useVbenModal } from '#/packages/effects/common-ui/src';
import { downloadFileFromBlobPart, isEmpty } from '#/packages/utils/src';
@@ -23,6 +25,7 @@
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
+import AgentImport from './modules/agent-import.vue';
import Form from './modules/form.vue';
import ImportForm from './modules/import-form.vue';
@@ -35,6 +38,11 @@
const [ImportModal, importModalApi] = useVbenModal({
connectedComponent: ImportForm,
+ destroyOnClose: true,
+});
+
+const [AgentImportModal, agentImportModalApi] = useVbenModal({
+ connectedComponent: AgentImport,
destroyOnClose: true,
});
@@ -96,6 +104,56 @@
function handleImport() {
importModalApi.open();
}
+
+/** 鏅鸿兘浣撳鍏ョ墿鏂� */
+function handleAgentImport() {
+ agentImportModalApi.open();
+}
+
+/** 宸ュ叿鏍忔寜閽細鏅鸿兘浣撳鍏ュ彈 AI 鎬诲紑鍏虫帶鍒� */
+const toolbarActions = computed(() => [
+ {
+ label: $t('ui.actionTitle.create', ['鐗╂枡']),
+ type: 'primary' as const,
+ icon: ACTION_ICON.ADD,
+ auth: ['mdm:item:create'],
+ onClick: handleCreate,
+ },
+ {
+ label: $t('ui.actionTitle.import', ['鐗╂枡']),
+ type: 'primary' as const,
+ icon: ACTION_ICON.UPLOAD,
+ auth: ['mdm:item:import'],
+ onClick: handleImport,
+ },
+ ...(isAiEnable()
+ ? [
+ {
+ label: '鏅鸿兘浣撳鍏�',
+ type: 'primary' as const,
+ icon: ACTION_ICON.UPLOAD,
+ auth: ['mdm:item:import'],
+ onClick: handleAgentImport,
+ },
+ ]
+ : []),
+ {
+ label: $t('ui.actionTitle.export'),
+ type: 'primary' as const,
+ icon: ACTION_ICON.DOWNLOAD,
+ auth: ['mdm:item:export'],
+ onClick: handleExport,
+ },
+ {
+ label: $t('ui.actionTitle.deleteBatch'),
+ type: 'primary' as const,
+ danger: true,
+ icon: ACTION_ICON.DELETE,
+ auth: ['mdm:item:delete'],
+ disabled: isEmpty(checkedIds),
+ onClick: handleDeleteBatch,
+ },
+]);
/** 缂栬緫鐗╂枡 */
function handleEdit(row: MdmItemApi.Item) {
@@ -223,42 +281,10 @@
<Page auto-content-height>
<FormModal @success="handleRefresh" />
<ImportModal @success="handleRefresh" />
+ <AgentImportModal @success="handleRefresh" />
<Grid table-title="鐗╂枡鍒楄〃">
<template #toolbar-tools>
- <TableAction
- :actions="[
- {
- label: $t('ui.actionTitle.create', ['鐗╂枡']),
- type: 'primary',
- icon: ACTION_ICON.ADD,
- auth: ['mdm:item:create'],
- onClick: handleCreate,
- },
- {
- label: $t('ui.actionTitle.import', ['鐗╂枡']),
- type: 'primary',
- icon: ACTION_ICON.UPLOAD,
- auth: ['mdm:item:import'],
- onClick: handleImport,
- },
- {
- label: $t('ui.actionTitle.export'),
- type: 'primary',
- icon: ACTION_ICON.DOWNLOAD,
- auth: ['mdm:item:export'],
- onClick: handleExport,
- },
- {
- label: $t('ui.actionTitle.deleteBatch'),
- type: 'primary',
- danger: true,
- icon: ACTION_ICON.DELETE,
- auth: ['mdm:item:delete'],
- disabled: isEmpty(checkedIds),
- onClick: handleDeleteBatch,
- },
- ]"
- />
+ <TableAction :actions="toolbarActions" />
</template>
<template #categoryName="{ row }">
<Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag>
diff --git a/src/views/basicData/mdm/modules/agent-import.vue b/src/views/basicData/mdm/modules/agent-import.vue
new file mode 100644
index 0000000..029860f
--- /dev/null
+++ b/src/views/basicData/mdm/modules/agent-import.vue
@@ -0,0 +1,610 @@
+<script lang="ts" setup>
+import type { FileType } from 'ant-design-vue/es/upload/interface';
+
+import type { MdmAgentImportApi } from '#/api/mdm/item/agent';
+
+import { computed, ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import {
+ Alert,
+ Button,
+ Input,
+ message,
+ Steps,
+ Table,
+ Tag,
+ Upload,
+} from 'ant-design-vue';
+
+import {
+ agentImportErrorMessage,
+ bindImportAttachment,
+ createImportSession,
+ getMaterialImportReceipt,
+ reviewMaterialImport,
+ startMaterialImport,
+} from '#/api/mdm/item/agent';
+import { uploadFile } from '#/api/system/storage';
+
+defineOptions({ name: 'MdmAgentImport' });
+
+const emit = defineEmits<{ success: [] }>();
+
+const MAX_BYTES = 8 * 1024 * 1024;
+const FIELD_KEYS = [
+ 'code',
+ 'name',
+ 'specification',
+ 'categoryCode',
+ 'unitMeasureCode',
+] as const;
+type FieldKey = (typeof FIELD_KEYS)[number];
+
+interface EditableRow {
+ candidate_id: string;
+ row_no?: number;
+ code: string;
+ name: string;
+ specification: string;
+ categoryCode: string;
+ unitMeasureCode: string;
+ original: Record<string, string>;
+ preflight?: MdmAgentImportApi.PreflightRow;
+ issues: string[];
+}
+
+interface RowMessage {
+ type: 'error' | 'warning';
+ text: string;
+}
+
+const step = ref(1);
+const file = ref<File>();
+const fileName = ref('');
+const processing = ref(false);
+const taskId = ref('');
+const state = ref<MdmAgentImportApi.ImportState>();
+const receipt = ref<MdmAgentImportApi.Receipt>();
+const rows = ref<EditableRow[]>([]);
+const lastError = ref('');
+let sessionId: number | undefined;
+let attachmentId: number | undefined;
+
+const preflight = computed(() => state.value?.preflight);
+const issues = computed(() => state.value?.issues ?? []);
+const canCommit = computed(
+ () => !!preflight.value?.can_commit && issues.value.length === 0,
+);
+const hasChanges = computed(() => corrections.value.length > 0);
+
+const corrections = computed<MdmAgentImportApi.Correction[]>(() => {
+ const result: MdmAgentImportApi.Correction[] = [];
+ for (const row of rows.value) {
+ for (const field of FIELD_KEYS) {
+ const before = (row.original[field] ?? '').trim();
+ const after = (row[field] ?? '').trim();
+ if (before !== after) {
+ result.push({
+ candidate_id: row.candidate_id,
+ field,
+ value: after,
+ reason: '浜哄伐淇',
+ });
+ }
+ }
+ }
+ return result;
+});
+
+const ACTION_LABEL: Record<MdmAgentImportApi.RowAction, string> = {
+ BLOCKED: '闃绘柇',
+ CREATE: '鏂板缓',
+ SKIP: '宸插瓨鍦�',
+};
+const ACTION_COLOR: Record<MdmAgentImportApi.RowAction, string> = {
+ BLOCKED: 'red',
+ CREATE: 'green',
+ SKIP: 'orange',
+};
+const STATUS_LABEL: Record<MdmAgentImportApi.RowStatus, string> = {
+ FAILED: '澶辫触',
+ SKIPPED: '宸茶烦杩�',
+ SUCCESS: '鎴愬姛',
+ UNKNOWN: '鏈煡',
+};
+const STATUS_COLOR: Record<MdmAgentImportApi.RowStatus, string> = {
+ FAILED: 'red',
+ SKIPPED: 'orange',
+ SUCCESS: 'green',
+ UNKNOWN: 'default',
+};
+
+const reviewColumns = [
+ { dataIndex: 'row_no', key: 'row_no', title: '琛屽彿', width: 64 },
+ { dataIndex: 'code', key: 'code', title: '鐗╂枡缂栫爜', width: 150 },
+ { dataIndex: 'name', key: 'name', title: '鐗╂枡鍚嶇О', width: 180 },
+ { dataIndex: 'specification', key: 'specification', title: '瑙勬牸鍨嬪彿', width: 150 },
+ { dataIndex: 'categoryCode', key: 'categoryCode', title: '鍒嗙被缂栫爜', width: 140 },
+ {
+ dataIndex: 'unitMeasureCode',
+ key: 'unitMeasureCode',
+ title: '璁¢噺鍗曚綅',
+ width: 130,
+ },
+ { key: 'action', title: '棰勬鍔ㄤ綔', width: 100 },
+ { key: 'message', title: '鏍¢獙淇℃伅', width: 260 },
+];
+
+const receiptColumns = [
+ { dataIndex: 'row_no', key: 'row_no', title: '琛屽彿', width: 64 },
+ { dataIndex: 'code', key: 'code', title: '鐗╂枡缂栫爜', width: 150 },
+ { dataIndex: 'name', key: 'name', title: '鐗╂枡鍚嶇О', width: 180 },
+ { key: 'action', title: '鍔ㄤ綔', width: 90 },
+ { key: 'status', title: '缁撴灉', width: 90 },
+ { dataIndex: 'target_item_id', key: 'target_item_id', title: '鐗╂枡 ID', width: 100 },
+ { key: 'error', title: '澶辫触鍘熷洜', width: 220 },
+];
+
+function isEditableColumn(key: unknown): key is FieldKey {
+ return typeof key === 'string' && (FIELD_KEYS as readonly string[]).includes(key);
+}
+
+function rowMessages(row: EditableRow): RowMessage[] {
+ return [
+ ...(row.preflight?.blockers ?? []).map((item) => ({
+ type: 'error' as const,
+ text: item.message,
+ })),
+ ...(row.preflight?.warnings ?? []).map((item) => ({
+ type: 'warning' as const,
+ text: item.message,
+ })),
+ ...row.issues.map((text) => ({ type: 'warning' as const, text })),
+ ];
+}
+
+function buildRows(data: MdmAgentImportApi.ImportState): EditableRow[] {
+ const plannedRows = data.preflight?.rows ?? [];
+ return (data.candidates ?? [])
+ .map((candidate) => {
+ const planned = plannedRows.find(
+ (item) => item.candidate_id === candidate.candidate_id,
+ );
+ const values = candidate.values ?? {};
+ return {
+ candidate_id: candidate.candidate_id,
+ row_no: planned?.row_no ?? candidate.evidence?.code?.row,
+ code: values.code ?? '',
+ name: values.name ?? '',
+ specification: values.specification ?? '',
+ categoryCode: values.categoryCode ?? '',
+ unitMeasureCode: values.unitMeasureCode ?? '',
+ original: { ...values },
+ preflight: planned,
+ issues: candidate.issues ?? [],
+ };
+ })
+ .sort((a, b) => (a.row_no ?? 0) - (b.row_no ?? 0));
+}
+
+function applyState(payload: MdmAgentImportApi.PublicState) {
+ state.value = payload.state;
+ taskId.value = payload.state.task_id;
+ lastError.value =
+ payload.state.last_error || payload.interrupts?.[0]?.last_error || '';
+ receipt.value = payload.state.receipt;
+ rows.value = buildRows(payload.state);
+ step.value = receipt.value ? 3 : 2;
+ syncFooter();
+}
+
+function syncFooter() {
+ void modalApi.setState({
+ cancelText: step.value === 2 ? '鍙栨秷浠诲姟' : '鍙栨秷',
+ confirmText:
+ step.value === 1 ? '寮�濮嬭В鏋�' : step.value === 2 ? '纭鎻愪氦' : '瀹屾垚',
+ showCancelButton: step.value !== 3,
+ });
+}
+
+function reset() {
+ step.value = 1;
+ file.value = undefined;
+ fileName.value = '';
+ processing.value = false;
+ taskId.value = '';
+ state.value = undefined;
+ receipt.value = undefined;
+ rows.value = [];
+ lastError.value = '';
+ sessionId = undefined;
+ attachmentId = undefined;
+}
+
+function beforeUpload(fileInfo: FileType) {
+ const raw = fileInfo as unknown as File;
+ const name = raw.name.toLowerCase();
+ if (!name.endsWith('.csv') && !name.endsWith('.xlsx')) {
+ message.error('浠呮敮鎸� CSV 鎴� XLSX 鏂囦欢');
+ return false;
+ }
+ if (raw.size > MAX_BYTES) {
+ message.error('鏂囦欢涓嶈兘瓒呰繃 8 MiB');
+ return false;
+ }
+ file.value = raw;
+ fileName.value = raw.name;
+ return false;
+}
+
+async function startImport() {
+ if (!file.value) {
+ message.warning('璇峰厛閫夋嫨 CSV/XLSX 鏂囦欢');
+ return;
+ }
+ processing.value = true;
+ modalApi.lock();
+ try {
+ sessionId = await createImportSession();
+ const blobs = await uploadFile([file.value]);
+ const blobId = blobs?.[0]?.id;
+ if (!blobId) {
+ throw new Error('鏂囦欢涓婁紶澶辫触锛屾湭鍙栧緱 blobId');
+ }
+ attachmentId = await bindImportAttachment(sessionId, blobId);
+ const payload = await startMaterialImport(attachmentId);
+ applyState(payload);
+ } catch (error) {
+ message.error(agentImportErrorMessage(error));
+ } finally {
+ processing.value = false;
+ modalApi.unlock();
+ }
+}
+
+async function revise() {
+ if (!state.value) return;
+ if (!hasChanges.value) {
+ message.info('鏈娴嬪埌淇敼');
+ return;
+ }
+ processing.value = true;
+ modalApi.lock();
+ try {
+ const payload = await reviewMaterialImport(taskId.value, {
+ action: 'revise',
+ corrections: corrections.value,
+ expected_revision: state.value.revision,
+ });
+ applyState(payload);
+ message.success('宸叉寜淇敼閲嶆柊棰勬锛岃鏍稿缁撴灉');
+ } catch (error) {
+ message.error(agentImportErrorMessage(error));
+ } finally {
+ processing.value = false;
+ modalApi.unlock();
+ }
+}
+
+async function confirmSubmit() {
+ if (!state.value) return;
+ if (hasChanges.value) {
+ message.warning('瀛樺湪鏈彁浜ょ殑淇敼锛岃鍏堢偣銆岄噸鏂版鏌ャ�嶅苟鎸夋柊鐨勯妫�缁撴灉纭');
+ return;
+ }
+ if (!canCommit.value) {
+ message.warning(lastError.value || '棰勬浠嶆湁闃绘柇椤癸紝璇蜂慨璁㈠悗閲嶆柊妫�鏌�');
+ return;
+ }
+ processing.value = true;
+ modalApi.lock();
+ try {
+ const payload = await reviewMaterialImport(taskId.value, {
+ action: 'confirm',
+ expected_preflight_hash: state.value.preflight_hash,
+ expected_revision: state.value.revision,
+ });
+ applyState(payload);
+ if (receipt.value) {
+ message.success('鎻愪氦瀹屾垚锛岃鏌ョ湅鍥炴墽');
+ } else if (lastError.value) {
+ message.error(lastError.value);
+ }
+ } catch (error) {
+ const text = agentImportErrorMessage(error);
+ message.error(text);
+ // 鎻愪氦瓒呮椂/缃戝叧涓柇鏃跺懡浠ゅ彲鑳藉凡鎵ц锛屾彁绀虹敤鎴锋煡鍥炴墽锛岄伩鍏嶉噸澶嶆彁浜�
+ lastError.value = text;
+ } finally {
+ processing.value = false;
+ modalApi.unlock();
+ }
+}
+
+async function fetchReceipt() {
+ if (!taskId.value) return;
+ processing.value = true;
+ modalApi.lock();
+ try {
+ receipt.value = await getMaterialImportReceipt(taskId.value);
+ step.value = 3;
+ syncFooter();
+ } catch (error) {
+ message.error(agentImportErrorMessage(error));
+ } finally {
+ processing.value = false;
+ modalApi.unlock();
+ }
+}
+
+async function handleCancel() {
+ if (step.value === 2 && taskId.value) {
+ try {
+ await reviewMaterialImport(taskId.value, {
+ action: 'cancel',
+ expected_revision: state.value?.revision ?? 0,
+ });
+ } catch {
+ // 鍙栨秷澶辫触涓嶅奖鍝嶅叧闂獥鍙�
+ }
+ }
+ modalApi.close();
+}
+
+function finish() {
+ if ((receipt.value?.summary.success ?? 0) > 0) {
+ emit('success');
+ }
+ modalApi.close();
+}
+
+async function handlePrimary() {
+ if (processing.value) return;
+ if (step.value === 1) {
+ await startImport();
+ return;
+ }
+ if (step.value === 2) {
+ await confirmSubmit();
+ return;
+ }
+ finish();
+}
+
+const [Modal, modalApi] = useVbenModal({
+ onCancel() {
+ void handleCancel();
+ },
+ onClosed() {
+ reset();
+ },
+ onConfirm() {
+ void handlePrimary();
+ },
+ onOpenChange(isOpen) {
+ if (isOpen) {
+ reset();
+ syncFooter();
+ }
+ },
+});
+</script>
+
+<template>
+ <Modal title="鏅鸿兘浣撳鍏ョ墿鏂�" class="w-[1080px]">
+ <Steps
+ :current="step - 1"
+ class="mx-4 mb-4"
+ size="small"
+ :items="[
+ { title: '涓婁紶鏂囦欢' },
+ { title: '瀹℃牳纭' },
+ { title: '鎻愪氦鍥炴墽' },
+ ]"
+ />
+
+ <div v-if="step === 1" class="mx-4">
+ <Upload
+ accept=".csv,.xlsx"
+ :max-count="1"
+ :show-upload-list="false"
+ :before-upload="beforeUpload"
+ >
+ <Button type="primary">閫夋嫨 CSV / XLSX 鏂囦欢</Button>
+ </Upload>
+ <div v-if="fileName" class="mt-2 text-sm text-gray-600">
+ 宸查�夋嫨锛歿{ fileName }}
+ </div>
+ <div class="mt-3 text-xs text-gray-500 leading-relaxed">
+ <div>鏂囦欢涓婇檺 8 MiB锛屼粎鏀寔 CSV / XLSX銆�</div>
+ <div>
+ 娴佺▼锛氳В鏋愭竻鍗� 鈫� Java 鏍¢獙鍒嗙被/鍗曚綅/缂栫爜 鈫� 浜哄伐鏍稿 鈫� 纭鎻愪氦銆�
+ </div>
+ <div>
+ 鏈樁娈靛彧鏂板缓鐗╂枡锛氱紪鐮佸凡瀛樺湪浼氳烦杩囷紝涓嶆洿鏂板師鐗╂枡锛屼篃涓嶅悓姝� MES銆�
+ </div>
+ </div>
+ </div>
+
+ <div v-else-if="step === 2" class="mx-4">
+ <div class="mb-3 flex flex-wrap items-center gap-x-5 gap-y-1 text-sm">
+ <span>鎬昏锛歿{ preflight?.summary.total ?? rows.length }}</span>
+ <span class="text-green-600">
+ 鏂板缓锛歿{ preflight?.summary.create ?? 0 }}
+ </span>
+ <span class="text-orange-500">
+ 璺宠繃锛歿{ preflight?.summary.skip ?? 0 }}
+ </span>
+ <span class="text-red-500">
+ 闃绘柇锛歿{ preflight?.summary.blocked ?? 0 }}
+ </span>
+ <span class="text-gray-500">鏂规鐗堟湰锛歿{ state?.revision ?? 0 }}</span>
+ </div>
+
+ <Alert
+ v-if="lastError"
+ type="error"
+ :message="lastError"
+ show-icon
+ class="mb-3"
+ />
+
+ <Alert
+ v-if="issues.length > 0"
+ type="warning"
+ show-icon
+ class="mb-3"
+ message="瀛樺湪闇�瑕佸鐞嗙殑闂"
+ >
+ <template #description>
+ <div v-for="(issue, index) in issues" :key="index">
+ {{ issue.message }}
+ </div>
+ </template>
+ </Alert>
+
+ <Alert
+ v-else-if="preflight && !preflight.can_commit"
+ type="warning"
+ show-icon
+ class="mb-3"
+ message="棰勬浠嶆湁闃绘柇椤癸紝淇鍚庤鐐广�岄噸鏂版鏌ャ�嶏紝閫氳繃鍚庢墠鑳界‘璁ゆ彁浜�"
+ />
+
+ <Table
+ bordered
+ size="small"
+ :columns="reviewColumns"
+ :data-source="rows"
+ :pagination="false"
+ :row-key="(record: EditableRow) => record.candidate_id"
+ :scroll="{ y: 360 }"
+ >
+ <template #bodyCell="{ column, record }">
+ <template v-if="isEditableColumn(column.key)">
+ <Input
+ v-model:value="record[column.key]"
+ size="small"
+ :status="
+ record.preflight?.blockers?.some(
+ (item: MdmAgentImportApi.Issue) => item.field === column.key,
+ )
+ ? 'error'
+ : undefined
+ "
+ />
+ <div
+ v-if="
+ column.key === 'categoryCode' &&
+ record.preflight?.resolved?.category_name
+ "
+ class="mt-1 text-xs text-gray-400"
+ >
+ 瑙f瀽涓猴細{{ record.preflight.resolved.category_name }}
+ </div>
+ <div
+ v-if="
+ column.key === 'unitMeasureCode' &&
+ record.preflight?.resolved?.unit_measure_name
+ "
+ class="mt-1 text-xs text-gray-400"
+ >
+ 瑙f瀽涓猴細{{ record.preflight.resolved.unit_measure_name }}
+ </div>
+ </template>
+ <template v-else-if="column.key === 'action'">
+ <Tag
+ v-if="record.preflight"
+ :color="
+ ACTION_COLOR[record.preflight.action as MdmAgentImportApi.RowAction]
+ "
+ >
+ {{ ACTION_LABEL[record.preflight.action as MdmAgentImportApi.RowAction] }}
+ </Tag>
+ </template>
+ <template v-else-if="column.key === 'message'">
+ <div
+ v-for="(item, index) in rowMessages(record as EditableRow)"
+ :key="index"
+ class="text-xs leading-relaxed"
+ :class="item.type === 'error' ? 'text-red-500' : 'text-orange-500'"
+ >
+ {{ item.text }}
+ </div>
+ </template>
+ </template>
+ </Table>
+
+ <div class="mt-3 flex flex-wrap items-center gap-2">
+ <Button :disabled="processing || !hasChanges" @click="revise">
+ 閲嶆柊妫�鏌�
+ </Button>
+ <Button :disabled="processing || !taskId" @click="fetchReceipt">
+ 鏌ヨ鍥炴墽
+ </Button>
+ <span class="text-xs text-gray-400">
+ {{ hasChanges ? '宸蹭慨鏀癸紝闇�閲嶆柊妫�鏌ュ悗鎵嶈兘纭' : '纭鍚庢彁浜わ紝宸插瓨鍦ㄧ紪鐮佷細璺宠繃' }}
+ </span>
+ </div>
+ </div>
+
+ <div v-else class="mx-4">
+ <div class="mb-3 flex flex-wrap items-center gap-x-5 gap-y-1 text-sm">
+ <Tag :color="receipt?.status === 'SUCCEEDED' ? 'green' : 'orange'">
+ {{ receipt?.status ?? 'UNKNOWN' }}
+ </Tag>
+ <span>鎬昏锛歿{ receipt?.summary.total ?? 0 }}</span>
+ <span class="text-green-600">
+ 鎴愬姛锛歿{ receipt?.summary.success ?? 0 }}
+ </span>
+ <span class="text-orange-500">
+ 璺宠繃锛歿{ receipt?.summary.skipped ?? 0 }}
+ </span>
+ <span class="text-red-500">
+ 澶辫触锛歿{ receipt?.summary.failed ?? 0 }}
+ </span>
+ <span class="text-gray-500">
+ 鏈煡锛歿{ receipt?.summary.unknown ?? 0 }}
+ </span>
+ </div>
+
+ <Alert
+ v-if="receipt?.error_message"
+ type="error"
+ :message="receipt.error_message"
+ show-icon
+ class="mb-3"
+ />
+
+ <Table
+ bordered
+ size="small"
+ :columns="receiptColumns"
+ :data-source="receipt?.rows ?? []"
+ :pagination="false"
+ :row-key="(record: MdmAgentImportApi.ReceiptRow) => record.candidate_id"
+ :scroll="{ y: 360 }"
+ >
+ <template #bodyCell="{ column, record }">
+ <template v-if="column.key === 'action'">
+ <Tag :color="record.action === 'CREATE' ? 'green' : 'orange'">
+ {{ record.action === 'CREATE' ? '鏂板缓' : '璺宠繃' }}
+ </Tag>
+ </template>
+ <template v-else-if="column.key === 'status'">
+ <Tag :color="STATUS_COLOR[record.status as MdmAgentImportApi.RowStatus]">
+ {{ STATUS_LABEL[record.status as MdmAgentImportApi.RowStatus] }}
+ </Tag>
+ </template>
+ <template v-else-if="column.key === 'error'">
+ <span class="text-xs text-red-500">
+ {{ record.error_message ?? '' }}
+ </span>
+ </template>
+ </template>
+ </Table>
+ </div>
+ </Modal>
+</template>
diff --git a/src/views/crm/saleQuotation/index.vue b/src/views/crm/saleQuotation/index.vue
index cf01246..9b0f50f 100644
--- a/src/views/crm/saleQuotation/index.vue
+++ b/src/views/crm/saleQuotation/index.vue
@@ -19,7 +19,9 @@
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';
@@ -119,6 +121,27 @@
});
}
+/** 宸ュ叿鏍忔寜閽細璇嗗埆褰曞叆鍙� 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: {
schema: useGridFormSchema(),
@@ -156,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)">
diff --git a/src/views/dashboard/analytics/index.vue b/src/views/dashboard/analytics/index.vue
index 907fac8..90988e2 100644
--- a/src/views/dashboard/analytics/index.vue
+++ b/src/views/dashboard/analytics/index.vue
@@ -3,6 +3,7 @@
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
+import { isAiEnable } from '@vben/hooks';
import { Col, Row } from 'ant-design-vue';
@@ -83,7 +84,7 @@
<!-- AI 鏅鸿兘鍒嗘瀽 -->
<AiInsights
- v-if="canViewHome && canNavigate('MesProWorkOrder')"
+ v-if="canViewHome && canNavigate('MesProWorkOrder') && isAiEnable()"
:active-order-count="summary.workOrderActiveCount"
@navigate="handleNavigate"
/>
diff --git a/src/views/erp/purchase/invoice/index.vue b/src/views/erp/purchase/invoice/index.vue
index 2878f23..44cba30 100644
--- a/src/views/erp/purchase/invoice/index.vue
+++ b/src/views/erp/purchase/invoice/index.vue
@@ -4,10 +4,11 @@
import type { ErpPurchaseInvoiceAiApi } from '#/api/erp/purchase/invoice/ai';
import { Page, useVbenModal } from '@vben/common-ui';
+import { isAiEnable } from '@vben/hooks';
import { downloadFileFromBlobPart } from '@vben/utils';
import { Button, message, Tag } from 'ant-design-vue';
-import { nextTick, ref } from 'vue';
+import { computed, nextTick, ref } from 'vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
@@ -84,6 +85,34 @@
}
}
+/** 宸ュ叿鏍忔寜閽細璇嗗埆褰曞叆鍙� AI 鎬诲紑鍏虫帶鍒� */
+const toolbarActions = computed(() => [
+ {
+ label: $t('ui.actionTitle.create', ['鏉ョエ']),
+ type: 'primary' as const,
+ icon: ACTION_ICON.ADD,
+ auth: ['erp:purchase-invoice:create'],
+ onClick: handleCreate,
+ },
+ ...(isAiEnable()
+ ? [
+ {
+ label: '璇嗗埆褰曞叆',
+ type: 'primary' as const,
+ auth: ['erp:purchase-invoice:create'],
+ onClick: handleOcrCreate,
+ },
+ ]
+ : []),
+ {
+ label: $t('ui.actionTitle.export'),
+ type: 'primary' as const,
+ icon: ACTION_ICON.DOWNLOAD,
+ auth: ['erp:purchase-invoice:export'],
+ onClick: handleExport,
+ },
+]);
+
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
@@ -121,30 +150,7 @@
<OcrUpload ref="ocrUploadRef" @success="handleOcrSuccess" />
<Grid table-title="鏉ョエ鍒楄〃">
<template #toolbar-tools>
- <TableAction
- :actions="[
- {
- label: $t('ui.actionTitle.create', ['鏉ョエ']),
- type: 'primary',
- icon: ACTION_ICON.ADD,
- auth: ['erp:purchase-invoice:create'],
- onClick: handleCreate,
- },
- {
- label: '璇嗗埆褰曞叆',
- type: 'primary',
- auth: ['erp:purchase-invoice:create'],
- onClick: handleOcrCreate,
- },
- {
- label: $t('ui.actionTitle.export'),
- type: 'primary',
- icon: ACTION_ICON.DOWNLOAD,
- auth: ['erp:purchase-invoice:export'],
- onClick: handleExport,
- },
- ]"
- />
+ <TableAction :actions="toolbarActions" />
</template>
<template #no="{ row }">
<Button type="link" @click="handleDetail(row)">
diff --git a/src/views/mes/pro/workorder/modules/form.vue b/src/views/mes/pro/workorder/modules/form.vue
index 36a346e..180e00f 100644
--- a/src/views/mes/pro/workorder/modules/form.vue
+++ b/src/views/mes/pro/workorder/modules/form.vue
@@ -10,6 +10,7 @@
import {
MesProWorkOrderStatusEnum,
} from "@vben/constants";
+ import { isAiEnable } from "@vben/hooks";
import { Button, message, Tabs } from "ant-design-vue";
@@ -56,6 +57,7 @@
);
const canUseAi = computed(
() =>
+ isAiEnable() &&
formData.value?.id &&
(formData.value?.status === MesProWorkOrderStatusEnum.PREPARE ||
formData.value?.status === MesProWorkOrderStatusEnum.CONFIRMED)
diff --git a/src/views/mes/qc/components/ai-assistant.vue b/src/views/mes/qc/components/ai-assistant.vue
index 1857e31..b099925 100644
--- a/src/views/mes/qc/components/ai-assistant.vue
+++ b/src/views/mes/qc/components/ai-assistant.vue
@@ -2,6 +2,7 @@
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
+import { isAiEnable } from '@vben/hooks';
import { Empty, Input, Spin } from 'ant-design-vue';
@@ -43,7 +44,7 @@
</script>
<template>
- <a-button type="default" @click="modalApi.open()">
+ <a-button v-if="isAiEnable()" type="default" @click="modalApi.open()">
璐ㄦ鍔╂墜
</a-button>
diff --git a/src/views/mes/qc/components/ai-suggest.vue b/src/views/mes/qc/components/ai-suggest.vue
index ca87463..dd2f18e 100644
--- a/src/views/mes/qc/components/ai-suggest.vue
+++ b/src/views/mes/qc/components/ai-suggest.vue
@@ -4,6 +4,7 @@
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
+import { isAiEnable } from '@vben/hooks';
import { IconifyIcon } from '@vben/icons';
import { Alert, Button, message, Tag } from 'ant-design-vue';
@@ -51,7 +52,12 @@
</script>
<template>
- <Button type="default" :loading="loading" @click="handleSuggest">
+ <Button
+ v-if="isAiEnable()"
+ type="default"
+ :loading="loading"
+ @click="handleSuggest"
+ >
<template #icon>
<IconifyIcon icon="ant-design:robot-outlined" />
</template>
diff --git a/src/views/mes/qc/report/template/designer/index.vue b/src/views/mes/qc/report/template/designer/index.vue
index f07a6ef..47b6d28 100644
--- a/src/views/mes/qc/report/template/designer/index.vue
+++ b/src/views/mes/qc/report/template/designer/index.vue
@@ -7,7 +7,7 @@
import { useAccess } from '@vben/access';
import { Page } from '@vben/common-ui';
-import { useTabs } from '@vben/hooks';
+import { isAiEnable, useTabs } from '@vben/hooks';
import { IconifyIcon } from '@vben/icons';
import {
@@ -48,8 +48,8 @@
const { hasAccessByCodes } = useAccess();
/** AI 瀵煎叆鏄嫭绔嬫潈闄愮爜锛氳兘鏀规ā鏉夸笉绛変簬鑳界敤澶фā鍨嬭瘑鍒枃浠讹紙姣忔璋冪敤閮借鑺遍挶锛� */
-const canAiImport = computed(() =>
- hasAccessByCodes(['qc-report:template:ai-import']),
+const canAiImport = computed(
+ () => isAiEnable() && hasAccessByCodes(['qc-report:template:ai-import']),
);
const loading = ref(true);
diff --git a/vite.config.ts b/vite.config.ts
index 9382ae0..b48844a 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -85,6 +85,12 @@
target: "http://localhost:48080",
ws: true,
},
+ "/agent-api": {
+ changeOrigin: true,
+ target: "http://127.0.0.1:8091",
+ rewrite: (path) => path.replace(/^\/agent-api/, ""),
+ ws: true,
+ },
},
},
},
--
Gitblit v1.9.3