feat: 实现Revit查看当前模型功能并完善数据显示
- 扩展RevitApi服务,添加getCurrentModel方法调用/api/overview端点 - 重构RevitModelViewer组件支持真实API数据,替换硬编码模拟数据 - 修复CadSidebar中Revit模型加载逻辑,集成真实API调用 - 完善DashboardView中RevitModelViewer的props传递 - 修正RevitAnalysisDashboard的数据结构判断逻辑 - 统一API数据流:CadSidebar → DashboardView → RevitModelViewer - 保持与Creo实现的架构一致性,支持自动通知和日志记录 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
69d21cc752
commit
507bc96dcd
@ -153,19 +153,11 @@ const handleOpenModel = async () => {
|
|||||||
emit('show-model-viewer', result.data)
|
emit('show-model-viewer', result.data)
|
||||||
}
|
}
|
||||||
} else if (connectedCAD.id === 'revit') {
|
} else if (connectedCAD.id === 'revit') {
|
||||||
// Revit模拟数据,仅供测试
|
const result = await revitApi.getCurrentModel()
|
||||||
const mockRevitData = {
|
if (result.success) {
|
||||||
fileName: 'Revit测试模型.rvt',
|
cadStore.currentProjectName = result.data.data.project.name
|
||||||
sourceSoftware: 'Autodesk Revit 2024',
|
emit('show-model-viewer', result.data.data)
|
||||||
openTime: new Date().toISOString(),
|
|
||||||
connectionStatus: '已连接',
|
|
||||||
partCount: 150,
|
|
||||||
assemblyLevel: 3,
|
|
||||||
basicStats: {
|
|
||||||
fileSize: '45.6 MB'
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
emit('show-model-viewer', { data: mockRevitData })
|
|
||||||
} else if (connectedCAD.id === 'pdms') {
|
} else if (connectedCAD.id === 'pdms') {
|
||||||
// PDMS模拟数据,直接显示工厂设计分析界面
|
// PDMS模拟数据,直接显示工厂设计分析界面
|
||||||
emit('show-model-viewer', {
|
emit('show-model-viewer', {
|
||||||
|
|||||||
@ -149,55 +149,78 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
import { ElNotification } from 'element-plus'
|
import { ElNotification } from 'element-plus'
|
||||||
|
|
||||||
// 硬编码的Revit模拟数据
|
// 定义props接收API数据
|
||||||
const projectData = {
|
const props = defineProps({
|
||||||
ProjectName: 'COMMERCIAL_BUILDING_2024',
|
modelData: {
|
||||||
FilePath: 'C:/BIM_Projects/Commercial_Building_2024.rvt',
|
type: Object,
|
||||||
RevitVersion: 'Autodesk Revit 2024',
|
required: true
|
||||||
FileSizeDisplay: '87.5 MB',
|
}
|
||||||
IsCentralFile: true,
|
})
|
||||||
IsLoaded: true
|
|
||||||
}
|
|
||||||
|
|
||||||
const modelStats = {
|
// 从API数据中提取项目信息
|
||||||
TotalElements: 8945,
|
const projectData = computed(() => {
|
||||||
Levels: 12,
|
const project = props.modelData?.project || {}
|
||||||
Views3D: 8,
|
return {
|
||||||
LinkedFiles: 6,
|
ProjectName: project.name || 'Unknown Project',
|
||||||
FloorPlans: 15,
|
FilePath: project.filePath || 'Unknown Path',
|
||||||
Elevations: 8,
|
RevitVersion: project.revitVersion || 'Unknown Version',
|
||||||
Sections: 12,
|
FileSizeDisplay: project.fileSizeDisplay || 'Unknown Size',
|
||||||
Sheets: 24,
|
IsCentralFile: project.isCentralFile || false,
|
||||||
|
IsLoaded: project.status === '活动'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 从API数据中提取统计信息
|
||||||
|
const modelStats = computed(() => {
|
||||||
|
const elements = props.modelData?.elements || {}
|
||||||
|
const structure = props.modelData?.structure || {}
|
||||||
|
const hierarchy = props.modelData?.hierarchy || {}
|
||||||
|
|
||||||
|
return {
|
||||||
|
TotalElements: elements.total || 0,
|
||||||
|
Levels: hierarchy.levels?.length || structure.levels || 0,
|
||||||
|
Views3D: structure.views3D || 0,
|
||||||
|
LinkedFiles: (props.modelData?.links?.revitLinks?.total || 0) + (props.modelData?.links?.cadLinks?.total || 0),
|
||||||
|
FloorPlans: structure.floorPlans || 0,
|
||||||
|
Elevations: structure.elevations || 0,
|
||||||
|
Sections: structure.sections || 0,
|
||||||
|
Sheets: structure.sheets || 0,
|
||||||
ActiveViews: ['Level 1 Floor Plan', '3D View - Building', 'South Elevation', 'Longitudinal Section'],
|
ActiveViews: ['Level 1 Floor Plan', '3D View - Building', 'South Elevation', 'Longitudinal Section'],
|
||||||
ElementCounts: {
|
ElementCounts: {
|
||||||
'Walls': 2847,
|
'Walls': elements.walls || 0,
|
||||||
'Doors': 486,
|
'Doors': elements.doors || 0,
|
||||||
'Windows': 672,
|
'Windows': elements.windows || 0,
|
||||||
'Floors': 234,
|
'Floors': elements.floors || 0,
|
||||||
'Ceilings': 189,
|
'Ceilings': elements.ceilings || 0,
|
||||||
'Columns': 145,
|
'Columns': elements.columns || 0,
|
||||||
'Beams': 398,
|
'Beams': elements.beams || 0,
|
||||||
'Rooms': 267,
|
'Rooms': elements.rooms || 0,
|
||||||
'Stairs': 24,
|
'Stairs': 0, // API中没有楼梯数据,设为0
|
||||||
'Railings': 156
|
'Railings': 0 // API中没有栏杆数据,设为0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const linkData = {
|
// 从API数据中提取链接文件信息
|
||||||
|
const linkData = computed(() => {
|
||||||
|
const links = props.modelData?.links || {}
|
||||||
|
return {
|
||||||
RevitLinks: {
|
RevitLinks: {
|
||||||
Total: 4,
|
Total: links.revitLinks?.total || 0,
|
||||||
Loaded: 3,
|
Loaded: links.revitLinks?.loaded || 0,
|
||||||
Unloaded: 1
|
Unloaded: links.revitLinks?.unloaded || 0
|
||||||
},
|
},
|
||||||
CadLinks: {
|
CadLinks: {
|
||||||
Total: 2,
|
Total: links.cadLinks?.total || 0,
|
||||||
Loaded: 2,
|
Loaded: links.cadLinks?.loaded || 0,
|
||||||
Unloaded: 0
|
Unloaded: links.cadLinks?.unloaded || 0
|
||||||
},
|
},
|
||||||
PointClouds: 1
|
PointClouds: links.pointClouds || 0
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Revit建筑元素类型配置
|
// Revit建筑元素类型配置
|
||||||
const elementTypeIcons = {
|
const elementTypeIcons = {
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
<i class="fas fa-building"></i>
|
<i class="fas fa-building"></i>
|
||||||
Revit 建筑分析
|
Revit 建筑分析
|
||||||
</h3>
|
</h3>
|
||||||
<p class="subtitle">{{ modelData?.data?.fileName || 'Revit测试模型.rvt' }}</p>
|
<p class="subtitle">{{ modelData?.project?.name || 'Revit测试模型.rvt' }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="revit-strategy-selector">
|
<div class="revit-strategy-selector">
|
||||||
@ -226,7 +226,7 @@ const analysisResults = ref(null)
|
|||||||
|
|
||||||
// 计算属性
|
// 计算属性
|
||||||
const hasModel = computed(() => {
|
const hasModel = computed(() => {
|
||||||
return props.modelData && props.modelData.data
|
return props.modelData && props.modelData.project
|
||||||
})
|
})
|
||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
|
|||||||
@ -29,6 +29,21 @@ class RevitApiService {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前模型总览
|
||||||
|
* @returns {Promise<{success: boolean, data?: any, error?: string}>}
|
||||||
|
*/
|
||||||
|
async getCurrentModel() {
|
||||||
|
const url = buildApiUrl(this.softwareName, 'overview')
|
||||||
|
|
||||||
|
return await apiClient.get(url, {
|
||||||
|
operationContext: {
|
||||||
|
software: 'Revit',
|
||||||
|
operation: '获取当前模型'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出单例实例
|
// 导出单例实例
|
||||||
|
|||||||
@ -92,7 +92,7 @@
|
|||||||
<div v-if="currentPage === PAGE_TYPES.MODEL_VIEWER && showModelViewer" class="page-content">
|
<div v-if="currentPage === PAGE_TYPES.MODEL_VIEWER && showModelViewer" class="page-content">
|
||||||
<CreoModelViewer v-if="currentConnectedSoftware === 'creo'" :model-data="currentModelData" />
|
<CreoModelViewer v-if="currentConnectedSoftware === 'creo'" :model-data="currentModelData" />
|
||||||
<PdmsModelViewer v-else-if="currentConnectedSoftware === 'pdms'" />
|
<PdmsModelViewer v-else-if="currentConnectedSoftware === 'pdms'" />
|
||||||
<RevitModelViewer v-else-if="currentConnectedSoftware === 'revit'" />
|
<RevitModelViewer v-else-if="currentConnectedSoftware === 'revit'" :model-data="currentModelData" />
|
||||||
<CreoModelViewer v-else :model-data="currentModelData" />
|
<CreoModelViewer v-else :model-data="currentModelData" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user