1 |
- import{i as X,L as V}from"./echarts.594b4072.js";import{T as D}from"./index.c691347b.js";import{g as F}from"./api.5b72954d.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 J}from"./index.9ac6c923.js";import{r as i,p as K,d as Q,w as Y,e as k,a7 as I,af as Z,H as $,h as ee,i as ae,M as v,G as M,j as x,u as R,q as T}from"./vue.fb807239.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.fdc894a5.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(),d=i(!0),c=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 G(),W()});let g=null;async function h(){return g=await F({startDate:c.value[0],endDate:c.value[1],profileId:z.profile.profile_id}),g.data}let n=null,y=null,_,w,A,C;async function G(){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]),d.value=!1}i();let s;function j(a){t.value=a,S()}function H(a){o.value=a,S()}function S(){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(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)),U=k(()=>O(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: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 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]}}]},r.setOption(s),f()}function f(){r.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(D,{modelValue:R(t),"onUpdate:modelValue":e[0]||(e[0]=p=>T(t)?t.value=p:t=p),options:P.value,onChange:j,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:U.value,onChange:H,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,d.value]])}}};export{ve as default};
|