import{d as M,f as P,h as L,i as B,u as F}from"./columns.969164d6.js";import I from"./index.f3462343.js";import{m as O}from"./enum.227ba7b1.js";import j from"./index.0520ab3a.js";import{S as W}from"./index.405f4f89.js";import{d as q,r as o,Q as H,a9 as D,o as Q,c as R,M as r,G as s,a as g,u,y as T,B as U,ac as A,L as h,K as G}from"./vue.6daa721c.js";import{_ as K}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.ae7ce77b.js";import"./elementPlus.346c766a.js";import"./echarts.72dc8373.js";import"./tools.95a26331.js";const $={class:"px-3.5"},J={class:"custom-card-style flex gap-1.5 justify-between my-1.5 mx-2",style:{display:"flex","align-items":"center"}},X={class:"font-semibold"},Y={class:"font-semibold",style:{color:"#164285"}},Z=q({__name:"monthlyComparativeData",setup(V){const _=o(null),i=o({}),v=o({}),x=o({taskIds:i,monthCurrentDate:v}),y=o([]),f=o([]),C=o(null),b=o(null),t=H({border:"inner",height:900,align:null,round:!0,loading:!1,id:"monthlyCustomStorage",customConfig:{storage:{visible:!0}},columnConfig:{isCurrent:!0,resizable:!0},rowConfig:{isHover:!0},pagerConfig:{enabled:!0,total:20,currentPage:1,pageSize:20,pageSizes:[10,20,30]},toolbarConfig:{custom:!0,zoom:{iconIn:"vxe-icon-fullscreen",iconOut:"vxe-icon-minimize"}},columns:y,data:f}),S={pageChange({currentPage:e,pageSize:l}){t.pagerConfig&&(t.pagerConfig.currentPage=e,t.pagerConfig.pageSize=l,d(props.taskIds))}};async function d(e,l=!1){l&&(t.pagerConfig.currentPage=1);try{t.loading=!0;const a=await B({page:t.pagerConfig.currentPage,limit:t.pagerConfig.pageSize,task_ids:e,month_start_date:C.value,month_end_date:b.value});if(a.data&&a.data.length>0){f.value=a.data,t.pagerConfig.total=a.total;const c=new Set;a.data.forEach(m=>{Object.keys(m).forEach(p=>{(p.includes("的销售额")||p.includes("的周销售额"))&&c.add(p)})});const n=Array.from(c).map(m=>({field:m,title:m,minWidth:120,align:"center",formatter:k}));y.value=[...F,...n]}else f.value=[],t.pagerConfig.total=0}catch(a){console.error("Error fetching data:",a)}finally{t.loading=!1}}const E=e=>{v.value=e,C.value=e.startDate,b.value=e.endDate,i.value&&Object.keys(i.value).length>0&&d(i.value,!0)};function N(e){_.value&&(i.value=e.value,d(e.value,!0))}function k({cellValue:e}){return e==null||e===""?"--":typeof e=="number"?new Intl.NumberFormat("en-US",{minimumFractionDigits:2}).format(e):e}const z=()=>({fontSize:"12px",fontWeight:"500"}),w=()=>({fontSize:"12px"});return(e,l)=>{const a=D("el-card"),c=D("vxe-grid");return Q(),R("div",$,[r(a,{"body-style":"padding: 10px",class:"mb-3.5 mt-3.5"},{default:s(()=>[g("div",J,[r(W,{ref_key:"selectorRef",ref:_,"onUpdate:updateData":N},null,512),r(I,{onMonthDateChange:E})])]),_:1}),r(a,null,{default:s(()=>[r(j,{"fetch-line-month":u(M),"fetch-line-week":u(P),fetchLine:u(L),metricEnum:u(O),query:x.value},null,8,["fetch-line-month","fetch-line-week","fetchLine","metricEnum","query"])]),_:1}),r(a,{class:"mt-3"},{default:s(()=>[T(e.$slots,"table-header",{},void 0,!0),r(c,U({"cell-style":z,"header-cell-style":w},t,A(S)),{platformNumber_default:s(({row:n})=>[g("div",X,h(n.platformNumber),1)]),platformName_default:s(({row:n})=>[g("div",Y,h(n.platformName),1)]),brandName_default:s(({row:n})=>[G(h(n.brandName),1)]),_:1},16)]),_:3})])}}});const ue=K(Z,[["__scopeId","data-v-03a4c2ec"]]);export{ue as default};
