Добавил строку с итогами
Рефакторинг контроллера статистики
This commit is contained in:
@@ -36,6 +36,10 @@ const columns = ref([
|
||||
}, h(NText, { style: 'font-weight: 600;' }, row.groupName))
|
||||
}
|
||||
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.department)
|
||||
}
|
||||
|
||||
// Получаем текущие query параметры
|
||||
const { url } = usePage()
|
||||
const currentUrl = new URL(url, window.location.origin)
|
||||
@@ -64,7 +68,14 @@ const columns = ref([
|
||||
key: 'beds',
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.beds)
|
||||
} else {
|
||||
return h(NText, { }, row.beds)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Поступило',
|
||||
@@ -76,28 +87,56 @@ const columns = ref([
|
||||
key: 'recipients.all',
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.recipients.all)
|
||||
} else {
|
||||
return h(NText, { }, row.recipients.all)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'План',
|
||||
key: 'recipients.plan',
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.recipients.plan)
|
||||
} else {
|
||||
return h(NText, { }, row.recipients.plan)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Экстр',
|
||||
key: 'recipients.emergency',
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.recipients.emergency)
|
||||
} else {
|
||||
return h(NText, { }, row.recipients.emergency)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Перевод',
|
||||
key: 'recipients.transferred',
|
||||
width: 84,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.recipients.transferred)
|
||||
} else {
|
||||
return h(NText, { }, row.recipients.transferred)
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -106,21 +145,42 @@ const columns = ref([
|
||||
key: 'outcome',
|
||||
width: 84,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.outcome)
|
||||
} else {
|
||||
return h(NText, { }, row.outcome)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Состоит',
|
||||
key: 'consist',
|
||||
width: 84,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.consist)
|
||||
} else {
|
||||
return h(NText, { }, row.consist)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '% загруженности',
|
||||
key: 'percentLoadedBeds',
|
||||
width: 84,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.percentLoadedBeds)
|
||||
} else {
|
||||
return h(NText, { }, row.percentLoadedBeds)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Операции',
|
||||
@@ -132,14 +192,28 @@ const columns = ref([
|
||||
key: 'surgical.emergency',
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.surgical.emergency)
|
||||
} else {
|
||||
return h(NText, { }, row.surgical.emergency)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'П',
|
||||
key: 'surgical.plan',
|
||||
width: 60,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.surgical.plan)
|
||||
} else {
|
||||
return h(NText, { }, row.surgical.plan)
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -148,7 +222,14 @@ const columns = ref([
|
||||
key: 'deceased',
|
||||
width: 84,
|
||||
titleAlign: 'center',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
render: (row) => {
|
||||
if (row.isTotalRow) {
|
||||
return h(NText, { style: 'font-weight: 600;' }, row.deceased)
|
||||
} else {
|
||||
return h(NText, { }, row.deceased)
|
||||
}
|
||||
}
|
||||
},
|
||||
])
|
||||
|
||||
@@ -156,6 +237,9 @@ const rowProps = (row) => {
|
||||
if (row.isGroupHeader) return {
|
||||
style: `--n-merged-td-color: var(--n-merged-th-color)`
|
||||
}
|
||||
if (row.isTotalRow) return {
|
||||
style: `--n-merged-td-color: var(--n-merged-th-color); --n-text-color: var(--n-th-icon-color-active);`
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user