import{e,P as s,gj as a,ax as l,$ as t}from"./utils-lib.js?v=1761009159";import{c as o,s as i,r,e as u,C as n,q as m,n as p,a6 as d,H as c,v as _,x as v,B as f,y as b,I as j,N as x,F as g,b0 as k,z as y,A as h,T as w,ab as V,b1 as C,ak as q,a9 as S}from"./base-lib.js?v=1761009159";import{T as D,U,C as L,V as T}from"./ssl.js?v=1761009159";import{u as M,o as F}from"./index85.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index105.js?v=1761009159";import"./index219.js?v=1761009159";import"./we-com.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";import"./useController13.js?v=1761009159";import"./site.js?v=1761009159";import"./useStore12.js?v=1761009159";import"./useStore4.js?v=1761009159";import"./useController6.js?v=1761009159";import"./useController5.js?v=1761009159";import"./useMethod5.js?v=1761009159";import"./useController4.js?v=1761009159";import"./useStore10.js?v=1761009159";import"./useMethod11.js?v=1761009159";import"./useStore11.js?v=1761009159";import"./useMethod10.js?v=1761009159";const H={class:"p-[16px]"},R={class:"flex items-center"},z=o({__name:"index",props:{compData:{}},emits:["close"],setup(o,{expose:z,emit:A}){const B=o,E=A,{isEdit:I,row:N}=B.compData,{deployFormData:P,siteList:$,certificateDeployTaskList:G,isRefreshDeployTaskList:J}=i(M()),K=r(),O=r(!1),Q=r(!1),W=[{content:"提示：请先在宝塔官网->SSL模块->自动同步中创建同步任务，请不要泄露同步任务的密钥"},{content:u(e,{class:"inline-block",onClick:F},{default:()=>[u("div",{class:"flex items-center"},[u("span",{class:"text-small"},[">>"]),u("span",null,[n("使用说明")])])]})}],X={task_name:[{required:!0,message:"请输入名称",trigger:"blur"},{min:2,max:50,message:"长度在 2 到 50 个字符之间",trigger:"blur"}],cloud_id:[{required:!0,message:"请选择证书部署任务",trigger:["blur","change"]}],private_key:[{required:!0,message:"请输入密钥",trigger:"blur"}],sites:[{required:!0,message:"请选择至少一个网站",trigger:"change"},{type:"array",min:1,message:"请选择至少一个网站",trigger:"change"}]},Y=()=>{window.open("https://www.bt.cn/admin/safe","_blank","noopener,noreferrer")};return m(()=>{(async()=>{O.value=!0,s({request:L(),success:e=>{const{data:s}=e;$.value=s.map(e=>({label:e.name,value:e.name})),O.value=!1}})})(),(async()=>{Q.value=!0,s({request:T(),success:e=>{G.value=e.data.map(e=>({label:e.synchron_name,host:e.host,value:e.id})),Q.value=!1}})})(),p(()=>{var e;I?(P.value.task_id=N.id,P.value.task_name=N.task_name,P.value.cloud_id=N.cloud_id,P.value.private_key=N.private_key,P.value.sites=null==(e=N.sites)?void 0:e.split(",")):P.value.task_name=a(8)})}),d(()=>{P.value={}}),z({onConfirm:async()=>{if(K.value)try{await K.value.validate();const e={...P.value,sites:P.value.sites.join(",")};s({loading:I?"正在修改同步任务":"正在创建同步任务",message:!0,request:I?D(e):U(e),success:e=>{e.status&&(J.value=!0,E("close"))}})}catch(e){}}}),(s,a)=>{const o=w,i=V,r=C,n=q,m=l,p=e,d=S,D=t,U=c("bt-loading");return _(),v("div",H,[u(d,{ref_key:"formRef",ref:K,model:b(P),rules:X,"label-width":"120px"},{default:f(()=>[u(i,{label:"名称",prop:"task_name"},{default:f(()=>[u(o,{class:"!w-[230px]",placeholder:"请输入名称",disabled:b(I),modelValue:b(P).task_name,"onUpdate:modelValue":a[0]||(a[0]=e=>b(P).task_name=e)},null,8,["disabled","modelValue"])]),_:1}),u(i,{label:"选择证书部署任务",prop:"cloud_id"},{default:f(()=>[j((_(),x(m,{class:"!w-[230px]",placeholder:"请选择证书部署任务",modelValue:b(P).cloud_id,"onUpdate:modelValue":a[1]||(a[1]=e=>b(P).cloud_id=e)},{default:f(()=>[(_(!0),v(g,null,k(b(G),e=>(_(),x(n,{key:e.value,label:e.label,value:e.value},{default:f(()=>[y("div",R,[y("span",null,h(e.label),1),u(r,{direction:"vertical"}),y("span",null,h(e.host),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])),[[U,b(Q)]]),u(p,{class:"ml-[12px]",onClick:Y},{default:f(()=>a[4]||(a[4]=[y("div",{class:"flex items-center"},[y("span",{class:"text-small"},">>"),y("span",null,"去创建")],-1)])),_:1,__:[4]})]),_:1}),u(i,{label:"密钥",prop:"private_key"},{default:f(()=>[u(o,{class:"!w-[230px]",placeholder:"请输入密钥",modelValue:b(P).private_key,"onUpdate:modelValue":a[2]||(a[2]=e=>b(P).private_key=e)},null,8,["modelValue"]),u(p,{class:"ml-[12px]",onClick:Y},{default:f(()=>a[5]||(a[5]=[y("div",{class:"flex items-center"},[y("span",{class:"text-small"},">>"),y("span",null,"去获取")],-1)])),_:1,__:[5]})]),_:1}),u(i,{label:"选择网站",prop:"sites"},{default:f(()=>[j(u(m,{class:"!w-[230px]",multiple:!0,placeholder:"请选择网站",options:b($),modelValue:b(P).sites,"onUpdate:modelValue":a[3]||(a[3]=e=>b(P).sites=e)},null,8,["options","modelValue"]),[[U,b(O)]])]),_:1})]),_:1},8,["model"]),u(D,{options:W,listStyle:"disc",class:"ml-[20px]"})])}}});export{z as default};
