* переписал функции прототипов в сервисы
* оптимизация доставки контента до клиента * переписал запросы выборок * убрал из подсчета переведенных * добавил сохранение метрикам для вывода в дашборд
This commit is contained in:
@@ -27,7 +27,7 @@ const dateType = computed(() => {
|
||||
})
|
||||
|
||||
const queryDate = ref([null, null])
|
||||
const modelValue = ref(props.date)
|
||||
const modelValue = defineModel('date')
|
||||
|
||||
const setQueryDate = () => {
|
||||
router.reload({
|
||||
@@ -75,14 +75,21 @@ const formattedValue = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => modelValue.value, (newVal) => {
|
||||
if (isUseDateRange.value) {
|
||||
queryDate.value = newVal
|
||||
} else {
|
||||
queryDate.value = [newVal, newVal]
|
||||
}
|
||||
watch(() => modelValue.value, (newVal, oldVal) => {
|
||||
if (!newVal) return
|
||||
|
||||
setQueryDate()
|
||||
if (Array.isArray(newVal)) {
|
||||
if (newVal.length === 2 &&
|
||||
(!oldVal || newVal[0] !== oldVal[0] || newVal[1] !== oldVal[1])) {
|
||||
queryDate.value = newVal
|
||||
setQueryDate()
|
||||
}
|
||||
} else {
|
||||
if (newVal !== oldVal) {
|
||||
queryDate.value = newVal
|
||||
setQueryDate()
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { ref, reactive } from 'vue'
|
||||
import {Head, router, useForm} from '@inertiajs/vue3'
|
||||
import { useAuthStore } from '../../Stores/auth.js'
|
||||
import { TbUser, TbLock } from 'vue-icons-plus/tb'
|
||||
import {
|
||||
NForm, NFormItem, NInput, NButton, NCheckbox,
|
||||
NSpace, NCard, NIcon, NAlert, NModal, darkTheme,
|
||||
@@ -114,7 +115,7 @@ const handleForgotPassword = async () => {
|
||||
@keydown.enter="handleLogin"
|
||||
>
|
||||
<template #prefix>
|
||||
<n-icon><Mail /></n-icon>
|
||||
<n-icon><TbUser /></n-icon>
|
||||
</template>
|
||||
</n-input>
|
||||
</n-form-item>
|
||||
@@ -130,7 +131,7 @@ const handleForgotPassword = async () => {
|
||||
@keydown.enter="handleLogin"
|
||||
>
|
||||
<template #prefix>
|
||||
<n-icon><LockClosed /></n-icon>
|
||||
<n-icon><TbLock /></n-icon>
|
||||
</template>
|
||||
</n-input>
|
||||
</n-form-item>
|
||||
|
||||
@@ -12,6 +12,7 @@ import {useReportStore} from "../../../Stores/report.js";
|
||||
import ReportSelectDate from "../../../Components/ReportSelectDate.vue";
|
||||
import DepartmentSelect from "../../../Components/DepartmentSelect.vue";
|
||||
import UnwantedEventModal from "./UnwantedEventModal.vue";
|
||||
import DatePickerQuery from "../../../Components/DatePickerQuery.vue";
|
||||
|
||||
const props = defineProps({
|
||||
mode: {
|
||||
@@ -66,7 +67,7 @@ const currentDate = computed(() => {
|
||||
</NSpace>
|
||||
|
||||
<div class="col-3 w-full">
|
||||
<ReportSelectDate :is-one-day="reportStore.reportInfo.report?.isOneDay"/>
|
||||
<DatePickerQuery :is-head-or-admin="reportStore.reportInfo.report?.isHeadOrAdmin" v-model:date="reportStore.timestampCurrentRange" :is-one-day="reportStore.reportInfo.report?.isOneDay" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -44,9 +44,14 @@ onMounted(async () => {
|
||||
await fetchPatientCount()
|
||||
})
|
||||
|
||||
watch(() => reportStore.timestampCurrentRange, (newRange) => {
|
||||
if (newRange) 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>
|
||||
|
||||
@@ -145,7 +145,7 @@ const columns = computed(() => {
|
||||
const operationColumn = {
|
||||
title: 'Операции',
|
||||
key: 'operations',
|
||||
render: (row) => row.operations.length ?
|
||||
render: (row) => row.operations?.length ?
|
||||
h(
|
||||
NText,
|
||||
{},
|
||||
|
||||
@@ -2,9 +2,28 @@
|
||||
import AppLayout from "../../Layouts/AppLayout.vue";
|
||||
import ReportForm from "./Components/ReportForm.vue";
|
||||
import {useReportStore} from "../../Stores/report.js";
|
||||
import {computed, onMounted} from "vue";
|
||||
import {computed, onMounted, watch} from "vue";
|
||||
import {useAuthStore} from "../../Stores/auth.js";
|
||||
|
||||
const props = defineProps({
|
||||
department: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
report: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
metrikaItems: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
dates: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
})
|
||||
|
||||
const reportStore = useReportStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
@@ -15,7 +34,24 @@ onMounted(() => {
|
||||
|
||||
reportStore.reportInfo.userId = userId
|
||||
|
||||
reportStore.getReportInfo()
|
||||
reportStore.reportInfo = props
|
||||
|
||||
reportStore.reportForm.metrika_item_3 = props.department.recipientCount
|
||||
reportStore.reportForm.metrika_item_7 = props.department.extractCount
|
||||
reportStore.reportForm.metrika_item_8 = props.department.currentCount
|
||||
|
||||
reportStore.reportForm.metrika_item_9 = props.department.deadCount
|
||||
reportStore.reportForm.metrika_item_10 = props.department.surgicalCount[1]
|
||||
reportStore.reportForm.metrika_item_11 = props.department.surgicalCount[0]
|
||||
|
||||
reportStore.unwantedEvents = props.report.unwantedEvents
|
||||
|
||||
reportStore.timestampCurrentRange = [
|
||||
props.dates.startAt,
|
||||
props.dates.endAt,
|
||||
]
|
||||
|
||||
// reportStore.getReportInfo()
|
||||
})
|
||||
|
||||
// reportStore.getReportInfo()
|
||||
@@ -26,6 +62,28 @@ const mode = computed(() => {
|
||||
return 'fillable'
|
||||
})
|
||||
|
||||
watch(() => props, (newProps) => {
|
||||
|
||||
reportStore.reportInfo = newProps
|
||||
|
||||
reportStore.reportForm.metrika_item_3 = newProps.department.recipientCount
|
||||
reportStore.reportForm.metrika_item_7 = newProps.department.extractCount
|
||||
reportStore.reportForm.metrika_item_8 = newProps.department.currentCount
|
||||
|
||||
reportStore.reportForm.metrika_item_9 = newProps.department.deadCount
|
||||
reportStore.reportForm.metrika_item_10 = newProps.department.surgicalCount[1]
|
||||
reportStore.reportForm.metrika_item_11 = newProps.department.surgicalCount[0]
|
||||
|
||||
reportStore.unwantedEvents = newProps.report.unwantedEvents
|
||||
|
||||
reportStore.timestampCurrentRange = [
|
||||
newProps.dates.startAt,
|
||||
newProps.dates.endAt,
|
||||
]
|
||||
}, {
|
||||
deep: true, // важно для глубокого отслеживания
|
||||
immediate: true // выполнить сразу при создании
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user