import{i as H,L as U}from"./echarts.72dc8373.js";import{c as C}from"./dropdowndisable.88660b16.js";import{T as j}from"./index.05a2d588.js";import{u as se}from"./index.ad3efb29.js";import{g as re}from"./api.4758178e.js";import{s as F,a as G,p as N,b as y,m as ue}from"./enum.e566fd6e.js";import{r as s,B as pe,j as de,w as ce,k as O,ai as w,aq as fe,P as me,o as V,c as q,U as c,O as S,a as f,u as A,D as B,F as ve,a8 as be,M as he}from"./vue.adf17aba.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.4833989a.js";const ge={style:{"margin-left":"40%"}},_e=f("span",{style:{background:"#3a83f7",width:"18px",height:"10px","margin-top":"8px",display:"inline-block","border-radius":"3px"}},null,-1),xe=f("span",{style:{background:"#f19a37",width:"18px",height:"10px","margin-top":"8px","margin-left":"20px",display:"inline-block","border-radius":"3px"}},null,-1),ye={__name:"adStruct",setup(we,{expose:X}){const J=se();let m=s(),v=s();const D=s(),L=s(),h=s(!0),g=pe("dateRange");let i=s(N[0].value),t=s(F[0].value),l=s(G[2].value);de(async()=>{v=H(L.value),m=H(D.value),window.addEventListener("resize",x),setTimeout(()=>{x()},0),await K(),oe()});let k=null;async function M(){return k=await re({startDate:g.value[0],endDate:g.value[1],profileId:J.profile.profile_id}),k.data}let z,p,r,I,P,R,E;async function K(){r=await M(),z=[{value:r.pie_data[0].Spend,name:"品牌视频"},{value:r.pie_data[1].Spend,name:"商品集"},{value:r.pie_data[2].Spend,name:"视频"}],p=r.line_data,I=p.map(a=>a.ACOS),P=p.map(a=>a.Spend),R=p.map(a=>a.Classification);const e={BROAD:"关键词-广泛",THEME:"主题",category:"品类",EXACT:"关键词-精准",asin:"商品",PHRASE:"关键词-词组"};E=R.map(a=>e[a]),h.value=!1}let _=s(),n,d;function Q(e){i.value=e,_.value=i.value,d.series[0].data=[{value:r.pie_data[0][_.value],name:"品牌视频"},{value:r.pie_data[1][_.value],name:"商品集"},{value:r.pie_data[2][_.value],name:"视频"}],m.setOption(d)}function Y(e){t.value=e,T()}function Z(e){l.value=e,T()}function T(){const e=p.map(u=>u[t.value]),a=p.map(u=>u[l.value]);n.series[0].data=e,n.series[1].data=a,n.series[0].name=y[t.value]||t.value,n.series[1].name=y[l.value]||l.value,v.setOption(n)}ce(g,async()=>{if(g.value){h.value=!0;const e=await M();$(e),ee(e),h.value=!1}});function $(e){d.series[0].data=[{value:e.pie_data[0][i.value],name:"品牌视频"},{value:e.pie_data[1][i.value],name:"商品集"},{value:e.pie_data[2][i.value],name:"视频"}],m.setOption(d)}function ee(e){const a=e.line_data.map(b=>b[t.value]),u=e.line_data.map(b=>b[l.value]);n.series[0].data=a,n.series[1].data=u,v.setOption(n)}const ae=O(()=>C(F,l.value,t.value)),te=O(()=>C(G,t.value,l.value)),le=O(()=>C(N,i.value));function oe(){n={tooltip:{trigger:"axis",axisPointer:{type:"shadow"},rich:{b:{color:"#4C5058",fontSize:15,fontWeight:"bold",lineHeight:33}}},toolbox:{feature:{saveAsImage:{yAxisIndex:"none"}}},grid:{top:55,right:60,bottom:55,left:55},xAxis:[{type:"category",boundaryGap:!0,data:E}],yAxis:[{type:"value",axisLine:{show:!0,lineStyle:{color:"#3a83f7"}}},{type:"value",splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:"#f19a37"}}}],series:[{name:y[t.value],type:"bar",barWidth:15,data:I,yAxisIndex:0,itemStyle:{color:new U(0,0,0,1,[{offset:0,color:"#3a83f7"},{offset:.5,color:"#5a9ef4"},{offset:1,color:"#8ab6f1"}]),borderRadius:[4,4,4,4]}},{name:y[l.value],type:"bar",barWidth:15,data:P,yAxisIndex:1,itemStyle:{color:new U(0,0,0,1,[{offset:0,color:"#f19a37"},{offset:.5,color:"#f7b96c"},{offset:1,color:"rgb(234, 207, 135)"}]),borderRadius:[4,4,4,4]}}]},v.setOption(n),d={tooltip:{show:!1,trigger:"item"},series:[{type:"pie",radius:["20%","45%"],avoidLabelOverlap:!1,itemStyle:{borderWidth:1,borderColor:"#fff"},emphasis:{label:{show:!0,fontWeight:"bold"}},label:{show:!0,position:"outside",formatter:e=>e.name+`
{b|`+ue[i.value]+":}{b|"+e.data.value+`}
`+e.percent+"%",rich:{b:{color:"#4C5058",fontSize:15,fontWeight:"bold",lineHeight:33}}},labelLine:{normal:{show:!0}},data:z}]},m.setOption(d),x()}function x(){v.resize(),m.resize()}return X({resizeChart:x}),(e,a)=>{const u=w("el-option"),b=w("el-select"),W=w("el-col"),ie=w("el-row"),ne=fe("loading");return me((V(),q("div",null,[c(ie,{gutter:5},{default:S(()=>[c(W,{span:7},{default:S(()=>[f("div",null,[c(b,{modelValue:A(i),"onUpdate:modelValue":a[0]||(a[0]=o=>B(i)?i.value=o:i=o),class:"m-2",size:"small",onChange:Q,style:{width:"120px"}},{default:S(()=>[(V(!0),q(ve,null,be(le.value,o=>(V(),he(u,{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),f("div",{ref_key:"pie",ref:D,style:{height:"400px"}},null,512)]),_:1}),c(W,{span:17},{default:S(()=>[f("div",ge,[_e,c(j,{modelValue:A(t),"onUpdate:modelValue":a[1]||(a[1]=o=>B(t)?t.value=o:t=o),options:ae.value,onChange:Y,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),xe,c(j,{modelValue:A(l),"onUpdate:modelValue":a[2]||(a[2]=o=>B(l)?l.value=o:l=o),options:te.value,onChange:Z,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"])]),f("div",{ref_key:"bar",ref:L,style:{height:"400px"}},null,512)]),_:1})]),_:1})])),[[ne,h.value]])}}},Me=ye;export{Me as default};
