import{h as M,i as L,j as O,k as j}from"./api.f4ace24c.js";import{u as F}from"./columns.c1b3552e.js";import B from"./index.a9d9b3fe.js";import{m as H}from"./enum.75055dcb.js";import I from"./index.0d02d330.js";import{S as T}from"./index.c3716782.js";import{d as U,r as o,Z as W,ai as D,o as q,c as R,U as r,O as i,a as g,u,H as A,K,am as Q,T as h,S as Z}from"./vue.adf17aba.js";import{_ as $}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.ad3efb29.js";import"./elementPlus.4833989a.js";import"./echarts.72dc8373.js";import"./tools.cdecb49f.js";const G={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"}},V=U({__name:"monthlyComparativeData",setup(ee){const _=o(null),s=o({}),v=o({}),S=o({taskIds:s,monthCurrentDate:v}),y=o([]),f=o([]),C=o(null),b=o(null),t=W({border:"inner",height:800,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}),x={pageChange({currentPage:e,pageSize:l}){t.pagerConfig&&(t.pagerConfig.currentPage=e,t.pagerConfig.pageSize=l,d(s.value))}};async function d(e,l=!1){l&&(t.pagerConfig.currentPage=1);try{t.loading=!0;const a=await j({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 m=new Set;a.data.forEach(c=>{Object.keys(c).forEach(p=>{(p.includes("的销售额")||p.includes("的周销售额"))&&m.add(p)})});const n=Array.from(m).map(c=>({field:c,title:c,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,s.value&&Object.keys(s.value).length>0&&d(s.value,!0)};function N(e){_.value&&(s.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 w=()=>({fontSize:"12px",fontWeight:"600",padding:0}),z=()=>({fontSize:"12px"}),P=()=>({padding:0,height:"50px"});return(e,l)=>{const a=D("el-card"),m=D("vxe-grid");return q(),R("div",G,[r(a,{"body-style":"padding: 10px",class:"mb-3.5 mt-3.5"},{default:i(()=>[g("div",J,[r(T,{ref_key:"selectorRef",ref:_,"onUpdate:updateData":N},null,512),r(B,{onMonthDateChange:E})])]),_:1}),r(a,null,{default:i(()=>[r(I,{"fetch-line-month":u(M),"fetch-line-week":u(L),fetchLine:u(O),metricEnum:u(H),query:S.value},null,8,["fetch-line-month","fetch-line-week","fetchLine","metricEnum","query"])]),_:1}),r(a,{class:"mt-3"},{default:i(()=>[A(e.$slots,"table-header",{},void 0,!0),r(m,K({"cell-style":w,"header-cell-style":z},t,Q(x),{"row-style":P}),{platformNumber_default:i(({row:n})=>[g("div",X,h(n.platformNumber),1)]),platformName_default:i(({row:n})=>[g("div",Y,h(n.platformName),1)]),brandName_default:i(({row:n})=>[Z(h(n.brandName),1)]),_:1},16)]),_:3})])}}});const de=$(V,[["__scopeId","data-v-74f8dd81"]]);export{de as default};
