← Back
Editing: form-legacy4.js
System.register(["./public-legacy.js?v=1753755607904","./index.vue_vue_type_script_setup_true_lang-legacy.js?v=1753755607904","./index-legacy100.js?v=1753755607904","./vue-legacy.js?v=1753755607904","./page_layout-legacy.js?v=1753755607904","./naive-legacy.js?v=1753755607904","./common-legacy.js?v=1753755607904","./__commonjsHelpers__-legacy.js?v=1753755607904"],(function(e,l){"use strict";var r,a,t,o,i,s,u,c,d,n,p,f,m,_,v,y,w,b,h,P,S;return{setters:[e=>{r=e._},e=>{a=e._},e=>{t=e._},e=>{o=e.k,i=e.P,s=e.r,u=e.e,c=e.U,d=e.X,n=e.Q,p=e.a2,f=e.l,m=e.V,_=e.W,v=e.v,y=e.a3},e=>{w=e.fU,b=e.fV},e=>{h=e.cC,P=e.cG,S=e.aq},null,null],execute:function(){const l={class:"p-20px"},F={class:"w-240px"},g={class:"w-240px"},U={class:"w-240px"},x={class:"w-240px"},$={class:"w-240px"},j={class:"w-240px"},E={class:"w-240px"},T={class:"w-240px"};e("default",o({__name:"form",props:{row:{},isEdit:{type:Boolean,default:!1}},emits:["refresh"],setup(e,{expose:o,emit:C}){const I=e,k=C,{t:A}=i(),{isEdit:D,row:N}=I,O=s(null),V=u({protocol:"tcp",port:"",choose:"all",address:"",domain:"",types:"accept",chain:"INPUT",brief:""}),q={port:{trigger:["blur","input"],validator:()=>{const e=V.port.split(","),l=/^\d+$/;for(let r of e)if(l.test(r)){const e=parseInt(r,10);if(e<1||e>65535)return new Error(A("Security.Firewall.Port.form_15"))}else{if(!r.includes("-"))return""==r?new Error(A("Security.Firewall.Port.form_16")):new Error(A("Security.Firewall.Port.form_15"));{const e=r.split("-"),l=parseInt(e[0],10),a=parseInt(e[1],10);if(l<1||a>65535||l>a)return new Error(A("Security.Firewall.Port.form_15"))}}return!0}},address:{trigger:["blur","input"],validator:()=>!!("point"!==V.choose||""!==V.address.trim()&&V.address)||new Error(A("Security.Firewall.Port.form_18"))},domain:{trigger:["blur","input"],validator:()=>!!("domain"!==V.choose||""!==V.domain.trim()&&V.domain)||new Error(A("Security.Firewall.Port.form_19"))}},B=[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"},{label:"TCP/UDP",value:"all"}],G=[{label:A("Security.Firewall.Port.form_20"),value:"all"},{label:A("Security.Firewall.Port.form_5"),value:"point"}],H=[{label:A("Security.Firewall.Port.form_21"),value:"accept"},{label:A("Security.Firewall.Port.form_22"),value:"drop"}],Q=[{label:A("Security.Firewall.Port.form_23"),value:"INPUT"},{label:A("Security.Firewall.Port.form_24"),value:"OUTPUT"}];return D&&N&&(V.protocol=N.Protocol,V.port=N.Port,V.choose="all"===N.Address?"all":""===N.domain?"point":"domain",V.address="all"===N.Address?"":N.Address,V.domain=N.domain,V.types=N.Strategy,V.chain=N.Chain,V.brief=N.brief),o({onConfirm:async()=>{await(O.value?.validate());const e=(()=>{let e={protocol:V.protocol,port:V.port,choose:V.choose,domain:"domain"===V.choose?V.domain:"",types:V.types,strategy:V.types,chain:V.chain,brief:V.brief};return"point"===e.choose&&(e=Object.assign(e,{address:V.address})),e})();D&&N?await w({new_data:e,old_data:N}):await b(e),k("refresh")}}),(e,o)=>{const i=P,s=h,u=S,w=t,b=a,C=r;return d(),c("div",l,[n(b,{ref_key:"formRef",ref:O,model:_(V),rules:q},{default:p((()=>[n(s,{label:e.$t("Security.Firewall.Port.form_1"),path:"protocol"},{default:p((()=>[m("div",F,[n(i,{value:_(V).protocol,"onUpdate:value":o[0]||(o[0]=e=>_(V).protocol=e),options:B},null,8,["value"])])])),_:1},8,["label"]),n(s,{label:e.$t("Security.Firewall.Port.form_2"),path:"port"},{default:p((()=>[m("div",g,[n(u,{value:_(V).port,"onUpdate:value":o[1]||(o[1]=e=>_(V).port=e),disabled:_(D),placeholder:e.$t("Security.Firewall.Port.form_3")},null,8,["value","disabled","placeholder"])])])),_:1},8,["label"]),n(s,{label:e.$t("Security.Firewall.Port.form_4"),path:"choose"},{default:p((()=>[m("div",U,[n(i,{value:_(V).choose,"onUpdate:value":o[2]||(o[2]=e=>_(V).choose=e),options:G},null,8,["value"])])])),_:1},8,["label"]),f(n(s,{label:e.$t("Security.Firewall.Port.form_5"),path:"address"},{default:p((()=>[m("div",x,[n(w,{value:_(V).address,"onUpdate:value":o[3]||(o[3]=e=>_(V).address=e),rows:3,placeholder:e.$t("Security.Firewall.Port.form_6")},null,8,["value","placeholder"])])])),_:1},8,["label"]),[[v,"point"===_(V).choose]]),f(n(s,{label:e.$t("Security.Firewall.Port.form_7"),path:"domain"},{default:p((()=>[m("div",$,[n(w,{value:_(V).domain,"onUpdate:value":o[4]||(o[4]=e=>_(V).domain=e),rows:3,placeholder:e.$t("Security.Firewall.Port.form_8")},null,8,["value","placeholder"])])])),_:1},8,["label"]),[[v,"domain"===_(V).choose]]),n(s,{label:e.$t("Security.Firewall.Port.form_9"),path:"types"},{default:p((()=>[m("div",j,[n(i,{value:_(V).types,"onUpdate:value":o[5]||(o[5]=e=>_(V).types=e),options:H},null,8,["value"])])])),_:1},8,["label"]),n(s,{label:e.$t("Security.Firewall.Port.form_10"),path:"types"},{default:p((()=>[m("div",E,[n(i,{value:_(V).chain,"onUpdate:value":o[6]||(o[6]=e=>_(V).chain=e),options:Q},null,8,["value"])])])),_:1},8,["label"]),n(s,{label:e.$t("Security.Firewall.Port.form_11"),path:"brief","show-feedback":!1},{default:p((()=>[m("div",T,[n(u,{value:_(V).brief,"onUpdate:value":o[7]||(o[7]=e=>_(V).brief=e),placeholder:e.$t("Security.Firewall.Port.form_12")},null,8,["value","placeholder"])])])),_:1},8,["label"])])),_:1},8,["model"]),n(C,{class:"mt-20px ml-40px"},{default:p((()=>[m("li",null,y(e.$t("Security.Firewall.Port.form_13")),1),m("li",null,y(e.$t("Security.Firewall.Port.form_14")),1)])),_:1})])}}}))}}}));
Save File
Cancel