all result tables
This commit is contained in:
parent
289e256286
commit
8335b16bad
|
@ -0,0 +1,58 @@
|
|||
<script setup>
|
||||
|
||||
defineProps({
|
||||
drawingData: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
// Форматируем чертежи под TableItem
|
||||
function formatDrawings(item) {
|
||||
return item.drawings.reduce((acc, drawing) => {
|
||||
acc[drawing.name] = drawing.path
|
||||
return acc
|
||||
}, {})
|
||||
}
|
||||
|
||||
// Проверяем, есть ли спецификации
|
||||
function hasSpecifications(item) {
|
||||
return item.specifications && Array.isArray(item.specifications) && item.specifications.length > 0
|
||||
}
|
||||
|
||||
// Форматируем спецификации под TableItem
|
||||
function formatSpecifications(item) {
|
||||
if (!hasSpecifications(item)) return {}
|
||||
return item.specifications.reduce((acc, spec) => {
|
||||
acc[spec.name] = spec.path
|
||||
return acc
|
||||
}, {})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-6">
|
||||
<h3 class="text-xl font-semibold mb-4">Результат: Чертежи и спецификации</h3>
|
||||
|
||||
<div v-for="item in drawingData" :key="item.document_name" class="mb-6 border p-4 rounded shadow-sm bg-white">
|
||||
<h4 class="font-medium text-lg">{{ item.document_name }}</h4>
|
||||
|
||||
<!-- Чертежи -->
|
||||
<TableItem
|
||||
caption="Чертежи:"
|
||||
:items="formatDrawings(item)"
|
||||
label-key="Название"
|
||||
label-value="Путь"
|
||||
/>
|
||||
|
||||
<!-- Спецификации -->
|
||||
<TableItem
|
||||
v-if="hasSpecifications(item)"
|
||||
caption="Спецификации:"
|
||||
:items="formatSpecifications(item)"
|
||||
label-key="Название"
|
||||
label-value="Путь"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="p-4">
|
||||
<div>
|
||||
<h2 class="text-xl font-bold mb-4">Результаты сохранения в IGES</h2>
|
||||
|
||||
<table class="min-w-full border-collapse mt-4">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div v-if="item" class="p-4">
|
||||
<div v-if="item">
|
||||
<h3 class="text-xl font-bold mb-2">{{ item.name }}</h3>
|
||||
<p>Количество элементов: {{ item.elements_count }}</p>
|
||||
<p>Количество гибов: {{ item.bends_count }}</p>
|
||||
|
|
|
@ -23,6 +23,7 @@ watch(selectedAction, () => {
|
|||
|
||||
const statsData = ref(null)
|
||||
const filesData = ref(null)
|
||||
const drawingData = ref(null)
|
||||
const resultData = ref(null)
|
||||
|
||||
// Синхронизация с КОМПАС
|
||||
|
@ -65,6 +66,7 @@ function updateUIWithResult(data: any, action: any) {
|
|||
// Обнуляем предыдущие данные
|
||||
statsData.value = null
|
||||
filesData.value = null
|
||||
drawingData.value = null
|
||||
resultData.value = null
|
||||
|
||||
// Сохраняем сырые данные на случай непредвиденного типа действия
|
||||
|
@ -84,10 +86,14 @@ function updateUIWithResult(data: any, action: any) {
|
|||
break
|
||||
|
||||
case 'iges':
|
||||
// Для файлов IGES
|
||||
case 'export_raster':
|
||||
filesData.value = data
|
||||
break
|
||||
|
||||
case 'project_support':
|
||||
drawingData.value = data
|
||||
break
|
||||
|
||||
default:
|
||||
console.warn(`Неизвестное действие: ${action}`)
|
||||
break
|
||||
|
@ -105,6 +111,7 @@ async function runSelectedAction() {
|
|||
// Обнуляем предыдущие данные
|
||||
statsData.value = null
|
||||
filesData.value = null
|
||||
drawingData.value = null
|
||||
resultData.value = null
|
||||
|
||||
const result = await sendCommandToPython(selectedAction.value)
|
||||
|
@ -226,6 +233,9 @@ async function runSelectedAction() {
|
|||
<template v-if="statsData">
|
||||
<TableStats v-for="item in (statsData as any).result" :key="item.name" :item="item" />
|
||||
</template>
|
||||
<template v-if="drawingData">
|
||||
<TableDrawing :drawingData="(drawingData as any).result" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue