Files
onboard/resources/js/Pages/Report/Components/ReportSectionHeader.vue
brusnitsyn cb43c74a72 * добавлены операции и услуги операций
* добавлена выборка и подсчет по датам для роли зав.
* переключатель ролей
* выбор отделений для роли зав.
2026-01-22 17:58:27 +09:00

66 lines
1.5 KiB
Vue

<script setup>
import {computed, onMounted, ref, watch} from "vue";
import {NSkeleton, NText} from 'naive-ui'
import {useReportStore} from "../../../Stores/report.js";
const props = defineProps({
title: {
type: String,
default: null
},
status: {
type: String,
default: null
}
})
const reportStore = useReportStore()
const isLoading = ref(true)
const countPatient = ref(null)
const fetchPatientCount = async () => {
if (props.status === 'plan' || props.status === 'emergency') {
isLoading.value = true
const data = {
status: props.status,
startAt: reportStore.timestampCurrentRange[0],
endAt: reportStore.timestampCurrentRange[1]
}
await axios.post('/api/mis/patients/count', data).then((res) => {
countPatient.value = res.data
}).finally(() => {
isLoading.value = false
})
} else {
isLoading.value = false
}
}
const computedHeader = computed(() => {
if (countPatient.value !== null) {
return `${props.title} (${countPatient.value})`
} else {
return props.title
}
})
onMounted(async () => {
await fetchPatientCount()
})
watch(() => reportStore.timestampCurrentRange, (newRange) => {
if (newRange) fetchPatientCount()
})
</script>
<template>
<NSkeleton text style="width: 128px; height: 22px" round v-if="isLoading" />
<NText v-else>
{{ computedHeader }}
</NText>
</template>
<style scoped>
</style>