import{d as D,B as z,Z as B,r as g,A as T,w as A,ai as d,aq as O,P as w,o as U,M as j,O as S,a as n,U as r,u as F,V as x}from"./vue.adf17aba.js";import{a as I}from"./elementPlus.4833989a.js";import{a as L}from"./api.3f733443.js";import{i as R}from"./echarts.72dc8373.js";import{e as V}from"./emitter.bff31cdd.js";const q={class:"flex gap-5 mb-4 justify-center"},k=n("span",{class:"font-medium mr-0.5"},"层级 ",-1),N=n("span",{class:"font-medium mr-0.5"},"搜索词 ",-1),W={class:"w-full",style:{"min-height":"500px"}},$={class:"no-data-message",style:{"min-height":"500px"}},G=D({__name:"IndicatorFunnel",setup(E){const i=z("filter"),l=B({layerSelect:"all_asin",searchTermInp:""}),p=g(!1),f=g(null);let e=null,s=null;const m=g(!0);T(()=>{V.all.clear(),s&&s.disconnect(),e&&(e.dispose(),e=null)}),V.on("QueryCondition-sendRequest",()=>{_()}),A(i.value,()=>{l.layerSelect=i.value.layerType});async function _(){p.value=!0;const c={date_start:i.value.reportDate[0],date_end:i.value.reportDate[1],report_range:i.value.reportType,layer_type:l.layerSelect};(l.layerSelect==="asin_view"||l.layerSelect==="brand_view")&&(c[l.layerSelect.split("_")[0]]=i.value.variable);try{const t=await L(c);if(!t.data||Object.keys(t.data).length===0){m.value=!1,e&&e.clear();return}m.value=!0;const o=t.data,v=Object.entries(o).filter(([a])=>a.endsWith("log2")).map(([a,h])=>{const y=a.replace("_Total_Countlog2","").charAt(0).toUpperCase()+a.replace("_Total_Countlog2","").slice(1).toLowerCase(),u=a.replace("log2","");return{value:h,name:y,originalValue:o[u]}});C({title:{text:"购买旅程漏斗图"},tooltip:{trigger:"item",formatter:function(a){return`${a.name}: ${a.data.originalValue.toLocaleString()}`}},series:[{type:"funnel",left:"10%",top:50,bottom:0,width:"80%",min:0,max:100,minSize:"0%",maxSize:"100%",sort:"descending",gap:2,labelLine:{length:10,lineStyle:{width:1,type:"solid"}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{fontSize:20}},data:v}]})}catch(t){console.error("==Error==",t)}finally{p.value=!1}}function C(c){e||(e=R(f.value)),e.setOption(c),s||(s=new ResizeObserver(()=>{e==null||e.resize()}),s.observe(f.value))}return(c,t)=>{const o=d("el-option"),v=d("el-select"),b=d("el-input"),a=d("el-empty"),h=d("el-card"),y=O("loading");return w((U(),j(h,{shadow:"never",class:"mt-5"},{default:S(()=>[n("div",q,[n("div",null,[k,r(v,{modelValue:l.layerSelect,"onUpdate:modelValue":t[0]||(t[0]=u=>l.layerSelect=u),onChange:_,style:{width:"130px"}},{default:S(()=>[r(o,{label:"Asin View",value:"asin_view"}),r(o,{label:"Brand View",value:"brand_view"}),r(o,{label:"All Asin",value:"all_asin"}),r(o,{label:"All Brand",value:"all_brand"})]),_:1},8,["modelValue"])]),n("div",null,[N,r(b,{modelValue:l.searchTermInp,"onUpdate:modelValue":t[1]||(t[1]=u=>l.searchTermInp=u),"prefix-icon":F(I),onChange:_,style:{width:"200px"}},null,8,["modelValue","prefix-icon"])])]),n("div",W,[w(n("div",$,[r(a,{"image-size":300})],512),[[x,!p.value&&!m.value]]),w(n("div",{ref_key:"chartRef",ref:f,style:{width:"100%",height:"500px"}},null,512),[[x,m.value]])])]),_:1})),[[y,p.value]])}}});export{G as _};
