* добавлены операции и услуги операций
* добавлена выборка и подсчет по датам для роли зав. * переключатель ролей * выбор отделений для роли зав.
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user