1 |
- import{i as X,L as O}from"./echarts.72dc8373.js";import{T as S}from"./index.05a2d588.js";import{g as F}from"./api.b3a5bd9c.js";import{c as V}from"./dropdowndisable.88660b16.js";import{c as B,d as L,b as m}from"./enum.e566fd6e.js";import{u as J}from"./index.34b03be2.js";import{r as i,B as K,j as Q,w as Y,k,ai as I,aq as Z,P as $,o as ee,c as ae,U as v,O as R,a as x,u as M,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),ve={__name:"adStruct",setup(le,{expose:E}){const z=J();let r=i();i();const b=i(),c=i(!0),d=K("dateRange");let t=i(B[0].value),o=i(L[2].value);Q(async()=>{r=X(b.value),window.addEventListener("resize",f),setTimeout(()=>{f()},0),await P(),q()});let g=null;async function h(){return g=await F({startDate:d.value[0],endDate:d.value[1],profileId:z.profile.profile_id}),g.data}let n=null,y=null,_,w,A,C;async function P(){y=await h(),n=y,_=n.map(e=>e.ACOS),w=n.map(e=>e.Spend),A=n.map(e=>e.Classification);const a={BROAD:"关键词-广泛",category:"品类",EXACT:"关键词-精准",asin:"商品",PHRASE:"关键词-词组","close-match":"紧密匹配","loose-match":"广泛匹配",substitutes:"同类商品",complements:"关联商品"};C=A.map(e=>a[e]),c.value=!1}i();let s;function U(a){t.value=a,D()}function j(a){o.value=a,D()}function D(){const a=n.map(l=>l[t.value]),e=n.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(d,async()=>{if(d.value){c.value=!0;const a=await h();G(a),c.value=!1}});function G(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 N=k(()=>V(B,o.value,t.value)),W=k(()=>V(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:C}],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 O(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 O(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 E({resizeChart:f}),(a,e)=>{const l=I("el-col"),u=I("el-row"),H=Z("loading");return $((ee(),ae("div",null,[v(u,{gutter:5},{default:R(()=>[v(l,{span:24},{default:R(()=>[x("div",te,[oe,v(S,{modelValue:M(t),"onUpdate:modelValue":e[0]||(e[0]=p=>T(t)?t.value=p:t=p),options:N.value,onChange:U,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),se,v(S,{modelValue:M(o),"onUpdate:modelValue":e[1]||(e[1]=p=>T(o)?o.value=p:o=p),options:W.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})])),[[H,c.value]])}}};export{ve as default};
|