You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
2.6 KiB
1 lines
2.6 KiB
import{$ as m,a0 as v,a2 as P,C as B,r as g,Z as O,b2 as R,O as T,ac as D,e as y,o as w,z as _,w as $,aj as j,h as c,A as N,L as z,t as S}from"./index-9b4667b6.js";const Z={__name:"index",props:{previewFileVisible:{type:Boolean,default:!1},file:Object},emits:["update:previewFileVisible"],setup(d,{emit:C}){const o=d;m(()=>v(()=>import("./docxPreview-d6526c10.js"),["static/js/docxPreview-d6526c10.js","static/js/index-9b4667b6.js","static/css/index-03655e05.css","static/js/index-d783beed.js","static/css/docxPreview-2753369b.css"]));const L=m(()=>v(()=>import("./xlsxPreview-ef6a3a81.js"),["static/js/xlsxPreview-ef6a3a81.js","static/js/index-9b4667b6.js","static/css/index-03655e05.css","static/js/index-d783beed.js","static/css/xlsxPreview-e721f229.css"])),u=m(()=>v(()=>import("./pdfPreview-48c511d8.js"),["static/js/pdfPreview-48c511d8.js","static/js/index-9b4667b6.js","static/css/index-03655e05.css","static/js/index-d783beed.js","static/css/pdfPreview-c276ac2c.css"])),V=P(),k=B(()=>V.sideTheme==="theme-dark"),{proxy:a}=S(),x=["docx","doc","xlsx","pdf"],A=["docx","doc"],b=["jpg","jpeg","png","gif","bmp","webp","svg"],t=g(),E={docx:u,doc:u,xlsx:L,pdf:u},i=g(),f=g();O(()=>o.previewFileVisible,l=>{if(!l||!o.file)return;const{fileName:n,extension:e}=R(o.file.url||o.file.originalName);t.value=e,T(async()=>{if(x.includes(e)){i.value=D.service({target:".preview-dialog",text:"\u62FC\u547D\u52A0\u8F7D\u4E2D...",background:"rgba(0, 0, 0, 0.7)",customClass:"loading-class"});try{let s;A.includes(e)?s=await a.$download.getBlob(o.file.ossId,"/ac/analysisReport/download/"):s=await a.$download.getBlob(o.file.ossId);const p=new FileReader;p.onload=function(){f.value=p.result},p.readAsArrayBuffer(s)}catch(s){console.log(s),i.value.close()}}}),[...x,...b].includes(e)||F(n,e)},{immediate:!0});const I=()=>{i.value.close()},F=(l,n)=>{try{const{url:e,ossId:r}=o.file;n==="zip"?a.$download.downloadZip(e,l):a.$download.oss(r)}catch(e){console.error("\u4E0B\u8F7D\u6587\u4EF6\u51FA\u9519:",e)}finally{h()}},h=()=>{var l;(l=i.value)==null||l.close(),f.value=null,t.value=null,C("update:previewFileVisible",!1)};return(l,n)=>{const e=y("el-image"),r=y("el-dialog");return w(),_(r,{class:z(["preview-dialog",{"dialog-dark":c(k)}]),"model-value":d.previewFileVisible,title:"\u6587\u4EF6\u9884\u89C8","align-center":"",fullscreen:"","destroy-on-close":"","close-on-click-modal":"","before-close":h},{default:$(()=>[(w(),_(j(E[c(t)]),{path:c(f),onRenderedHandler:I},null,40,["path"])),b.includes(c(t))?(w(),_(e,{key:0,src:d.file.url,fit:"cover"},null,8,["src"])):N("",!0)]),_:1},8,["model-value","class"])}}};export{Z as default};
|