import{d as k}from"./index.36946cea.js";import{_ as b,q as D,B as t,bl as U,r,o as p,K as V,H as u,t as d,n as R,P as S,v as N,bm as q,p as w,S as i,aF as _}from"./index.10c3f8e5.js";import{u as H}from"./use-response-handle.23bba72b.js";const A={key:0,class:"el-upload__text"},j={flex:"","justify-end":"","mt-2":"","gap-2":""},I=i("\u4FDD\u5B58"),K=i("\u53D6\u6D88"),M=D({__name:"execl-upload",setup(P,{expose:m}){const o=t(!1),f=t(!1),n=t(null),a=t(null),v=H(),x=U(),h=async()=>o.value=!1,F=l=>a.value=l,B=()=>a.value=null,C=async({file:l})=>{const e=new FormData;e.append("excel",l),e.append("token",x.token);const{message:s,code:c}=await k(e);v({message:s,code:c,handler:()=>_.success("\u5BFC\u5165\u6587\u4EF6\u6210\u529F")})},g=()=>{a.value=null,n.value.clearFiles()},E=()=>{if(!a.value)return _.error("\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u4EF6");n.value.submit()};return m({onDisplay:()=>o.value=!0}),(l,e)=>{const s=r("el-button"),c=r("el-dialog");return p(),V(c,{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=y=>o.value=y),title:"\u5BFC\u5165\u8868\u683C\u6570\u636E",center:"",onClose:g},{default:u(()=>[d(N(q),{ref_key:"uploadRef",ref:n,action:"#",class:"execl-uploader",accept:".xls,.xlsx","auto-upload":!1,"http-request":C,onChange:F,onRemove:B,onSuccess:h},{default:u(()=>[a.value?S("",!0):(p(),R("div",A,"\u70B9\u51FB\u6B64\u5904,\u4E0A\u4F20\u6587\u4EF6"))]),_:1},512),w("div",j,[d(s,{type:"primary",loading:f.value,onClick:E},{default:u(()=>[I]),_:1},8,["loading"]),d(s,null,{default:u(()=>[K]),_:1})])]),_:1},8,["modelValue"])}}});var J=b(M,[["__scopeId","data-v-0e536df2"]]);export{J as default};
