import{i as X,L as V}from"./echarts.72dc8373.js";import{c as D}from"./dropdowndisable.88660b16.js";import{T as O}from"./index.abe7750b.js";import{u as F}from"./index.ae7ce77b.js";import{g as J}from"./api.fa2a6390.js";import{c as B,d as L,b as m}from"./enum.b537673d.js";import{r as n,q as K,j as Q,w as Y,k,a9 as I,af as Z,H as $,o as ee,c as ae,M as v,G as M,a as x,u as R,t as T}from"./vue.6daa721c.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.346c766a.js";const te={style:{"margin-left":"45%"}},oe=x("span",{style:{background:"#3a83f7",width:"18px",height:"10px","margin-top":"8px",display:"inline-block","border-radius":"3px"}},null,-1),se=x("span",{style:{background:"#f19a37",width:"18px",height:"10px","margin-top":"8px","margin-left":"20px",display:"inline-block","border-radius":"3px"}},null,-1),le={__name:"adStruct",setup(ne,{expose:E}){const z=F();let i=n();n();const b=n(),c=n(!0),d=K("dateRange");let t=n(B[0].value),o=n(L[2].value);Q(async()=>{i=X(b.value),window.addEventListener("resize",f),setTimeout(()=>{f()},0),await G(),W()});let g=null;async function h(){return g=await J({profileId:z.profile.profile_id,startDate:d.value[0],endDate:d.value[1],tactic:"T00020"}),g.data}let r=null,y=null,_,w,A,S;async function G(){y=await h(),r=y.target_data,_=r.map(e=>e.ACOS),w=r.map(e=>e.Spend),A=r.map(e=>e.Name);const a={BROAD:"关键词-广泛",category:"品类",EXACT:"关键词-精准",asin:"商品",PHRASE:"关键词-词组","close-match":"紧密匹配","loose-match":"广泛匹配",substitutes:"同类商品",complements:"关联商品"};S=A.map(e=>a[e]),c.value=!1}n();let s;function N(a){t.value=a,C()}function j(a){o.value=a,C()}function C(){const a=r.map(l=>l[t.value]),e=r.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)}Y(d,async()=>{if(d.value){c.value=!0;const a=await h();H(a),c.value=!1}});function H(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 P=k(()=>D(B,o.value,t.value)),U=k(()=>D(L,t.value,o.value));function W(){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:S}],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:_,yAxisIndex:0,itemStyle:{color:new V(0,0,0,1,[{offset:0,color:"#3a83f7"},{offset:.5,color:"#5a9ef4"},{offset:1,color:"#8ab6f1"}]),borderRadius:[6,6,6,6]}},{name:m[o.value],type:"bar",barWidth:"3%",data:w,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:[6,6,6,6]}}]},i.setOption(s),f()}function f(){i.resize()}return E({resizeChart:f}),(a,e)=>{const l=I("el-col"),u=I("el-row"),q=Z("loading");return $((ee(),ae("div",null,[v(u,{gutter:5},{default:M(()=>[v(l,{span:24},{default:M(()=>[x("div",te,[oe,v(O,{modelValue:R(t),"onUpdate:modelValue":e[0]||(e[0]=p=>T(t)?t.value=p:t=p),options:P.value,onChange:N,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),se,v(O,{modelValue:R(o),"onUpdate:modelValue":e[1]||(e[1]=p=>T(o)?o.value=p:o=p),options:U.value,onChange:j,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"])]),x("div",{ref_key:"bar",ref:b,style:{height:"400px"}},null,512)]),_:1})]),_:1})])),[[q,c.value]])}}},xe=le;export{xe as default};
