var $url="/cms/material/layerGroupAdd",data=utils.init({siteId:utils.getQueryInt("siteId"),groupId:utils.getQueryInt("groupId"),materialType:utils.getQueryString("materialType"),form:{groupName:""}}),methods={apiGet:function(){var t=this;utils.loading(this,!0),$api.get($url,{params:{siteId:this.siteId,groupId:this.groupId}}).then(function(i){var u=i.data;t.form.groupName=u.value}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},apiSubmit:function(){var t=this;utils.loading(this,!0),0===this.groupId?$api.post($url,{siteId:this.siteId,materialType:this.materialType,groupName:this.form.groupName}).then(function(t){var i=t.data;utils.success("素材分组添加成功！"),parent.$vue.runUpdateGroups(i.groups),utils.closeLayer()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)}):$api.put($url,{siteId:this.siteId,groupId:this.groupId,groupName:this.form.groupName}).then(function(t){var i=t.data;utils.success("素材分组修改成功！"),parent.$vue.runUpdateGroups(i.groups),utils.closeLayer()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},btnSubmitClick:function(){var t=this;this.$refs.form.validate(function(i){i&&t.apiSubmit()})},btnCancelClick:function(){utils.closeLayer()}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.groupId>0?this.apiGet():utils.loading(this,!1)}});