Правка процент-бейджа

This commit is contained in:
Brusnitsyn
2026-07-06 13:58:56 +00:00
parent 84a6d8e7c4
commit 040c83c4d1

View File

@@ -43,6 +43,13 @@ const typePlan = computed(() => {
if (props.plan.debt_from_year > 10) return 'warning' if (props.plan.debt_from_year > 10) return 'warning'
return 'success' return 'success'
}) })
// % выполнения плана именно за выбранный период (не с начала года)
const periodPercent = computed(() => {
const planForPeriod = Number(props.plan?.period_plan ?? 0)
if (!planForPeriod) return 0
return Math.round((Number(props.value) * 100) / planForPeriod)
})
</script> </script>
<template> <template>
@@ -71,13 +78,13 @@ const typePlan = computed(() => {
:arrow="false" :arrow="false"
> >
<template #trigger> <template #trigger>
<NTag :type="percentType(plan.cumulative_percent)" <NTag :type="percentType(periodPercent)"
round round
:bordered="false" :bordered="false"
size="tiny" size="tiny"
class="absolute! -right-1.5 bottom-2.5 text-xs" class="absolute! -right-1.5 bottom-2.5 text-xs"
> >
{{ plan.cumulative_percent }}% {{ periodPercent }}%
</NTag> </NTag>
</template> </template>
<NSpace vertical> <NSpace vertical>