Исправил передачу дат умерших, нежелательных и наблюдений

This commit is contained in:
brusnitsyn
2026-06-10 10:47:08 +09:00
parent bd8b4fe81b
commit 9954501437
4 changed files with 52 additions and 32 deletions

View File

@@ -7,11 +7,7 @@ import { format, formatDistanceStrict } from 'date-fns'
import { ru } from 'date-fns/locale'
import { computed, h, ref, watch } from 'vue'
import TooltipColumn from '../../Report/Components/DataTableColumns/TooltipColumn.vue'
const props = defineProps({
startAt: { required: true },
endAt: { required: true },
})
import {usePage} from "@inertiajs/vue3";
const open = defineModel('open')
const loading = ref(true)
@@ -19,6 +15,16 @@ const deadPatients = ref([])
const currentPatient = ref(null)
const showDrawer = ref(false)
const startAt = computed(() => {
const urlParams = new URLSearchParams(window.location.search)
return urlParams.get('startAt')
})
const endAt = computed(() => {
const urlParams = new URLSearchParams(window.location.search)
return urlParams.get('endAt')
})
// Получаем уникальные отделения для фильтра
const departmentOptions = computed(() => {
const departments = new Set()
@@ -31,6 +37,7 @@ const departmentOptions = computed(() => {
label: dept,
value: dept
}))
.sort((a, b) => a.label.localeCompare(b.label))
})
// Состояние для выбранных фильтров
@@ -92,10 +99,10 @@ const columns = computed(() => [
},
])
const fetch = () => {
const fetch = (startAt, endAt) => {
loading.value = true
axios.get('/api/statistics/reports/dead-patients', {
params: { startAt: props.startAt, endAt: props.endAt }
params: { startAt, endAt }
}).then((res) => {
deadPatients.value = res.data ?? []
@@ -106,9 +113,9 @@ const fetch = () => {
})
}
watch(open, (isOpen) => {
if (isOpen && props.endAt && props.startAt) {
fetch()
watch(open, (open) => {
if (open) {
fetch(startAt.value, endAt.value)
}
})
</script>