Tidying in Removing

Added ID Check to SetPosnumber
This commit is contained in:
2025-02-03 19:59:54 +01:00
parent 70cca68f30
commit 75b6e630fb

View File

@@ -430,14 +430,7 @@ const addPosition = (mode) => {
}
const removePosition = (id) => {
let rows = itemInfo.value.rows.filter(row => row.id !== id)
/*rows = rows.sort((a,b) => a.pos - b.pos)
rows.forEach((row,index) => {
rows[index] = {...row, pos: index + 1}
})*/
itemInfo.value.rows = rows
itemInfo.value.rows = itemInfo.value.rows.filter(row => row.id !== id)
setPosNumbers()
@@ -830,6 +823,11 @@ const setPosNumbers = () => {
row.pos = itemInfo.value.rows.filter(i => i.mode === "title").length === 0 ? `${subIndex}` :`${ mainIndex - 1}.${subIndex}`
subIndex += 1
}
if(!row.id) {
row.id = uuidv4()
}
return row
})
}
@@ -1076,7 +1074,6 @@ const setRowData = (row) => {
</UButton>
</template>
</UDashboardNavbar>
<UDashboardPanelContent>
<UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded">
<template #item="{item}">