mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 00:47:19 +08:00
2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
var E=Object.defineProperty,B=Object.defineProperties;var S=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var b=(a,e,t)=>e in a?E(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,w=(a,e)=>{for(var t in e||(e={}))V.call(e,t)&&b(a,t,e[t]);if(x)for(var t of x(e))z.call(e,t)&&b(a,t,e[t]);return a},y=(a,e)=>B(a,S(e));import{u as f,w as K}from"./xlsx-xf2utV5S.js";import{d as N,c as A,w as i,e as u,f as j,g as $,h as d,i as p,u as g}from"./index-BQLilEpU.js";const F={class:"font-medium"},J={class:"h-[25rem] mt-3"},q=N({name:"Excel",__name:"excel",setup(a){const e=(s=10,n="column-",r)=>Array.from({length:s}).map((l,o)=>y(w({},r),{key:`${n}${o}`,dataKey:`${n}${o}`,title:`Column ${o}`,width:150})),t=(s,n=200,r="row-")=>Array.from({length:n}).map((l,o)=>s.reduce((c,_,h)=>(c[_.dataKey]=`Row ${o} - Col ${h}`,c),{id:`${r}${o}`,parentId:null})),m=e(10),k=t(m,1e3),C=()=>{const s=k.map(o=>{const c=[];return m.forEach(_=>{c.push(o[_.dataKey])}),c}),n=[];m.forEach(o=>{n.push(o.title)}),s.unshift(n);const r=f.aoa_to_sheet(s),l=f.book_new();f.book_append_sheet(l,r,"数据报表"),K(l,"tableV2.xlsx")};return(s,n)=>{const r=u("el-link"),l=u("el-button"),o=u("el-table-v2"),c=u("el-auto-resizer"),_=u("el-card");return j(),A(_,{shadow:"never"},{header:i(()=>[$("div",F,[d(" 导出Excel( "),p(r,{href:"https://github.com/SheetJS/sheetjs",target:"_blank",style:{margin:"0 5px 4px 0","font-size":"16px"}},{default:i(()=>[d(" github地址 ")]),_:1}),d(" ) ")])]),default:i(()=>[p(l,{type:"primary",onClick:C},{default:i(()=>[d("导出Excel")]),_:1}),$("div",J,[p(c,null,{default:i(({height:h,width:v})=>[p(o,{columns:g(m),data:g(k),width:v,height:h,fixed:""},null,8,["columns","data","width","height"])]),_:1})])]),_:1})}}});export{q as default};
|