import{aP as e,iI as a,P as s,iJ as r,K as l,_ as t}from"./utils-lib.js?v=1761009159";import{c as i,aA as v,g as u,at as o,v as n,x as m,e as p,y as d}from"./base-lib.js?v=1761009159";import{b as g,n as b,j as c,d as w,o as _,c as y}from"./form-item.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const{refs:{isRefreshNetworkList:f}}=e(),h=[{label:"bridge",value:"bridge"},{label:"ipvlan",value:"ipvlan"},{label:"macvlan",value:"macvlan"},{label:"overlay",value:"overlay"}],I=(e,s,r)=>{""===e||a(e)?s():s(new Error(r))},P={class:"p-[1.6rem]"},j=t(i({__name:"index",setup(e,{expose:a}){const t=v("popupClose",()=>{}),{BtForm:i,submit:j}=l({data:()=>({name:"",driver:"bridge",options:"",subnet:"",gateway:"",iprange:"",labels:"",remark:"",subnet_v6:"",gateway_v6:"",isAdv:!1,ipv6:!1}),options:e=>u(()=>[g("网络名","name",{attrs:{class:"!w-[40rem]",placeholder:"请输入网络名"},rules:[{required:!0,message:"请输入网络名",trigger:"blur"}]}),b(o(e.value,"isAdv")),...e.value.isAdv?[c("设备","driver",h,{attrs:{class:"!w-[40rem]"}}),w([g("ipv4子网","subnet",{attrs:{class:"!w-[15rem]",placeholder:"例：124.42.0.0/16"},rules:[{validator:(e,a,s)=>I(a,s,"请输入正确的ipv4子网"),trigger:"blur"}]}),g("ipv4网关","gateway",{attrs:{class:"!w-[15rem]",placeholder:"例：124.42.0.254"},rules:[{validator:(e,a,s)=>I(a,s,"请输入正确的ipv4网关"),trigger:"blur"}]})]),g("ipv4范围","iprange",{attrs:{class:"!w-[40rem]",placeholder:"例：124.42.0.0/24"},rules:[{validator:(e,a,s)=>I(a,s,"请输入正确的IP范围"),trigger:"blur"}]}),_("开启IPV6","ipv6"),...e.value.ipv6?[w([g("IPV6子网","subnet_v6",{attrs:{class:"!w-[15rem]",placeholder:"例：2001:db8::/48"},rules:[{required:!0,message:"请输入IPV6子网",trigger:"blur"}]}),g("IPV6网关","gateway_v6",{attrs:{class:"!w-[15rem]",placeholder:"例：2001:db8::1"},rules:[{required:!0,message:"请输入IPV6网关",trigger:"blur"}]})])]:[],y("备注","remark",{attrs:{placeholder:"请输入备注",autosize:{minRows:5,maxRows:5},resize:"none",class:"w-[40rem]"}})]:[]]),submit:async(e,a,l)=>{await a(),(async(e,a)=>{s({request:r({data:JSON.stringify({name:e.value.name,driver:e.value.driver,options:e.value.options,subnet:e.value.subnet,gateway:e.value.gateway,iprange:e.value.iprange,labels:e.value.labels,remark:e.value.remark,status:e.value.ipv6?1:0,...e.value.ipv6?{subnet_v6:e.value.subnet_v6,gateway_v6:e.value.gateway_v6}:{subnet_v6:"",gateway_v6:""}})}),message:!0,loading:"正在设置网络...",success:({status:e})=>{e&&(f.value=!0,a())}})})(e,t)}});return a({onConfirm:j}),(e,a)=>(n(),m("div",P,[p(d(i))]))}}),[["__scopeId","data-v-157fab76"]]);export{j as default};
