Обновлен стартовый экран

Переписаны запросы для статистики, отчетов
Добавлена интеграция отчета сестры
This commit is contained in:
brusnitsyn
2026-05-28 22:10:00 +09:00
parent 90e0d04dfd
commit 739168d427
96 changed files with 6663 additions and 1465 deletions

View File

@@ -5,6 +5,22 @@ import {computed, ref, watch} from "vue";
import {router, Link} from "@inertiajs/vue3";
import {useDebounceFn} from "@vueuse/core";
const show = defineModel('show')
const props = defineProps({
targetPath: {
type: String,
default: '/report'
},
submitLabel: {
type: String,
default: 'Перейти к заполнению сводной'
},
withExistsCheck: {
type: Boolean,
default: true
}
})
const reportStore = useReportStore()
const formRef = ref()
@@ -44,7 +60,7 @@ const fetchDepartments = () => {
}
const checkReportExists = async (userId, departmentId) => {
if (!userId || !departmentId) {
if (!props.withExistsCheck || !userId || !departmentId) {
reportExists.value = false;
existingReportId.value = null;
return;
@@ -64,7 +80,6 @@ const checkReportExists = async (userId, departmentId) => {
console.error('Ошибка при проверке отчета:', error);
reportExists.value = false;
existingReportId.value = null;
} finally {
}
}
@@ -124,7 +139,7 @@ const onSubmit = (e) => {
formRef.value?.validate((errors) => {
if (!errors) {
if (reportExists.value) return
router.visit(`/report`, {
router.visit(props.targetPath, {
data: {
userId: reportStore.reportInfo.userId,
departmentId: reportStore.reportInfo.departmentId
@@ -166,9 +181,9 @@ const onAfterLeave = () => {
/>
</NFormItem>
</NForm>
<NAlert v-if="reportExists" type="warning">
<NAlert v-if="reportExists && withExistsCheck" type="warning">
Сводная уже создана.
<NButton :tag="Link" text :href="`/report?userId=${reportStore.reportInfo.userId}&departmentId=${reportStore.reportInfo.departmentId}`">
<NButton :tag="Link" text :href="`${targetPath}?userId=${reportStore.reportInfo.userId}&departmentId=${reportStore.reportInfo.departmentId}`">
Перейти
</NButton>
</NAlert>
@@ -177,8 +192,8 @@ const onAfterLeave = () => {
type="primary"
block
@click="onSubmit"
:disabled="reportExists">
Перейти к заполнению сводной
:disabled="withExistsCheck && reportExists">
{{ submitLabel }}
</NButton>
</template>
</NModal>