"use strict";(self["webpackChunkwaf_dashboard"]=self["webpackChunkwaf_dashboard"]||[]).push([[926],{21926: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.users,rowKey:t=>t.id,scroll:{x:"calc(600px + 50%)"}},scopedSlots:t._u([{key:"role",fn:function(e){return[t._v(" "+t._s(t.roleStr(e))+" ")]}},{key:"first",fn:function(s){return[e("a-tag",{staticClass:"tag-status",class:s?"ant-tag-danger":"ant-tag-success"},[t._v(" "+t._s(s?"未启用":"已启用")+" ")])]}},{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:"用户名",dataIndex:"usr",width:200,fixed:"left",ellipsis:!0},{title:"用户角色",dataIndex:"role",scopedSlots:{customRender:"role"}},{title:"动态口令",dataIndex:"first",scopedSlots:{customRender:"first"}},{title:"更新时间",dataIndex:"update_time"},{title:"操作",scopedSlots:{customRender:"ActBtn"},width:140,fixed:"right",align:"center"}];var o={props:{searchStr:{type:String,default:""}},data(){return{oldUsers:[],users:[],columns:n}},methods:{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("/users/"+t).then((t=>{t.data.err?e.$message.error("错误："+t.data.err):(e.$message.success("删除成功!"),e.http.get("/users/").then((t=>{e.users=t.data,e.oldUsers=e.users})).catch((t=>{if(t.response&&401===t.response.status)return e.$message.info("请重新登录！"),void e.$router.push({name:"用户登录"});console.log(t)})))})).catch((t=>{console.log(t)}))},onCancel(){console.log("Cancel")}})},roleStr(t){return"0"===t?"管理员":"1"===t?"操作员":"2"===t?"审计员":void 0},redirect(t){this.$router.push({name:"用户配置",params:{ex:t}})}},mounted(){this.http.get("/users/").then((t=>{t.data.err?this.$message.error("错误："+t.data.err):(this.users=t.data,this.oldUsers=this.users)})).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.users=t?this.oldUsers.filter((function(e){return e.usr.match(t)})):this.oldUsers}}},i=o,l=s(81656),c=(0,l.A)(i,r,a,!1,null,null,null),u=c.exports}}]);