var $url="/settings/usersGroup",data=utils.init({groups:null,adminNames:null,panel:!1,form:null}),methods={apiList:function(t){var i=this;utils.loading(this,!0),$api.get($url).then(function(t){var n=t.data;i.groups=n.groups,i.adminNames=n.adminNames}).catch(function(t){utils.error(t)}).then(function(){utils.loading(i,!1),t&&utils.success(t)})},apiDelete:function(t){var i=this;utils.loading(this,!0),$api.delete($url,{data:{id:t}}).then(function(t){var n=t.data;i.groups=n.groups,utils.success("用户组删除成功！")}).catch(function(t){utils.error(t)}).then(function(){utils.loading(i,!1)})},apiSubmit:function(){var t=this;utils.loading(this,!0),$api.post($url,this.form).then(function(i){var n=i.data;t.groups=n.groups,utils.success(-1===t.form.id?"用户组添加成功！":"用户组修改成功！"),t.panel=!1}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},btnAdminClick:function(t){utils.openLayer({title:"管理员查看",url:utils.getCommonUrl("adminLayerView",{userName:t}),full:!0})},btnEditClick:function(t){this.panel=!0,this.form=_.assign({},t)},btnAddClick:function(){this.panel=!0,this.form={id:-1,groupName:"",adminName:""}},btnDeleteClick:function(t){var i=this;utils.alertDelete({title:"删除用户组",text:"此操作将删除用户组 "+t.groupName+"，确定吗？",callback:function(){i.apiDelete(t.id)}})},btnSubmitClick:function(){var t=this;this.$refs.form.validate(function(i){i&&t.apiSubmit()})},btnCancelClick:function(){this.panel=!1}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiList()}});