import{_ as e,r as a,a as l,b as t,c as i,d as r,j as s,g as o,f as n,l as d,a2 as u,aX as p,B as c,N as g,L as h,t as m}from"./index.5f1a5861.1761573291572.js";const f={class:"SearchEngine"},v={class:"p-4 bg-white rounded-lg overflow-hidden flex flex-wrap gap-4"},w={class:"ml-auto"},_={class:"mt-4 p-4 bg-white rounded-lg overflow-hidden w-full"},b={key:1,title:"无法预览",style:{width:"40px",height:"40px",margin:"auto"},src:"/dist/assets/file.a6743b7c.1761573291572.svg"},y={key:0},x={key:1},k=["download","href"];var C=e({__name:"file",setup(e){const C=a([]),z=e=>{C.value=e.map((e=>e.id))},j=a({page:1,limit:20,total:0,refresh(e){j.value.page=e,U()},sizes(e){j.value.limit=e,U()}}),V=()=>{u.confirm("扫描本地需要消耗更多的资源，需要耐心等待，期间请勿离开","温馨提示").then((e=>{const a=p.service({fullscreen:!0,text:"扫描中"});c({url:"/File/scanLocal",method:"post"}).then((e=>{j.value.refresh(1),g.success(e.msg)})).finally((e=>{a.close()}))})).catch((e=>{}))},F=a({path:"",user_id:""}),S=a(""),I=e=>{u.confirm("是否删除","删除提示").then((a=>{c({url:"/File/del",method:"post",data:{ids:e}}).then((e=>{g.success(e.msg),U()}))}))};let L=a(!1);const O=a([]),U=()=>{O.value=[],c({url:"/File/list",method:"post",data:{search:F.value,limit:j.value.limit,page:j.value.page}}).then((e=>{L.value=!0,O.value=e.data.data,Object.assign(j.value,e.data)}))};return U(),(e,a)=>{const u=l("el-input"),p=l("el-button"),c=l("el-table-column"),g=l("el-image"),L=l("el-tag"),B=l("el-table"),D=l("el-pagination");return t(),i("div",f,[r("div",v,[s(u,{modelValue:F.value.path,"onUpdate:modelValue":a[0]||(a[0]=e=>F.value.path=e),style:{width:"200px"},placeholder:"图片地址搜索",clearable:""},null,8,["modelValue"]),s(u,{modelValue:F.value.user_id,"onUpdate:modelValue":a[1]||(a[1]=e=>F.value.user_id=e),style:{width:"200px"},placeholder:"用户ID搜索",clearable:""},null,8,["modelValue"]),s(p,{onClick:U,type:"primary"},{default:o((()=>a[3]||(a[3]=[h("搜索",-1)]))),_:1,__:[3]}),C.value.length?(t(),n(p,{key:0,type:"danger",onClick:a[2]||(a[2]=e=>I(C.value))},{default:o((()=>a[4]||(a[4]=[h("批量删除",-1)]))),_:1,__:[4]})):d("",!0),r("div",w,[s(p,{type:"danger",onClick:V},{default:o((()=>a[5]||(a[5]=[h("扫描本地文件入库 ",-1)]))),_:1,__:[5]})])]),r("div",_,[s(B,{onSelectionChange:z,ref_key:"table",ref:S,height:"calc(100vh - 200px)",data:O.value},{default:o((()=>[s(c,{type:"selection",width:"55"}),s(c,{prop:"name",label:"预览",align:"center",width:"90"},{default:o((e=>[["image/png","image/jpg","image/jpeg","image/gif","image/webp","image/svg","image/svg+xml","image/vnd.microsoft.icon","image/x-icon","application/octet-stream"].indexOf(e.row.mime_type)>=0?(t(),n(g,{key:0,style:{width:"40px",height:"40px",margin:"auto","background-color":"rgba(143,143,143,0.2)","border-radius":"6px",border:"1px solid #ffffff"},src:e.row.path},null,8,["src"])):(t(),i("img",b))])),_:1}),s(c,{prop:"status",label:"上传用户",align:"center",width:"180"},{default:o((e=>[e.row.user?(t(),i("div",y,[e.row.user.nickname?(t(),n(L,{key:0},{default:o((()=>[h(m(e.row.user.nickname),1)])),_:2},1024)):e.row.user_id?(t(),i("span",x,"id:"+m(e.row.user_id),1)):d("",!0)])):d("",!0)])),_:1}),s(c,{prop:"path","show-overflow-tooltip":"",label:"文件路径",align:"center","min-width":"260"}),s(c,{prop:"mime_type",label:"文件类型",width:"200px",align:"center"}),s(c,{prop:"status",label:"文件大小",align:"center",width:"180"},{default:o((e=>[h(m((e.row.size/1024).toFixed(2))+"kb ",1)])),_:1}),s(c,{prop:"hash",label:"文件哈希值",align:"center",width:"300"}),s(c,{prop:"create_time",label:"创建时间",align:"center",width:"200"}),s(c,{fixed:"right",label:"操作",align:"center",width:"200"},{default:o((e=>[r("a",{download:e.row.path,class:"el-button el-button--small el-button--primary",target:"_blank",href:e.row.path},"下载",8,k),s(p,{type:"danger",size:"small",onClick:a=>I([e.row.id])},{default:o((()=>a[6]||(a[6]=[h("删除",-1)]))),_:2,__:[6]},1032,["onClick"])])),_:1})])),_:1},8,["data"]),s(D,{"page-size":j.value.limit,"current-page":j.value.page,onSizeChange:j.value.sizes,onCurrentChange:j.value.refresh,"page-sizes":[20,30,40,50,100],class:"mt-6",layout:"sizes,total,prev,pager,jumper",total:j.value.total},null,8,["page-size","current-page","onSizeChange","onCurrentChange","total"])])])}}},[["__scopeId","data-v-40e02a81"]]);export{C as default};
