From 5f434a38815592bb31ae55be9af377ec00bee300 Mon Sep 17 00:00:00 2001 From: sladro Date: Tue, 16 Sep 2025 19:04:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0Creo=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=88=86=E6=9E=90=E5=8A=9F=E8=83=BD=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=92=8C=E9=A1=B5=E9=9D=A2=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加智能薄壳化分析接口和结果页面 - 添加按层级删除优化分析接口和结果页面 - 添加几何复杂度分析接口和结果页面 - 添加几何优化分析参数设置页面 - 实现API客户端Loading动画系统 - 完善页面切换和事件处理机制 - 更新页面添加标准流程文档 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- CLAUDE.md | 11 +++ src/assets/styles/theme.css | 5 ++ src/components/pages/CreoModelAnalysis.vue | 28 ++++++- .../pages/GeometryComplexityResult.vue | 84 +++++++++++++++++++ .../pages/GeometryOptimizationParams.vue | 84 +++++++++++++++++++ .../pages/HierarchyAnalysisResult.vue | 84 +++++++++++++++++++ src/components/pages/ShellAnalysisResult.vue | 84 +++++++++++++++++++ src/config/pages.js | 6 +- src/services/apiClient.js | 34 +++++++- src/services/creoApi.js | 65 ++++++++++++++ src/views/DashboardView.vue | 51 ++++++++++- 11 files changed, 529 insertions(+), 7 deletions(-) create mode 100644 src/components/pages/GeometryComplexityResult.vue create mode 100644 src/components/pages/GeometryOptimizationParams.vue create mode 100644 src/components/pages/HierarchyAnalysisResult.vue create mode 100644 src/components/pages/ShellAnalysisResult.vue diff --git a/CLAUDE.md b/CLAUDE.md index ee605cf..de33c01 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -141,6 +141,17 @@ const handleOperation = async () => { - ✅ 页面常量配置系统(src/config/pages.js) - ✅ Creo专属页面框架(模型分析、导出工具) - ✅ 通用格式转换页面框架 +- ✅ 智能薄壳化分析接口(startShellAnalysis) + +## 页面添加标准流程 + +1. **添加页面类型** - `src/config/pages.js` 添加常量 +2. **创建页面组件** - `src/components/pages/XxxPage.vue` +3. **在DashboardView添加**: + - 导入组件 + - 添加显示条件判断 + - 添加页面切换处理方法 +4. **组件间通信** - 使用emit事件,不用router.push ## 待开发功能 diff --git a/src/assets/styles/theme.css b/src/assets/styles/theme.css index cce4573..785f063 100644 --- a/src/assets/styles/theme.css +++ b/src/assets/styles/theme.css @@ -434,4 +434,9 @@ html, body { .glass-hover:hover { background: var(--color-white-rgb-05); border-color: var(--color-white-rgb-15); +} + +/* ===== 自定义Loading样式 ===== */ +.custom-loading .el-loading-text { + color: rgba(var(--color-white-base), 0.9) !important; } \ No newline at end of file diff --git a/src/components/pages/CreoModelAnalysis.vue b/src/components/pages/CreoModelAnalysis.vue index 36f856e..2ecb02a 100644 --- a/src/components/pages/CreoModelAnalysis.vue +++ b/src/components/pages/CreoModelAnalysis.vue @@ -72,12 +72,32 @@ diff --git a/src/components/pages/GeometryComplexityResult.vue b/src/components/pages/GeometryComplexityResult.vue new file mode 100644 index 0000000..15b4db8 --- /dev/null +++ b/src/components/pages/GeometryComplexityResult.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/src/components/pages/GeometryOptimizationParams.vue b/src/components/pages/GeometryOptimizationParams.vue new file mode 100644 index 0000000..eafd24e --- /dev/null +++ b/src/components/pages/GeometryOptimizationParams.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/src/components/pages/HierarchyAnalysisResult.vue b/src/components/pages/HierarchyAnalysisResult.vue new file mode 100644 index 0000000..34885b3 --- /dev/null +++ b/src/components/pages/HierarchyAnalysisResult.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/src/components/pages/ShellAnalysisResult.vue b/src/components/pages/ShellAnalysisResult.vue new file mode 100644 index 0000000..98280b0 --- /dev/null +++ b/src/components/pages/ShellAnalysisResult.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/src/config/pages.js b/src/config/pages.js index 9d8b7f0..cfac9df 100644 --- a/src/config/pages.js +++ b/src/config/pages.js @@ -4,7 +4,11 @@ export const PAGE_TYPES = { MODEL_VIEWER: 'model-viewer', ANALYSIS_TOOLS: 'analysis-tools', EXPORT_TOOLS: 'export-tools', - FORMAT_CONVERTER: 'format-converter' + FORMAT_CONVERTER: 'format-converter', + SHELL_ANALYSIS_RESULT: 'shell-analysis-result', + HIERARCHY_ANALYSIS_RESULT: 'hierarchy-analysis-result', + GEOMETRY_COMPLEXITY_RESULT: 'geometry-complexity-result', + GEOMETRY_OPTIMIZATION_PARAMS: 'geometry-optimization-params' } // 需要CAD连接的页面 diff --git a/src/services/apiClient.js b/src/services/apiClient.js index 5ac47ea..7ae01cb 100644 --- a/src/services/apiClient.js +++ b/src/services/apiClient.js @@ -2,7 +2,7 @@ // 包含拦截器、日志记录和后处理能力 import { getDefaultRequestConfig, getNotificationConfig } from '@/config/cad' -import { ElNotification } from 'element-plus' +import { ElNotification, ElLoading } from 'element-plus' // 日志记录系统 class ApiLogger { @@ -55,6 +55,7 @@ class ApiClient { constructor() { this.defaultConfig = getDefaultRequestConfig() this.setupNotificationHandler() + this.loadingInstance = null } // 设置通知处理器 @@ -146,11 +147,39 @@ class ApiClient { // 请求拦截器 interceptRequest(context) { console.log(`🚀 发起${context.method}请求:`, context.url) + + // 显示loading动画 + this.showLoading(context) + } + + // 显示loading动画 + showLoading(context) { + if (context.showLoading !== false) { + this.loadingInstance = ElLoading.service({ + lock: true, + text: context.operationContext ? + `正在执行${context.operationContext.operation}...` : + '请求处理中...', + background: 'rgba(0, 0, 0, 0.7)', + customClass: 'custom-loading' + }) + } + } + + // 隐藏loading动画 + hideLoading() { + if (this.loadingInstance) { + this.loadingInstance.close() + this.loadingInstance = null + } } // 响应拦截器 async interceptResponse(response, context, duration) { console.log(`📡 收到响应 [${response.status}]:`, `${context.url} (${duration}ms)`) + + // 隐藏loading动画 + this.hideLoading() } // 解析响应数据 @@ -177,6 +206,9 @@ class ApiClient { async handleError(error, context, duration) { const errorResponse = { ok: false, status: 0, statusText: error.message } + // 确保隐藏loading动画 + this.hideLoading() + console.error('❌ API请求失败:', { url: context.url, error: error.message, diff --git a/src/services/creoApi.js b/src/services/creoApi.js index 49480b3..6855b66 100644 --- a/src/services/creoApi.js +++ b/src/services/creoApi.js @@ -59,6 +59,71 @@ class CreoApiService { } }) } + + /** + * 开始智能薄壳化分析 + * @returns {Promise<{success: boolean, data?: any, error?: string}>} + */ + async startShellAnalysis() { + const url = buildApiUrl(this.softwareName, 'shellAnalysis') + + return await apiClient.post(url, { + "software_type": "creo", + "projectName": "current_model", + "analysisType": "surface_shell", + "preserveExternalSurfaces": true, + "minWallThickness": 1.0, + "confidenceThreshold": 0.7 + }, { + operationContext: { + software: 'Creo', + operation: '智能薄壳化分析' + } + }) + } + + /** + * 开始按层级删除优化分析 + * @returns {Promise<{success: boolean, data?: any, error?: string}>} + */ + async startHierarchyAnalysis() { + const url = buildApiUrl(this.softwareName, 'hierarchy') + + return await apiClient.post(url, { + "software_type": "creo", + "project_name": "overall_top_design.asm", + "max_depth": 20, + "include_geometry": true, + "target_level": 0 + }, { + operationContext: { + software: 'Creo', + operation: '按层级删除优化分析' + } + }) + } + + /** + * 开始几何复杂度分析 + * @returns {Promise<{success: boolean, data?: any, error?: string}>} + */ + async startGeometryComplexityAnalysis() { + const url = buildApiUrl(this.softwareName, 'geometryComplexity') + + return await apiClient.post(url, { + "software_type": "creo", + "project_name": "Geometry Analysis", + "max_results": 20, + "sort_order": "desc", + "complexity_threshold": 0.0, + "include_details": true + }, { + operationContext: { + software: 'Creo', + operation: '几何复杂度分析' + } + }) + } } // 导出单例实例 diff --git a/src/views/DashboardView.vue b/src/views/DashboardView.vue index c4ed119..da88dcb 100644 --- a/src/views/DashboardView.vue +++ b/src/views/DashboardView.vue @@ -92,7 +92,12 @@
- +
@@ -105,6 +110,26 @@ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
@@ -193,6 +218,10 @@ import CreoModelViewer from '@/components/model/CreoModelViewer.vue' import CreoModelAnalysis from '@/components/pages/CreoModelAnalysis.vue' import CreoExportTools from '@/components/pages/CreoExportTools.vue' import UniversalConverter from '@/components/pages/UniversalConverter.vue' +import ShellAnalysisResult from '@/components/pages/ShellAnalysisResult.vue' +import HierarchyAnalysisResult from '@/components/pages/HierarchyAnalysisResult.vue' +import GeometryComplexityResult from '@/components/pages/GeometryComplexityResult.vue' +import GeometryOptimizationParams from '@/components/pages/GeometryOptimizationParams.vue' import { PAGE_TYPES } from '@/config/pages' // 当前页面状态 @@ -214,6 +243,26 @@ const handlePageChange = (page) => { currentPage.value = page } +// 处理跳转到分析结果页面 +const handleShowShellAnalysisResult = () => { + currentPage.value = PAGE_TYPES.SHELL_ANALYSIS_RESULT +} + +// 处理跳转到层级分析结果页面 +const handleShowHierarchyAnalysisResult = () => { + currentPage.value = PAGE_TYPES.HIERARCHY_ANALYSIS_RESULT +} + +// 处理跳转到几何复杂度分析结果页面 +const handleShowGeometryComplexityResult = () => { + currentPage.value = PAGE_TYPES.GEOMETRY_COMPLEXITY_RESULT +} + +// 处理跳转到几何优化分析参数设置页面 +const handleShowGeometryOptimizationParams = () => { + currentPage.value = PAGE_TYPES.GEOMETRY_OPTIMIZATION_PARAMS +} + // 按钮事件处理 const connectCAD = () => { // CAD连接逻辑