import{request as o}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r}from"react";function t(t="object"){const[e,i]=r(!1);let n=0;const a=(r,t)=>{if(n++,n>0&&i(!0),r)return new Promise((e,a)=>{const{files:l=[],params:c={}}=t,p=new FormData;l.forEach(o=>{o.originFileObj&&p.append("file",o.originFileObj)}),Object.keys(c).forEach(o=>{p.append(o,c[o])}),o(r,"post",p,{"Content-Type":"multipart/form-data"}).then(o=>{e(o)}).catch(o=>{a(o)}).finally(()=>{n--,n<=0&&i(!1)})});console.error("【importFile】 缺少 url 参数")};return"array"===t?[e,a]:{loading:e,importFile:a}}export{t as default};
