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

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { getMarketCapList, getStudyList } 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 getStudyList(props.enterpriseInfo.id)
    lineData.value = data?.map(item => ({
        time: new Date(item.year, 1, 1),
        value: item.currentValue,
        type: item.type,
        unit: item.unit ?? '亿元'
    })) ?? []
}
</script>