import{o as s,c as m,w as o,u as e,b as c,g as p,i as f,f as n,h as i,a as l,n as w,t as h}from"./app-DA7OTM4Q.js";import{i as I,c as k}from"./app-BT68AfZ-.js";import{_ as b}from"./app-CKBPOVnC.js";import{_ as x}from"./app-B4tq9Xj4.js";import{_ as C}from"./app-DQ7IohAF.js";import{s as u,L as $}from"./app-CjSxNKvA.js";import{_}from"./app-D9gZpsQn.js";import{_ as G}from"./app-BWsCS5pa.js";import{_ as P}from"./app-j31z0Ghb.js";import{_ as g}from"./app-C6hnOMuv.js";import"./app-P70ZK_FT.js";import"./app-D5twQdhO.js";import"./app-BotiHebp.js";import"./app-OC5wWJiS.js";import"./app-CnGe5nlE.js";import"./app-scFtFqL8.js";import"./app-DREBJ-ou.js";import"./app-CWBL8eTX.js";import"./app-BX4pd6U-.js";import"./app-Bhreb6Cm.js";import"./app-D6fSNcLx.js";import"./app-up4gT9D9.js";import"./app-D29bbm9n.js";import"./app-Dxa5h-uG.js";import"./app-B_5dka6q.js";import"./app-BqY8p2gl.js";import"./app-CQwVTjAx.js";import"./app-z_TsLOhk.js";import"./app-C5ROEzFd.js";import"./app-Bnbo6OlJ.js";import"./app-AbPAjGV5.js";import"./app-C-GI59rl.js";import"./app-DSiZNBrr.js";import"./app-DUjqI3OV.js";import"./app-45ZaIHUI.js";import"./app-KNE_24OY.js";import"./app-SLkqftrw.js";import"./app-BxVwOz69.js";import"./app-WOreqTiW.js";import"./app-BkWUIifj.js";import"./app-Zes_jb7S.js";function O(){const{utils:d,Tea:t}=I(this);this.enableGroup=function(a){this.$post("/servers/components/waf/updateGroupOn").params({groupId:a,isOn:1}).refresh()},this.disableGroup=function(a){this.$post("/servers/components/waf/updateGroupOn").params({groupId:a,isOn:0}).refresh()},this.deleteGroup=function(a){d.confirm("确定要删除此规则分组吗？",function(){this.$post("/servers/components/waf/deleteGroup").params({firewallPolicyId:this.firewallPolicyId,groupId:a}).refresh()})},this.createGroup=function(a){d.popup("/servers/components/waf/createGroupPopup?firewallPolicyId="+this.firewallPolicyId+"&type="+a,{callback:function(){d.success("保存成功",function(){d.reload()})}})},this.sortTable=function(a){this.$post("/servers/components/waf/sortGroups").params({firewallPolicyId:this.firewallPolicyId,type:this.type,groupIds:a}).success(function(){d.successToast("排序保存成功")})}}const T={key:0},S={key:1},B=["href"],N={key:0,class:"comment",style:{"padding-bottom":"0"}},V={class:"label-group mt-1"},D=["href"],L=["href"],R=["onClick"],z=["onClick"],E=["onClick"],M=l("p",{class:"comment flex items-center"},[n("所有规则匹配顺序为从上到下，可以拖动左侧的"),l("i",{class:"icon bars"}),n("排序。 ")],-1),j={key:1},Oe={__name:"groups",setup(d){const t=k(new O);return(a,y)=>(s(),m(b,{ctx:e(t)},{default:o(()=>[c(x,{ctx:e(t),"active-tab":e(t).type},null,8,["ctx","active-tab"]),e(t).featureIsOn?(s(),p("div",T,[c(P,null,{default:o(()=>[c(g,{onClick:y[0]||(y[0]=f(r=>e(t).createGroup(e(t).type),["prevent"])),"action-create":""},{default:o(()=>[n("添加分组")]),_:1})]),_:1}),e(t).groups.length==0?(s(),m(G,{key:0},{default:o(()=>[n("暂时还没有规则分组。")]),_:1})):i("",!0),e(t).groups.length>0?(s(),p("div",S,[c($,{items:e(t).groups,onSort:e(t).sortTable},{default:o(()=>[c(e(u),{rowReorder:"",headerStyle:"width: 3em"}),c(e(u),{header:"规则分组"},{body:o(({data:r})=>[l("a",{href:"/servers/server/settings/waf/group?serverId="+e(t).serverId+"&firewallPolicyId="+e(t).firewallPolicyId+"&type="+e(t).type+"&groupId="+r.id},[l("span",{class:w({disabled:!r.isOn})},h(r.name),3)],8,B),r.description.length>0?(s(),p("p",N,h(r.description),1)):i("",!0),l("p",V,[r.isOn?(s(),m(_,{key:0,class:"green"},{default:o(()=>[n("启用")]),_:1})):i("",!0),r.isOn?i("",!0):(s(),m(_,{key:1,class:"red"},{default:o(()=>[n("停用")]),_:1})),r.code.length>0?(s(),m(_,{key:2},{default:o(()=>[n("预置")]),_:1})):i("",!0),r.code.length==0?(s(),m(_,{key:3},{default:o(()=>[n("自定义")]),_:1})):i("",!0)])]),_:1}),c(e(u),{header:"规则集",headerClass:"text-center two wide",bodyClass:"text-center"},{body:o(({data:r})=>[l("a",{href:"/servers/server/settings/waf/group?serverId="+e(t).serverId+"&firewallPolicyId="+e(t).firewallPolicyId+"&type="+e(t).type+"&groupId="+r.id},h(r.countSets),9,D)]),_:1}),c(e(u),{header:"操作",headerClass:"three op"},{body:o(({data:r})=>[l("a",{href:"/servers/server/settings/waf/group?serverId="+e(t).serverId+"&firewallPolicyId="+e(t).firewallPolicyId+"&type="+e(t).type+"&groupId="+r.id},"详情",8,L),n("   "),r.isOn?i("",!0):(s(),p("a",{key:0,href:"",onClick:f(v=>e(t).enableGroup(r.id),["prevent"])},"启用",8,R)),r.isOn?(s(),p("a",{key:1,href:"",onClick:f(v=>e(t).disableGroup(r.id),["prevent"])},"停用",8,z)):i("",!0),n("   "),r.canDelete?(s(),p("a",{key:2,href:"",onClick:f(v=>e(t).deleteGroup(r.id),["prevent"])},"删除",8,E)):i("",!0)]),_:1})]),_:1},8,["items","onSort"]),M])):i("",!0)])):i("",!0),e(t).featureIsOn?i("",!0):(s(),p("div",j,[c(C)]))]),_:1},8,["ctx"]))}};export{Oe as default};
