import{d as D,p as i,cr as G,r as u,co as H,cp as J,aP as K,o as _,c as $,i as p,w as j,a as c,y as N,W as Q,g as s,aF as S,l as R,a2 as T,ca as m,bo as X,aO as Y,v as Z,ac as ee,ad as ae,__tla as le}from"./index-2c56227b.js";import{E as ie,__tla as te}from"./el-image-viewer-da1b6008.js";import{u as se,__tla as re}from"./useMessage-96878a4a.js";let q,de=Promise.all([(()=>{try{return le}catch{}})(),(()=>{try{return te}catch{}})(),(()=>{try{return re}catch{}})()]).then(async()=>{let f,v,y,h,b,k,w,x,z;f=e=>(ee("data-v-9d666400"),e=e(),ae(),e),v={class:"upload-box"},y={class:"upload-empty"},h=["src"],b=["onClick"],k=f(()=>s("span",null,"\u67E5\u770B",-1)),w=["onClick"],x=f(()=>s("span",null,"\u5220\u9664",-1)),z={class:"el-upload__tip"},q=D({name:"UploadImgs",__name:"UploadImgs",props:{modelValue:{type:Array,required:!0},updateUrl:i.string.def("http://10.0.5.227:8002/admin-api/infra/file/upload"),drag:i.bool.def(!0),disabled:i.bool.def(!1),limit:i.number.def(5),fileSize:i.number.def(5),fileType:i.array.def(["image/jpeg","image/png","image/gif"]),height:i.string.def("150px"),width:i.string.def("150px"),borderradius:i.string.def("8px")},emits:["update:modelValue"],setup(e,{emit:A}){G(a=>({"9d666400-borderradius":e.borderradius,"9d666400-width":e.width,"9d666400-height":e.height}));const I=se(),n=e,P=u({Authorization:"Bearer "+H(),"tenant-id":J()}),t=u([]);K(()=>n.modelValue,a=>{a&&(t.value=a)},{deep:!0,immediate:!0});const B=a=>{const l=a.size/1024/1024<n.fileSize,r=n.fileType;return r.includes(a.type)||m({title:"\u6E29\u99A8\u63D0\u793A",message:"\u4E0A\u4F20\u56FE\u7247\u4E0D\u7B26\u5408\u6240\u9700\u7684\u683C\u5F0F\uFF01",type:"warning"}),l||m({title:"\u6E29\u99A8\u63D0\u793A",message:`\u4E0A\u4F20\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${n.fileSize}M\uFF01`,type:"warning"}),r.includes(a.type)&&l},C=A,E=(a,l)=>{a&&(l.url=a.data,C("update:modelValue",t.value),I.success("\u4E0A\u4F20\u6210\u529F"))},F=()=>{m({title:"\u6E29\u99A8\u63D0\u793A",message:"\u56FE\u7247\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u60A8\u91CD\u65B0\u4E0A\u4F20\uFF01",type:"error"})},L=()=>{m({title:"\u6E29\u99A8\u63D0\u793A",message:`\u5F53\u524D\u6700\u591A\u53EA\u80FD\u4E0A\u4F20 ${n.limit} \u5F20\u56FE\u7247\uFF0C\u8BF7\u79FB\u9664\u540E\u4E0A\u4F20\uFF01`,type:"warning"})},U=u(""),g=u(!1);return(a,l)=>{const r=Z,M=X,O=ie;return _(),$("div",v,[p(M,{"file-list":c(t),"onUpdate:fileList":l[1]||(l[1]=d=>N(t)?t.value=d:null),accept:e.fileType.join(","),action:e.updateUrl,"before-upload":B,class:Q(["upload",e.drag?"no-border":""]),drag:e.drag,headers:c(P),limit:e.limit,multiple:!0,"on-error":F,"on-exceed":L,"on-success":E,"list-type":"picture-card"},{file:j(({file:d})=>[s("img",{src:d.url,class:"upload-image"},null,8,h),s("div",{class:"upload-handle",onClick:l[0]||(l[0]=Y(()=>{},["stop"]))},[s("div",{class:"handle-icon",onClick:W=>{return o=d,U.value=o.url,void(g.value=!0);var o}},[p(r,{icon:"ep:zoom-in"}),k],8,b),e.disabled?T("",!0):(_(),$("div",{key:0,class:"handle-icon",onClick:W=>{return o=d,t.value=t.value.filter(V=>V.url!==o.url||V.name!==o.name),void C("update:modelValue",t.value);var o}},[p(r,{icon:"ep:delete"}),x],8,w))])]),default:j(()=>[s("div",y,[S(a.$slots,"empty",{},()=>[p(r,{icon:"ep:plus"})],!0)])]),_:3},8,["file-list","accept","action","class","drag","headers","limit"]),s("div",z,[S(a.$slots,"tip",{},void 0,!0)]),c(g)?(_(),R(O,{key:0,"url-list":[c(U)],onClose:l[2]||(l[2]=d=>g.value=!1)},null,8,["url-list"])):T("",!0)])}}})});export{q as _,de as __tla};
