import{i as v,L as h}from"./echarts.72dc8373.js";import{a as w}from"./api.e246f1ff.js";import{p as g}from"./index.ad3efb29.js";import{d as _,r as c,k as x,j as b,A as L,w as z,ai as C,aq as k,P as q,o as B,M as S,O as A,a as O}from"./vue.adf17aba.js";const E=_({__name:"lineChart",props:{query:{}},setup(l){const a=l,s=c();let e;const o=c(!0),d=x(()=>g(a.query)),r=()=>{e.resize()},u=()=>{window.addEventListener("resize",r)},p=()=>{window.removeEventListener("resize",r)};b(()=>{u(),setTimeout(()=>{f()},0)}),L(()=>{e&&(e.dispose(),e=null),p()});const f=async()=>{e=v(s.value);const t={dataset:{source:[]},tooltip:{trigger:"axis",axisPointer:{label:{backgroundColor:"#6a7985"}}},grid:{top:30,bottom:30,left:30,right:30},xAxis:{type:"category"},yAxis:{type:"value",name:"预算",axisLine:{show:!0,lineStyle:{color:"#0085ff"}}},series:[{type:"line",encode:{x:"date",y:"campaignBudgetAmount"},smooth:!0,symbol:"circle",symbolSize:4,lineStyle:{width:2},itemStyle:{color:"#0085ff",borderColor:"#0085ff"},areaStyle:{color:new h(0,0,0,1,[{offset:0,color:"#0085ff93"},{offset:1,color:"#0085ff03"}])}}]},n=await i();t.dataset.source=n,e.setOption(t),o.value=!1},i=async()=>(await w(d.value)).data;return z(a.query,async()=>{o.value=!0;const t=await i();e.setOption({dataset:{source:t}}),o.value=!1},{deep:!0}),(t,n)=>{const m=C("el-card"),y=k("loading");return q((B(),S(m,{shadow:"never",style:{"margin-bottom":"5px","border-radius":"0"}},{default:A(()=>[O("div",{style:{height:"350px"},ref_key:"chartRef",ref:s},null,512)]),_:1})),[[y,o.value]])}}});export{E as _};
