import{d as P,ai as i,bK as D,r as u,b8 as F,b9 as H,M as J,o as _,c as $,g as p,w as j,a as c,Q as N,a0 as O,h as t,aG as S,x as W,R as T,b1 as m,ba as X,bb as Y,k as Z,p as ee,l as ae,__tla as le}from"./index-7d5b26d3.js";import{E as ie,__tla as se}from"./el-image-viewer-2f0c9a58.js";import{u as te,__tla as re}from"./useMessage-c81eaa5b.js";let q,de=Promise.all([(()=>{try{return le}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return re}catch{}})()]).then(async()=>{let g,h,v,y,b,k,x,w,z;g=e=>(ee("data-v-9d666400"),e=e(),ae(),e),h={class:"upload-box"},v={class:"upload-empty"},y=["src"],b=["onClick"],k=g(()=>t("span",null,"\u67E5\u770B",-1)),x=["onClick"],w=g(()=>t("span",null,"\u5220\u9664",-1)),z={class:"el-upload__tip"},q=P({name:"UploadImgs",__name:"UploadImgs",props:{modelValue:{type:Array,required:!0},updateUrl:i.string.def("https://sh.letcgo.com/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}){D(a=>({"9d666400-borderradius":e.borderradius,"9d666400-width":e.width,"9d666400-height":e.height}));const I=te(),n=e,M=u({Authorization:"Bearer "+F(),"tenant-id":H()}),s=u([]);J(()=>n.modelValue,a=>{a&&(s.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",s.value),I.success("\u4E0A\u4F20\u6210\u529F"))},G=()=>{m({title:"\u6E29\u99A8\u63D0\u793A",message:"\u56FE\u7247\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u60A8\u91CD\u65B0\u4E0A\u4F20\uFF01",type:"error"})},K=()=>{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(""),f=u(!1);return(a,l)=>{const r=Z,L=X,Q=ie;return _(),$("div",h,[p(L,{"file-list":c(s),"onUpdate:fileList":l[1]||(l[1]=d=>N(s)?s.value=d:null),accept:e.fileType.join(","),action:e.updateUrl,"before-upload":B,class:O(["upload",e.drag?"no-border":""]),drag:e.drag,headers:c(M),limit:e.limit,multiple:!0,"on-error":G,"on-exceed":K,"on-success":E,"list-type":"picture-card"},{file:j(({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:R=>{return o=d,U.value=o.url,void(f.value=!0);var o}},[p(r,{icon:"ep:zoom-in"}),k],8,b),e.disabled?T("",!0):(_(),$("div",{key:0,class:"handle-icon",onClick:R=>{return o=d,s.value=s.value.filter(V=>V.url!==o.url||V.name!==o.name),void C("update:modelValue",s.value);var o}},[p(r,{icon:"ep:delete"}),w],8,x))])]),default:j(()=>[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(f)?(_(),W(Q,{key:0,"url-list":[c(U)],onClose:l[2]||(l[2]=d=>f.value=!1)},null,8,["url-list"])):T("",!0)])}}})});export{q as _,de as __tla};
