import{d as D,p as t,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-b2b3c6c4.js";import{E as te,__tla as ie}from"./el-image-viewer-b5664270.js";import{u as se,__tla as re}from"./useMessage-a5edbb0f.js";let q,de=Promise.all([(()=>{try{return le}catch{}})(),(()=>{try{return ie}catch{}})(),(()=>{try{return re}catch{}})()]).then(async()=>{let f,v,y,h,b,k,w,z,x;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"],z=f(()=>s("span",null,"\u5220\u9664",-1)),x={class:"el-upload__tip"},q=D({name:"UploadImgs",__name:"UploadImgs",props:{modelValue:{type:Array,required:!0},updateUrl:t.string.def("https://zxpt.newfeifan.cn/admin-api/infra/file/upload"),drag:t.bool.def(!0),disabled:t.bool.def(!1),limit:t.number.def(5),fileSize:t.number.def(5),fileType:t.array.def(["image/jpeg","image/png","image/gif"]),height:t.string.def("150px"),width:t.string.def("150px"),borderradius:t.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()}),i=u([]);K(()=>n.modelValue,a=>{a&&(i.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",i.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=te;return _(),$("div",v,[p(M,{"file-list":c(i),"onUpdate:fileList":l[1]||(l[1]=d=>N(i)?i.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,i.value=i.value.filter(V=>V.url!==o.url||V.name!==o.name),void C("update:modelValue",i.value);var o}},[p(r,{icon:"ep:delete"}),z],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",x,[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};
