Restore AI design preview confirmations

This commit is contained in:
2026-06-09 22:23:59 +08:00
parent 68ee56034a
commit e6aa82f058
4 changed files with 221 additions and 0 deletions
@@ -32,6 +32,11 @@ import {
import { AiWorkingAnimation } from '#/components/ai-loading'; import { AiWorkingAnimation } from '#/components/ai-loading';
import { ChatBox } from '#/components/ChatBox'; import { ChatBox } from '#/components/ChatBox';
import { import {
AppDesignPanel,
AppSettingsPanel,
DashboardBasicInfoConfirmPanel,
DashboardDesignConfirmPanel,
DashboardPublishConfirmPanel,
DesignEditorPanel, DesignEditorPanel,
SystemSummaryConfirmPanel, SystemSummaryConfirmPanel,
} from '#/components/form-editor'; } from '#/components/form-editor';
@@ -192,6 +197,21 @@ const pendingMessage = ref('');
const showDesignPanel = ref(false); const showDesignPanel = ref(false);
const currentDesign = ref<DesignPreviewData | undefined>(undefined); const currentDesign = ref<DesignPreviewData | undefined>(undefined);
const showAppDesignPanel = ref(false);
const currentAppDesign = ref<DesignPreviewData | undefined>(undefined);
const showAppSettingsPanel = ref(false);
const currentAppSettings = ref<DesignPreviewData | undefined>(undefined);
const showDashboardBasicInfoPanel = ref(false);
const currentDashboardBasicInfo = ref<DesignPreviewData | undefined>(undefined);
const showDashboardDesignPanel = ref(false);
const currentDashboardDesign = ref<DesignPreviewData | undefined>(undefined);
const showDashboardPublishPanel = ref(false);
const currentDashboardPublish = ref<DesignPreviewData | undefined>(undefined);
const showSystemSummaryPanel = ref(false); const showSystemSummaryPanel = ref(false);
const currentSystemSummary = ref<DesignPreviewData | undefined>(undefined); const currentSystemSummary = ref<DesignPreviewData | undefined>(undefined);
@@ -203,6 +223,11 @@ const loadingAnimationTitle = ref('AI 正在开发...');
const hasAnyDesignPanelOpen = computed( const hasAnyDesignPanelOpen = computed(
() => () =>
showDesignPanel.value || showDesignPanel.value ||
showAppDesignPanel.value ||
showAppSettingsPanel.value ||
showDashboardBasicInfoPanel.value ||
showDashboardDesignPanel.value ||
showDashboardPublishPanel.value ||
showSystemSummaryPanel.value || showSystemSummaryPanel.value ||
showLoadingAnimation.value, showLoadingAnimation.value,
); );
@@ -253,6 +278,31 @@ const handleDesignPreview = (data: DesignPreviewData) => {
showLoadingAnimation.value = false; showLoadingAnimation.value = false;
switch (data.type) { 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': { case 'system_summary': {
currentSystemSummary.value = data; currentSystemSummary.value = data;
showSystemSummaryPanel.value = true; showSystemSummaryPanel.value = true;
@@ -757,6 +807,68 @@ const handleDesignClose = createDesignCloseHandler(
currentDesign, 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<string, any>) => {
showDashboardPublishPanel.value = false;
currentDashboardPublish.value = undefined;
const userMsg: ChatMessage = {
id: generateId(),
role: 'user',
content: `发布到菜单:${data.menu_name || data.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( const handleSystemSummaryConfirm = createDesignConfirmHandler(
showSystemSummaryPanel, showSystemSummaryPanel,
currentSystemSummary, currentSystemSummary,
@@ -902,6 +1014,51 @@ onUnmounted(() => {
@close="handleDesignClose" @close="handleDesignClose"
/> />
<AppDesignPanel
v-if="showAppDesignPanel"
:visible="showAppDesignPanel"
:design="currentAppDesign as any"
@update:visible="showAppDesignPanel = $event"
@confirm="handleAppDesignConfirm"
@close="handleAppDesignClose"
/>
<AppSettingsPanel
v-if="showAppSettingsPanel"
:visible="showAppSettingsPanel"
:settings="currentAppSettings as any"
@update:visible="showAppSettingsPanel = $event"
@confirm="handleAppSettingsConfirm"
@close="handleAppSettingsClose"
/>
<DashboardBasicInfoConfirmPanel
v-if="showDashboardBasicInfoPanel"
:visible="showDashboardBasicInfoPanel"
:basic-info="currentDashboardBasicInfo as any"
@update:visible="showDashboardBasicInfoPanel = $event"
@confirm="handleDashboardBasicInfoConfirm"
@close="handleDashboardBasicInfoClose"
/>
<DashboardDesignConfirmPanel
v-if="showDashboardDesignPanel"
:visible="showDashboardDesignPanel"
:design="currentDashboardDesign as any"
@update:visible="showDashboardDesignPanel = $event"
@confirm="handleDashboardDesignConfirm"
@close="handleDashboardDesignClose"
/>
<DashboardPublishConfirmPanel
v-if="showDashboardPublishPanel"
:visible="showDashboardPublishPanel"
:publish-data="currentDashboardPublish as any"
@update:visible="showDashboardPublishPanel = $event"
@confirm="handleDashboardPublishConfirm"
@close="handleDashboardPublishClose"
/>
<!-- 系统总结面板 --> <!-- 系统总结面板 -->
<SystemSummaryConfirmPanel <SystemSummaryConfirmPanel
v-if="showSystemSummaryPanel" v-if="showSystemSummaryPanel"
@@ -923,6 +1080,46 @@ onUnmounted(() => {
@close="handleDesignClose" @close="handleDesignClose"
/> />
<AppDesignPanel
:visible="showAppDesignPanel"
:design="currentAppDesign as any"
@update:visible="showAppDesignPanel = $event"
@confirm="handleAppDesignConfirm"
@close="handleAppDesignClose"
/>
<AppSettingsPanel
:visible="showAppSettingsPanel"
:settings="currentAppSettings as any"
@update:visible="showAppSettingsPanel = $event"
@confirm="handleAppSettingsConfirm"
@close="handleAppSettingsClose"
/>
<DashboardBasicInfoConfirmPanel
:visible="showDashboardBasicInfoPanel"
:basic-info="currentDashboardBasicInfo as any"
@update:visible="showDashboardBasicInfoPanel = $event"
@confirm="handleDashboardBasicInfoConfirm"
@close="handleDashboardBasicInfoClose"
/>
<DashboardDesignConfirmPanel
:visible="showDashboardDesignPanel"
:design="currentDashboardDesign as any"
@update:visible="showDashboardDesignPanel = $event"
@confirm="handleDashboardDesignConfirm"
@close="handleDashboardDesignClose"
/>
<DashboardPublishConfirmPanel
:visible="showDashboardPublishPanel"
:publish-data="currentDashboardPublish as any"
@update:visible="showDashboardPublishPanel = $event"
@confirm="handleDashboardPublishConfirm"
@close="handleDashboardPublishClose"
/>
<SystemSummaryConfirmPanel <SystemSummaryConfirmPanel
:visible="showSystemSummaryPanel" :visible="showSystemSummaryPanel"
:data="currentSystemSummary as any" :data="currentSystemSummary as any"
@@ -7,7 +7,17 @@ type PreviewData = {
export type DesignData = PreviewData; export type DesignData = PreviewData;
export type DesignType = string; export type DesignType = string;
export type AppDesignData = PreviewData;
export type AppSettingsData = PreviewData;
export type DashboardBasicInfoData = PreviewData;
export type DashboardDesignData = PreviewData;
export type DashboardPublishData = PreviewData;
export type SystemSummaryData = PreviewData; export type SystemSummaryData = PreviewData;
export const AppDesignPanel = DesignPreviewDialog;
export const AppSettingsPanel = DesignPreviewDialog;
export const DashboardBasicInfoConfirmPanel = DesignPreviewDialog;
export const DashboardDesignConfirmPanel = DesignPreviewDialog;
export const DashboardPublishConfirmPanel = DesignPreviewDialog;
export const DesignEditorPanel = DesignPreviewDialog; export const DesignEditorPanel = DesignPreviewDialog;
export const SystemSummaryConfirmPanel = DesignPreviewDialog; export const SystemSummaryConfirmPanel = DesignPreviewDialog;
@@ -57,7 +57,14 @@ export interface AgentInfo {
/** 设计预览类型 */ /** 设计预览类型 */
export type DesignPreviewType = export type DesignPreviewType =
| 'agent_capability' | 'agent_capability'
| 'app_design'
| 'app_settings'
| 'dashboard_basic_info'
| 'dashboard_design'
| 'dashboard_publish'
| 'database_design' | 'database_design'
| 'form_basic_info'
| 'form_ui_design'
| 'knowledge_retrieval' | 'knowledge_retrieval'
| 'list_config' | 'list_config'
| 'llm_config' | 'llm_config'
@@ -71,7 +78,9 @@ export interface DesignPreviewData {
data: Record<string, any>; data: Record<string, any>;
nodeId: string; nodeId: string;
data_sources?: any[]; data_sources?: any[];
form_fields?: any[];
schema_fields?: any[]; schema_fields?: any[];
table_configs?: any[];
layoutOptions?: any[]; layoutOptions?: any[];
themeOptions?: any[]; themeOptions?: any[];
} }
@@ -20,5 +20,10 @@ export type PageEditorData = PreviewData;
export type PagePublishInfo = PreviewData; export type PagePublishInfo = PreviewData;
export type SystemSummaryData = PreviewData; export type SystemSummaryData = PreviewData;
export const AppDesignPanel = DesignPreviewDialog;
export const AppSettingsPanel = DesignPreviewDialog;
export const DashboardBasicInfoConfirmPanel = DesignPreviewDialog;
export const DashboardDesignConfirmPanel = DesignPreviewDialog;
export const DashboardPublishConfirmPanel = DesignPreviewDialog;
export const DesignEditorPanel = DesignPreviewDialog; export const DesignEditorPanel = DesignPreviewDialog;
export const SystemSummaryConfirmPanel = DesignPreviewDialog; export const SystemSummaryConfirmPanel = DesignPreviewDialog;