// 复制指标数据 import apiDataEDB from '@/api/dataEDB' import apiDataPredictEDB from '@/api/dataPredictEDB' import { showToast } from 'vant' import { copyText } from 'vue3-clipboard' export function useCopyEdbData(){ async function copyData(e){ const params={ PageSize: 100000, CurrentIndex: 1, EdbInfoId:e.EdbInfoId } const res=params.EdbInfoCategoryType===1?await apiDataPredictEDB.edbDataList(params):await apiDataEDB.edbDataList(params) if(res.Ret===200){ const arr=res.Data.Item.DataList || []; let str = '日期\t 值\n'; arr.forEach((item) => (str += `${item.DataTime}\t${item.Value}\n`)); copyText(str,undefined,(error,event)=>{ if(error){ showToast('复制失败') }else{ showToast('复制成功') } }) } } return { copyData } }