feat: 实现Creo模型分析功能接口和页面系统

- 添加智能薄壳化分析接口和结果页面
- 添加按层级删除优化分析接口和结果页面
- 添加几何复杂度分析接口和结果页面
- 添加几何优化分析参数设置页面
- 实现API客户端Loading动画系统
- 完善页面切换和事件处理机制
- 更新页面添加标准流程文档

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sladro 2025-09-16 19:04:17 +08:00
parent 899c1fbb67
commit 5f434a3881
11 changed files with 529 additions and 7 deletions

View File

@ -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
## 待开发功能

View File

@ -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;
}

View File

@ -72,12 +72,32 @@
<script setup>
import AnalysisToolCard from '@/components/ui/AnalysisToolCard.vue'
import { creoApi } from '@/services/creoApi'
const emit = defineEmits(['show-shell-analysis-result', 'show-hierarchy-analysis-result', 'show-geometry-complexity-result', 'show-geometry-optimization-params'])
//
const handleShellAnalysis = () => {}
const handleHierarchyDeletion = () => {}
const handleGeometryComplexity = () => {}
const handleGeometryOptimization = () => {}
const handleShellAnalysis = async () => {
const result = await creoApi.startShellAnalysis()
if (result.success) {
emit('show-shell-analysis-result')
}
}
const handleHierarchyDeletion = async () => {
const result = await creoApi.startHierarchyAnalysis()
if (result.success) {
emit('show-hierarchy-analysis-result')
}
}
const handleGeometryComplexity = async () => {
const result = await creoApi.startGeometryComplexityAnalysis()
if (result.success) {
emit('show-geometry-complexity-result')
}
}
const handleGeometryOptimization = () => {
emit('show-geometry-optimization-params')
}
const handleBatchProcessing = () => {}
</script>

View File

@ -0,0 +1,84 @@
<template>
<div class="geometry-complexity-result-page">
<div class="page-header">
<h2>
<i class="fas fa-chart-line"></i>
几何复杂度分析结果
</h2>
<p>Creo几何复杂度分析结果展示</p>
</div>
<div class="page-content">
<div class="result-placeholder">
<div class="placeholder-icon">
<i class="fas fa-hourglass-half"></i>
</div>
<h3>分析结果页面</h3>
<p>此页面将展示几何复杂度分析的结果</p>
</div>
</div>
</div>
</template>
<script setup>
//
</script>
<style scoped>
.geometry-complexity-result-page {
padding: var(--spacing-2xl);
height: 100%;
}
.page-header {
margin-bottom: var(--spacing-2xl);
}
.page-header h2 {
display: flex;
align-items: center;
gap: var(--spacing-md);
font-size: var(--font-size-3xl);
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-sm) 0;
}
.page-header h2 i {
color: var(--color-primary);
}
.page-header p {
color: var(--color-text-secondary);
margin: 0;
}
.page-content {
height: calc(100% - 100px);
display: flex;
align-items: center;
justify-content: center;
}
.result-placeholder {
text-align: center;
color: var(--color-text-secondary);
}
.placeholder-icon {
font-size: 4rem;
margin-bottom: var(--spacing-lg);
color: var(--color-primary);
}
.result-placeholder h3 {
font-size: var(--font-size-2xl);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-md) 0;
}
.result-placeholder p {
font-size: var(--font-size-lg);
margin: 0;
}
</style>

View File

@ -0,0 +1,84 @@
<template>
<div class="geometry-optimization-params-page">
<div class="page-header">
<h2>
<i class="fas fa-shapes"></i>
几何优化分析参数设置
</h2>
<p>配置几何优化分析的相关参数</p>
</div>
<div class="page-content">
<div class="params-placeholder">
<div class="placeholder-icon">
<i class="fas fa-cogs"></i>
</div>
<h3>参数设置页面</h3>
<p>此页面将提供几何优化分析的参数配置功能</p>
</div>
</div>
</div>
</template>
<script setup>
//
</script>
<style scoped>
.geometry-optimization-params-page {
padding: var(--spacing-2xl);
height: 100%;
}
.page-header {
margin-bottom: var(--spacing-2xl);
}
.page-header h2 {
display: flex;
align-items: center;
gap: var(--spacing-md);
font-size: var(--font-size-3xl);
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-sm) 0;
}
.page-header h2 i {
color: var(--color-primary);
}
.page-header p {
color: var(--color-text-secondary);
margin: 0;
}
.page-content {
height: calc(100% - 100px);
display: flex;
align-items: center;
justify-content: center;
}
.params-placeholder {
text-align: center;
color: var(--color-text-secondary);
}
.placeholder-icon {
font-size: 4rem;
margin-bottom: var(--spacing-lg);
color: var(--color-primary);
}
.params-placeholder h3 {
font-size: var(--font-size-2xl);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-md) 0;
}
.params-placeholder p {
font-size: var(--font-size-lg);
margin: 0;
}
</style>

View File

