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