* добавлены операции и услуги операций
* добавлена выборка и подсчет по датам для роли зав. * переключатель ролей * выбор отделений для роли зав.
This commit is contained in:
@@ -27,7 +27,7 @@ const onSubmit = () => {
|
||||
<NFlex vertical class="max-w-6xl mx-auto mt-6 mb-4 w-full">
|
||||
<ReportHeader :mode="mode" />
|
||||
|
||||
<ReportFormInput />
|
||||
<ReportFormInput v-if="mode === 'fillable'" />
|
||||
|
||||
<ReportSection label="Планово" />
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ import {useAuthStore} from "../../../Stores/auth.js";
|
||||
import {storeToRefs} from "pinia";
|
||||
import {RiAddCircleLine} from 'vue-icons-plus/ri'
|
||||
import {useReportStore} from "../../../Stores/report.js";
|
||||
import ReportSelectDate from "../../../Components/ReportSelectDate.vue";
|
||||
import DepartmentSelect from "../../../Components/DepartmentSelect.vue";
|
||||
import UnwantedEventModal from "./UnwantedEventModal.vue";
|
||||
|
||||
const props = defineProps({
|
||||
mode: {
|
||||
@@ -34,6 +37,8 @@ const {reportInfo} = storeToRefs(reportStore)
|
||||
const isFillableMode = computed(() => props.mode.toLowerCase() === 'fillable')
|
||||
const isReadonlyMode = computed(() => props.mode.toLowerCase() === 'readonly')
|
||||
|
||||
const openUnwantedEventModal = ref(false)
|
||||
|
||||
const selectDepartment = ref(0)
|
||||
|
||||
const currentDate = computed(() => {
|
||||
@@ -48,17 +53,17 @@ const currentDate = computed(() => {
|
||||
<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" justify="space-between" :wrap="false">
|
||||
<NTag v-if="isFillableMode" type="info" :bordered="false">
|
||||
{{ authStore.userDepartment.name_full }}
|
||||
</NTag>
|
||||
<DepartmentSelect 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" />
|
||||
<NH2 v-if="isFillableMode" class="mb-0!">
|
||||
{{ currentDate }}
|
||||
</NH2>
|
||||
<ReportSelectDate v-if="isReadonlyMode" />
|
||||
</NFlex>
|
||||
</NFlex>
|
||||
|
||||
@@ -80,9 +85,33 @@ const currentDate = computed(() => {
|
||||
</template>
|
||||
</NStatistic>
|
||||
</NCol>
|
||||
<NCol :span="5">
|
||||
<NStatistic label="Поступило">
|
||||
<template #default>
|
||||
<NSkeleton v-if="reportStore.isLoadReportInfo" round class="w-[70px]! mt-2 h-[29px]!" />
|
||||
<span v-else>{{ reportStore.reportInfo?.department.recipientCount }}</span>
|
||||
</template>
|
||||
</NStatistic>
|
||||
</NCol>
|
||||
<NCol :span="5">
|
||||
<NStatistic label="Выбыло">
|
||||
<template #default>
|
||||
<NSkeleton v-if="reportStore.isLoadReportInfo" round class="w-[70px]! mt-2 h-[29px]!" />
|
||||
<span v-else>{{ reportStore.reportInfo?.department.extractCount }}</span>
|
||||
</template>
|
||||
</NStatistic>
|
||||
</NCol>
|
||||
<NCol :span="5">
|
||||
<NStatistic label="Состоит">
|
||||
<template #default>
|
||||
<NSkeleton v-if="reportStore.isLoadReportInfo" round class="w-[70px]! mt-2 h-[29px]!" />
|
||||
<span v-else>{{ reportStore.reportInfo?.department.currentCount }}</span>
|
||||
</template>
|
||||
</NStatistic>
|
||||
</NCol>
|
||||
</NRow>
|
||||
|
||||
<NButton type="primary" secondary>
|
||||
<NButton type="error" secondary @click="openUnwantedEventModal = true">
|
||||
<template #icon>
|
||||
<RiAddCircleLine />
|
||||
</template>
|
||||
@@ -91,6 +120,8 @@ const currentDate = computed(() => {
|
||||
</NFlex>
|
||||
</NFlex>
|
||||
</NCard>
|
||||
|
||||
<UnwantedEventModal v-model:open="openUnwantedEventModal" />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -17,7 +17,7 @@ const reportStore = useReportStore()
|
||||
const {patientsData} = storeToRefs(reportStore)
|
||||
|
||||
const handleItemDragged = (event) => {
|
||||
console.log('Начато перетаскивание:', event)
|
||||
// console.log('Начато перетаскивание:', event)
|
||||
}
|
||||
|
||||
// Обработка события drop
|
||||
@@ -47,6 +47,8 @@ const isReadonlyMode = computed(() => props.mode.toLowerCase() === 'readonly')
|
||||
<ReportSectionHeader title="Планово" status="plan" />
|
||||
</template>
|
||||
<ReportSectionItem status="plan"
|
||||
:accent-ids="reportStore.reportInfo?.department.recipientIds"
|
||||
is-draggable
|
||||
@item-dragged="handleItemDragged"
|
||||
/>
|
||||
</NCollapseItem>
|
||||
@@ -55,17 +57,20 @@ const isReadonlyMode = computed(() => props.mode.toLowerCase() === 'readonly')
|
||||
<ReportSectionHeader title="Экстренно" status="emergency" />
|
||||
</template>
|
||||
<ReportSectionItem status="emergency"
|
||||
:accent-ids="reportStore.reportInfo?.department.recipientIds"
|
||||
is-draggable
|
||||
@item-dragged="handleItemDragged"
|
||||
/>
|
||||
</NCollapseItem>
|
||||
<NCollapseItem name="3">
|
||||
<template #header>
|
||||
<ReportSectionHeader title="Наблюдение" status="observation" />
|
||||
<ReportSectionHeader title="Находятся на контроле" status="observation" />
|
||||
</template>
|
||||
<NFlex :size="12">
|
||||
<ReportSectionItem status="observation"
|
||||
@item-dragged="handleItemDragged"
|
||||
@item-dropped="handleItemDropped"
|
||||
is-removable
|
||||
/>
|
||||
<NAlert v-if="isFillableMode" type="info" class="w-full">
|
||||
Перетаскивайте строки из верхних таблиц, что бы добавить в наблюдение
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import {computed, onMounted, ref} from "vue";
|
||||
import {computed, onMounted, ref, watch} from "vue";
|
||||
import {NSkeleton, NText} from 'naive-ui'
|
||||
import {useReportStore} from "../../../Stores/report.js";
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
@@ -13,14 +14,19 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const reportStore = useReportStore()
|
||||
|
||||
const isLoading = ref(true)
|
||||
const countPatient = ref(null)
|
||||
const fetchPatientCount = async () => {
|
||||
if (props.status === 'plan' || props.status === 'emergency') {
|
||||
isLoading.value = true
|
||||
await axios.post('/api/mis/patients/count', {
|
||||
status: props.status
|
||||
}).then((res) => {
|
||||
const data = {
|
||||
status: props.status,
|
||||
startAt: reportStore.timestampCurrentRange[0],
|
||||
endAt: reportStore.timestampCurrentRange[1]
|
||||
}
|
||||
await axios.post('/api/mis/patients/count', data).then((res) => {
|
||||
countPatient.value = res.data
|
||||
}).finally(() => {
|
||||
isLoading.value = false
|
||||
@@ -41,6 +47,10 @@ const computedHeader = computed(() => {
|
||||
onMounted(async () => {
|
||||
await fetchPatientCount()
|
||||
})
|
||||
|
||||
watch(() => reportStore.timestampCurrentRange, (newRange) => {
|
||||
if (newRange) fetchPatientCount()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import {NIcon, NDataTable} from "naive-ui";
|
||||
import {NIcon, NText, NDataTable, NButton} from "naive-ui";
|
||||
import {useReportStore} from "../../../Stores/report.js";
|
||||
import {computed, h, onMounted, ref, watch} from "vue";
|
||||
import { VueDraggableNext } from 'vue-draggable-next'
|
||||
@@ -18,12 +18,26 @@ const props = defineProps({
|
||||
status: {
|
||||
type: String,
|
||||
default: null // 'plan'
|
||||
},
|
||||
isRemovable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isDraggable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
accentIds: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
const isFillableMode = computed(() => props.mode.toLowerCase() === 'fillable')
|
||||
const isReadonlyMode = computed(() => props.mode.toLowerCase() === 'readonly')
|
||||
|
||||
const tableRef = ref()
|
||||
|
||||
const emit = defineEmits(['item-dragged', 'item-dropped'])
|
||||
|
||||
const reportStore = useReportStore()
|
||||
@@ -37,6 +51,8 @@ const isLoading = ref(true)
|
||||
const columns = computed(() => {
|
||||
if (!isFillableMode.value) return baseColumns
|
||||
|
||||
const newColumns = []
|
||||
|
||||
const dragColumn = {
|
||||
title: '',
|
||||
key: 'drag',
|
||||
@@ -59,7 +75,46 @@ const columns = computed(() => {
|
||||
)
|
||||
}
|
||||
|
||||
return [dragColumn, ...baseColumns]
|
||||
const removeColumn = {
|
||||
title: '',
|
||||
key: 'remove',
|
||||
render: (row) => h(
|
||||
NButton,
|
||||
{
|
||||
text: true,
|
||||
onClick: () => {
|
||||
alert('message')
|
||||
}
|
||||
},
|
||||
[
|
||||
'Снять с наблюдения'
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
if (props.isDraggable) newColumns.push(dragColumn)
|
||||
newColumns.push(...baseColumns)
|
||||
if (props.isRemovable) newColumns.push(removeColumn)
|
||||
|
||||
if (props.status === 'emergency') {
|
||||
const operationColumn = {
|
||||
title: 'Операции',
|
||||
key: 'operations',
|
||||
render: (row) => row.operations.length ?
|
||||
h(
|
||||
NText,
|
||||
{},
|
||||
[
|
||||
row.operations.map(itm => {
|
||||
return `${itm.code}; `
|
||||
})
|
||||
]
|
||||
) : h('div', {}, '-')
|
||||
}
|
||||
newColumns.push(operationColumn)
|
||||
}
|
||||
|
||||
return newColumns
|
||||
})
|
||||
|
||||
const handleDragStart = (e, row) => {
|
||||
@@ -108,9 +163,12 @@ const handleDrop = (e) => {
|
||||
|
||||
const fetchPatients = async () => {
|
||||
isLoading.value = true
|
||||
await axios.post('/api/mis/patients', {
|
||||
status: props.status
|
||||
}).then((res) => {
|
||||
const data = {
|
||||
status: props.status,
|
||||
startAt: reportStore.timestampCurrentRange[0],
|
||||
endAt: reportStore.timestampCurrentRange[1],
|
||||
}
|
||||
await axios.post('/api/mis/patients', data).then((res) => {
|
||||
patientsData.value[props.status] = res.data
|
||||
}).finally(() => {
|
||||
isLoading.value = false
|
||||
@@ -118,19 +176,35 @@ const fetchPatients = async () => {
|
||||
}
|
||||
|
||||
function rowProps(row) {
|
||||
const style = []
|
||||
const classes = []
|
||||
|
||||
style.push(props.isDraggable ? 'cursor: grab;' : 'cursor: arrow;')
|
||||
|
||||
if (props.accentIds.length) {
|
||||
console.log(props.accentIds.includes(row.id))
|
||||
if (props.accentIds.includes(row.id)) {
|
||||
style.push('--n-merged-td-color: #047857')
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
draggable: true,
|
||||
style: 'cursor: grab;',
|
||||
draggable: props.isDraggable,
|
||||
style: style,
|
||||
onDragstart: (e) => {
|
||||
if (!props.isDraggable) return
|
||||
handleDragStart(e, row)
|
||||
},
|
||||
onDragend: (e) => {
|
||||
if (!props.isDraggable) return
|
||||
handleDragEnd(e)
|
||||
},
|
||||
onDragover: (e) => {
|
||||
if (!props.isDraggable) return
|
||||
handleDragOver(e)
|
||||
},
|
||||
onDrop: (e) => {
|
||||
if (!props.isDraggable) return
|
||||
handleDrop(e)
|
||||
}
|
||||
}
|
||||
@@ -143,6 +217,7 @@ onMounted(async () => {
|
||||
|
||||
<template>
|
||||
<NDataTable :columns="columns"
|
||||
ref="tableRef"
|
||||
:data="patientsData[status]"
|
||||
size="small"
|
||||
@drop="handleDrop"
|
||||
|
||||
50
resources/js/Pages/Report/Components/UnwantedEventModal.vue
Normal file
50
resources/js/Pages/Report/Components/UnwantedEventModal.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<script setup>
|
||||
import {NModal, NForm, NFormItem, NInput, NFlex, NButton} from 'naive-ui'
|
||||
import {useForm} from "@inertiajs/vue3";
|
||||
import {useReportStore} from "../../../Stores/report.js";
|
||||
import {ref} from "vue";
|
||||
const open = defineModel('open')
|
||||
|
||||
const reportStore = useReportStore()
|
||||
const formRef = ref()
|
||||
const rules = {
|
||||
comment: {
|
||||
required: true,
|
||||
message: 'Заполните этот блок',
|
||||
trigger: 'blur'
|
||||
}
|
||||
}
|
||||
|
||||
const onSubmit = () => {
|
||||
formRef.value?.validate((errors) => {
|
||||
if (!errors) {
|
||||
open.value = false
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NModal v-model:show="open" title="Нежелательное событие" preset="card" class="max-w-xl">
|
||||
<NForm ref="formRef" :model="reportStore.reportForm" :rules="rules">
|
||||
<NFormItem :show-label="false" path="comment">
|
||||
<NInput type="textarea" :rows="8" v-model:value="reportStore.reportForm.comment" />
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
|
||||
<template #action>
|
||||
<NFlex align="center" justify="end">
|
||||
<NButton type="primary" tertiary @click="onSubmit">
|
||||
Сохранить
|
||||
</NButton>
|
||||
</NFlex>
|
||||
</template>
|
||||
</NModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user