import{E as N}from"./exceljs.min.71bead6c.js";import{g as j,h as y,r as a,o as p,j as k,w as l,b as s,s as C,U as V,a as i,c as L,F as U,D as H,e as J,N as M}from"./index.df7b46f6.js";const P=i("div",{class:"el-upload__text"},[J(" \u62D6\u62FD\u4E0A\u4F20 "),i("em",null,"\u6216\u8005\u70B9\u51FB\u4E0A\u4F20 Excel")],-1),W=j({__name:"index",setup(R){const f=y([]),h=y([]),g=(m,B)=>new Promise((x,b)=>{const o=new FileReader;o.onload=async r=>{const n=r.target.result,e=new N.Workbook;try{let c=await e.xlsx.load(n);const F=c._worksheets&&c._worksheets.filter(_=>typeof _<"u"),E=[];let u=[];F.forEach(_=>{_._rows.forEach((v,A)=>{if(A===0)v.values.forEach(t=>{u.push(t)});else{let t={},w=[];v.values.forEach(d=>{w.push(d)}),u.forEach((d,D)=>{t[d]=w[D]}),E.push(t)}})}),f.value=E,h.value=u}catch{M.error("\u89E3\u6790\u5931\u8D25")}},o.readAsArrayBuffer(m)});return(m,B)=>{const x=a("el-icon"),b=a("el-upload"),o=a("el-table-column"),r=a("el-table"),n=a("u-container-layout");return p(),k(n,{class:"m-upload-excel"},{default:l(()=>[s(b,{style:{width:"100%"},class:"upload-demo",drag:"",action:"/","before-upload":g,type:"file",accept:".xlsx, .xls"},{default:l(()=>[s(x,{class:"el-icon--upload"},{default:l(()=>[s(C(V))]),_:1}),P]),_:1}),i("div",null,[s(r,{data:f.value,border:"","highlight-current-row":"",style:{width:"100%","margin-top":"20px"}},{default:l(()=>[(p(!0),L(U,null,H(h.value,e=>(p(),k(o,{prop:e,label:e,key:e},null,8,["prop","label"]))),128))]),_:1},8,["data"])])]),_:1})}}});export{W as default};
