diff --git a/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue b/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue index 32c2f53..f1458d2 100644 --- a/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue +++ b/web/apps/web-ele/src/components/ai-chat-panel/AiChatPanel.vue @@ -35,6 +35,24 @@ import { ChatBox } from '#/components/ChatBox'; import { useChatApi } from './composables/useChatApi'; import { useEventHandler } from './composables/useEventHandler'; +const AppDesignPanel = defineAsyncComponent(() => + import('#/components/form-editor/AppDesignPanel.vue'), +); +const AppSettingsPanel = defineAsyncComponent(() => + import('#/components/form-editor/AppSettingsPanel.vue'), +); +const DashboardBasicInfoConfirmPanel = defineAsyncComponent(() => + import('#/components/form-editor/DashboardBasicInfoConfirmPanel.vue'), +); +const DashboardDesignConfirmPanel = defineAsyncComponent(() => + import('#/components/form-editor/DashboardDesignConfirmPanel.vue'), +); +const DashboardPublishConfirmPanel = defineAsyncComponent(() => + import('#/components/form-editor/DashboardPublishConfirmPanel.vue'), +); +const DesignEditorPanel = defineAsyncComponent(() => + import('#/components/form-editor/DesignEditorPanel.vue'), +); const SystemSummaryConfirmPanel = defineAsyncComponent(() => import('#/components/form-editor/SystemSummaryConfirmPanel.vue'), ); @@ -188,7 +206,25 @@ const variablesDialogVisible = ref(false); const variablesForm = ref>({}); const pendingMessage = ref(''); -// ==================== 轻量版设计预览面板状态 ==================== +// ==================== 设计预览面板状态 ==================== +const showDesignPanel = ref(false); +const currentDesign = ref(undefined); + +const showAppDesignPanel = ref(false); +const currentAppDesign = ref(undefined); + +const showAppSettingsPanel = ref(false); +const currentAppSettings = ref(undefined); + +const showDashboardBasicInfoPanel = ref(false); +const currentDashboardBasicInfo = ref(undefined); + +const showDashboardDesignPanel = ref(false); +const currentDashboardDesign = ref(undefined); + +const showDashboardPublishPanel = ref(false); +const currentDashboardPublish = ref(undefined); + const showSystemSummaryPanel = ref(false); const currentSystemSummary = ref(undefined); @@ -198,7 +234,15 @@ const loadingAnimationTitle = ref('AI 正在开发...'); // 是否有任何设计面板打开 const hasAnyDesignPanelOpen = computed( - () => showSystemSummaryPanel.value || showLoadingAnimation.value, + () => + showDesignPanel.value || + showAppDesignPanel.value || + showAppSettingsPanel.value || + showDashboardBasicInfoPanel.value || + showDashboardDesignPanel.value || + showDashboardPublishPanel.value || + showSystemSummaryPanel.value || + showLoadingAnimation.value, ); // ==================== 工作流变量 ==================== @@ -246,15 +290,43 @@ const handleDesignPreview = (data: DesignPreviewData) => { // 关闭加载动画 showLoadingAnimation.value = false; - if (data.type === 'system_summary') { - currentSystemSummary.value = data; - showSystemSummaryPanel.value = true; - return undefined; + switch (data.type) { + case 'app_design': { + currentAppDesign.value = data; + showAppDesignPanel.value = true; + break; + } + case 'app_settings': { + currentAppSettings.value = data; + showAppSettingsPanel.value = true; + break; + } + case 'dashboard_basic_info': { + currentDashboardBasicInfo.value = data; + showDashboardBasicInfoPanel.value = true; + break; + } + case 'dashboard_design': { + currentDashboardDesign.value = data; + showDashboardDesignPanel.value = true; + break; + } + case 'dashboard_publish': { + currentDashboardPublish.value = data; + showDashboardPublishPanel.value = true; + break; + } + case 'system_summary': { + currentSystemSummary.value = data; + showSystemSummaryPanel.value = true; + break; + } + default: { + currentDesign.value = data; + showDesignPanel.value = true; + break; + } } - - waitingForInput.value = false; - waitingConfig.value = null; - return `**${data.title || '设计预览'}**\n\n轻量版已移除在线开发设计确认面板。请将该流程改为 LLM、对话、条件、并行、子流程或知识库检索等 AI 协作节点后再运行。`; }; const { handleStreamEvent, updateAssistantMessage } = useEventHandler({ @@ -738,6 +810,78 @@ const createDesignCloseHandler = ( }; }; +const handleDesignConfirm = createDesignConfirmHandler( + showDesignPanel, + currentDesign, + '确认设计', +); +const handleDesignClose = createDesignCloseHandler( + showDesignPanel, + currentDesign, +); + +const handleAppDesignConfirm = createDesignConfirmHandler( + showAppDesignPanel, + currentAppDesign, + '确认应用设计', +); +const handleAppDesignClose = createDesignCloseHandler( + showAppDesignPanel, + currentAppDesign, +); + +const handleAppSettingsConfirm = createDesignConfirmHandler( + showAppSettingsPanel, + currentAppSettings, + '确认应用设置', +); +const handleAppSettingsClose = createDesignCloseHandler( + showAppSettingsPanel, + currentAppSettings, +); + +const handleDashboardBasicInfoConfirm = createDesignConfirmHandler( + showDashboardBasicInfoPanel, + currentDashboardBasicInfo, + '确认仪表盘基础信息', +); +const handleDashboardBasicInfoClose = createDesignCloseHandler( + showDashboardBasicInfoPanel, + currentDashboardBasicInfo, +); + +const handleDashboardDesignConfirm = createDesignConfirmHandler( + showDashboardDesignPanel, + currentDashboardDesign, + '确认仪表盘设计', +); +const handleDashboardDesignClose = createDesignCloseHandler( + showDashboardDesignPanel, + currentDashboardDesign, +); + +const handleDashboardPublishConfirm = (data: Record) => { + showDashboardPublishPanel.value = false; + currentDashboardPublish.value = undefined; + + const userMsg: ChatMessage = { + id: generateId(), + role: 'user', + content: `发布到菜单:${data.menu_name}`, + timestamp: new Date(), + }; + messages.value.push(userMsg); + + waitingForInput.value = false; + waitingConfig.value = null; + + resumeExecution(JSON.stringify(data)); +}; +const handleDashboardPublishClose = createDesignCloseHandler( + showDashboardPublishPanel, + currentDashboardPublish, +); + const handleSystemSummaryConfirm = createDesignConfirmHandler( showSystemSummaryPanel, currentSystemSummary, @@ -873,6 +1017,66 @@ onUnmounted(() => { class="ml-3 h-full min-h-[400px] flex-1 rounded-lg" /> + + + + + + + + + + + + + + + + + + {