import{i as Z,L as V}from"./echarts.72dc8373.js";import{ay as k,r as u,j as q,w as $,k as B,ai as E,aq as ee,P as ae,o as te,c as oe,U as h,O as M,a as x,u as R,D as G}from"./vue.adf17aba.js";import{c as I}from"./dropdowndisable.88660b16.js";import{T as P}from"./index.05a2d588.js";import{r as s,u as ne,a as re}from"./index.ad3efb29.js";import{c as j,d as U,b as v}from"./enum.e566fd6e.js";const l="/api/ad_manage/sbkeywords/";function ve(e){return s({url:l+"list/",method:"get",params:e})}function xe(e){return s({url:l,method:"post",data:e})}function ye(e){return s({url:l+e.id+"/",method:"put",data:e})}function _e(e){return s({url:l+e+"/",method:"delete",data:{id:e}})}function De(e){return s({url:l+"total/",method:"GET",params:e})}function we(e){return e.dateRangeType="D",s({url:l+"daily/",method:"GET",params:e})}function Oe(e){return e.dateRangeType="W",s({url:l+"daily/",method:"GET",params:e})}function Ae(e){return e.dateRangeType="M",s({url:l+"daily/",method:"GET",params:e})}function se(e){return s({url:l+"structure/",method:"GET",params:e})}const le={style:{"margin-left":"45%"}},ie=x("span",{style:{background:"#3a83f7",width:"18px",height:"10px","margin-top":"8px",display:"inline-block","border-radius":"3px"}},null,-1),ue=x("span",{style:{background:"#f19a37",width:"18px",height:"10px","margin-top":"8px","margin-left":"20px",display:"inline-block","border-radius":"3px"}},null,-1),de={__name:"adStruct",setup(e,{expose:z}){const y=ne(),W=re(),{dateRange:m}=k(W);k(y);let p=u();u();const _=u(),b=u(!0);let o=u(j[0].value),n=u(U[2].value);q(async()=>{p=Z(_.value),window.addEventListener("resize",g),setTimeout(()=>{g()},0),await H(),Q()});let D=null;async function w(){return D=await se({startDate:m.value[0],endDate:m.value[1],profileId:y.profile.profile_id}),D.data}let d=null,O=null,A,S,T,C;async function H(){O=await w(),d=O,A=d.map(a=>a.ACOS),S=d.map(a=>a.Spend),T=d.map(a=>a.matchType);const t={BROAD:"关键词-广泛",THEME:"主题",EXACT:"关键词-精准",PHRASE:"关键词-词组"};C=T.map(a=>t[a]),b.value=!1}u();let r;function N(t){o.value=t,L()}function X(t){n.value=t,L()}function L(){const t=d.map(i=>i[o.value]),a=d.map(i=>i[n.value]);r.series[0].data=t,r.series[1].data=a,r.series[0].name=v[o.value]||o.value,r.series[1].name=v[n.value]||n.value,p.setOption(r)}$(m,async()=>{if(m.value){b.value=!0;const t=await w();F(t),b.value=!1}});function F(t){const a=t.map(c=>c[o.value]),i=t.map(c=>c[n.value]);r.series[0].data=a,r.series[1].data=i,p.setOption(r)}const J=B(()=>I(j,n.value,o.value)),K=B(()=>I(U,o.value,n.value));function Q(){r={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:C}],yAxis:[{type:"value",axisLine:{show:!0,lineStyle:{color:"#3a83f7"}}},{type:"value",splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:"#f19a37"}}}],series:[{name:v[o.value],type:"bar",barWidth:"3%",data:A,yAxisIndex:0,itemStyle:{color:new V(0,0,0,1,[{offset:0,color:"#3a83f7"},{offset:.5,color:"#5a9ef4"},{offset:1,color:"#8ab6f1"}]),borderRadius:[4,4,4,4]}},{name:v[n.value],type:"bar",barWidth:"3%",data:S,yAxisIndex:1,itemStyle:{color:new V(0,0,0,1,[{offset:0,color:"#f19a37"},{offset:.5,color:"#f7b96c"},{offset:1,color:"rgb(234, 207, 135)"}]),borderRadius:[4,4,4,4]}}]},p.setOption(r),g()}function g(){p.resize()}return z({resizeChart:g}),(t,a)=>{const i=E("el-col"),c=E("el-row"),Y=ee("loading");return ae((te(),oe("div",null,[h(c,{gutter:5},{default:M(()=>[h(i,{span:24},{default:M(()=>[x("div",le,[ie,h(P,{modelValue:R(o),"onUpdate:modelValue":a[0]||(a[0]=f=>G(o)?o.value=f:o=f),options:J.value,onChange:N,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),ue,h(P,{modelValue:R(n),"onUpdate:modelValue":a[1]||(a[1]=f=>G(n)?n.value=f:n=f),options:K.value,onChange:X,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"])]),x("div",{ref_key:"bar",ref:_,style:{height:"400px"}},null,512)]),_:1})]),_:1})])),[[Y,b.value]])}}},pe=de,Se=Object.freeze(Object.defineProperty({__proto__:null,default:pe},Symbol.toStringTag,{value:"Module"}));export{xe as A,_e as D,ve as G,ye as U,we as a,Ae as b,Oe as c,pe as d,Se as e,De as g};
