<script setup>
//设置图表英文名称
import {ref,onMounted, initCustomFormatter} from 'vue'
import { useRoute } from 'vue-router'
import {sameOptionType} from '@/hooks/chart/config'
import apiChart from '@/api/chart'
const route=useRoute()
const chartInfo = ref(null)
async function getChartDetail(){
    const params=sameOptionType.includes(Number(route.query.chartType))?{
        ChartInfoId:Number(route.query.id),
        DateType: '',
        StartDate: '',
        EndDate: '',
    }:{
        ChartInfoId:Number(route.query.id),
        Calendar: '公历',
        SeasonStartDate: '',
        SeasonEndDate:'' ,
    }
    const res=await apiChart.chartInfoById(params)
    if(res.Ret!==200) return
    chartInfo.value = res.Data
    initForm()
}
//表格组,第一项固定为图表名称
const formGroup = ref([
    /* {
        groupName:'图表名称',//分组名称
        formList:[{
            label:'图表名称',
            cnValue:'测试截面散点图',//中文值
            enValue:'',//英文值
        }],//需要填写的项
    } */
])

const ExtraConfig = ref({})
function initForm(){
    const {EdbInfoList} = chartInfo.value
    const {ChartName,ChartNameEn,ExtraConfig} = chartInfo.value.ChartInfo
    //第一项固定为图表名称
    formGroup.value.push({
        groupName:'图表名称',
        formList:[{
            label:'图表名称',
            cnValue:ChartName,
            enValue:ChartNameEn,
        }]
    })
    //截面散点图 chartType===10 与其他图格式不一样 保存一下额外数据
    if(Number(route.query.chartType)===10){
        ExtraConfig.value = JSON.parse(ExtraConfig)
        const {SeriesList} = ExtraConfig
        const seriesEdbInfoList = SeriesList[0].EdbInfoList //每一项的EdbInfoList是一样的,取第一项就行
        let formSeriesList = []
        let formEdbInfoList = []
        formGroup.value.push({
            groupName:'标签，系列名称',

        })
    }

    
    for(const edb in EdbInfoList){

    }
    

}
onMounted(() => {
    getChartDetail()
})
</script>

<template>
    <div class="set-name-pop-wrap">
        
    </div>
</template>

<style scoped lang="scss">
.set-name-pop-wrap{

}
</style>
