import{_ as F,d as b,E as r,bE as h,aI as B,x as i,o as E,N as j,K as l,y as x,W as C,b as I,aS as c,bF as U,bG as k}from"./index.743f0c80.js";const w=C("\u4E0A\u4F20\u56FE\u7247"),y=I("div",{class:"el-upload__tip"},"\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247",-1),D=b({__name:"img-upload",emits:["change"],setup(N,{emit:p}){const d=["image/png","image/jpg","image/bmp","image/jpeg"],t=r([]),s=r([]),m=h(),_=B(),g=({type:a,size:e})=>{if(!d.includes(a))return c.error("\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247"),!1;if(e/1024/1024>1)return c.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:o,code:n,data:u}=await U(e);_({message:o,code:n,handler:()=>{s.value.push(k+"/"+u[0].url),p("change",s.value.join(","))}})},v=a=>{const e=t.value.findIndex(({uid:o})=>o===a.uid);return s.value.splice(e,1),p("change",s.value.join(",")),!0};return(a,e)=>{const o=i("el-button"),n=i("el-upload");return E(),j(n,{"file-list":t.value,"onUpdate:file-list":e[0]||(e[0]=u=>t.value=u),"before-upload":g,"http-request":f,"before-remove":v,multiple:""},{tip:l(()=>[y]),default:l(()=>[x(o,{type:"primary"},{default:l(()=>[w]),_:1})]),_:1},8,["file-list"])}}});var S=F(D,[["__file","D:/work/accout-vue3-ui/src/views/InvoiceSales/refund/components/approval-process/img-upload.vue"]]);export{S as default};