import{_ as B,d as b,n as r,e_ as j,cb as E,r as i,o as x,A as C,y as l,e as h,h as I,H as U,cm as d,e$ as k,f0 as w}from"./index.js";const y=b({__name:"img-upload",emits:["change"],setup(A,{emit:m}){const p=m,c=["image/png","image/jpg","image/bmp","image/jpeg"],o=r([]),t=r([]),g=j(),f=E(),_=({type:a,size:e})=>{if(!c.includes(a))return d.error("\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247"),!1;if(e/1024/1024>1)return d.error("\u56FE\u7247\u5927\u5C0F\u8D85\u8FC71M"),!1},v=async({file:a})=>{const e=new FormData;e.append("img",a),e.append("token",g.token);const{message:s,code:n,data:u}=await k(e);f({message:s,code:n,handler:()=>{t.value.push(w+"/"+u[0].url),p("change",t.value.join(","))}})},F=a=>{const e=o.value.findIndex(({uid:s})=>s===a.uid);return t.value.splice(e,1),p("change",t.value.join(",")),!0};return(a,e)=>{const s=i("el-button"),n=i("el-upload");return x(),C(n,{"file-list":o.value,"onUpdate:fileList":e[0]||(e[0]=u=>o.value=u),"before-upload":_,"http-request":v,"before-remove":F,multiple:""},{tip:l(()=>e[2]||(e[2]=[h("div",{class:"el-upload__tip"},"\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247",-1)])),default:l(()=>[I(s,{type:"primary"},{default:l(()=>e[1]||(e[1]=[U("\u4E0A\u4F20\u56FE\u7247")])),_:1})]),_:1},8,["file-list"])}}});var R=B(y,[["__file","D:/work/jiesuan/settle-vue3/src/views/InvoiceSales/refund/components/approval-process/img-upload.vue"]]);export{R as default};
