From 090c32c90e94486720a5d96bb99be7f48286624c Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 26 Oct 2025 15:40:07 +0800 Subject: [PATCH] feat: enhance AddNewPlatform dialog with data preparation on enter and improve code formatting --- .../components/platform/AddNewPlatform.vue | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/dashboard/src/components/platform/AddNewPlatform.vue b/dashboard/src/components/platform/AddNewPlatform.vue index b837eef0d..751bbd20c 100644 --- a/dashboard/src/components/platform/AddNewPlatform.vue +++ b/dashboard/src/components/platform/AddNewPlatform.vue @@ -1,5 +1,5 @@ - *消息下发时,根据会话来源按顺序从上到下匹配首个符合条件的配置文件。使用 * 表示匹配所有。使用 /sid 指令获取会话 ID。 + *消息下发时,根据会话来源按顺序从上到下匹配首个符合条件的配置文件。使用 * 表示匹配所有。使用 /sid 指令获取会话 + ID。全部不匹配时将使用默认配置文件。 @@ -674,7 +682,7 @@ export default { const newConfigId = createRes.data.data.conf_id; console.log(`成功创建新配置文件 ${configName},ID: ${newConfigId}`); - + return newConfigId; } catch (err) { console.error('创建新配置文件失败:', err); @@ -754,7 +762,7 @@ export default { } this.platformRoutes = routes; - + // 如果没有路由,添加一个默认的空路由供用户编辑 if (this.platformRoutes.length === 0) { this.platformRoutes.push({ @@ -833,7 +841,7 @@ export default { const messageType = route.messageType === '*' ? '*' : route.messageType; const sessionId = route.sessionId === '*' ? '*' : route.sessionId; const newUmop = `${platformId}:${messageType}:${sessionId}`; - + if (route.configId) { fullRoutingTable[newUmop] = route.configId; } @@ -882,16 +890,17 @@ export default { toggleShowConfigSection() { this.showConfigSection = false; this.showConfigSection = true; + }, + + prepareData() { + this.getConfigInfoList(); + this.getConfigForPreview(this.selectedAbConfId); + if (this.updatingMode && this.updatingPlatformConfig && this.updatingPlatformConfig.id) { + this.getPlatformConfigs(this.updatingPlatformConfig.id); + } } }, - mounted() { - this.getConfigInfoList(); - this.getConfigForPreview(this.selectedAbConfId); - if (this.updatingMode && this.updatingPlatformConfig && this.updatingPlatformConfig.id) { - this.getPlatformConfigs(this.updatingPlatformConfig.id); - } - } }