1 |
- import{i as J,L as C}from"./echarts.72dc8373.js";import{T as O}from"./index.4dc9403e.js";import{g as K}from"./api.a1d75185.js";import{c as B}from"./dropdowndisable.88660b16.js";import{c as L,d as k,b as f}from"./enum.b537673d.js";import{u as Q,a as X}from"./index.5ce19447.js";import{al as I,r,j as Y,w as Z,k as M,a9 as R,af as $,H as ee,o as ae,c as te,M as m,G as T,a as v,u as z,t as G}from"./vue.65d9dadc.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./elementPlus.ff7602ba.js";const oe={style:{"margin-left":"45%"}},se=v("span",{style:{background:"#3a83f7",width:"18px",height:"10px","margin-top":"8px",display:"inline-block","border-radius":"3px"}},null,-1),le=v("span",{style:{background:"#f19a37",width:"18px",height:"10px","margin-top":"8px","margin-left":"20px",display:"inline-block","border-radius":"3px"}},null,-1),re={__name:"adStruct",setup(ne){const x=Q(),E=X(),{dateRange:d}=I(E);I(x);let i=r();r();const g=r(),c=r(!0);let t=r(L[0].value),o=r(k[2].value);Y(async()=>{i=J(g.value),window.addEventListener("resize",b),setTimeout(()=>{b()},0),console.log(1111),await N(),q()});let h=null;async function y(){return h=await K({startDate:d.value[0],endDate:d.value[1],profileId:x.profile.profile_id}),h.data}let n=null,_=null,w,D,S,V;async function N(){_=await y(),n=_,w=n.map(e=>e.ACOS),D=n.map(e=>e.Spend),S=n.map(e=>e.placement);const a={top:"首页",rest_of_search:"其他页面",product_page:"产品页面"};V=S.map(e=>a[e]),c.value=!1}r();let s;function P(a){t.value=a,A()}function U(a){o.value=a,A()}function A(){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=f[t.value]||t.value,s.series[1].name=f[o.value]||o.value,i.setOption(s)}Z(d,async()=>{if(d.value){c.value=!0;const a=await y();W(a),c.value=!1}});function W(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 j=M(()=>B(L,o.value,t.value)),H=M(()=>B(k,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:V}],yAxis:[{type:"value",axisLine:{show:!0,lineStyle:{color:"#3a83f7"}}},{type:"value",splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:"#f19a37"}}}],series:[{name:f[t.value],type:"bar",barWidth:"3%",data:w,yAxisIndex:0,itemStyle:{color:new C(0,0,0,1,[{offset:0,color:"#3a83f7"},{offset:1,color:"rgb(111, 209, 206)"}]),borderRadius:[6,6,6,6]}},{name:f[o.value],type:"bar",barWidth:"3%",data:D,yAxisIndex:1,itemStyle:{color:new C(0,0,0,1,[{offset:0,color:"#f19a37"},{offset:1,color:"rgb(234,207,135)"}]),borderRadius:[6,6,6,6]}}]},i.setOption(s),b()}function b(){i.resize()}return(a,e)=>{const l=R("el-col"),u=R("el-row"),F=$("loading");return ee((ae(),te("div",null,[m(u,{gutter:5},{default:T(()=>[m(l,{span:24},{default:T(()=>[v("div",oe,[se,m(O,{modelValue:z(t),"onUpdate:modelValue":e[0]||(e[0]=p=>G(t)?t.value=p:t=p),options:j.value,onChange:P,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"]),le,m(O,{modelValue:z(o),"onUpdate:modelValue":e[1]||(e[1]=p=>G(o)?o.value=p:o=p),options:H.value,onChange:U,style:{"margin-top":"5px","margin-left":"8px"}},null,8,["modelValue","options"])]),v("div",{ref_key:"bar",ref:g,style:{height:"400px"}},null,512)]),_:1})]),_:1})])),[[F,c.value]])}}},xe=re;export{xe as default};
|