import{a as U,r,q as $,aj as s,J as g,o as n,K as l,S as o,b as u,u as a,H as j,c as w,M as d,Q as q,P as G,G as J,L as R,T as z,t as Q}from"./vue.D1BjjNmv.js";import{a2 as W,a3 as X,C as _}from"./index.Df8UJ10K.js";import{createCrudOptions as Y}from"./crud.vBF4-LGW.js";import{F as Z,S as ee}from"./index.DFs5McSn.js";import{_ as oe}from"./_plugin-vue_export-helper.DlAUqK2U.js";const te={key:0},se=["onClick"],le=["onClick"],re={key:4},ae=["src"],ne=["src"],ie={class:"closePreviewBtn"},ce=U({__name:"index",setup(ue){const k=r(null),V=t=>t<1024?t+"b":t<1024*1024?(t/1024).toFixed(2)+"Kb":(t/(1024*1024)).toFixed(2)+"Mb",L=async()=>{k.value.selectVisiable=!0,await Q()},C=r(),h=r(),{crudExpose:p}=W({crudRef:C,crudBinding:h}),{crudOptions:B}=Y({crudExpose:p,context:{openAddHandle:L}});X({crudExpose:p,crudOptions:B});const S=r([]),v=r(!1),i=r(""),f=r(""),P=r(),b=r(),x=(t,c)=>{v.value=!0,P.value.muted=!0,b.value.muted=!0,i.value=t,window.addEventListener("keydown",y)},E=()=>{v.value=!1,i.value="",f.value="",window.removeEventListener("keydown",y)},y=t=>{t.key==="Escape"&&(v.value=!1,i.value="",f.value="",window.removeEventListener("keydown",y))};return $(()=>{p.doRefresh()}),(t,c)=>{const H=s("el-button"),D=s("el-upload"),N=s("el-image"),F=s("VideoCamera"),m=s("el-icon"),I=s("Headset"),K=s("Document"),T=s("fs-crud"),M=s("CircleClose"),O=s("fs-page");return n(),g(O,null,{default:l(()=>[o(Z,{modelValue:S.value,"onUpdate:modelValue":c[0]||(c[0]=e=>S.value=e),showInput:!1,ref_key:"fileSelectorRef",ref:k,tabsShow:a(ee).ALL,itemSize:120,multiple:!1,selectable:!0,valueKey:"url",inputType:"image"},null,8,["modelValue","tabsShow"]),o(T,j({ref_key:"crudRef",ref:C},h.value),{"actionbar-left":l(e=>[o(D,{action:a(_)()+"api/system/file/",multiple:!1,"on-success":()=>a(p).doRefresh(),drag:!1,"show-file-list":!1},{default:l(()=>[o(H,{type:"primary",icon:"plus"},{default:l(()=>c[1]||(c[1]=[G("上传")])),_:1})]),_:1},8,["action","on-success"])]),cell_size:l(e=>[u("span",null,q(e.row.size?V(e.row.size):"0b"),1)]),cell_preview:l(e=>[e.row.file_type===0?(n(),w("div",te,[o(N,{style:{width:"100%","aspect-ratio":"1 /1"},src:a(_)(e.row.url),"preview-src-list":[a(_)(e.row.url)],"preview-teleported":!0},null,8,["src","preview-src-list"])])):d("",!0),e.row.file_type===1?(n(),w("div",{key:1,class:"_preview",onClick:A=>x(a(_)(e.row.url),"video")},[o(m,{size:60},{default:l(()=>[o(F)]),_:1})],8,se)):d("",!0),e.row.file_type===2?(n(),w("div",{key:2,class:"_preview",onClick:A=>x(a(_)(e.row.url),"video")},[o(m,{size:60},{default:l(()=>[o(I)]),_:1})],8,le)):d("",!0),e.row.file_type===3?(n(),g(m,{key:3,size:60},{default:l(()=>[o(K)]),_:1})):d("",!0),e.row.file_type>3?(n(),w("div",re,"未知类型")):d("",!0)]),_:1},16),u("div",{class:J(["preview",{show:v.value}])},[R(u("video",{src:i.value,class:"previewItem",controls:!0,autoplay:!0,muted:!0,loop:!1,ref_key:"videoPreviewRef",ref:P},null,8,ae),[[z,i.value]]),R(u("audio",{src:f.value,class:"previewItem",controls:!0,autoplay:!1,muted:!0,loop:!1,ref_key:"audioPreviewRef",ref:b},null,8,ne),[[z,f.value]]),u("div",ie,[o(m,{size:48,color:"white",style:{cursor:"pointer"},onClick:E},{default:l(()=>[o(M)]),_:1})])],2)]),_:1})}}}),me=oe(ce,[["__scopeId","data-v-e3880e09"]]);export{me as default};
