"use strict";(self["webpackChunkwaf_dashboard"]=self["webpackChunkwaf_dashboard"]||[]).push([[577],{15577:function(t,e,s){s.r(e),s.d(e,{default:function(){return u}});var r=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("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.certs,rowKey:t=>t.id,scroll:{x:"calc(600px + 50%)"}},on:{change:t.onChange},scopedSlots:t._u([{key:"level",fn:function(s){return[e("a-tag",{staticClass:"tag-status",class:t.levelcls(s)},[t._v(" "+t._s(t.levelStr(s))+" ")])]}},{key:"type",fn:function(e){return[t._v(" "+t._s(t.typeStr(e))+" ")]}},{key:"ActBtn",fn:function(s){return[e("a-button",{staticClass:"custom-button",attrs:{icon:"setting",shape:"circle",size:"small"},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"},on:{click:function(e){return t.showConfirm(s.id)}}})]}}])})],1)],1)],1)],1)},a=[];const n=[{title:"SNI",dataIndex:"sni",width:350,fixed:"left",ellipsis:!0},{title:"过期时间",dataIndex:"expire_time"},{title:"更新时间",dataIndex:"update_time"},{title:"操作",scopedSlots:{customRender:"ActBtn"},width:140,fixed:"right",align:"center"}];function c(t,e,s){console.log("params",t,e,s)}var o={props:{searchStr:{type:String,default:""}},data(){return{oldCerts:[],certs:[],columns:n}},methods:{onChange:c,showConfirm(t){this.$createElement;let e=this;this.$confirm({title:"是否删除该证书?",content:t=>t("div",{style:"color:red;"},[t("a-icon",{attrs:{type:"warning"}})," 警告: 删除后该证书将失效! "]),okText:"确定",okType:"danger",cancelText:"取消",onOk(){e.http.delete("/certs/"+t).then((t=>{t.data.err?e.$message.error("错误："+t.data.err):(e.$message.success("删除成功!"),e.http.get("/certs/").then((t=>{e.certs=t.data,e.oldCerts=e.certs})).catch((t=>{e.$message.error(t.message)})))})).catch((t=>{if(t.response&&401===t.response.status)return e.$message.info("请重新登录！"),void e.$router.push({name:"用户登录"});console.log(t)}))},onCancel(){console.log("Cancel")}})},typeStr(t){return"0"===t?"请求阶段":"1"===t?"返回HTTP头":"2"===t?"返回页面":void 0},levelStr(t){return"0"===t?"低危":"1"===t?"中危":"2"===t?"高危":"3"===t?"严重":void 0},levelcls(t){return"0"===t?"ant-tag-primary":"1"===t?"ant-tag-secondary":"2"===t?"ant-tag-warning":"3"===t?"ant-tag-danger":void 0},redirect(t){this.$router.push({name:"证书配置",params:{ex:t}})}},mounted(){this.http.get("/certs/").then((t=>{t.data.err?this.$message.error("错误："+t.data.err):(this.certs=t.data,this.oldCerts=this.certs)})).catch((t=>{if(t.response&&401===t.response.status)return this.$message.info("请重新登录！"),void this.$router.push({name:"用户登录"});console.log(t)}))},watch:{searchStr:function(t){this.certs=t?this.oldCerts.filter((function(e){return e.name.match(t)||e.description.match(t)})):this.oldCerts}}},i=o,l=s(81656),d=(0,l.A)(i,r,a,!1,null,null,null),u=d.exports}}]);