Работа с планом

This commit is contained in:
Brusnitsyn
2026-07-06 14:56:46 +00:00
parent d1e087e4a8
commit ce6dace65c
3 changed files with 48 additions and 51 deletions

View File

@@ -15,30 +15,35 @@ const props = defineProps({
plan: {
type: Object,
default: () => ({
actual_to_date: 0,
cumulative_plan: 0,
current_mouth_dept: 0,
debt_from_year: 0,
month_plan: 0,
outcome_in_current_mouth: 0,
total_debt: 0,
year_plan: 0,
month_plan: 0,
period_plan: 0,
debt_at_period_start: 0,
cumulative_plan: 0,
debt_from_year: 0,
actual_year_to_date: 0,
cumulative_percent: 0,
})
}
})
// План за период + непогашенный долг, накопленный до начала периода
const planWithDebt = computed(() => {
return Number(props.plan?.period_plan ?? 0) + Number(props.plan?.debt_at_period_start ?? 0)
})
// % выполнения плана за период с учётом долга (иначе долг никак не влияет на оценку)
const periodPercent = computed(() => {
if (!planWithDebt.value) return 0
return Math.round((Number(props.value) * 100) / planWithDebt.value)
})
// Цвет долга с начала года (на дату конца выбранного периода)
const typePlan = computed(() => {
if (props.plan.debt_from_year > 20) return 'error'
if (props.plan.debt_from_year > 10) return 'warning'
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>
<template>
@@ -78,10 +83,9 @@ const periodPercent = computed(() => {
</template>
<NSpace vertical>
<NFlex align="center" justify="start" :wrap="false" size="small">
<NTag type="info">План / Выбывшие: {{ plan.period_plan }} / {{ value }}</NTag>
<NTag type="info">План (с долгом) / Выбывшие: {{ planWithDebt }} / {{ value }}</NTag>
</NFlex>
<NTag :type="typePlan">Долг с начала года: {{ plan.debt_from_year }}</NTag>
<!-- Долг с начала года: {{ plan.debt_from_year }}-->
</NSpace>
<!-- <br>План:-->
<!-- <span class="font-medium">{{ plan.cumulative_plan }}</span>, долг:-->