import{d as T,r as l,z,c as u,a as t,w as o,a$ as L,B as x,b as i,q as N,i as P,h as f,aY as V,Z as $,b0 as j,t as r,bm as M,b2 as q,bc as I,C as w,o as d}from"./index-DqVhJ65C.js";/* empty css                *//* empty css                      *//* empty css               *//* empty css                  *//* empty css                     *//* empty css                  *//* empty css                        *//* empty css                    */import"./el-tooltip-l0sNRNKZ.js";/* empty css                      *//* empty css                   */const U={class:"p-6"},Y={class:"mb-4 flex justify-between"},Z={class:"font-medium"},A={key:0,class:"text-red-500"},F={key:1,class:"text-green-600"},G={class:"mt-4 flex justify-end"},ne=T({__name:"Ssl",setup(H){const g=l([]),p=l(!1),c=l(1),v=l(20),b=l(0),_=async()=>{p.value=!0;try{const a=await x.get("/admin/ssl/list",{params:{page:c.value,limit:v.value}});a.code===0&&(g.value=a.data.data,b.value=a.data.total)}catch(a){console.error(a)}finally{p.value=!1}},y=async a=>{try{await x.post(`/admin/ssl/delete/${a.id}`),w.success("删除成功"),_()}catch(s){w.error(s.message)}},C=a=>new Date(a).getTime()<Date.now();return z(()=>{_()}),(a,s)=>{const h=P,n=j,E=M,k=q,B=I,D=L,S=V;return d(),u("div",U,[t(D,{shadow:"hover"},{default:o(()=>[i("div",Y,[s[2]||(s[2]=i("h3",{class:"font-bold"},"SSL 证书管理",-1)),t(h,{disabled:""},{default:o(()=>[...s[1]||(s[1]=[f("上传证书 (仅用户前台)",-1)])]),_:1})]),N((d(),$(k,{data:g.value,stripe:"",border:""},{default:o(()=>[t(n,{prop:"id",label:"ID",width:"80"}),t(n,{label:"域名","min-width":"150"},{default:o(({row:e})=>[i("span",Z,r(e.domain),1)]),_:1}),t(n,{label:"用户",width:"120"},{default:o(({row:e})=>{var m;return[f(r((m=e.user)==null?void 0:m.username),1)]}),_:1}),t(n,{prop:"provider",label:"颁发机构",width:"120"}),t(n,{prop:"expires_at",label:"过期时间",width:"180"},{default:o(({row:e})=>[C(e.expires_at)?(d(),u("span",A,r(e.expires_at)+" (已过期)",1)):(d(),u("span",F,r(e.expires_at),1))]),_:1}),t(n,{label:"操作",width:"120",fixed:"right"},{default:o(({row:e})=>[t(E,{title:"确定删除吗？",onConfirm:m=>y(e)},{reference:o(()=>[t(h,{link:"",type:"danger"},{default:o(()=>[...s[3]||(s[3]=[f("删除",-1)])]),_:1})]),_:1},8,["onConfirm"])]),_:1})]),_:1},8,["data"])),[[S,p.value]]),i("div",G,[t(B,{background:"",layout:"prev, pager, next",total:b.value,"current-page":c.value,"onUpdate:currentPage":s[0]||(s[0]=e=>c.value=e),"page-size":v.value,onCurrentChange:_},null,8,["total","current-page","page-size"])])]),_:1})])}}});export{ne as default};
