diff --git a/nuxt4/app/components/lotes/Table.vue b/nuxt4/app/components/lotes/Table.vue index 8290639..caaf775 100644 --- a/nuxt4/app/components/lotes/Table.vue +++ b/nuxt4/app/components/lotes/Table.vue @@ -27,6 +27,18 @@ /> + + +
+ +
+

Error cargando lotes

+

{{ error }}

+

Ver consola del navegador (F12) para más detalles

+
+
+
+ ([]) const loading = ref(false) const selected = ref([]) const filtroTipo = ref('') +const error = ref(null) const columns = [ { key: 'codigo', label: 'Código' }, @@ -115,10 +128,21 @@ const columns = [ const loadLotes = async () => { loading.value = true + error.value = null try { + console.log('🟢 LotesTable: Iniciando carga de lotes...') lotes.value = await fetchLotes({ tipo: filtroTipo.value || undefined, }) + console.log('🟢 LotesTable: Lotes cargados exitosamente:', lotes.value.length) + } catch (err: any) { + const errorMsg = err?.message || String(err) + error.value = errorMsg + console.error('❌ LotesTable: Error cargando lotes:', { + message: errorMsg, + stack: err?.stack, + error: err + }) } finally { loading.value = false } @@ -159,11 +183,21 @@ const formatDate = (dateString: string) => { // Cargar lotes al montar onMounted(() => { - loadLotes() + try { + console.log('🟢 LotesTable: Componente montado, cargando lotes...') + loadLotes() + } catch (err: any) { + console.error('❌ LotesTable: Error en onMounted:', err) + } }) // Recargar cuando cambia el filtro watch(filtroTipo, () => { - loadLotes() + try { + console.log('🟢 LotesTable: Filtro cambiado, recargando lotes...') + loadLotes() + } catch (err: any) { + console.error('❌ LotesTable: Error en watch:', err) + } }) diff --git a/nuxt4/app/components/operaciones/Table.vue b/nuxt4/app/components/operaciones/Table.vue index c95e0b0..dd667a5 100644 --- a/nuxt4/app/components/operaciones/Table.vue +++ b/nuxt4/app/components/operaciones/Table.vue @@ -27,6 +27,18 @@ /> + + +
+ +
+

Error cargando operaciones

+

{{ error }}

+

Ver consola del navegador (F12) para más detalles

+
+
+
+ ([]) const loading = ref(false) const filtroTipo = ref('') +const error = ref(null) const columns = [ { key: 'tipo', label: 'Tipo de Operación' }, @@ -91,10 +104,21 @@ const columns = [ const loadOperaciones = async () => { loading.value = true + error.value = null try { + console.log('🟡 OperacionesTable: Iniciando carga de operaciones...') operaciones.value = await fetchOperaciones({ tipo: filtroTipo.value || undefined, }) + console.log('🟡 OperacionesTable: Operaciones cargadas exitosamente:', operaciones.value.length) + } catch (err: any) { + const errorMsg = err?.message || String(err) + error.value = errorMsg + console.error('❌ OperacionesTable: Error cargando operaciones:', { + message: errorMsg, + stack: err?.stack, + error: err + }) } finally { loading.value = false } @@ -137,14 +161,23 @@ const formatDate = (dateString: string) => { }) } -// onMounted(() => { -// console.log('🟡 OperacionesTable montado correctamente') -// loadOperaciones().catch(error => { -// console.error('❌ Error cargando operaciones:', error) -// }) -// }) +// Cargar operaciones al montar +onMounted(() => { + try { + console.log('🟡 OperacionesTable: Componente montado, cargando operaciones...') + loadOperaciones() + } catch (err: any) { + console.error('❌ OperacionesTable: Error en onMounted:', err) + } +}) -// watch(filtroTipo, () => { -// loadOperaciones() -// }) +// Recargar cuando cambia el filtro +watch(filtroTipo, () => { + try { + console.log('🟡 OperacionesTable: Filtro cambiado, recargando operaciones...') + loadOperaciones() + } catch (err: any) { + console.error('❌ OperacionesTable: Error en watch:', err) + } +})