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