import{d as G,ah as i,bD as H,r as u,bj as J,bk as K,L as N,o as _,c as V,f as p,w as $,a as c,P as O,$ as R,g as t,aD as S,v as W,Q as L,bg as m,bl as X,aS as Y,j as Z,p as ee,k as ae,__tla as le}from"./index-04f8d540.js";import{E as ie,__tla as se}from"./el-image-viewer-5878bd7a.js";import{u as te,__tla as re}from"./useMessage-9c37e840.js";let T,de=Promise.all([(()=>{try{return le}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return re}catch{}})()]).then(async()=>{let f,h,v,y,b,k,w,x,z;f=e=>(ee("data-v-9d666400"),e=e(),ae(),e),h={class:"upload-box"},v={class:"upload-empty"},y=["src"],b=["onClick"],k=f(()=>t("span",null,"\u67E5\u770B",-1)),w=["onClick"],x=f(()=>t("span",null,"\u5220\u9664",-1)),z={class:"el-upload__tip"},T=G({name:"UploadImgs",__name:"UploadImgs",props:{modelValue:{type:Array,required:!0},updateUrl:i.string.def("https://zxsh.newfeifan.cn/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}){H(a=>({"9d666400-borderradius":e.borderradius,"9d666400-width":e.width,"9d666400-height":e.height}));const D=te(),o=e,I=u({Authorization:"Bearer "+J(),"tenant-id":K()}),s=u([]);N(()=>o.modelValue,a=>{a&&(s.value=a)},{deep:!0,immediate:!0});const P=a=>{const l=a.size/1024/1024<o.fileSize,r=o.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 ${o.fileSize}M\uFF01`,type:"warning"}),r.includes(a.type)&&l},C=A,q=(a,l)=>{a&&(l.url=a.data,C("update:modelValue",s.value),D.success("\u4E0A\u4F20\u6210\u529F"))},B=()=>{m({title:"\u6E29\u99A8\u63D0\u793A",message:"\u56FE\u7247\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u60A8\u91CD\u65B0\u4E0A\u4F20\uFF01",type:"error"})},E=()=>{m({title:"\u6E29\u99A8\u63D0\u793A",message:`\u5F53\u524D\u6700\u591A\u53EA\u80FD\u4E0A\u4F20 ${o.limit} \u5F20\u56FE\u7247\uFF0C\u8BF7\u79FB\u9664\u540E\u4E0A\u4F20\uFF01`,type:"warning"})},j=u(""),g=u(!1);return(a,l)=>{const r=Z,M=X,Q=ie;return _(),V("div",h,[p(M,{"file-list":c(s),"onUpdate:fileList":l[1]||(l[1]=d=>O(s)?s.value=d:null),accept:e.fileType.join(","),action:e.updateUrl,"before-upload":P,class:R(["upload",e.drag?"no-border":""]),drag:e.drag,headers:c(I),limit:e.limit,multiple:!0,"on-error":B,"on-exceed":E,"on-success":q,"list-type":"picture-card"},{file:$(({file:d})=>[t("img",{src:d.url,class:"upload-image"},null,8,y),t("div",{class:"upload-handle",onClick:l[0]||(l[0]=Y(()=>{},["stop"]))},[t("div",{class:"handle-icon",onClick:F=>{return n=d,j.value=n.url,void(g.value=!0);var n}},[p(r,{icon:"ep:zoom-in"}),k],8,b),e.disabled?L("",!0):(_(),V("div",{key:0,class:"handle-icon",onClick:F=>{return n=d,s.value=s.value.filter(U=>U.url!==n.url||U.name!==n.name),void C("update:modelValue",s.value);var n}},[p(r,{icon:"ep:delete"}),x],8,w))])]),default:$(()=>[t("div",v,[S(a.$slots,"empty",{},()=>[p(r,{icon:"ep:plus"})],!0)])]),_:3},8,["file-list","accept","action","class","drag","headers","limit"]),t("div",z,[S(a.$slots,"tip",{},void 0,!0)]),c(g)?(_(),W(Q,{key:0,"url-list":[c(j)],onClose:l[2]||(l[2]=d=>g.value=!1)},null,8,["url-list"])):L("",!0)])}}})});export{T as _,de as __tla};
