"use strict";(self["webpackChunkmi_wifi_agent"]=self["webpackChunkmi_wifi_agent"]||[]).push([[4947],{6410:function(e,t,l){l.r(t),l.d(t,{default:function(){return r}});var a=l(641);const i={class:"left-panel"};function s(e,t,l,s,n,o){const c=(0,a.g2)("el-button"),d=(0,a.g2)("el-header"),r=(0,a.g2)("el-table-column"),b=(0,a.g2)("el-icon-circle-check-filled"),h=(0,a.g2)("el-icon"),p=(0,a.g2)("el-popconfirm"),u=(0,a.g2)("el-button-group"),f=(0,a.g2)("scTable"),g=(0,a.g2)("el-main"),k=(0,a.g2)("el-container"),m=(0,a.g2)("save-dialog");return(0,a.uX)(),(0,a.CE)(a.FK,null,[(0,a.bF)(k,null,{default:(0,a.k6)((()=>[(0,a.bF)(d,null,{default:(0,a.k6)((()=>[(0,a.Lk)("div",i,[(0,a.bF)(c,{type:"primary",icon:"el-icon-plus",onClick:o.add},null,8,["onClick"]),(0,a.bF)(c,{type:"danger",plain:"",icon:"el-icon-delete",disabled:0==n.selection.length,onClick:o.batch_del},null,8,["disabled","onClick"])])])),_:1}),(0,a.bF)(g,{class:"nopadding"},{default:(0,a.k6)((()=>[(0,a.bF)(f,{ref:"table",apiObj:n.apiObj,"row-key":"id",onSelectionChange:o.selectionChange,stripe:""},{default:(0,a.k6)((()=>[(0,a.bF)(r,{type:"selection",width:"50"}),(0,a.bF)(r,{label:"应用ID",prop:"appId",width:"150"}),(0,a.bF)(r,{label:"应用名称",prop:"appName",width:"250"}),(0,a.bF)(r,{label:"状态",width:"50"},{default:(0,a.k6)((()=>[(0,a.bF)(h,{style:{color:"#67C23A"}},{default:(0,a.k6)((()=>[(0,a.bF)(b)])),_:1})])),_:1}),(0,a.bF)(r,{label:"秘钥",prop:"secret","show-overflow-tooltip":"",width:"150"}),(0,a.bF)(r,{label:"授权到期",prop:"exp",width:"150"}),(0,a.bF)(r,{label:"操作",fixed:"right",align:"right",width:"120"},{default:(0,a.k6)((e=>[(0,a.bF)(u,null,{default:(0,a.k6)((()=>[(0,a.bF)(c,{text:"",type:"primary",size:"small",onClick:t=>o.table_edit(e.row,e.$index)},{default:(0,a.k6)((()=>[(0,a.eW)("编辑")])),_:2},1032,["onClick"]),(0,a.bF)(p,{title:"确定删除吗？",onConfirm:t=>o.table_del(e.row,e.$index)},{reference:(0,a.k6)((()=>[(0,a.bF)(c,{text:"",type:"primary",size:"small"},{default:(0,a.k6)((()=>[(0,a.eW)("删除")])),_:1})])),_:2},1032,["onConfirm"])])),_:2},1024)])),_:1})])),_:1},8,["apiObj","onSelectionChange"])])),_:1})])),_:1}),n.dialog.save?((0,a.uX)(),(0,a.Wv)(m,{key:0,ref:"saveDialog",onSuccess:o.handleSuccess,onClosed:t[0]||(t[0]=e=>n.dialog.save=!1)},null,8,["onSuccess"])):(0,a.Q3)("",!0)],64)}var n=l(5872),o={name:"client",components:{saveDialog:n["default"]},data(){return{dialog:{save:!1},apiObj:this.$API.system.app.list,selection:[]}},methods:{add(){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open()}))},table_edit(e){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open("edit").setData(e)}))},async table_del(e,t){var l={id:e.id},a=await this.$API.user.del.post(l);200==a.code?(this.$refs.table.tableData.splice(t,1),this.$message.success("删除成功")):this.$alert(a.message,"提示",{type:"error"})},async batch_del(){this.$confirm(`确定删除选中的 ${this.selection.length} 项吗？`,"提示",{type:"warning"}).then((()=>{const e=this.$loading();this.selection.forEach((e=>{this.$refs.table.tableData.forEach(((t,l)=>{e.id===t.id&&this.$refs.table.tableData.splice(l,1)}))})),e.close(),this.$message.success("操作成功")})).catch((()=>{}))},selectionChange(e){this.selection=e},handleSuccess(e,t){"add"==t?(e.id=(new Date).getTime(),this.$refs.table.tableData.unshift(e)):"edit"==t&&this.$refs.table.tableData.filter((t=>t.id===e.id)).forEach((t=>{Object.assign(t,e)}))}}},c=l(6262);const d=(0,c.A)(o,[["render",s]]);var r=d}}]);