import{d as q,p as t,r as T,cq as D,co as F,cp as M,o as s,c as l,i as d,w as A,a as n,W as P,g as p,aF as V,bo as L,F as O,t as f,a2 as r,aO as G,n as H,v as J,__tla as K}from"./index-b2b3c6c4.js";import{c as N,__tla as Q}from"./index-677601df.js";import{u as R,__tla as X}from"./useMessage-a5edbb0f.js";let B,Y=Promise.all([(()=>{try{return K}catch{}})(),(()=>{try{return Q}catch{}})(),(()=>{try{return X}catch{}})()]).then(async()=>{let _,g,h,y,v,b,k;_={class:"upload-box"},g=["src"],h={key:0},y={key:0},v={key:0},b={key:1,class:"upload-empty"},k={class:"el-upload__tip"},B=q({name:"UploadImg",__name:"SPuUploadImg",props:{modelValue:t.string.def(""),updateUrl:t.string.def("https://zxpt.newfeifan.cn/admin-api/infra/file/upload"),drag:t.bool.def(!0),disabled:t.bool.def(!1),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"),showDelete:t.bool.def(!0),showBtnText:t.bool.def(!0)},emits:["update:modelValue"],setup(e,{emit:C}){const u=e,{t:m}=H(),c=R(),w=T("id-"+D()),x=C,S=()=>{x("update:modelValue","")},U=T({Authorization:"Bearer "+F(),"tenant-id":M()}),$=()=>{const a=document.querySelector(`#${w.value} .el-upload__input`);a&&a.dispatchEvent(new MouseEvent("click"))},E=a=>{const i=a.size/1024/1024<u.fileSize,o=u.fileType;return o.includes(a.type)||c.notifyWarning("\u4E0A\u4F20\u56FE\u7247\u4E0D\u7B26\u5408\u6240\u9700\u7684\u683C\u5F0F\uFF01"),i||c.notifyWarning(`\u4E0A\u4F20\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${u.fileSize}M\uFF01`),o.includes(a.type)&&i},I=a=>{c.success("\u4E0A\u4F20\u6210\u529F"),x("update:modelValue",a.data)},W=()=>{c.notifyError("\u56FE\u7247\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u60A8\u91CD\u65B0\u4E0A\u4F20\uFF01")};return(a,i)=>{const o=J,j=L;return s(),l("div",_,[d(j,{id:n(w),accept:e.fileType.join(","),action:e.updateUrl,"before-upload":E,class:P(["upload",e.drag?"no-border":""]),drag:e.drag,headers:n(U),multiple:!1,"on-error":W,"on-success":I,"show-file-list":!1},{default:A(()=>[e.modelValue?(s(),l(O,{key:0},[p("img",{src:e.modelValue,class:"upload-image"},null,8,g),p("div",{class:"upload-handle",onClick:i[1]||(i[1]=G(()=>{},["stop"]))},[e.disabled?r("",!0):(s(),l("div",{key:0,class:"handle-icon",onClick:$},[d(o,{icon:"ep:edit"}),e.showBtnText?(s(),l("span",h,f(n(m)("action.edit")),1)):r("",!0)])),p("div",{class:"handle-icon",onClick:i[0]||(i[0]=Z=>{return z=e.modelValue,void N({zIndex:9999999,urlList:[z]});var z})},[d(o,{icon:"ep:zoom-in"}),e.showBtnText?(s(),l("span",y,f(n(m)("action.detail")),1)):r("",!0)]),e.showDelete&&!e.disabled?(s(),l("div",{key:1,class:"handle-icon",onClick:S},[d(o,{icon:"ep:delete"}),e.showBtnText?(s(),l("span",v,f(n(m)("action.del")),1)):r("",!0)])):r("",!0)])],64)):(s(),l("div",b,[V(a.$slots,"empty",{},()=>[d(o,{icon:"ep:plus"})],!0)]))]),_:3},8,["id","accept","action","class","drag","headers"]),p("div",k,[V(a.$slots,"tip",{},void 0,!0)])])}}})});export{B as _,Y as __tla};
