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-SC54XQDl.js";import{i as I,c as k}from"./app-Ba7ZqSpq.js";import{_ as b}from"./app-Cft_lrsr.js";import{_ as x}from"./app-DJCl4rzT.js";import{_ as C}from"./app-rIYFLdeU.js";import{s as u,L as $}from"./app-Crd12MWL.js";import{_}from"./app-C33Py4oT.js";import{_ as G}from"./app-D9UgVOV0.js";import{_ as P}from"./app-CBN_lwXA.js";import{_ as g}from"./app-BUqHq_rP.js";import"./app-qhR41k1m.js";import"./app-CS3AUTAk.js";import"./app-CCkWSX4Q.js";import"./app-Dhl-Bw0H.js";import"./app-BjSCO7rC.js";import"./app-CL60OiIv.js";import"./app-D9TrJBlL.js";import"./app-_Ovp2dOH.js";import"./app-B2C_dtYI.js";import"./app-COidJXl1.js";import"./app-B9xxzP2y.js";import"./app-C28obFWS.js";import"./app-CkINxBL9.js";import"./app-PPG0ZS4d.js";import"./app--Lj8zATS.js";import"./app-Ch8j4za4.js";import"./app-C2mBgI5Z.js";import"./app-DHsI_tns.js";import"./app-BZGObKCm.js";import"./app-BPIIxVwk.js";import"./app-DgoEZtNT.js";import"./app-Dw0jKdCD.js";import"./app-DnXuoh8P.js";import"./app-C8HFiBxn.js";import"./app-g-bJrEAS.js";import"./app-DZaelcLs.js";import"./app-D_RBJHM6.js";import"./app-CmrRgGIA.js";import"./app-DyP4Nide.js";import"./app-DoVkxbmA.js";import"./app-CNHjdV6U.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};
