import{d as F,m as p,o as _,A as U,x as C,a as i,c as R,u as N,dd as S,_ as A,de as b,cc as D}from"./index.e80c366d.js";import{r as L,u as c}from"./xlsx.ed122d16.js";const M={key:0,class:"el-upload__text"},j=F({__name:"execl-upload",emits:["onSuccess"],setup(K,{expose:f,emit:m}){const x=p(null),n=p(null),v=e=>{const o=e.raw;!o||g(o)},g=e=>{u(e)&&h(e)},h=async e=>{const o=b.service({lock:!0,text:"Loading",background:"rgba(0, 0, 0, 0.7)"});return new Promise(a=>{const s=new FileReader;s.onload=l=>{const t=l.target.result,r=L(t,{type:"array"}),E=r.SheetNames[0],d=r.Sheets[E],B=k(d),w=c.sheet_to_json(d,{defval:""});m("onSuccess",{header:B,results:w}),o.close(),a({isok:!0})},s.readAsArrayBuffer(e)})},k=e=>{const o=[],a=c.decode_range(e["!ref"]);let s;const l=a.s.r;for(s=a.s.c;s<=a.e.c;++s){const t=e[c.encode_cell({c:s,r:l})];let r="UNKNOWN "+s;t&&t.t&&(r=c.format_cell(t)),o.push(r)}return o},u=async e=>e.size/1024<500?!0:(D.warning("\u8BF7\u4E0D\u8981\u4E0A\u4F20\u5927\u4E8E500KB\u7684\u6587\u4EF6"),!1),y=()=>n.value=null;return f({onDisplay:()=>n.value=null}),(e,o)=>(_(),U(N(S),{ref_key:"uploadRef",ref:x,action:"#",accept:".xls,.xlsx",drag:"","auto-upload":!1,onChange:v,onRemove:y,onBeforeUpload:u,multiple:""},{default:C(()=>[i(' class="execl-uploader" '),n.value?i("v-if",!0):(_(),R("div",M,"\u70B9\u51FB\u6B64\u5904,\u4E0A\u4F20\u6587\u4EF6"))]),_:1},512))}});var I=A(j,[["__scopeId","data-v-dec4647e"],["__file","C:/Users/63107/Desktop/projects/report-v3/src/components/execlUpload/src/execl-upload.vue"]]);export{I as e};
