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-BYcXwl4U.js";import{i as I,c as k}from"./app-a6cKceqE.js";import{_ as b}from"./app-C3oVnfUH.js";import{_ as x}from"./app-DStQB5ZD.js";import{_ as C}from"./app-B8JChEZz.js";import{s as u,L as $}from"./app-W_y7sflh.js";import{_}from"./app-uVRRKSkZ.js";import{_ as G}from"./app-uhTxLRnQ.js";import{_ as P}from"./app-B6Y8s8wR.js";import{_ as g}from"./app-DmX24te2.js";import"./app-CLawzVMq.js";import"./app-BeFNDz9n.js";import"./app-BDgR0DSb.js";import"./app-DxjODhok.js";import"./app-DPDEogA0.js";import"./app-DCd54JMo.js";import"./app-MrAtUXr3.js";import"./app-BWSI2Z1R.js";import"./app-CabATHnR.js";import"./app-BhzV4gWo.js";import"./app-D7QVa3_6.js";import"./app-CO4sV-Ic.js";import"./app-yt37eDzA.js";import"./app-BG60hdvp.js";import"./app-BQ5ggxk2.js";import"./app-SxAW7vhf.js";import"./app-D3zbrzdO.js";import"./app-CJCAnMrx.js";import"./app-Cp3gmk2J.js";import"./app--MWyBMkA.js";import"./app-CNARLpXE.js";import"./app-D5k1HLu9.js";import"./app-ysQ8KbGS.js";import"./app-Cc2zXvHs.js";import"./app-aSafd0Me.js";import"./app-BHl80pFw.js";import"./app-Btbk6LWy.js";import"./app-CrkKi1Ag.js";import"./app-u5shTDG_.js";import"./app-D2Wz0BUQ.js";import"./app-CrjU8lgK.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};