@ -0,0 +1,84 @@
<template>
<div class="hierarchy-analysis-result-page">
<div class="page-header">
<h2>
<i class="fas fa-layer-group"></i>
按层级删除优化分析结果
</h2>
<p>Creo层级删除优化分析结果展示</p>
</div>
<div class="page-content">
<div class="result-placeholder">
<div class="placeholder-icon">
<i class="fas fa-hourglass-half"></i>
</div>
<h3>分析结果页面</h3>
<p>此页面将展示按层级删除优化分析的结果</p>
</div>
</div>
</div>
</template>
<script setup>
//
</script>
<style scoped>
.hierarchy-analysis-result-page {
padding: var(--spacing-2xl);
height: 100%;
}
.page-header {
margin-bottom: var(--spacing-2xl);
}
.page-header h2 {
display: flex;
align-items: center;
gap: var(--spacing-md);
font-size: var(--font-size-3xl);
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-sm) 0;
}
.page-header h2 i {
color: var(--color-primary);
}
.page-header p {
color: var(--color-text-secondary);
margin: 0;
}
.page-content {
height: calc(100% - 100px);
display: flex;
align-items: center;
justify-content: center;
}
.result-placeholder {
text-align: center;
color: var(--color-text-secondary);
}
.placeholder-icon {
font-size: 4rem;
margin-bottom: var(--spacing-lg);
color: var(--color-primary);
}
.result-placeholder h3 {
font-size: var(--font-size-2xl);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-md) 0;
}
.result-placeholder p {
font-size: var(--font-size-lg);
margin: 0;
}
</style>

View File

@ -0,0 +1,84 @@
<template>
<div class="shell-analysis-result-page">
<div class="page-header">
<h2>
<i class="fas fa-magic"></i>
智能薄壳化分析结果
</h2>
<p>Creo智能薄壳化分析结果展示</p>
</div>
<div class="page-content">
<div class="result-placeholder">
<div class="placeholder-icon">
<i class="fas fa-hourglass-half"></i>
</div>
<h3>分析结果页面</h3>
<p>此页面将展示智能薄壳化分析的结果</p>
</div>
</div>
</div>
</template>
<script setup>
//
</script>
<style scoped>
.shell-analysis-result-page {
padding: var(--spacing-2xl);
height: 100%;
}
.page-header {
margin-bottom: var(--spacing-2xl);
}
.page-header h2 {
display: flex;
align-items: center;
gap: var(--spacing-md);
font-size: var(--font-size-3xl);
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-sm) 0;
}
.page-header h2 i {
color: var(--color-primary);
}
.page-header p {
color: var(--color-text-secondary);
margin: 0;
}
.page-content {
height: calc(100% - 100px);
display: flex;
align-items: center;
justify-content: center;
}
.result-placeholder {
text-align: center;
color: var(--color-text-secondary);
}
.placeholder-icon {
font-size: 4rem;
margin-bottom: var(--spacing-lg);
color: var(--color-primary);
}
.result-placeholder h3 {
font-size: var(--font-size-2xl);
color: var(--color-text-primary);
margin: 0 0 var(--spacing-md) 0;
}
.result-placeholder p {
font-size: var(--font-size-lg);
margin: 0;
}
</style>

View File

@ -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连接的页面

View File

@ -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,

View File

@ -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: '几何复杂度分析'
}
})
}
}
// 导出单例实例

View File

@ -92,7 +92,12 @@
<!-- 模型分析页面 -->
<div v-else-if="currentPage === PAGE_TYPES.ANALYSIS_TOOLS" class="page-content">
<CreoModelAnalysis />
<CreoModelAnalysis
@show-shell-analysis-result="handleShowShellAnalysisResult"
@show-hierarchy-analysis-result="handleShowHierarchyAnalysisResult"
@show-geometry-complexity-result="handleShowGeometryComplexityResult"
@show-geometry-optimization-params="handleShowGeometryOptimizationParams"
/>
</div>
<!-- 导出工具页面 -->
@ -105,6 +110,26 @@
<UniversalConverter />
</div>
<!-- 智能薄壳化分析结果页面 -->
<div v-else-if="currentPage === PAGE_TYPES.SHELL_ANALYSIS_RESULT" class="page-content">
<ShellAnalysisResult />
</div>
<!-- 按层级删除优化分析结果页面 -->
<div v-else-if="currentPage === PAGE_TYPES.HIERARCHY_ANALYSIS_RESULT" class="page-content">
<HierarchyAnalysisResult />
</div>
<!-- 几何复杂度分析结果页面 -->
<div v-else-if="currentPage === PAGE_TYPES.GEOMETRY_COMPLEXITY_RESULT" class="page-content">
<GeometryComplexityResult />
</div>
<!-- 几何优化分析参数设置页面 -->
<div v-else-if="currentPage === PAGE_TYPES.GEOMETRY_OPTIMIZATION_PARAMS" class="page-content">
<GeometryOptimizationParams />
</div>
<!-- 欢迎首页 -->
<div v-else class="page-content">
<div class="welcome-page">
@ -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