<!--
 * @Author: Kane
 * @Date: 2023-03-07 23:22:13
 * @LastEditors: Kane
 * @FilePath: /task_schedule/src/components/ArchievementCompleteRateComponent.vue
 * @Description: 业绩完成率组件
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
-->
<template>
    <div class="complete-rate-wrapper">
        <el-progress type="circle" :percentage="ui.percentage">
            <template #default="{ percentage }">
                <span class="percentage-label">{{ ui.indicator }}</span>
                <span class="percentage-value">{{ percentage }}%</span>
            </template>
        </el-progress>
    </div>
</template>

<script lang="ts">
import { reactive } from "vue";
export default {
    name: "ArchievementCompleteRateComponent",
    props: {
        percentage: {
            type: String,
            require: true,
        },
        indicator: {
            type: String,
            default: "",
        },
    },
    setup(props)
    {
        const percentage = Number(props.percentage).valueOf();

        const ui = reactive({
            percentage: percentage,
            indicator: props.indicator,
        });

        return { ui, };
    },
};
</script>

<style lang="scss">
.complete-rate-wrapper {
    // display: flex;
    // flex-direction: column;
    // justify-content: center;
    // align-items: center;

    span {
        display: block;
        width: 100%;
        color: #fff;
    }

    .el-progress {
        margin: 8px;
    }

    .percentage-value {
        display: block;
        margin-top: 10px;
        font-size: 28px;
    }

    .percentage-label {
        display: block;
        margin-top: 10px;
        font-size: 12px;
    }


}
</style>