import{c as e,o as a,g as l,r as o,q as d,v as s,x as r,e as n,B as t,z as i,y as m,C as p,A as _,F as c,b0 as u,R as f,T as v,al as y,ab as A,a9 as b,ak as h}from"./base-lib.js?v=1761009159";import{S as k}from"./ssl.js?v=1761009159";import{b as T}from"./utils-lib.js?v=1761009159";import{g as w}from"./useStore10.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const V={class:"p-[16px]"},g={class:"flex items-center"},j=e({__name:"index",props:{compData:{type:Object,default:()=>{}}},emits:["close"],setup(e,{expose:j,emit:C}){const x=T(),{refs:{isRefreshDomainList:D}}=w(),M=e,X=C,E=a({domain_name:"",domain_dns_value:"",dns_id:"",record_type:"A",domain:""}),z=[{title:"A",key:"A",placeholderTip:"将域名指向IPv4地址"},{title:"TXT",key:"TXT",placeholderTip:"设置文本记录"},{title:"CNAME",key:"CNAME",placeholderTip:"将域名指向另外一个域名"},{title:"MX",key:"MX",placeholderTip:"如果需要设置邮箱，让邮箱能收到邮件，就需要添加MX记录。"},{title:"CAA",key:"CAA",placeholderTip:"CA证书颁发机构授权校验"},{title:"AAAA",key:"AAAA",placeholderTip:"用来指定主机名（或域名）对应的IPv6地址（例如：ff06:0:0:0:0:0:0:c3）记录。"}],R=l(()=>{var e;return null==(e=z.find(e=>e.key===E.record_type))?void 0:e.placeholderTip}),S=o(null),U={domain_name:[{validator:(e,a,l)=>{a?l():l(new Error("请填写域名前缀"))},trigger:"blur"}],domain_dns_value:[{validator:(e,a,l)=>{a?l():l(new Error("请输入记录值"))},trigger:"blur"}]};return d(()=>{M.compData.row.dns_id&&(E.dns_id=M.compData.row.dns_id,E.domain=".".concat(M.compData.row.domain))}),j({onConfirm:async()=>{try{await S.value.validate();const e=x.load("正在解析域名，请稍候..."),a=await k({dns_id:E.dns_id,domain_name:"".concat(E.domain_name).concat(E.domain),domain_dns_value:E.domain_dns_value,record_type:E.record_type,fun_name:"create_dns_record"});x.request(a),e&&e.close(),a.status&&(D.value=!0,E.domain_name="",E.domain_dns_value="",E.dns_id="",E.record_type="A",E.domain="",X("close"))}catch(e){}}}),(e,a)=>{const l=v,o=h,d=y,k=A,T=b;return s(),r("div",V,[n(T,{ref_key:"formRef",ref:S,size:"small",rules:U,model:m(E),class:"relative w-full","label-position":"right",onSubmit:a[3]||(a[3]=f(()=>{},["prevent"]))},{default:t(()=>[n(k,{label:"主机记录",prop:"domain_name"},{default:t(()=>[i("div",g,[n(l,{modelValue:m(E).domain_name,"onUpdate:modelValue":a[0]||(a[0]=e=>m(E).domain_name=e),class:"!w-[34rem]",placeholder:"请填写域名前缀，支持多级，如：ab.cd.ef"},{append:t(()=>[p(_(m(E).domain),1)]),_:1},8,["modelValue"]),n(d,{size:"small",modelValue:m(E).record_type,"onUpdate:modelValue":a[1]||(a[1]=e=>m(E).record_type=e),class:"!w-[8rem] ml-[1rem]",placeholder:"请选择"},{default:t(()=>[(s(),r(c,null,u(z,e=>n(o,{key:e.key,label:e.title,value:e.key},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])]),_:1}),n(k,{label:"记录值",prop:"domain_dns_value"},{default:t(()=>[n(l,{modelValue:m(E).domain_dns_value,"onUpdate:modelValue":a[2]||(a[2]=e=>m(E).domain_dns_value=e),class:"!w-[43rem]",placeholder:m(R)},null,8,["modelValue","placeholder"])]),_:1})]),_:1},8,["model"])])}}});export{j as default};
