import{_ as r}from"./public.js?v=1763625242172";import{_ as e}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{b5 as a,gU as l,gV as o}from"./page_layout.js?v=1763625242172";import{k as t,P as s,r as d,e as i,R as p,S as _,X as u,a3 as c,U as w,V as f,a4 as m}from"./vue.js?v=1763625242172";import{dV as n,dP as v,au as F}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";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:g}){const j=t,U=g,{t:E}=s(),{isEdit:T,row:k}=j,C=d(null),V=i({protocol:"tcp",s_ports:"",d_address:"",d_ports:"",brief:""}),A={s_ports:{trigger:["blur","input"],validator:()=>""!==V.s_ports.trim()&&V.s_ports?!!a(V.s_ports)||new Error(E("Security.Firewall.Forward.form_12")):new Error(E("Security.Firewall.Forward.form_3"))},d_ports:{trigger:["blur","input"],validator:()=>""!==V.d_ports.trim()&&V.d_ports?!!a(V.d_ports)||new Error(E("Security.Firewall.Forward.form_12")):new Error(E("Security.Firewall.Forward.form_7"))}},R=[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"}];return T&&k&&(V.protocol=k.Protocol?k.Protocol.toLowerCase():"tcp",V.s_ports=k.S_Port||"",V.d_address=k.T_Address||"",V.d_ports=k.T_Port||"",V.brief=k.brief),P({onConfirm:async()=>{var r;await(null==(r=C.value)?void 0:r.validate());const e={protocol:V.protocol,S_Port:V.s_ports,T_Port:V.d_ports,T_Address:V.d_address,brief:V.brief};T&&k?await l({new_data:{...e,id:k.id},old_data:k}):await o(e),U("refresh")}}),(a,l)=>{const o=n,t=v,s=F,d=e,i=r;return p(),_("div",b,[u(d,{ref_key:"formRef",ref:C,model:f(V),rules:A},{default:c((()=>[u(t,{label:a.$t("Security.Firewall.Forward.form_1"),path:"protocol"},{default:c((()=>[w("div",y,[u(o,{value:f(V).protocol,"onUpdate:value":l[0]||(l[0]=r=>f(V).protocol=r),options:R},null,8,["value"])])])),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_2"),path:"s_ports"},{default:c((()=>[w("div",S,[u(s,{value:f(V).s_ports,"onUpdate:value":l[1]||(l[1]=r=>f(V).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((()=>[w("div",h,[u(s,{value:f(V).d_address,"onUpdate:value":l[2]||(l[2]=r=>f(V).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((()=>[w("div",x,[u(s,{value:f(V).d_ports,"onUpdate:value":l[3]||(l[3]=r=>f(V).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((()=>[w("div",$,[u(s,{value:f(V).brief,"onUpdate:value":l[4]||(l[4]=r=>f(V).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((()=>[w("li",null,m(a.$t("Security.Firewall.Forward.form_10")),1),w("li",null,m(a.$t("Security.Firewall.Forward.form_11")),1)])),_:1})])}}});export{P as default};
