"use strict";(self["webpackChunkwaf_dashboard"]=self["webpackChunkwaf_dashboard"]||[]).push([[665],{32665:function(t,e,s){s.r(e),s.d(e,{default:function(){return g}});var a=function(){var t=this,e=t._self._c;return e("div",[e("a-row",{attrs:{gutter:24,type:"flex"}},[e("a-col",{staticClass:"mb-24",attrs:{span:24}},[e("SiteTable",{attrs:{sites:t.sites,columns:t.columns,searchStr:t.searchStr}})],1)],1)],1)},r=[],n=function(){var t=this,e=t._self._c;return e("a-card",{staticClass:"header-solid h-full",attrs:{bordered:!1,bodyStyle:{padding:0}},scopedSlots:t._u([{key:"title",fn:function(){return[e("a-row",{attrs:{type:"flex",align:"middle"}},[e("a-col",{attrs:{span:24,md:12}},[e("h6",{staticClass:"font-semibold m-0"},[t._v("网站列表")])]),e("a-col",{staticStyle:{display:"flex","align-items":"center","justify-content":"flex-end"},attrs:{span:24,md:12}},[e("a-button",{staticClass:"custom-button",attrs:{icon:"plus-circle",type:"success",shape:"round",size:"small"},on:{click:function(e){return t.redirect(!1)}}},[t._v("添加站点")])],1)],1)]},proxy:!0}])},[e("a-table",{style:{minHeight:"calc(100vh - 228px)"},attrs:{columns:t.columns,"data-source":t.localSites,rowKey:t=>t.id,pagination:{pageSize:10},scroll:{x:"calc(500px + 50%)"}},scopedSlots:t._u([{key:"host",fn:function(e){return[t._v(" "+t._s(e)+" ")]}},{key:"description",fn:function(e){return[t._v(" "+t._s(e)+" ")]}},{key:"mode",fn:function(s){return[e("a-tag",{staticClass:"tag-status",class:"1"===s?"ant-tag-success":"ant-tag-danger"},[t._v(" "+t._s("1"===s?"拦截模式":"观察模式")+" ")])]}},{key:"actBtn",fn:function(s){return[e("a-button",{staticStyle:{"background-color":"#52c41a","border-color":"#52c41a"},attrs:{icon:"setting",type:"primary",shape:"circle",size:"small","data-id":s.id},on:{click:function(e){return t.redirect(s)}}}),e("a-divider",{attrs:{type:"vertical"}}),e("a-button",{attrs:{icon:"delete",type:"danger",shape:"circle",size:"small","data-id":s.id},on:{click:function(e){return t.showConfirm(s.id)}}})]}}])})],1)},i=[],c={props:{sites:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},searchStr:{type:String,default:""}},data(){return{localSites:[]}},methods:{redirect(t){this.$router.push({name:"站点配置",params:{ex:t}})},showConfirm(t){this.$createElement;let e=this;this.$confirm({title:"是否删除该网站?",content:t=>t("div",{style:"color:red;"},[" ",t("a-icon",{attrs:{type:"warning"}})," 警告: 删除网站配置后,将不能通过WAF访问该网站! "]),okText:"确定",okType:"danger",cancelText:"取消",onOk(){e.http.delete("/sites/"+t).then((t=>{t.data.err?e.$message.error("错误："+t.data.err):(e.$message.success("删除成功!"),e.http.get("/sites/").then((t=>{e.localSites=t.data})).catch((t=>{console.log(t)})))})).catch((t=>{console.log(t)}))},onCancel(){}})}},watch:{searchStr:function(t){this.localSites=t?this.sites.filter((function(e){return e.host.match(t)||e.description.match(t)})):this.sites},sites:function(t){t&&(this.localSites=this.sites)}}},o=c,l=s(81656),d=(0,l.A)(o,n,i,!1,null,null,null),u=d.exports;const h=[{title:"域名",dataIndex:"host",scopedSlots:{customRender:"host"},width:240,fixed:"left",ellipsis:!0},{title:"状态",dataIndex:"mode",scopedSlots:{customRender:"mode"},width:120,align:"center"},{title:"描述",dataIndex:"description",scopedSlots:{customRender:"description"},ellipsis:!0},{title:"更新时间",dataIndex:"update_time",class:"text-muted",width:190},{title:"操作",scopedSlots:{customRender:"actBtn"},width:140,fixed:"right",align:"center"}];var p={components:{SiteTable:u},props:{searchStr:{type:String,default:""}},data(){return{sites:[],columns:h}},mounted(){this.http.get("/sites/").then((t=>{t.data.err?this.$message.error("错误："+t.data.err):this.sites=t.data})).catch((t=>{if(t.response&&401===t.response.status)return this.$message.info("请重新登录！"),void this.$router.push({name:"用户登录"});console.log(t)}))}},f=p,m=(0,l.A)(f,a,r,!1,null,null,null),g=m.exports}}]);