Files
onboard/resources/js/Pages/Statistic/Components/OutcomeColumn.vue
2026-07-06 14:23:15 +00:00

97 lines
3.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup>
import {NFlex, NSpace, NTag, NTooltip} from 'naive-ui'
import {percentType} from "../../../Utils/numbers.js";
import {computed} from "vue";
const props = defineProps({
isTotalRow: {
type: Boolean,
default: false
},
value: {
type: [Number, String],
default: ''
},
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,
})
}
})
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>
<NFlex align="center" justify="center" class="relative!">
<!-- <NTooltip v-if="needCompletedToPlan && !isTotalRow"-->
<!-- trigger="hover"-->
<!-- :arrow="false"-->
<!-- >-->
<!-- <template #trigger>-->
<!-- <NTag :type="typePlan(planOfYear, needCompletedToPlan)"-->
<!-- round-->
<!-- :bordered="false"-->
<!-- size="tiny"-->
<!-- class="absolute! -left-1.5 bottom-2.5 text-xs"-->
<!-- >-->
<!-- {{ needCompletedToPlan }}-->
<!-- </NTag>-->
<!-- </template>-->
<!-- Требуется выписать в текущем месяце-->
<!-- </NTooltip>-->
<div>
{{ value }}
</div>
<NTooltip v-if="plan && !isTotalRow"
trigger="hover"
:arrow="false"
>
<template #trigger>
<NTag :type="percentType(periodPercent)"
round
:bordered="false"
size="tiny"
class="absolute! -right-1.5 bottom-2.5 text-xs"
>
{{ periodPercent }}%
</NTag>
</template>
<NSpace vertical>
<NFlex align="center" justify="start" :wrap="false" size="small">
<NTag type="info">План / Выбывшие: {{ plan.period_plan }} / {{ 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>, долг:-->
<!-- <span class="font-medium">{{ plan.debt_from_year }}</span> +-->
<!-- <span class="font-medium">{{ plan.current_mouth_dept }}</span>-->
</NTooltip>
</NFlex>
</template>
<style scoped>
</style>