modified: .gitignore
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import {computed, onMounted, ref, watch} from "vue";
|
||||
import {NSkeleton, NText} from 'naive-ui'
|
||||
import {computed} from "vue";
|
||||
import {NText, NSkeleton} from 'naive-ui'
|
||||
import {useReportStore} from "../../../Stores/report.js";
|
||||
|
||||
const props = defineProps({
|
||||
@@ -16,49 +16,20 @@ const props = defineProps({
|
||||
|
||||
const reportStore = useReportStore()
|
||||
|
||||
const isLoading = ref(true)
|
||||
const countPatient = ref(null)
|
||||
const fetchPatientCount = async () => {
|
||||
isLoading.value = true
|
||||
const data = {
|
||||
status: props.status,
|
||||
startAt: reportStore.timestampCurrentRange[0],
|
||||
endAt: reportStore.timestampCurrentRange[1],
|
||||
departmentId: reportStore.reportInfo.department.department_id
|
||||
}
|
||||
await axios.post('/api/mis/patients/count', data).then((res) => {
|
||||
countPatient.value = res.data
|
||||
}).finally(() => {
|
||||
isLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
const computedHeader = computed(() => {
|
||||
if (countPatient.value !== null) {
|
||||
return `${props.title} (${countPatient.value})`
|
||||
} else {
|
||||
return props.title
|
||||
}
|
||||
return `${props.title} (${reportStore.getPatientsCount(props.status)})`
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchPatientCount()
|
||||
})
|
||||
|
||||
watch(() => reportStore.timestampCurrentRange, (newRange, oldRange) => {
|
||||
// Проверяем, что диапазон изменился и валиден
|
||||
if (newRange &&
|
||||
newRange.length === 2 &&
|
||||
(!oldRange || newRange[0] !== oldRange[0] || newRange[1] !== oldRange[1])) {
|
||||
fetchPatientCount()
|
||||
}
|
||||
}, { deep: true })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NSkeleton text style="width: 128px; height: 22px" round v-if="isLoading" />
|
||||
<NText v-else>
|
||||
{{ computedHeader }}
|
||||
<NText>
|
||||
<template v-if="reportStore.countsLoading">
|
||||
{{ title }}
|
||||
<NSkeleton text style="width: 24px; display: inline-block; margin-left: 6px;" />
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ computedHeader }}
|
||||
</template>
|
||||
</NText>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user