* исправил нумерацию пациентов
This commit is contained in:
@@ -231,7 +231,7 @@ const fetchPatients = async () => {
|
|||||||
endAt: reportStore.timestampCurrentRange[1],
|
endAt: reportStore.timestampCurrentRange[1],
|
||||||
}
|
}
|
||||||
await axios.post('/api/mis/patients', data).then((res) => {
|
await axios.post('/api/mis/patients', data).then((res) => {
|
||||||
patientsData.value[props.status] = res.data
|
patientsData.value[props.status] = reportStore.addRowNumbers(res.data)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
})
|
})
|
||||||
@@ -287,7 +287,7 @@ onMounted(async () => {
|
|||||||
max-height="200"
|
max-height="200"
|
||||||
min-height="200"
|
min-height="200"
|
||||||
:row-props="rowProps"
|
:row-props="rowProps"
|
||||||
:row-key="(row) => row.id"
|
:row-key="(row, index) => row.id"
|
||||||
class="text-sm!">
|
class="text-sm!">
|
||||||
</NDataTable>
|
</NDataTable>
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,18 @@ export const useReportStore = defineStore('reportStore', () => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// Функция для добавления номеров
|
||||||
|
const addRowNumbers = (data, page = 1, perPage = 15) => {
|
||||||
|
if (!Array.isArray(data)) return data
|
||||||
|
|
||||||
|
const startFrom = ((page - 1) * perPage) + 1
|
||||||
|
|
||||||
|
return data.map((item, index) => ({
|
||||||
|
...item,
|
||||||
|
num: startFrom + index
|
||||||
|
}))
|
||||||
|
|
||||||
|
}
|
||||||
const patientsData = ref({
|
const patientsData = ref({
|
||||||
plan: [],
|
plan: [],
|
||||||
emergency: [],
|
emergency: [],
|
||||||
@@ -212,5 +224,6 @@ export const useReportStore = defineStore('reportStore', () => {
|
|||||||
getReportInfo,
|
getReportInfo,
|
||||||
sendReportForm,
|
sendReportForm,
|
||||||
resetReportForm,
|
resetReportForm,
|
||||||
|
addRowNumbers,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user