import{d as R,u as T,r as s,o as Q,a as d,b as U,c as v,I as w,j as S,h as a,w as o,i as r,f as q,e as F,aD as G,aI as O,E as W,as as I,a1 as J,k as p,t as m,W as K,a7 as X,a8 as Z,aG as x,aH as ee}from"./index-6c60ffba.js";import{b as te,d as ae}from"./system-4c24cbad.js";import{a as le,_ as oe,b as ne,c as se}from"./QueryItem.vue_vue_type_script_setup_true_lang-b16aac13.js";const re={class:"mb-3"},ie={class:"app-block mt-3"},ue={name:"AttachmentList"},fe=R({...ue,setup(de){const{t:P}=T(),h=s({}),f=s(),g=s(1),y=s(10),z=s(0),C=s(),D=s([]),_=s([]),$=s(!1),B=s(!1),E=s(),i=async()=>{$.value=!0;try{const{content:t,totalElements:l}=await te({...G(h.value),Q_OrderBy:f.value,page:g.value,pageSize:y.value});D.value=t,z.value=l}finally{$.value=!1}};Q(i);const L=({column:t,prop:l,order:b})=>{var c;l?f.value=((c=t.sortBy)!=null?c:l)+(b==="descending"?"_desc":""):f.value=void 0,i()},M=()=>i(),V=()=>{C.value.clearSort(),O(h.value),f.value=void 0,i()},Y=t=>{E.value=t,B.value=!0},k=async t=>{await ae(t),i(),W.success(P("success"))};return(t,l)=>{const b=d("el-button"),c=d("el-popconfirm"),n=d("el-table-column"),j=d("el-tag"),A=d("el-table"),H=d("el-pagination"),N=U("loading");return v(),w("div",null,[S("div",re,[a(r(oe),{params:h.value,onSearch:M,onReset:V},{default:o(()=>[a(r(le),{label:t.$t("attachment.name"),name:"Q_Contains_name"},null,8,["label"])]),_:1},8,["params"])]),S("div",null,[a(c,{title:t.$t("confirmDelete"),onConfirm:l[0]||(l[0]=e=>k(_.value.map(u=>u.id)))},{reference:o(()=>[a(b,{disabled:_.value.length<=0||r(I)("attachment:delete"),icon:r(J)},{default:o(()=>[p(m(t.$t("delete")),1)]),_:1},8,["disabled","icon"])]),_:1},8,["title"]),a(r(ne),{name:"attachment",class:"ml-2"})]),S("div",ie,[q((v(),F(A,{ref_key:"table",ref:C,data:D.value,onSelectionChange:l[1]||(l[1]=e=>_.value=e),onRowDblclick:l[2]||(l[2]=e=>Y(e.id)),onSortChange:L},{default:o(()=>[a(r(se),{name:"attachment"},{default:o(()=>[a(n,{type:"selection",selectable:e=>!e.used,width:"45"},null,8,["selectable"]),a(n,{property:"id",label:"ID",width:"64",sortable:"custom"}),a(n,{property:"name",label:t.$t("attachment.name"),sortable:"custom","min-width":"130","show-overflow-tooltip":""},null,8,["label"]),a(n,{property:"path",label:t.$t("attachment.path"),sortable:"custom","min-width":"200",display:"none","show-overflow-tooltip":""},null,8,["label"]),a(n,{property:"url",label:t.$t("attachment.url"),sortable:"custom","min-width":"350",display:"none","show-overflow-tooltip":""},null,8,["label"]),a(n,{property:"length",label:t.$t("attachment.length"),sortable:"custom",align:"right","show-overflow-tooltip":""},{default:o(({row:e})=>[p(m(e.size),1)]),_:1},8,["label"]),a(n,{property:"created",label:t.$t("attachment.created"),sortable:"custom","min-width":"120","show-overflow-tooltip":""},{default:o(({row:e})=>[p(m(r(K)(e.created).format("YYYY-MM-DD HH:mm")),1)]),_:1},8,["label"]),a(n,{property:"user.username",label:t.$t("attachment.user"),sortable:"custom","show-overflow-tooltip":""},null,8,["label"]),a(n,{label:t.$t("attachment.refer"),"show-overflow-tooltip":""},{default:o(({row:e})=>[(v(!0),w(X,null,Z(e.referList,u=>(v(),w("div",{key:`${u.referType}-${u.referId}`},m(`${u.referType}-${u.referId}`),1))),128))]),_:1},8,["label"]),a(n,{property:"used",label:t.$t("attachment.used"),sortable:"custom","show-overflow-tooltip":""},{default:o(({row:e})=>[a(j,{type:e.used?"success":"info",size:"small"},{default:o(()=>[p(m(t.$t(e.used?"yes":"no")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),a(n,{label:t.$t("table.action")},{default:o(({row:e})=>[a(c,{title:t.$t("confirmDelete"),onConfirm:u=>k([e.id])},{reference:o(()=>[a(b,{type:"primary",disabled:e.used||r(I)("attachment:delete"),size:"small",link:""},{default:o(()=>[p(m(t.$t("delete")),1)]),_:2},1032,["disabled"])]),_:2},1032,["title","onConfirm"])]),_:1},8,["label"])]),_:1})]),_:1},8,["data"])),[[N,$.value]]),a(H,{currentPage:g.value,"onUpdate:currentPage":l[3]||(l[3]=e=>g.value=e),pageSize:y.value,"onUpdate:pageSize":l[4]||(l[4]=e=>y.value=e),total:z.value,"page-sizes":r(x),layout:r(ee),onSizeChange:l[5]||(l[5]=e=>i()),onCurrentChange:l[6]||(l[6]=e=>i()),small:"",background:"",class:"px-3 py-2 justify-end"},null,8,["currentPage","pageSize","total","page-sizes","layout"])])])}}});export{fe as default};
