import{i as H,L as A}from"./echarts.72dc8373.js";import{T as D}from"./index.05a2d588.js";import{g as J}from"./api.0c2b52c8.js";import{c as O}from"./dropdowndisable.88660b16.js";import{c as B,d as L,b as m}from"./enum.e566fd6e.js";import{u as K}from"./index.ad3efb29.js";import{r as n,B as Q,j as X,w as Y,k,ai as I,aq as Z,P as $,o as ee,c as ae,U as v,O as M,a as x,u as R,D as T}from"./vue.adf17aba.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.4833989a.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:z}){const U=K();let r=n();n();const b=n(),d=n(!0),c=Q("dateRange");let t=n(B[0].value),o=n(L[2].value);X(async()=>{r=H(b.value),window.addEventListener("resize",f),setTimeout(()=>{f()},0),await j(),q()});let g=null;async function h(){return g=await J({startDate:c.value[0],endDate:c.value[1],profileId:U.profile.profile_id}),g.data}let i=null,y=null,_,w,C,S;async function j(){y=await h(),i=y,_=i.map(e=>e.ACOS),w=i.map(e=>e.Spend),C=i.map(e=>e.Classification);const a={asin:"商品"};S=C.map(e=>a[e]),d.value=!1}n();let s;function E(a){t.value=a,V()}function G(a){o.value=a,V()}function V(){const a=i.map(l=>l[t.value]),e=i.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,r.setOption(s)}Y(c,async()=>{if(c.value){d.value=!0;const a=await h();N(a),d.value=!1}});function N(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,r.setOption(s)}const P=k(()=>O(B,o.value,t.value)),W=k(()=>O(L,t.value,o.value));function q(){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 A(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 A(0,0,0,1,[{offset:0,color:"#f19a37"},{offset:.5,color:"#f7b96c"},{offset:1,color:"rgb(234, 207, 135)"}]),borderRadius:[6,6,6,6]}}]},r.setOption(s),f()}function f(){r.resize()}return z({resizeChart:f}),(a,e)=>{const l=I("el-col"),u=I("el-row"),F=Z("loading");return $((ee(),ae("div",null,[v(u,{gutter:5},{default:M(()=>[v(l,{span:24},{default:M(()=>[x("div",te,[oe,v(D,{modelValue:R(t),"onUpdate:modelValue":e[0]||(e[0]=p=>T(t)?t.value=p:t=p),options:P.value,onChange:E,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),se,v(D,{modelValue:R(o),"onUpdate:modelValue":e[1]||(e[1]=p=>T(o)?o.value=p:o=p),options:W.value,onChange:G,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})])),[[F,d.value]])}}},xe=le;export{xe as default};
