import{_ as r}from"./public.js?v=1753954525509";import{_ as e}from"./index.vue_vue_type_script_setup_true_lang.js?v=1753954525509";import{aP as a,fZ as l,f_ as o}from"./page_layout.js?v=1753954525509";import{k as t,P as s,r as d,e as i,U as p,V as _,Q as u,a2 as c,W as f,X as w,a3 as m}from"./vue.js?v=1753954525509";import{cG as n,cA as v,aq as F}from"./naive.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";const b={class:"p-20px"},y={class:"w-200px"},S={class:"w-200px"},h={class:"w-200px"},x={class:"w-200px"},$={class:"w-200px"},P=t({__name:"form",props:{row:{},isEdit:{type:Boolean,default:!1}},emits:["refresh"],setup(t,{expose:P,emit:j}){const U=t,g=j,{t:E}=s(),{isEdit:T,row:k}=U,A=d(null),C=i({protocol:"tcp",s_ports:"",d_address:"",d_ports:"",brief:""}),q={s_ports:{trigger:["blur","input"],validator:()=>""!==C.s_ports.trim()&&C.s_ports?!!a(C.s_ports)||new Error(E("Security.Firewall.Forward.form_12")):new Error(E("Security.Firewall.Forward.form_3"))},d_ports:{trigger:["blur","input"],validator:()=>""!==C.d_ports.trim()&&C.d_ports?!!a(C.d_ports)||new Error(E("Security.Firewall.Forward.form_12")):new Error(E("Security.Firewall.Forward.form_7"))}},B=[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"}];return T&&k&&(C.protocol=k.Protocol?k.Protocol.toLowerCase():"tcp",C.s_ports=k.S_Port||"",C.d_address=k.T_Address||"",C.d_ports=k.T_Port||"",C.brief=k.brief),P({onConfirm:async()=>{var r;await(null==(r=A.value)?void 0:r.validate());const e={protocol:C.protocol,S_Port:C.s_ports,T_Port:C.d_ports,T_Address:C.d_address,brief:C.brief};T&&k?await l({new_data:{...e,id:k.id},old_data:k}):await o(e),g("refresh")}}),(a,l)=>{const o=n,t=v,s=F,d=e,i=r;return p(),_("div",b,[u(d,{ref_key:"formRef",ref:A,model:w(C),rules:q},{default:c((()=>[u(t,{label:a.$t("Security.Firewall.Forward.form_1"),path:"protocol"},{default:c((()=>[f("div",y,[u(o,{value:w(C).protocol,"onUpdate:value":l[0]||(l[0]=r=>w(C).protocol=r),options:B},null,8,["value"])])])),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_2"),path:"s_ports"},{default:c((()=>[f("div",S,[u(s,{value:w(C).s_ports,"onUpdate:value":l[1]||(l[1]=r=>w(C).s_ports=r),placeholder:a.$t("Security.Firewall.Forward.form_3")},null,8,["value","placeholder"])])])),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_4"),path:"d_address"},{default:c((()=>[f("div",h,[u(s,{value:w(C).d_address,"onUpdate:value":l[2]||(l[2]=r=>w(C).d_address=r),placeholder:a.$t("Security.Firewall.Forward.form_5")},null,8,["value","placeholder"])])])),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_6"),path:"d_ports"},{default:c((()=>[f("div",x,[u(s,{value:w(C).d_ports,"onUpdate:value":l[3]||(l[3]=r=>w(C).d_ports=r),placeholder:a.$t("Security.Firewall.Forward.form_7")},null,8,["value","placeholder"])])])),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_8"),path:"brief","show-feedback":!1},{default:c((()=>[f("div",$,[u(s,{value:w(C).brief,"onUpdate:value":l[4]||(l[4]=r=>w(C).brief=r),placeholder:a.$t("Security.Firewall.Forward.form_9")},null,8,["value","placeholder"])])])),_:1},8,["label"])])),_:1},8,["model"]),u(i,{class:"mt-20px ml-40px"},{default:c((()=>[f("li",null,m(a.$t("Security.Firewall.Forward.form_10")),1),f("li",null,m(a.$t("Security.Firewall.Forward.form_11")),1)])),_:1})])}}});export{P as default};
