|
|
|
|
@ -60,7 +60,7 @@
|
|
|
|
|
<!-- Vigencia -->
|
|
|
|
|
<template v-else-if="column.key === 'vigencia'">
|
|
|
|
|
<span v-if="record.fecha_inicio || record.fecha_fin" style="font-size: 12px; color: #666;">
|
|
|
|
|
{{ record.fecha_inicio ?? '∞' }} → {{ record.fecha_fin ?? '∞' }}
|
|
|
|
|
{{ formatDate(record.fecha_inicio) }} → {{ formatDate(record.fecha_fin) }}
|
|
|
|
|
</span>
|
|
|
|
|
<a-tag v-else color="default">Sin vigencia</a-tag>
|
|
|
|
|
</template>
|
|
|
|
|
@ -121,15 +121,17 @@
|
|
|
|
|
<a-date-picker
|
|
|
|
|
v-model:value="form.fecha_inicio"
|
|
|
|
|
placeholder="Desde"
|
|
|
|
|
format="YYYY-MM-DD"
|
|
|
|
|
format="DD/MM/YYYY"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
|
|
|
|
:disabled-date="(d) => d && d.isBefore(dayjs().startOf('day'))"
|
|
|
|
|
/>
|
|
|
|
|
<span style="color: #999;">→</span>
|
|
|
|
|
<a-date-picker
|
|
|
|
|
v-model:value="form.fecha_fin"
|
|
|
|
|
placeholder="Hasta"
|
|
|
|
|
format="YYYY-MM-DD"
|
|
|
|
|
format="DD/MM/YYYY"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
|
|
|
|
:disabled-date="(d) => d && d.isBefore(dayjs().startOf('day'))"
|
|
|
|
|
/>
|
|
|
|
|
</a-space>
|
|
|
|
|
<div style="font-size: 12px; color: #999; margin-top: 4px;">
|
|
|
|
|
@ -240,6 +242,7 @@
|
|
|
|
|
import { ref, computed, onMounted } from 'vue'
|
|
|
|
|
import { message } from 'ant-design-vue'
|
|
|
|
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
|
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
import { useComunicadosStore } from '../../../store/comunicadosStore'
|
|
|
|
|
|
|
|
|
|
const store = useComunicadosStore()
|
|
|
|
|
@ -321,10 +324,10 @@ async function onGuardar() {
|
|
|
|
|
|
|
|
|
|
const fd = new FormData()
|
|
|
|
|
fd.append('titulo', form.value.titulo)
|
|
|
|
|
if (form.value.fecha_inicio) fd.append('fecha_inicio', form.value.fecha_inicio)
|
|
|
|
|
if (form.value.fecha_fin) fd.append('fecha_fin', form.value.fecha_fin)
|
|
|
|
|
if (form.value.url_accion) fd.append('url_accion', form.value.url_accion)
|
|
|
|
|
if (form.value.texto_boton) fd.append('texto_boton', form.value.texto_boton)
|
|
|
|
|
fd.append('fecha_inicio', form.value.fecha_inicio ?? '')
|
|
|
|
|
fd.append('fecha_fin', form.value.fecha_fin ?? '')
|
|
|
|
|
fd.append('url_accion', form.value.url_accion ?? '')
|
|
|
|
|
fd.append('texto_boton', form.value.texto_boton ?? '')
|
|
|
|
|
fileImagenes.value.forEach((f) => fd.append('imagenes[]', f.originFileObj))
|
|
|
|
|
|
|
|
|
|
guardando.value = true
|
|
|
|
|
@ -368,6 +371,14 @@ async function onEliminarImagen(img) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formatDate(date) {
|
|
|
|
|
if (!date) return '∞'
|
|
|
|
|
const [y, m, d] = date.substring(0, 10).split('-').map(Number)
|
|
|
|
|
const fecha = new Date(y, m - 1, d)
|
|
|
|
|
if (isNaN(fecha.getTime())) return '∞'
|
|
|
|
|
return fecha.toLocaleDateString('es-PE')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function onToggleActivo(record) {
|
|
|
|
|
togglingId.value = record.id
|
|
|
|
|
const ok = await store.toggleActivo(record.id)
|
|
|
|
|
|