import{d as P,f as L,h as B,i as F,u as I}from"./columns.e88b63a5.js";import O from"./index.18a1f378.js";import{m as j}from"./enum.29527124.js";import W from"./index.ffdc3966.js";import{S as q}from"./index.e6e9769c.js";import{d as H,r as o,Q,a9 as D,o as R,c as T,M as r,G as s,a as g,u,y as U,B as A,ac as G,L as h,K}from"./vue.65d9dadc.js";import{_ as $}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.373e4c1e.js";import"./elementPlus.c5b0e04f.js";import"./echarts.72dc8373.js";import"./tools.41e79328.js";const J={class:"px-3.5"},X={class:"custom-card-style flex gap-1.5 justify-between my-1.5 mx-2",style:{display:"flex","align-items":"center"}},Y={class:"font-semibold"},Z={class:"font-semibold",style:{color:"#164285"}},V=H({__name:"monthlyComparativeData",setup(ee){const _=o(null),i=o({}),v=o({}),x=o({taskIds:i,monthCurrentDate:v}),y=o([]),d=o([]),C=o(null),b=o(null),t=Q({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:d}),S={pageChange({currentPage:e,pageSize:l}){t.pagerConfig&&(t.pagerConfig.currentPage=e,t.pagerConfig.pageSize=l,f(props.taskIds))}};async function f(e,l=!1){l&&(t.pagerConfig.currentPage=1);try{t.loading=!0;const a=await F({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){d.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=[...I,...n]}else d.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&&f(i.value,!0)};function N(e){_.value&&(i.value=e.value,f(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 w=()=>({fontSize:"12px",fontWeight:"600",padding:0}),z=()=>({fontSize:"12px"}),M=()=>({padding:0,height:"50px"});return(e,l)=>{const a=D("el-card"),c=D("vxe-grid");return R(),T("div",J,[r(a,{"body-style":"padding: 10px",class:"mb-3.5 mt-3.5"},{default:s(()=>[g("div",X,[r(q,{ref_key:"selectorRef",ref:_,"onUpdate:updateData":N},null,512),r(O,{onMonthDateChange:E})])]),_:1}),r(a,null,{default:s(()=>[r(W,{"fetch-line-month":u(P),"fetch-line-week":u(L),fetchLine:u(B),metricEnum:u(j),query:x.value},null,8,["fetch-line-month","fetch-line-week","fetchLine","metricEnum","query"])]),_:1}),r(a,{class:"mt-3"},{default:s(()=>[U(e.$slots,"table-header",{},void 0,!0),r(c,A({"cell-style":w,"header-cell-style":z},t,G(S),{"row-style":M}),{platformNumber_default:s(({row:n})=>[g("div",Y,h(n.platformNumber),1)]),platformName_default:s(({row:n})=>[g("div",Z,h(n.platformName),1)]),brandName_default:s(({row:n})=>[K(h(n.brandName),1)]),_:1},16)]),_:3})])}}});const de=$(V,[["__scopeId","data-v-dc0fd006"]]);export{de as default};
