"use strict";(self["webpackChunkscui"]=self["webpackChunkscui"]||[]).push([[9698],{486:function(e,t,l){l.r(t),l.d(t,{default:function(){return u}});var a=l(66252);const i={class:"left-panel"},s=(0,a.Uk)("编辑"),n=(0,a.Uk)("删除");function o(e,t,l,o,c,d){const r=(0,a.up)("el-button"),p=(0,a.up)("el-header"),u=(0,a.up)("el-table-column"),h=(0,a.up)("el-icon-circle-check-filled"),f=(0,a.up)("el-icon"),m=(0,a.up)("el-popconfirm"),b=(0,a.up)("el-button-group"),g=(0,a.up)("scTable"),w=(0,a.up)("el-main"),W=(0,a.up)("el-container"),$=(0,a.up)("save-dialog");return(0,a.wg)(),(0,a.iD)(a.HY,null,[(0,a.Wm)(W,{class:"mainBox"},{default:(0,a.w5)((()=>[(0,a.Wm)(p,null,{default:(0,a.w5)((()=>[(0,a._)("div",i,[(0,a.Wm)(r,{type:"primary",icon:"el-icon-plus",onClick:d.add},null,8,["onClick"]),(0,a.Wm)(r,{type:"danger",plain:"",icon:"el-icon-delete",disabled:0==c.selection.length,onClick:d.batch_del},null,8,["disabled","onClick"])])])),_:1}),(0,a.Wm)(w,{class:"nopadding"},{default:(0,a.w5)((()=>[(0,a.Wm)(g,{ref:"table",apiObj:c.apiObj,"row-key":"id",onSelectionChange:d.selectionChange,stripe:""},{default:(0,a.w5)((()=>[(0,a.Wm)(u,{type:"selection",align:"center",width:"50"}),(0,a.Wm)(u,{label:"应用ID",prop:"appId",width:"150"}),(0,a.Wm)(u,{label:"应用名称",prop:"appName",width:"250"}),(0,a.Wm)(u,{label:"状态",width:"50"},{default:(0,a.w5)((()=>[(0,a.Wm)(f,{style:{color:"#67C23A"}},{default:(0,a.w5)((()=>[(0,a.Wm)(h)])),_:1})])),_:1}),(0,a.Wm)(u,{label:"秘钥",prop:"secret","show-overflow-tooltip":"",width:"150"}),(0,a.Wm)(u,{label:"授权到期",prop:"exp",width:"150"}),(0,a.Wm)(u,{label:"操作",fixed:"right",align:"right",width:"120"},{default:(0,a.w5)((e=>[(0,a.Wm)(b,null,{default:(0,a.w5)((()=>[(0,a.Wm)(r,{text:"",type:"primary",size:"small",onClick:t=>d.table_edit(e.row,e.$index)},{default:(0,a.w5)((()=>[s])),_:2},1032,["onClick"]),(0,a.Wm)(m,{title:"确定删除吗？",onConfirm:t=>d.table_del(e.row,e.$index)},{reference:(0,a.w5)((()=>[(0,a.Wm)(r,{text:"",type:"primary",size:"small"},{default:(0,a.w5)((()=>[n])),_:1})])),_:2},1032,["onConfirm"])])),_:2},1024)])),_:1})])),_:1},8,["apiObj","onSelectionChange"])])),_:1})])),_:1}),c.dialog.save?((0,a.wg)(),(0,a.j4)($,{key:0,ref:"saveDialog",onSuccess:d.handleSuccess,onClosed:t[0]||(t[0]=e=>c.dialog.save=!1)},null,8,["onSuccess"])):(0,a.kq)("",!0)],64)}l(30541);var c=l(45420),d={name:"client",components:{saveDialog:c["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)}))}}},r=l(83744);const p=(0,r.Z)(d,[["render",o]]);var u=p}}]);