import{K as k,q as A,I}from"./index.17037962789732.js";import"./index.170379627897314.js";import"./index.170379627897315.js";import"./index.170379627897329.js";import"./index.170379627897330.js";import{T as d,L as j,B as x,o as c}from"./comm.1703796278973.js";import{d as L,k as _,r as S,o as p,c as r,a as u,b as m,u as o,t as b,M as O}from"./vue.1703796278973.js";const z=L({__name:"InputFile",props:{id:{type:String,default:""},value:{type:String,default:""}},emits:["update:value"],setup(f,{emit:i}){const s=_(f.value||void 0),n=_(!1),g=e=>{var t,a;if(e.file.status==="uploading"&&(n.value=!0),e.file.status==="done"){e.file.url=(t=e.file.response)==null?void 0:t.result,n.value=!1;const l=(a=e.file.response)==null?void 0:a.result;i("update:value",l)}},v=e=>{const t=e.type==="image/jpeg"||e.type==="image/png";t||c("请上传正确格式图片","error");const a=e.size/1024/1024<4;return a||c("图片大小必须小于4M","error"),t&&a},h=e=>{i("update:value",e.target.value)};return(e,t)=>{const a=S("AIcon"),l=k,y=A,B=I;return p(),r(B,{allowClear:"",placeholder:"请上传文件",value:o(s),"onUpdate:value":t[0]||(t[0]=C=>O(s)?s.value=C:null),onChange:h},{addonAfter:u(()=>[m(y,{name:"file",showUploadList:!1,accept:"image/jpeg,image/png",disabled:o(n),headers:{[o(d)]:o(j).get(o(d))},action:`${o(x)}/file/static`,onChange:g,onBeforeUpload:v},{default:u(()=>[m(l,{type:"link",style:{height:"30px"}},{default:u(()=>[o(n)?(p(),r(a,{key:0,type:"LoadingOutlined"})):(p(),r(a,{key:1,type:"PlusOutlined"})),b(" 上传附件 ")]),_:1})]),_:1},8,["disabled","headers","action"])]),_:1},8,["value"])}}});export{z as _};
