import { useRouter } from 'vue-router'
import apiDataEDB from '@/api/dataEDB'
export function useToHistoryPage(){
    const router=useRouter()
    async function toHistoryPage(edbId){
        if(!edbId) return

        //改为传code获取溯源 改的地方太多了在这里直接获取code算了
        const {Ret,Data} = await apiDataEDB.getBaseEdbInfo({EdbInfoId: edbId})
        if(Ret!==200) return

        const routerEl = router.resolve({
            path:'/dataEDB/history',
            query:{
                code: Data.UniqueCode
            }
        })
        window.open(routerEl.href,'_blank')
    }
    return { toHistoryPage }
}