import{d as W,ac as i,bU as G,r as u,bB as H,bC as J,aM as K,o as _,c as T,f as p,w as $,a as c,l as N,T as O,g as t,aC as j,x as Q,a0 as I,bz as m,bD as X,aL as Y,j as Z,p as ee,k as ae,__tla as le}from"./index-8dc1e40a.js";import{E as ie,__tla as se}from"./el-image-viewer-3b8905e6.js";import{u as te,__tla as re}from"./useMessage-7a27dd80.js";let S,de=Promise.all([(()=>{try{return le}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return re}catch{}})()]).then(async()=>{let f,v,y,h,b,k,z,w,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(()=>t("span",null,"\u67E5\u770B",-1)),z=["onClick"],w=f(()=>t("span",null,"\u5220\u9664",-1)),x={class:"el-upload__tip"},S=W({name:"UploadImgs",__name:"UploadImgs",props:{modelValue:{type:Array,required:!0},updateUrl:i.string.def("https://zxpt.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}){G(a=>({"9d666400-borderradius":e.borderradius,"9d666400-width":e.width,"9d666400-height":e.height}));const B=te(),o=e,L=u({Authorization:"Bearer "+H(),"tenant-id":J()}),s=u([]);K(()=>o.modelValue,a=>{a&&(s.value=a)},{deep:!0,immediate:!0});const M=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),B.success("\u4E0A\u4F20\u6210\u529F"))},D=()=>{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"})},U=u(""),g=u(!1);return(a,l)=>{const r=Z,F=X,P=ie;return _(),T("div",v,[p(F,{"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":M,class:O(["upload",e.drag?"no-border":""]),drag:e.drag,headers:c(L),limit:e.limit,multiple:!0,"on-error":D,"on-exceed":E,"on-success":q,"list-type":"picture-card"},{file:$(({file:d})=>[t("img",{src:d.url,class:"upload-image"},null,8,h),t("div",{class:"upload-handle",onClick:l[0]||(l[0]=Y(()=>{},["stop"]))},[t("div",{class:"handle-icon",onClick:R=>{return n=d,U.value=n.url,void(g.value=!0);var n}},[p(r,{icon:"ep:zoom-in"}),k],8,b),e.disabled?I("",!0):(_(),T("div",{key:0,class:"handle-icon",onClick:R=>{return n=d,s.value=s.value.filter(V=>V.url!==n.url||V.name!==n.name),void C("update:modelValue",s.value);var n}},[p(r,{icon:"ep:delete"}),w],8,z))])]),default:$(()=>[t("div",y,[j(a.$slots,"empty",{},()=>[p(r,{icon:"ep:plus"})],!0)])]),_:3},8,["file-list","accept","action","class","drag","headers","limit"]),t("div",x,[j(a.$slots,"tip",{},void 0,!0)]),c(g)?(_(),Q(P,{key:0,"url-list":[c(U)],onClose:l[2]||(l[2]=d=>g.value=!1)},null,8,["url-list"])):I("",!0)])}}})});export{S as _,de as __tla};
