"use strict";(self["webpackChunkmi_wifi_agent"]=self["webpackChunkmi_wifi_agent"]||[]).push([[7094,8782],{5827:function(e,l,i){i.r(l),i.d(l,{default:function(){return p}});var a=i(641);const t={class:"left-panel"},s={class:"right-panel"},n={class:"right-panel-search"};function o(e,l,i,o,r,d){const c=(0,a.g2)("el-button"),h=(0,a.g2)("el-input"),u=(0,a.g2)("el-header"),p=(0,a.g2)("el-table-column"),b=(0,a.g2)("el-switch"),g=(0,a.g2)("el-popconfirm"),m=(0,a.g2)("el-button-group"),f=(0,a.g2)("scTable"),k=(0,a.g2)("el-main"),w=(0,a.g2)("el-container"),v=(0,a.g2)("save-dialog"),$=(0,a.g2)("permission-dialog");return(0,a.uX)(),(0,a.CE)(a.FK,null,[(0,a.bF)(w,null,{default:(0,a.k6)((()=>[(0,a.bF)(u,null,{default:(0,a.k6)((()=>[(0,a.Lk)("div",t,[(0,a.bF)(c,{type:"primary",icon:"el-icon-plus",onClick:d.add},null,8,["onClick"]),(0,a.bF)(c,{type:"danger",plain:"",icon:"el-icon-delete",disabled:0==r.selection.length,onClick:d.batch_del},null,8,["disabled","onClick"]),(0,a.bF)(c,{type:"primary",plain:"",disabled:1!=r.selection.length,onClick:d.permission},{default:(0,a.k6)((()=>[(0,a.eW)("权限设置")])),_:1},8,["disabled","onClick"])]),(0,a.Lk)("div",s,[(0,a.Lk)("div",n,[(0,a.bF)(h,{modelValue:r.search.keyword,"onUpdate:modelValue":l[0]||(l[0]=e=>r.search.keyword=e),placeholder:"角色名称",clearable:""},null,8,["modelValue"]),(0,a.bF)(c,{type:"primary",icon:"el-icon-search",onClick:d.upsearch},null,8,["onClick"])])])])),_:1}),(0,a.bF)(k,{class:"nopadding"},{default:(0,a.k6)((()=>[(0,a.bF)(f,{ref:"table",apiObj:r.apiObj,"row-key":"id",onSelectionChange:d.selectionChange,stripe:""},{default:(0,a.k6)((()=>[(0,a.bF)(p,{type:"selection",width:"50"}),(0,a.bF)(p,{label:"#",type:"index",width:"50"}),(0,a.bF)(p,{label:"角色名称",prop:"label",width:"150"}),(0,a.bF)(p,{label:"别名",prop:"alias",width:"200"}),(0,a.bF)(p,{label:"排序",prop:"sort",width:"80"}),(0,a.bF)(p,{label:"状态",prop:"status",width:"80"},{default:(0,a.k6)((e=>[(0,a.bF)(b,{modelValue:e.row.status,"onUpdate:modelValue":l=>e.row.status=l,onChange:l=>d.changeSwitch(l,e.row),loading:e.row.$switch_status,"active-value":"1","inactive-value":"0"},null,8,["modelValue","onUpdate:modelValue","onChange","loading"])])),_:1}),(0,a.bF)(p,{label:"创建时间",prop:"date",width:"180"}),(0,a.bF)(p,{label:"备注",prop:"remark","min-width":"150"}),(0,a.bF)(p,{label:"操作",fixed:"right",align:"right",width:"170"},{default:(0,a.k6)((e=>[(0,a.bF)(m,null,{default:(0,a.k6)((()=>[(0,a.bF)(c,{text:"",type:"primary",size:"small",onClick:l=>d.table_show(e.row,e.$index)},{default:(0,a.k6)((()=>[(0,a.eW)("查看")])),_:2},1032,["onClick"]),(0,a.bF)(c,{text:"",type:"primary",size:"small",onClick:l=>d.table_edit(e.row,e.$index)},{default:(0,a.k6)((()=>[(0,a.eW)("编辑")])),_:2},1032,["onClick"]),(0,a.bF)(g,{title:"确定删除吗？",onConfirm:l=>d.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}),r.dialog.save?((0,a.uX)(),(0,a.Wv)(v,{key:0,ref:"saveDialog",onSuccess:d.handleSaveSuccess,onClosed:l[1]||(l[1]=e=>r.dialog.save=!1)},null,8,["onSuccess"])):(0,a.Q3)("",!0),r.dialog.permission?((0,a.uX)(),(0,a.Wv)($,{key:1,ref:"permissionDialog",onClosed:l[2]||(l[2]=e=>r.dialog.permission=!1)},null,512)):(0,a.Q3)("",!0)],64)}var r=i(6034),d=i(1763),c={name:"role",components:{saveDialog:r["default"],permissionDialog:d["default"]},data(){return{dialog:{save:!1,permission:!1},apiObj:this.$API.system.role.list,selection:[],search:{keyword:null}}},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)}))},table_show(e){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open("show").setData(e)}))},permission(){this.dialog.permission=!0,this.$nextTick((()=>{this.$refs.permissionDialog.open()}))},async table_del(e){var l={id:e.id},i=await this.$API.demo.post.post(l);200==i.code?(this.$refs.table.refresh(),this.$message.success("删除成功")):this.$alert(i.message,"提示",{type:"error"})},async batch_del(){this.$confirm(`确定删除选中的 ${this.selection.length} 项吗？如果删除项中含有子集将会被一并删除`,"提示",{type:"warning"}).then((()=>{const e=this.$loading();this.$refs.table.refresh(),e.close(),this.$message.success("操作成功")})).catch((()=>{}))},selectionChange(e){this.selection=e},changeSwitch(e,l){l.status="1"==l.status?"0":"1",l.$switch_status=!0,setTimeout((()=>{delete l.$switch_status,l.status=e,this.$message.success("操作成功")}),500)},upsearch(){},filterTree(e){var l=null;function i(a){a.forEach((a=>{a.id==e&&(l=a),a.children&&i(a.children)}))}return i(this.$refs.table.tableData),l},handleSaveSuccess(e,l){("add"==l||"edit"==l)&&this.$refs.table.refresh()}}},h=i(6262);const u=(0,h.A)(c,[["render",o]]);var p=u}}]);