import{j as a,b as e,n as l,Q as s,p as t,b8 as n,l as o}from"./utils-lib.js?v=1761009159";import{_ as i}from"./index105.js?v=1761009159";import{_ as d}from"./index219.js?v=1761009159";import{c as r,r as u,aA as m,V as p,g as c,w as _,v,N as f,B as b,z as h,e as w,y as g,R as y,x as S,F as V,b0 as D,D as j,Q as N,ak as x,al as k,ab as C,T as R,a9 as L,q,_ as P,H as U,I as O}from"./base-lib.js?v=1761009159";import{O as z,P as E,Q as F,y as Q}from"./ssl.js?v=1761009159";import{u as A}from"./column.js?v=1761009159";import{g as H}from"./useStore10.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const I={class:"py-[16px]"},J=r({__name:"index",props:{title:{type:String,default:"添加NDS验证"}},setup(l){const s=e(),t=u({dns_name:"",ps:""}),n=u(null),o=m("isShowForm",p(!1)),i=m("formParams",p([])),d=m("isRefreshDNSList",p(!1)),r=m("formRow",p({})),q=u([]),P=c(()=>!!r.value.id),U=a=>{var e;q.value=(null==(e=i.value.find(e=>e.id.toLowerCase()===a.toLowerCase()))?void 0:e.params)||[],F()},O=u({dns_name:[{required:!0,message:"请选择验证类型",trigger:"change"}]}),F=()=>{q.value.forEach(a=>{O.value[a]=[{required:!0,message:"请输入".concat(a),trigger:"blur"}]})},Q=()=>{t.value={dns_name:"",ps:""},r.value={dns_name:"DNSPodDns"}},A=async()=>{const a=n.value;if(!(await a.validate().catch(()=>!1)))return!1;try{let a,e={...t.value};if(t.value.id){a=await z({dns_id:e.id,ps:e.ps||"",pdata:JSON.stringify(e)})}else{a=await E({dns_name:e.dns_name,ps:e.ps||"",pdata:JSON.stringify(e)})}s.request(a),o.value=!1,d.value=!0,Q()}catch(e){return s.error(e),!1}},H=async()=>{Q()};return _(i,a=>{a.length&&(t.value.dns_name=a[0].id,U(a[0].id))}),_(r,a=>{t.value={...a},a.dns_name&&U(a.dns_name)},{immediate:!0}),_(o,a=>{a&&r.value.dns_name&&(t.value={...r.value},U(r.value.dns_name))}),(e,s)=>{const d=x,r=k,u=C,m=R,p=L,c=a;return v(),f(c,{title:l.title,modelValue:g(o),"onUpdate:modelValue":s[3]||(s[3]=a=>N(o)?o.value=a:null),area:["50rem"],"show-footer":"",onCancel:H,onConfirm:A},{default:b(()=>[h("div",I,[w(p,{ref_key:"dnsformRef",ref:n,size:"small",model:g(t),rules:g(O),class:"relative w-full","label-position":"right",onSubmit:s[2]||(s[2]=y(()=>{},["prevent"]))},{default:b(()=>[w(u,{label:"验证类型",prop:"dns_name","label-width":"100"},{default:b(()=>[w(r,{modelValue:g(t).dns_name,"onUpdate:modelValue":s[0]||(s[0]=a=>g(t).dns_name=a),class:"!w-[33rem]",size:"default",filterable:"","default-first-option":"",placeholder:"请选择验证类型",disabled:g(P),onChange:U},{default:b(()=>[(v(!0),S(V,null,D(g(i),a=>(v(),f(d,{key:a.id,label:a.name,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),g(q).length?(v(!0),S(V,{key:0},D(g(q),(a,e)=>(v(),f(u,{key:e,label:a,prop:a,"label-width":"100"},{default:b(()=>[w(m,{modelValue:g(t)[a],"onUpdate:modelValue":e=>g(t)[a]=e,class:"!w-[33rem]",placeholder:"请输入".concat(a)},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label","prop"]))),128)):j("",!0),w(u,{prop:"ps",label:"备注","label-width":"100"},{default:b(()=>[w(m,{modelValue:g(t).ps,"onUpdate:modelValue":s[1]||(s[1]=a=>g(t).ps=a),placeholder:"请输入备注",clearable:"",class:"!w-[33rem]"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])])]),_:1},8,["title","modelValue"])}}}),T={class:"p-[16px]"},B=r({__name:"index",setup(a){const r=e(),{refs:{isRefreshDomainList:m}}=H(),c=u([]),f=u({}),h=u(!1),y=u(!1),V=u(!1),D=p("添加DNS接口"),j=p({}),N=[{label:"类型",prop:"dns_name"},{label:"账号备注",prop:"ps"},A([{onClick:a=>{j.value=a,l({title:"DNS域名【".concat(a.dns_name,"】"),area:50,component:()=>s(()=>import("./index483.js?v=1761009159"),__vite__mapDeps([]),import.meta.url),compData:{row:a}})},title:"域名"},{onClick:a=>{j.value=a,D.value="编辑【".concat(a.dns_name,"】"),V.value=!0},title:"编辑"},{onClick:a=>{k(a)},title:"删除"}])],x=[{content:"添加DNS接口",active:!0,event:()=>{D.value="添加DNS接口",V.value=!0}}],k=async a=>{await t({title:"删除【".concat(a.dns_name,"】"),content:"删除该验证接口，是否继续操作？",icon:"warning"});try{const e=await F({dns_id:a.id});r.request(e),y.value=!0,m.value=!0}catch(e){}};return _(y,a=>{a&&((async()=>{h.value=!0;const{data:a}=await Q(),e=n(a);if(e("data")){const{data:e}=a;c.value=e}if(e("add_data")){const{add_data:e}=a;f.value=e}h.value=!1})(),y.value=!1)},{immediate:!0}),q(()=>{y.value=!0}),P("isShowForm",V),P("formParams",f),P("isRefreshDNSList",y),P("formRow",j),(a,e)=>{const l=d,s=o,t=i,n=U("bt-loading");return v(),S("div",T,[w(t,null,{"header-left":b(()=>[w(l,{options:x})]),content:b(()=>[O(w(s,{class:"soft-table",column:N,"max-height":"350",data:g(c),description:"列表为空"},null,8,["data"]),[[n,g(h)],[n,"正在加载NDS验证接口列表，请稍后...","title"]])]),popup:b(()=>[w(J,{title:g(D)},null,8,["title"])]),_:1})])}}});export{B as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
