Шаблон отчета дежурного врача
This commit is contained in:
@@ -216,6 +216,33 @@ const reportCreatorType = computed(() => {
|
||||
else return 'warning'
|
||||
})
|
||||
|
||||
const downloadReport = async () => {
|
||||
try {
|
||||
const response = await fetch(`/duty/report/generate?startAt=${props.dates[0]}&endAt=${props.dates[1]}&departmentId=${props.department.department_id}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
},
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Ошибка загрузки файла')
|
||||
}
|
||||
|
||||
const blob = await response.blob()
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = 'Отчёт дежурного.xlsx'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
document.body.removeChild(a)
|
||||
} catch {
|
||||
// silent
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props, (newProps) => {
|
||||
syncPageProps(newProps)
|
||||
}, {
|
||||
@@ -321,6 +348,9 @@ watch(() => props, (newProps) => {
|
||||
secondary type="error" :loading="loading" @click="onShowUnwantedEventModal">
|
||||
Нежелательные события ({{ latestReportObj.unwanted_events?.length ?? 0 }})
|
||||
</NButton>
|
||||
<NButton secondary @click="downloadReport" :loading="loading">
|
||||
Сформировать отчет дежурного
|
||||
</NButton>
|
||||
<NButton v-if="props.canSaveReport" secondary @click="submit" :loading="loading">
|
||||
Сохранить введенные данные
|
||||
</NButton>
|
||||
|
||||
Reference in New Issue
Block a user