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 { ChatBox } from '#/components/ChatBox';
import {
AppDesignPanel,
AppSettingsPanel,
DashboardBasicInfoConfirmPanel,
DashboardDesignConfirmPanel,
DashboardPublishConfirmPanel,
DesignEditorPanel,
SystemSummaryConfirmPanel,
} from '#/components/form-editor';
@@ -192,6 +197,21 @@ const pendingMessage = ref('');
const showDesignPanel = ref(false);
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 currentSystemSummary = ref<DesignPreviewData | undefined>(undefined);
@@ -203,6 +223,11 @@ const loadingAnimationTitle = ref('AI 正在开发...');
const hasAnyDesignPanelOpen = computed(
() =>
showDesignPanel.value ||
showAppDesignPanel.value ||
showAppSettingsPanel.value ||
showDashboardBasicInfoPanel.value ||
showDashboardDesignPanel.value ||
showDashboardPublishPanel.value ||
showSystemSummaryPanel.value ||
showLoadingAnimation.value,
);
@@ -253,6 +278,31 @@ const handleDesignPreview = (data: DesignPreviewData) => {
showLoadingAnimation.value = false;
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;
@@ -757,6 +807,68 @@ const handleDesignClose = createDesignCloseHandler(
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(
showSystemSummaryPanel,
currentSystemSummary,
@@ -902,6 +1014,51 @@ onUnmounted(() => {
@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
v-if="showSystemSummaryPanel"
@@ -923,6 +1080,46 @@ onUnmounted(() => {
@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
:visible="showSystemSummaryPanel"
:data="currentSystemSummary as any"