import{_ as a}from"./index105.js?v=1761009159";import{p as s,P as e,hC as t,l,j as o}from"./utils-lib.js?v=1761009159";import{_ as i}from"./index126.js?v=1761009159";import{c as r,r as n,aD as p,aA as u,q as c,H as d,v as m,x as f,e as h,B as j,C as v,I as _,y as b,Q as x,z as w,A as g,F as y,b0 as C,G as k}from"./base-lib.js?v=1761009159";import{u as D}from"./column.js?v=1761009159";import{uploadCertToCloud as q,removeCloudCert as A}from"./site.js?v=1761009159";import{u as H}from"./useStore4.js?v=1761009159";import{s as S}from"./useController13.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./useStore12.js?v=1761009159";import"./useController6.js?v=1761009159";import"./validator.js?v=1761009159";import"./useController5.js?v=1761009159";import"./useMethod5.js?v=1761009159";import"./useController4.js?v=1761009159";import"./useStore10.js?v=1761009159";const V={class:"p-[20px]"},I={class:"relative h-full"},z={class:"p-[20px]"},B={class:"flex flex-col p-[12px] bg-light"},F={class:"mb-[4px]"},G={class:"mb-[4px]"},L={class:"mb-[4px]"},M={class:"overflow-auto h-[12rem] border border-lighter p-[12px]"},O={class:"absolute bottom-0 w-full bg-light flex items-center justify-end p-[12px]"},P=r({__name:"index",props:{compData:{default:()=>({})}},setup(r){var P,Q;const{siteInfo:R}=H(),T=r,U=n(null==(Q=null==(P=R.value)?void 0:P.project_type)?void 0:Q.toLowerCase()),E=n(!1),J=n({}),K=n([{label:"域名",prop:"subject"},{label:"到期时间",prop:"not_after"},{label:"品牌",prop:"info.issuer",showOverflowTooltip:!0},{label:"位置",render:a=>p("span",[a.cloud_id>0?"云端":"本地"])},D([{width:70,onClick:async a=>{await s({title:"上传云端证书",content:"将会上传证书信息至云端进行替换，是否继续操作？",icon:"warning-filled",type:"calc"});(await e({loading:"正在上传证书...",request:q({ssl_hash:a.hash}),message:!0})).status&&await X()},isHide:a=>a.cloud_id>0,title:"上传云端"},{onClick:a=>{J.value=a,E.value=!0},title:"部署"},{width:70,onClick:async a=>{await s({title:"删除证书",content:"删除后该证书将不会显示在证书夹，是否继续操作？",icon:"warning-filled"});(await e({loading:"正在删除证书...",request:A({local:a.cloud_id>0?0:1,ssl_hash:a.hash}),message:!0})).status&&await X()},title:"删除"}])]),N=n([]),W=n(!1),X=async()=>{await e({loading:W,request:t(),data:[Array,N]})},Y=u("popupClose");return c(X),(s,e)=>{const t=k,r=i,n=l,p=o,u=a,c=d("bt-loading");return m(),f("div",V,[h(u,null,{"header-left":j(()=>[h(t,{type:"default",onClick:X},{default:j(()=>e[3]||(e[3]=[v("从云端同步",-1)])),_:1,__:[3]})]),"header-right":j(()=>[h(r,{onRefresh:X})]),content:j(()=>[_(h(n,{column:b(K),data:b(N),"max-height":500},null,8,["column","data"]),[[c,b(W)],[c,"正在加载中，请稍后...","title"]])]),popup:j(()=>[h(p,{title:"部署当前证书",modelValue:b(E),"onUpdate:modelValue":e[2]||(e[2]=a=>x(E)?E.value=a:null),area:[52,36]},{default:j(()=>{var a;return[w("div",I,[w("div",z,[w("div",B,[w("span",F,"认证域名："+g(b(J).subject),1),w("span",G,"证书类型："+g(null==(a=b(J).info)?void 0:a.issuer),1),w("span",L,"到期时间："+g(b(J).not_after),1)]),e[4]||(e[4]=w("span",{class:"!mt-[24px] !mb-[4px] inline-block"},"如下是需要批量部署证书的站点：",-1)),w("div",M,[(m(!0),f(y,null,C(s.compData,(a,s)=>(m(),f("div",{key:s,class:"p-[4px] w-full"},g(a.name),1))),128))])]),w("div",O,[h(t,{type:"warning",onClick:e[0]||(e[0]=a=>E.value=!1)},{default:j(()=>e[5]||(e[5]=[v("取消",-1)])),_:1,__:[5]}),h(t,{type:"primary",onClick:e[1]||(e[1]=a=>(async(a=U.value)=>{const{hash:s,subject:e}=J.value;await S({hash:s,subject:e,list:T.compData,type:a}),E.value=!1,Y()})())},{default:j(()=>[v("部署("+g(s.compData.length)+"项目)",1)]),_:1})])])]}),_:1},8,["modelValue"])]),_:1})])}}});export{P as default};
