import{i as F,L as A}from"./echarts.72dc8373.js";import{T as D}from"./index.8a84e60c.js";import{g as J}from"./api.89728bf9.js";import{c as O}from"./dropdowndisable.88660b16.js";import{c as B,d as L,b as m}from"./enum.b537673d.js";import{u as K}from"./index.0d411246.js";import{r as n,q as Q,j as X,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.3f733908.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.0e5067e4.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 G=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=F(b.value),window.addEventListener("resize",f),setTimeout(()=>{f()},0),await j(),H()});let g=null;async function h(){return g=await J({startDate:c.value[0],endDate:c.value[1],profileId:G.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 N(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();U(a),d.value=!1}});function U(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 W=k(()=>O(B,o.value,t.value)),q=k(()=>O(L,t.value,o.value));function H(){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"),P=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:W.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:q.value,onChange:N,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})])),[[P,d.value]])}}},xe=le;export{xe as default};
