Добавлен вывод отчетов от системы

This commit is contained in:
brusnitsyn
2026-06-03 11:03:12 +09:00
parent f2cb6373ce
commit c857bd9f72
3 changed files with 16 additions and 5 deletions

View File

@@ -178,7 +178,7 @@ class GenerateDutyReport extends Command
// Формируем DateRange через ваш сервис (учёт смен, часовых поясов) // Формируем DateRange через ваш сервис (учёт смен, часовых поясов)
$user = User::find($userId); $user = User::find($userId);
$lpuDoctorId = $user->rf_lpudoctor_id ?? 1; $lpuDoctorId = 0;
$dateRange = $dateRangeService->createDateRangeForDate($shiftEnd, $user); $dateRange = $dateRangeService->createDateRangeForDate($shiftEnd, $user);
// Цепочка из вашего контроллера // Цепочка из вашего контроллера

View File

@@ -49,7 +49,7 @@ class DutyReportService
$departmentId = $departmentId ?? $user->rf_department_id; $departmentId = $departmentId ?? $user->rf_department_id;
$data = [ $data = [
'report_date' => Carbon::now()->format('Y-m-d'), 'report_date' => $dateRange->endSql(),
'sent_at' => Carbon::now()->format('Y-m-d H:i:s'), 'sent_at' => Carbon::now()->format('Y-m-d H:i:s'),
'period_type' => 'day', 'period_type' => 'day',
'period_start' => $dateRange->startSql(), 'period_start' => $dateRange->startSql(),

View File

@@ -1,7 +1,7 @@
<script setup> <script setup>
import AppLayout from "../../Layouts/AppLayout.vue"; import AppLayout from "../../Layouts/AppLayout.vue";
import {useReportStore} from "../../Stores/report.js"; import {useReportStore} from "../../Stores/report.js";
import {onMounted, ref, watch, provide} from "vue"; import {onMounted, ref, watch, provide, computed} from "vue";
import {useAuthStore} from "../../Stores/auth.js"; import {useAuthStore} from "../../Stores/auth.js";
import { import {
NFormItem, NFormItem,
@@ -184,6 +184,17 @@ const syncPageProps = (pageProps = props) => {
onMounted(syncPageProps) onMounted(syncPageProps)
const reportCreator = computed(() => {
if (latestReportObj.value === null) return ''
if (latestReportObj.value.doctor.LPUDoctorID === 0) return 'Отчет создан системой'
else return `Отчет создан: ${latestReportObj.value.doctor.FAM_V} ${latestReportObj.value.doctor.IM_V} ${latestReportObj.value.doctor.OT_V}`
})
const reportCreatorType = computed(() => {
if (latestReportObj.value === null) return 'warning'
if (latestReportObj.value.doctor.LPUDoctorID === 0) return 'error'
else return 'warning'
})
watch(() => props, (newProps) => { watch(() => props, (newProps) => {
syncPageProps(newProps) syncPageProps(newProps)
}, { }, {
@@ -206,8 +217,8 @@ watch(() => props, (newProps) => {
<NTag type="info" :bordered="false"> <NTag type="info" :bordered="false">
{{ department.name_full }} {{ department.name_full }}
</NTag> </NTag>
<NTag v-if="props.latestReport" type="warning" :bordered="false"> <NTag v-if="props.latestReport" :type="reportCreatorType" :bordered="false">
Отчет создан: {{ `${props.latestReport.doctor.FAM_V} ${props.latestReport.doctor.IM_V} ${props.latestReport.doctor.OT_V}` }} {{ reportCreator }}
</NTag> </NTag>
</NSpace> </NSpace>
<DatePickerQuery :date="dates" :is-head-or-admin="true" class="text-lg!" /> <DatePickerQuery :date="dates" :is-head-or-admin="true" class="text-lg!" />