Роли, переделывание отчета, изменение на главной странице

This commit is contained in:
brusnitsyn
2026-01-11 23:37:18 +09:00
parent eb019504d7
commit d4f077cdaf
59 changed files with 2099 additions and 366 deletions

View File

@@ -0,0 +1,88 @@
<script setup>
import {NStatistic, NRow, NCol, NCard, NButton, NTag, NDatePicker, NFlex, NSelect, NText, NH2} from "naive-ui";
import {computed, ref} from "vue";
import {format} from "date-fns";
import {useNow} from "@vueuse/core";
import {ru} from "date-fns/locale";
import {useAuthStore} from "../../../Stores/auth.js";
import {storeToRefs} from "pinia";
import {RiAddCircleLine} from 'vue-icons-plus/ri'
import {useReportStore} from "../../../Stores/report.js";
const props = defineProps({
mode: {
type: String,
default: 'fillable' // 'fillable', 'readonly'
},
isShowDepartmentSelect: {
type: Boolean,
default: false
},
})
const departments = [
{
label: 'Все отделения',
value: 0
}
]
const authStore = useAuthStore()
const reportStore = useReportStore()
const {user, availableDepartments} = storeToRefs(authStore)
const {reportInfo} = storeToRefs(reportStore)
const isFillableMode = computed(() => props.mode.toLowerCase() === 'fillable')
const isReadonlyMode = computed(() => props.mode.toLowerCase() === 'readonly')
const selectDepartment = ref(0)
const currentDate = computed(() => {
const formatted = format(useNow().value, 'PPPPpp', {
locale: ru
})
return formatted.charAt(0).toUpperCase() + formatted.slice(1)
})
</script>
<template>
<NCard>
<NFlex vertical>
<NFlex align="center" justify="space-between">
<NH2 v-if="isFillableMode" class="mb-0!">
{{ currentDate }}
</NH2>
<NDatePicker v-if="isReadonlyMode" />
<NFlex align="center" :wrap="false">
<NTag v-if="isFillableMode" type="info" :bordered="false">
{{ authStore.userDepartment.name_full }}
</NTag>
<NSelect v-if="isReadonlyMode" v-model:value="selectDepartment" :options="departments" />
</NFlex>
</NFlex>
<NFlex justify="space-between" align="center" :wrap="false">
<NRow class="grow">
<NCol :span="4">
<NStatistic label="Коек" :value="reportStore.reportInfo?.department.beds" />
</NCol>
<NCol :span="5">
<NStatistic label="Загруженность" :value="`${reportStore.reportInfo?.department.percentLoadedBeds}%`" />
</NCol>
</NRow>
<NButton type="primary" secondary>
<template #icon>
<RiAddCircleLine />
</template>
Нежелательное событие
</NButton>
</NFlex>
</NFlex>
</NCard>
</template>
<style scoped>
</style>