import{_ as K,__tla as D}from"./Dialog-44c9fa34.js";import{d as L,Q as P,r as s,o as Q,A as R,B as r,f as _,a as e,E as p,a2 as b,C as d,c_ as S,c$ as $,bi as q,K as G,__tla as H}from"./index-92ad187a.js";import{u as J,__tla as M}from"./useMessage-d9788660.js";let F,N=Promise.all([(()=>{try{return D}catch{}})(),(()=>{try{return H}catch{}})(),(()=>{try{return M}catch{}})()]).then(async()=>{let m,f,v;m=d("i",{class:"el-icon-upload"},null,-1),f=d("div",{class:"el-upload__text"},[p(" \u5C06\u6587\u4EF6\u62D6\u5230\u6B64\u5904\uFF0C\u6216 "),d("em",null,"\u70B9\u51FB\u4E0A\u4F20")],-1),v=d("div",{class:"el-upload__tip",style:{color:"red"}}," \u63D0\u793A\uFF1A\u4EC5\u5141\u8BB8\u5BFC\u5165 jpg\u3001png\u3001gif \u683C\u5F0F\u6587\u4EF6\uFF01 ",-1),F=L({name:"InfraFileForm",__name:"FileForm",emits:["success"],setup(O,{expose:x,emit:k}){const{t:C}=P(),i=J(),l=s(!1),o=s(!1),h=s(),n=s([]),g=s({path:""}),u=s();x({open:async()=>{l.value=!0,U()}});const V=a=>{g.value.path=a.name},j=()=>{var a;n.value.length!=0?(h.value={Authorization:"Bearer "+S(),"tenant-id":$()},(a=e(u))==null||a.submit()):i.error("\u8BF7\u4E0A\u4F20\u6587\u4EF6")},z=k,A=()=>{var a;l.value=!1,o.value=!1,(a=e(u))==null||a.clearFiles(),i.success(C("common.createSuccess")),z("success")},B=()=>{i.error("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u60A8\u91CD\u65B0\u4E0A\u4F20\uFF01"),o.value=!1},U=()=>{var a;o.value=!1,(a=u.value)==null||a.clearFiles()},w=()=>{i.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u6587\u4EF6\uFF01")};return(a,t)=>{const E=q,y=G,I=K;return Q(),R(I,{modelValue:e(l),"onUpdate:modelValue":t[2]||(t[2]=c=>b(l)?l.value=c:null),title:"\u4E0A\u4F20\u6587\u4EF6"},{footer:r(()=>[_(y,{disabled:e(o),type:"primary",onClick:j},{default:r(()=>[p("\u786E \u5B9A")]),_:1},8,["disabled"]),_(y,{onClick:t[1]||(t[1]=c=>l.value=!1)},{default:r(()=>[p("\u53D6 \u6D88")]),_:1})]),default:r(()=>[_(E,{ref_key:"uploadRef",ref:u,"file-list":e(n),"onUpdate:fileList":t[0]||(t[0]=c=>b(n)?n.value=c:null),action:e("https://zxpt.newfeifan.cn/admin-api/infra/file/upload"),"auto-upload":!1,data:e(g),disabled:e(o),headers:e(h),limit:1,"on-change":V,"on-error":B,"on-exceed":w,"on-success":A,accept:".jpg, .png, .gif",drag:""},{tip:r(()=>[v]),default:r(()=>[m,f]),_:1},8,["file-list","action","data","disabled","headers"])]),_:1},8,["modelValue"])}}})});export{F as _,N as __tla};
