diff --git a/front/components/table/item.vue b/front/components/table/item.vue
index 17f5f98..9d59dd1 100644
--- a/front/components/table/item.vue
+++ b/front/components/table/item.vue
@@ -1,5 +1,5 @@
-
@@ -23,8 +22,19 @@ defineProps({
-
-
+ |
+
{{ cell }}
|
diff --git a/front/components/table/stats.vue b/front/components/table/stats.vue
index 3d7bbab..37e39ae 100644
--- a/front/components/table/stats.vue
+++ b/front/components/table/stats.vue
@@ -5,10 +5,8 @@ const props = defineProps({
required: true
}
})
-
function generateTableData(data, config, showDetails = true) {
const headers = config.map(c => c.label)
-
const rows = []
for (const key in data) {
@@ -35,29 +33,46 @@ function generateTableData(data, config, showDetails = true) {
return ''
})
- rows.push(mainRow)
+ // Добавляем флаг isSubRow: false для основной строки
+ mainRow.isSubRow = false
- // Подстроки (если нужно)
- if (entries.length > 1 && showDetails) {
+ if (entries.length > 1) {
+ rows.push(mainRow)
+ }
+
+ // Подстроки
+ if (showDetails) {
+ let subRowIndex = 0
for (const entry of entries) {
+ const isOnlyOne = entries.length === 1
+ const isFirst = subRowIndex === 0
+
const subRow = config.map(c => {
- if (c.key === 'key') return ''
- if (c.key === 'count') return 1
+ if (c.key === 'key') {
+ return isOnlyOne ? key : '-'
+ }
+ if (c.key === 'count') {
+ return 1
+ }
const value = entry[c.key]
if (typeof value === 'number') {
return value.toFixed(c.precision ?? 6)
}
return value ?? '-'
})
+
+ // Добавляем служебные метки в подстроку
+ subRow.isSubRow = isOnlyOne ? false : true
+ subRow.isFirstSubRow = isFirst
+ subRow.indexSubRow = subRowIndex++
+ subRow.parentKey = key
+
rows.push(subRow)
}
}
}
- return {
- headers,
- rows
- }
+ return { headers, rows }
}
const standardTableData = computed(() => {
const standard = props.statsData?.Standard || {}
@@ -73,7 +88,6 @@ const weldTableData = computed(() => {
return generateTableData(weld, [
{ key: 'key', label: 'Сварка' },
{ key: 'count', label: 'Элементов' },
- { key: 'dummy', label: '-' }, // пустая колонка
{ key: 'length', label: 'Длина шва', total: true, precision: 6 }
])
})
@@ -85,6 +99,7 @@ const sheetTableData = computed(() => {
{ key: 'count', label: 'Количество' },
{ key: 'name', label: 'Имя детали' },
{ key: 'radius', label: 'Радиус гиба', precision: 1 },
+ // { key: 'folds', label: 'Количество гибов', precision: 0 },
{ key: 'area', label: 'Площадь (м²)', total: true, precision: 6 },
{ key: 'mass', label: 'Масса (кг)', total: true, precision: 6 }
])