import{l as P,m as E}from"./api.f4ace24c.js";import{d as h,E as R}from"./elementPlus.4833989a.js";import{S as U,a as V}from"./index.c3716782.js";import{p as j}from"./columns.c1b3552e.js";import{d as B,r as u,Z as L,w as O,j as T,ai as i,o as $,c as F,U as r,O as l,a as c,H as G,K as H,am as M,T as _,S as W,aF as A,aG as K}from"./vue.adf17aba.js";import{_ as Z}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.ad3efb29.js";import"./echarts.72dc8373.js";const q=d=>(A("data-v-3cd65874"),d=d(),K(),d),J={class:"px-3.5"},Q={class:"custom-card-style flex gap-1.5 justify-between my-1.5 mx-2",style:{display:"flex","align-items":"center",height:"52px"}},X={class:"demo-date-picker"},ee={class:"block"},te=q(()=>c("span",{class:"demonstration"},"年份：",-1)),ae={class:"pr-2.5"},oe={class:"font-semibold"},ne={class:"font-semibold",style:{color:"#164285"}},se=B({__name:"planInfo",setup(d){const o=u(""),g=u(null),p=u({}),f=u([]),t=L({border:"inner",height:800,loading:!1,round:!0,editConfig:{trigger:"manual",mode:"row",showStatus:!0,autoClear:!1},columnConfig:{resizable:!0},toolbarConfig:{custom:!0,zoom:{iconIn:"vxe-icon-fullscreen",iconOut:"vxe-icon-minimize"},slots:{tools:"toolbar_tools"}},pagerConfig:{enabled:!0,total:20,currentPage:1,pageSize:20,pageSizes:[10,20,30]},columns:j,data:[]});function y(){o.value=h().format("YYYY")}const x=e=>{const a=new Date().getFullYear();return e.getFullYear()>a+1},b={pageChange({currentPage:e,pageSize:a}){t.pagerConfig&&(t.pagerConfig.currentPage=e,t.pagerConfig.pageSize=a),m()}};async function C(e){try{const a=await E({year_date:o.value,task_ids:e});f.value=a.data,f.value.platformNumber="汇总"}catch(a){console.error("Error fetching total data:",a)}}async function m(){try{t.loading=!0,await C(p.value);const e=await V({page:t.pagerConfig.currentPage,limit:t.pagerConfig.pageSize,year_date:o.value,task_ids:p.value});t.data=[f.value,...e.data],t.pagerConfig.total=e.total}catch(e){console.error("Error fetching task data:",e)}finally{t.loading=!1}}async function S(){try{t.loading=!0;const e=await P({year_date:o.value,task_ids:p.value,include_sales:1}),a=window.URL.createObjectURL(new Blob([e.data])),n=document.createElement("a");n.href=a,n.setAttribute("download","计划销售额数据.xlsx"),document.body.appendChild(n),n.click(),t.loading=!1,R.success("导出数据成功")}catch(e){console.error("导出数据失败:",e)}}function w(e){g.value&&(t.pagerConfig&&(t.pagerConfig.currentPage=1),p.value=e.value,m())}O(o,(e,a)=>{e!==a&&(o.value=h(e).format("YYYY"))});const k=e=>e.$rowIndex===0&&e.$columnIndex<5?{position:"sticky",top:0,zIndex:30,fontSize:"12px",fontWeight:"600"}:{fontSize:"12px",fontWeight:"600",padding:0},I=()=>({fontSize:"12px"}),Y=e=>e.$rowIndex===0?{background:"#def6fe",position:"sticky",top:0,zIndex:1}:{padding:0,height:"50px"};return T(()=>{y()}),(e,a)=>{const n=i("el-date-picker"),v=i("el-card"),z=i("vxe-button"),D=i("el-tooltip"),N=i("vxe-grid");return $(),F("div",J,[r(v,{"body-style":"padding: 10px",class:"mb-3.5 mt-3.5"},{default:l(()=>[c("div",Q,[r(U,{ref_key:"selectorRef",ref:g,"onUpdate:updateData":w},null,512),c("div",X,[c("div",ee,[te,r(n,{modelValue:o.value,"onUpdate:modelValue":a[0]||(a[0]=s=>o.value=s),"disabled-date":x,placeholder:"Pick a year",style:{width:"150px"},type:"year",onChange:m},null,8,["modelValue"])])])])]),_:1}),r(v,{class:"mt-3"},{default:l(()=>[G(e.$slots,"table-header",{},void 0,!0),r(N,H({ref:"xGrid","cell-style":k,"header-cell-style":I,"row-style":Y},t,M(b)),{toolbar_tools:l(()=>[c("div",ae,[r(D,{content:"下载表格",placement:"top"},{default:l(()=>[r(z,{circle:"",icon:"vxe-icon-download",onClick:S})]),_:1})])]),platformNumber_default:l(({row:s})=>[c("div",oe,_(s.platformNumber),1)]),platformName_default:l(({row:s})=>[c("div",ne,_(s.platformName),1)]),brandName_default:l(({row:s})=>[W(_(s.brandName),1)]),_:1},16)]),_:3})])}}});const me=Z(se,[["__scopeId","data-v-3cd65874"]]);export{me as default};
