1 |
- var he=Object.defineProperty;var H=Object.getOwnPropertySymbols;var we=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var A=(i,u,n)=>u in i?he(i,u,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[u]=n,q=(i,u)=>{for(var n in u||(u={}))we.call(u,n)&&A(i,n,u[n]);if(H)for(var n of H(u))be.call(u,n)&&A(i,n,u[n]);return i};var g=(i,u,n)=>new Promise((D,I)=>{var N=m=>{try{U(n.next(m))}catch(P){I(P)}},S=m=>{try{U(n.throw(m))}catch(P){I(P)}},U=m=>m.done?D(m.value):Promise.resolve(m.value).then(N,S);U((n=n.apply(i,u)).next())});import{e as w,aD as ye,d as W,r as f,o as b,c as V,w as T,a as p,b as X,P as ge,u as _,_ as Y,j as J,y as M,l as k,aL as _e,t as K,q as $,bT as Q,H as Ie,b_ as xe,be as Z,b$ as ee,aX as Te,aY as Ue,E as Pe,__tla as Re}from"./index-fd0fd824.js";import{g as Ce,d as ke,__tla as Oe}from"./index-edb282b3.js";import{d as De,__tla as Ne}from"./download-1f0cd2f2.js";import{u as Se,__tla as Ee}from"./upload-b70f3dfc.js";import{g as je}from"./base64-10c35a1f.js";import{a as Be,B as Le,u as ze,__tla as Fe}from"./index-2901f384.js";let ae,Ve=Promise.all([(()=>{try{return Re}catch(i){}})(),(()=>{try{return Oe}catch(i){}})(),(()=>{try{return Ne}catch(i){}})(),(()=>{try{return Ee}catch(i){}})(),(()=>{try{return Fe}catch(i){}})()]).then(()=>g(void 0,null,function*(){var i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};const u=i;function n(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?Object(arguments[t]):{},y=Object.keys(s);typeof Object.getOwnPropertySymbols=="function"&&(y=y.concat(Object.getOwnPropertySymbols(s).filter(function(d){return Object.getOwnPropertyDescriptor(s,d).enumerable}))),y.forEach(function(d){D(e,d,s[d])})}return e}function D(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}var I=function(e,t){var s=n({},e,t.attrs);return w(ye,n({},s,{icon:u}),null)};I.displayName="UploadOutlined",I.inheritAttrs=!1;const N=I,S=["src"],U=W({__name:"UploadPreview",emits:["success","register"],setup(e){const t=f({}),[s,{setModalProps:y}]=Be(d=>g(this,null,function*(){y({confirmLoading:!1,height:800}),t.value=q({},d.baseData)}));return(d,o)=>{var v;return b(),V(_(Le),ge({destroyOnClose:!0,maskClosable:!1},d.$attrs,{onRegister:_(s),title:(v=t.value)==null?void 0:v.previewTitle,width:1002,height:800,footer:null,defaultFullscreen:!0}),{default:T(()=>{var x;return[p("iframe",{src:(x=t.value)==null?void 0:x.previewFile,class:"iframe-box"},null,8,S),X("; ")]}),_:1},16,["onRegister","title"])}}}),m=Y(U,[["__scopeId","data-v-8bba6a56"]]),P=e=>(Te("data-v-d0c3bbbd"),e=e(),Ue(),e),le={key:0},te={class:"dragger-text"},se=P(()=>p("div",{class:"mt-2 text-xs"},"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u8FD9\u91CC\u4E0A\u4F20",-1)),oe={class:"dragger-tip"},ne={key:1},ie={class:"flex flex-between mt-2"},re={class:"flex-1"},ce=["onClick"],ue=["onClick"],de={class:"ml-4"},pe=["onClick"],me=W({__name:"Upload",props:{value:String,maxNumber:Number,accept:String,name:String,disabled:Boolean,multiple:Boolean,maxSize:Number,api:Function,style:Object,listType:{type:String,default:"text"},tip:String,showPreviewIcon:{type:Boolean,default:!0},showRemoveIcon:{type:Boolean,default:!0},showDownloadIcon:{type:Boolean,default:!0}},emits:["update:value","change","click","success","reload"],setup(e,{emit:t}){const s=e,[y,{openModal:d}]=ze(),o=f([]),v=f([]),{notification:x}=Pe(),h=f(""),E=f(!1),R=f(!1);f(!1);const G=f(""),ve=f("");J(()=>s.value,a=>g(this,null,function*(){a&&(xe(a)?(o.value=[{name:a.substring(a.lastIndexOf("/")+1),download:a,url:a,thumbUrl:a,status:"done",fileUrl:a}],t("reload",o.value),h.value=""):(o.value=yield Ce({folderId:s.value}),o.value.length&&(o.value.forEach(l=>{l.name=l.fileName+l.fileType,l.download=l.name,l.url=l.fileUrl,l.thumbUrl=l.thUrl,l.status="done"}),t("reload",o.value),h.value=o.value[0].folderId))),a||(o.value=[],h.value="")}),{immediate:!0}),J(()=>v.value,a=>g(this,null,function*(){if(!E.value&&a.length){let l=a.filter(r=>!r.status);if(l.length<=0)return;try{let r=yield Se({name:"file",file:l},h.value);h.value=r[0].folderId,o.value.forEach(c=>{c.status="done",c.url=c.fileUrl,c.thumbUrl=c.thUrl}),t("success",v.value),t("update:value",h.value),t("change"),R.value=!1}catch(r){R.value=!1}}}));const j=a=>s.maxSize&&a.size/1024/1024>s.maxSize?(x.error({message:"Tip",description:`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7${s.maxSize}MB\uFF01`}),Z.LIST_IGNORE):s.maxNumber&&o.value.length+v.value.length===s.maxNumber?(x.error({message:"Tip",description:`\u6587\u4EF6\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7${s.maxNumber}\u4E2A\uFF01`}),!1):(v.value=[...v.value,a],E.value=!1,R.value=!0,Z.LIST_IGNORE);function O(){v.value=[]}const B=a=>g(this,null,function*(){const l=a.response?a.response.data.id:a.id;if(l){const r=yield ke(l);h.value=r,E.value=!0;const c=o.value.findIndex(C=>C.id===l);o.value.splice(c,1),o.value.forEach(C=>{C.folderId=r})}else{const r=o.value.findIndex(c=>c.uid===a.uid);o.value.splice(r,1)}t("update:value",h.value),t("change"),x.success({message:"Tip",description:"\u5220\u9664\u6210\u529F\uFF01"})}),L=a=>{const l=a.response?a.response.data.fileUrl:a.fileUrl,r=a.response?a.response.data.fileName+a.response.data.fileType:a.fileName+a.fileType;De({url:l,fileName:r})},z=a=>g(this,null,function*(){var r,c;const l=((c=(r=a.response)==null?void 0:r.data)==null?void 0:c.fileUrl)||a.fileUrl;G.value=ee().VITE_GLOB_FFFILEVIEW_URL+encodeURIComponent(je.encode(l.includes("http://")||l.includes("https://")?l:ee().VITE_GLOB_API_URL+l)),d(!0,{baseData:{previewTitle:a.name||a.fileName,previewFile:G.value}}),ve.value=a.name||a.fileName});return(a,l)=>{const r=M("a-upload-dragger"),c=M("a-upload"),C=M("a-button");return b(),k("div",null,[e.listType==="dragger"?(b(),k("div",le,[w(r,{"file-list":o.value,maxCount:e.maxNumber,accept:e.accept,name:e.name,disabled:e.disabled,multiple:e.multiple,beforeUpload:j,listType:"picture","show-upload-list":{showDownloadIcon:e.showDownloadIcon,showPreviewIcon:e.showPreviewIcon,showRemoveIcon:e.showRemoveIcon},onRemove:B,onDownload:L,onPreview:z,onDrop:O,onClick:O,class:"list-upload dragger-upload",style:$(e.style)},{default:T(()=>[p("div",te,[w(_(_e),{icon:"ep:upload-filled",color:"#5e95ff",size:24}),se]),p("div",oe,K(e.tip),1)]),_:1},8,["file-list","maxCount","accept","name","disabled","multiple","show-upload-list","style"])])):e.listType==="picture"?(b(),k("div",ne,[w(c,{"file-list":o.value,maxCount:e.maxNumber,accept:e.accept,name:e.name,disabled:e.disabled,multiple:e.multiple,beforeUpload:j,listType:e.listType,"show-upload-list":{showDownloadIcon:e.showDownloadIcon,showPreviewIcon:e.showPreviewIcon,showRemoveIcon:e.showRemoveIcon},onRemove:B,onDownload:L,onPreview:z,onClick:O,class:"list-upload",style:$(e.style)},{default:T(()=>[w(_(Q))]),_:1},8,["file-list","maxCount","accept","name","disabled","multiple","listType","show-upload-list","style"])])):(b(),V(c,{key:2,"file-list":o.value,maxCount:e.maxNumber,accept:e.accept,name:e.name,disabled:e.disabled,multiple:e.multiple,beforeUpload:j,listType:e.listType,"show-upload-list":{showDownloadIcon:e.showDownloadIcon,showPreviewIcon:e.showPreviewIcon,showRemoveIcon:e.showRemoveIcon},onRemove:B,onDownload:L,onPreview:z,onClick:O},{itemRender:T(({file:fe,actions:F})=>[p("div",ie,[p("div",re,[p("a",{href:"javascript:;",onClick:F.preview},K(fe.name),9,ce)]),p("div",null,[p("a",{href:"javascript:;",onClick:F.download},"\u4E0B\u8F7D",8,ue)]),p("div",de,[e.disabled?Ie("",!0):(b(),k("a",{key:0,href:"javascript:;",onClick:F.remove},"\u5220\u9664",8,pe))])])]),default:T(()=>[e.listType=="picture-card"?(b(),V(_(Q),{key:0})):(b(),k("div",{key:1,style:$(e.style)},[w(C,{loading:R.value,disabled:R.value},{default:T(()=>[w(_(N)),X(" \u70B9\u51FB\u4E0A\u4F20 ")]),_:1},8,["loading","disabled"])],4))]),_:1},8,["file-list","maxCount","accept","name","disabled","multiple","listType","show-upload-list"])),w(m,{onRegister:_(y)},null,8,["onRegister"])])}}});ae=Y(me,[["__scopeId","data-v-d0c3bbbd"]])}));export{ae as U,Ve as __tla};
|