import{i as J,L as C}from"./echarts.72dc8373.js";import{T as O}from"./index.05a2d588.js";import{g as K}from"./api.fa968e5b.js";import{c as B}from"./dropdowndisable.88660b16.js";import{c as L,d as k,b as m}from"./enum.e566fd6e.js";import{u as Q,a as X}from"./index.ad3efb29.js";import{ay as I,r,j as Y,w as Z,k as M,ai as R,aq as $,P as ee,o as ae,c as te,U as f,O as T,a as v,u as z,D as P}from"./vue.adf17aba.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.4833989a.js";const oe={style:{"margin-left":"45%"}},se=v("span",{style:{background:"#3a83f7",width:"18px",height:"10px","margin-top":"8px",display:"inline-block","border-radius":"3px"}},null,-1),le=v("span",{style:{background:"#f19a37",width:"18px",height:"10px","margin-top":"8px","margin-left":"20px",display:"inline-block","border-radius":"3px"}},null,-1),re={__name:"adStruct",setup(ne){const x=Q(),U=X(),{dateRange:d}=I(U);I(x);let i=r();r();const g=r(),c=r(!0);let t=r(L[0].value),o=r(k[2].value);Y(async()=>{i=J(g.value),window.addEventListener("resize",b),setTimeout(()=>{b()},0),console.log(1111),await E(),F()});let h=null;async function y(){return h=await K({startDate:d.value[0],endDate:d.value[1],profileId:x.profile.profile_id}),h.data}let n=null,_=null,w,D,S,V;async function E(){_=await y(),n=_,w=n.map(e=>e.ACOS),D=n.map(e=>e.Spend),S=n.map(e=>e.placement);const a={top:"首页",rest_of_search:"其他页面",product_page:"产品页面"};V=S.map(e=>a[e]),c.value=!1}r();let s;function G(a){t.value=a,A()}function N(a){o.value=a,A()}function A(){const a=n.map(l=>l[t.value]),e=n.map(l=>l[o.value]);s.series[0].data=a,s.series[1].data=e,s.series[0].name=m[t.value]||t.value,s.series[1].name=m[o.value]||o.value,i.setOption(s)}Z(d,async()=>{if(d.value){c.value=!0;const a=await y();W(a),c.value=!1}});function W(a){const e=a.map(u=>u[t.value]),l=a.map(u=>u[o.value]);s.series[0].data=e,s.series[1].data=l,i.setOption(s)}const j=M(()=>B(L,o.value,t.value)),q=M(()=>B(k,t.value,o.value));function F(){s={tooltip:{trigger:"axis",axisPointer:{type:"shadow",label:{backgroundColor:"#6a7985"}}},toolbox:{feature:{saveAsImage:{yAxisIndex:"none"}}},grid:{top:50,right:60,bottom:50,left:60},xAxis:[{type:"category",boundaryGap:!0,data:V}],yAxis:[{type:"value",axisLine:{show:!0,lineStyle:{color:"#3a83f7"}}},{type:"value",splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:"#f19a37"}}}],series:[{name:m[t.value],type:"bar",barWidth:"3%",data:w,yAxisIndex:0,itemStyle:{color:new C(0,0,0,1,[{offset:0,color:"#3a83f7"},{offset:1,color:"rgb(111, 209, 206)"}]),borderRadius:[6,6,6,6]}},{name:m[o.value],type:"bar",barWidth:"3%",data:D,yAxisIndex:1,itemStyle:{color:new C(0,0,0,1,[{offset:0,color:"#f19a37"},{offset:1,color:"rgb(234,207,135)"}]),borderRadius:[6,6,6,6]}}]},i.setOption(s),b()}function b(){i.resize()}return(a,e)=>{const l=R("el-col"),u=R("el-row"),H=$("loading");return ee((ae(),te("div",null,[f(u,{gutter:5},{default:T(()=>[f(l,{span:24},{default:T(()=>[v("div",oe,[se,f(O,{modelValue:z(t),"onUpdate:modelValue":e[0]||(e[0]=p=>P(t)?t.value=p:t=p),options:j.value,onChange:G,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),le,f(O,{modelValue:z(o),"onUpdate:modelValue":e[1]||(e[1]=p=>P(o)?o.value=p:o=p),options:q.value,onChange:N,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"])]),v("div",{ref_key:"bar",ref:g,style:{height:"400px"}},null,512)]),_:1})]),_:1})])),[[H,c.value]])}}},xe=re;export{xe as default};
