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