1 |
- import{e as Q,g as W,u as $}from"./columns.e697fcf9.js";import{a as q}from"./elementPlus.5243d764.js";import{f as J,r as l,Q as X,w as p,a7 as D,h as Y,E as Z,G as g,j as k,M as P,L as z,K as V,B as ee,aa as te}from"./vue.9083513e.js";import{_ as ae}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.e6340fb7.js";import"./echarts.594b4072.js";const oe={class:"mx-3.5"},ne={class:"font-semibold"},se={class:"font-semibold",style:{color:"#0097f8"}},re=J({__name:"mainData",props:{dayDate:Object,weekDate:Object,monthDate:Object,taskIds:Object},setup(B){const c=B,E=l([]),M=l([]),v=l(null),h=l(null),b=l(null),C=l(null),x=l(null),y=l(null),u=l(""),S=l(""),f=l(""),o=X({border:"inner",height:900,align:null,round:!0,loading:!1,columnConfig:{resizable:!0},rowConfig:{isHover:!0},pagerConfig:{enabled:!0,total:20,currentPage:1,pageSize:20,pageSizes:[10,20,30]},sortConfig:{remote:!0},toolbarConfig:{custom:!0,zoom:{iconIn:"vxe-icon-fullscreen",iconOut:"vxe-icon-minimize"},slots:{tools:"toolbar_buttons"}},columns:E,data:M}),H={pageChange({currentPage:e,pageSize:a}){o.pagerConfig&&(o.pagerConfig.currentPage=e,o.pagerConfig.pageSize=a,_(c.taskIds))}};async function _(e,a=!1){a&&(o.pagerConfig.currentPage=1);try{o.loading=!0;const t=await W({page:o.pagerConfig.currentPage,limit:o.pagerConfig.pageSize,task_ids:e,day_start_date:v.value,day_end_date:h.value,week_start_date:b.value,week_end_date:C.value,month_start_date:x.value,month_end_date:y.value,sort:S.value,order_date:u.value,date_type:f.value});if(o.data=t.data,o.pagerConfig.total=t.total,t.data&&t.data.length>0){const n=[],d=/\d{2}-\d{2}/,r=/\d{4}-\d{2}-\d{2}/,A=/\d{4}-\d{2}/,I=["~","截止","近90天平台退货率","余额"],N=new Set;t.data.forEach(s=>{for(const i in s)(d.test(i)||I.some(m=>i.includes(m)))&&N.add(i)});const O=[],F=[],j=[];N.forEach(s=>{let i=!1;s.includes("销售额")&&!s.includes("广告销售额")&&!s.includes("增长率")&&(i=!0);const m={field:s,title:s,minWidth:s.includes("~")||s.includes("截止")?90:r.test(s)?83:74,align:"center",formatter:K,sortable:i};I.some(G=>s.includes(G))?F.push(m):A.test(s)&&!r.test(s)?j.push(m):d.test(s)&&O.push(m)}),n.push(...O,...F,...j),E.value=[...$,...n]}}catch(t){console.error("Error fetching task data:",t)}finally{o.loading=!1}}function L({column:e,order:a}){S.value=a==="asc"?"smallfirst":"bigfirst";const t=e.field;if(t){const n=t.match(/(\d{4}-\d{2}-\d{2})的销售额/),d=t.match(/(\d{4}-\d{2}-\d{2})~(\d{4}-\d{2}-\d{2})的销售额/),r=t.match(/(\d{4}-\d{2})的销售额/);d?(u.value=d[1],f.value="week"):n?(u.value=n[1],f.value="day"):r&&(u.value=`${r[1]}-01`,f.value="month")}_(c.taskIds,!0)}p(()=>c.taskIds,e=>{_(e,!0)});function w(){S.value="",u.value="",f.value=""}p(()=>c.dayDate,e=>{if(e){const{dailyStartDate:a,dailyTime:t}=e;v.value=a,h.value=t}w()}),p(()=>c.weekDate,e=>{if(e){const{weekStartDate:a,weekEndDate:t}=e;b.value=a,C.value=t,_(c.taskIds)}w()}),p(()=>c.monthDate,e=>{if(e){const{startDate:a,endDate:t}=e;x.value=a,y.value=t}w()});const R=()=>({fontSize:"12px",fontWeight:"500"}),T=({column:e})=>{const a=e.field,t=/\d{2}-\d{2}/,n=/\d{4}-\d{2}-\d{2}/,d=/\d{4}-\d{2}/;return a.includes("~")||a.includes("截止")||a.includes("近90天平台退货率")||a.includes("余额")?{fontSize:"12px",backgroundColor:"#b3ced7"}:d.test(a)&&!n.test(a)?{fontSize:"12px",backgroundColor:"#8cbacc"}:t.test(a)?{fontSize:"12px",backgroundColor:"#d0dadf"}:{fontSize:"12px"}};async function U(){try{o.loading=!0;const e={page:o.pagerConfig.currentPage,limit:o.pagerConfig.pageSize,task_ids:c.taskIds,day_start_date:v.value,day_end_date:h.value,week_start_date:b.value,week_end_date:C.value,month_start_date:x.value,month_end_date:y.value},a=await Q(e),t=window.URL.createObjectURL(new Blob([a.data])),n=document.createElement("a");n.href=t,n.setAttribute("download","合并数据展示.xlsx"),document.body.appendChild(n),n.click(),o.loading=!1,q.success("导出数据成功")}catch(e){console.error("导出数据失败:",e)}}function K({cellValue:e}){return e==null||e===""?"--":typeof e=="number"?new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}).format(e):e}return(e,a)=>{const t=D("vxe-button"),n=D("el-tag"),d=D("vxe-grid");return Y(),Z(d,ee({"cell-style":R,"header-cell-style":T},o,te(H),{onSortChange:L}),{toolbar_buttons:g(()=>[k("div",oe,[P(t,{circle:"",icon:"vxe-icon-download",onClick:U})])]),platformNumber_default:g(({row:r})=>[k("div",ne,z(r.platformNumber),1)]),platformName_default:g(({row:r})=>[k("div",se,z(r.platformName),1)]),currencyCode_default:g(({row:r})=>[P(n,{color:"#fef9c3",style:{color:"#f59e0b","border-color":"#fbbf24"}},{default:g(()=>[V(z(r.currencyCode),1)]),_:2},1024)]),_:1},16)}}});const me=ae(re,[["__scopeId","data-v-624ae926"]]);export{me as default};
|