feat: 实现层级统计功能集成和层级删除配置页面
- 添加层级统计API端点配置和服务方法 - 集成getHierarchyStatistics API到层级删除配置页面 - 实现动态层级数据显示和组件数量统计 - 修复数据嵌套结构访问问题 - 调整层级显示从0-based改为1-based用户界面 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
98515ce0c6
commit
a7decc6645
@ -146,6 +146,7 @@ const handleOperation = async () => {
|
||||
- ✅ 信息面板实时日志显示和软件状态同步
|
||||
- ✅ PDMS工厂设计模型查看器(PdmsModelViewer)
|
||||
- ✅ Revit建筑设计模型查看器(RevitModelViewer)
|
||||
- ✅ 层级统计功能完整集成(getHierarchyStatistics API + 层级删除配置页面)
|
||||
|
||||
## 页面添加标准流程
|
||||
|
||||
|
||||
@ -28,16 +28,18 @@
|
||||
<input type="number"
|
||||
class="level-number-input"
|
||||
id="deletion-level-input"
|
||||
min="0"
|
||||
:max="maxLevel"
|
||||
v-model="selectedLevel">
|
||||
min="1"
|
||||
:max="maxLevel + 1"
|
||||
v-model="displayLevel"
|
||||
:disabled="loading">
|
||||
<span>或选择:</span>
|
||||
<select class="level-select"
|
||||
id="deletion-level-select"
|
||||
v-model="selectedLevel">
|
||||
v-model="displayLevel"
|
||||
:disabled="loading">
|
||||
<option value="">-- 选择层级 --</option>
|
||||
<option v-for="level in availableLevels" :key="level" :value="level">
|
||||
层级 {{ level }} (25 个组件)
|
||||
<option v-for="level in availableLevels" :key="level" :value="level + 1">
|
||||
层级 {{ level + 1 }} ({{ getLevelComponentCount(level) }} 个组件)
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -59,7 +61,8 @@
|
||||
</button>
|
||||
<button class="params-action-btn danger"
|
||||
id="execute-deletion-btn"
|
||||
@click="$emit('execute-deletion', getExecutionParams())">
|
||||
@click="$emit('execute-deletion', getExecutionParams())"
|
||||
:disabled="loading || selectedLevel === null">
|
||||
<i class="fas fa-trash"></i>
|
||||
执行删除
|
||||
</button>
|
||||
@ -70,6 +73,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { creoApi } from '@/services/creoApi'
|
||||
|
||||
// Props - 暂时保留供将来使用
|
||||
defineProps({
|
||||
@ -84,23 +88,45 @@ defineEmits(['close', 'execute-deletion'])
|
||||
|
||||
// 响应式数据
|
||||
const selectedLevel = ref(null)
|
||||
const hierarchyStatistics = ref({})
|
||||
const totalLevels = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
// 计算属性 - 可用层级列表
|
||||
const availableLevels = computed(() => {
|
||||
return [0, 1, 2, 3, 4]
|
||||
if (!hierarchyStatistics.value || Object.keys(hierarchyStatistics.value).length === 0) {
|
||||
return []
|
||||
}
|
||||
// 从statistics对象中提取所有层级并转换为数字数组
|
||||
return Object.keys(hierarchyStatistics.value)
|
||||
.map(level => parseInt(level))
|
||||
.sort((a, b) => a - b)
|
||||
})
|
||||
|
||||
// 计算属性 - 最大层级
|
||||
const maxLevel = computed(() => {
|
||||
return 4
|
||||
return totalLevels.value > 0 ? totalLevels.value - 1 : 0
|
||||
})
|
||||
|
||||
// 计算属性 - 显示层级(用户看到的层级,从1开始)
|
||||
const displayLevel = computed({
|
||||
get: () => selectedLevel.value !== null ? selectedLevel.value + 1 : null,
|
||||
set: (value) => selectedLevel.value = value !== null ? value - 1 : null
|
||||
})
|
||||
|
||||
// 计算属性 - 范围显示文本
|
||||
const rangeDisplayText = computed(() => {
|
||||
if (selectedLevel.value === null) return '请选择层级'
|
||||
return `层级 ${selectedLevel.value} 及以下`
|
||||
return `层级 ${selectedLevel.value + 1} 及以下`
|
||||
})
|
||||
|
||||
// 获取层级组件数量
|
||||
const getLevelComponentCount = (level) => {
|
||||
if (!hierarchyStatistics.value || !hierarchyStatistics.value[level]) {
|
||||
return 0
|
||||
}
|
||||
return hierarchyStatistics.value[level]
|
||||
}
|
||||
|
||||
// 获取执行参数
|
||||
const getExecutionParams = () => {
|
||||
@ -124,9 +150,21 @@ const initializeDefaultLevel = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取层级统计信息
|
||||
const fetchHierarchyStatistics = async () => {
|
||||
loading.value = true
|
||||
const result = await creoApi.getHierarchyStatistics()
|
||||
if (result.success && result.data && result.data.data) {
|
||||
hierarchyStatistics.value = result.data.data.statistics
|
||||
totalLevels.value = result.data.data.total_levels
|
||||
initializeDefaultLevel()
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
// 组件挂载时初始化
|
||||
onMounted(() => {
|
||||
initializeDefaultLevel()
|
||||
fetchHierarchyStatistics()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@ -83,6 +83,7 @@ const CAD_SOFTWARE_DEFINITIONS = {
|
||||
status: '/api/status/model',
|
||||
open: '/api/model/open',
|
||||
hierarchy: '/api/creo/analysis/hierarchy',
|
||||
hierarchyStatistics: '/api/analysis/hierarchy-statistics',
|
||||
geometryComplexity: '/api/analysis/geometry-complexity',
|
||||
shellAnalysis: '/api/analysis/shell-analysis',
|
||||
optimization: '/api/creo/shrinkwrap/shell',
|
||||
|
||||
@ -150,6 +150,21 @@ class CreoApiService {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取层级统计信息
|
||||
* @returns {Promise<{success: boolean, data?: any, error?: string}>}
|
||||
*/
|
||||
async getHierarchyStatistics() {
|
||||
const url = buildApiUrl(this.softwareName, 'hierarchyStatistics')
|
||||
|
||||
return await apiClient.post(url, {}, {
|
||||
operationContext: {
|
||||
software: 'Creo',
|
||||
operation: '获取层级统计'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 导出单例实例
|
||||
|
||||
Loading…
Reference in New Issue
Block a user