<template>
    <sanctions-situation :enterprise-info="enterpriseInfo" :line-data="lineData"></sanctions-situation>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { getMarketShareList } from '@/api/companyPages';
import SanctionsSituation, { LineDataItem } from './SanctionsSituation.vue';


// 定义组件属性
const props = defineProps({
    enterpriseInfo: {
        type: Object,
        default: {}
    }
});

const lineData = ref<LineDataItem[]>([])

onMounted(async () => {
    await intData()
})
async function intData() {
    const { data } = await getMarketShareList(props.enterpriseInfo.id)
    lineData.value = data?.map(item => ({
        time: new Date(item.year, 1, 1),
        value: item.value,
        unit: item.unit ?? '亿元'
    })) ?? []
}
</script>