var $url="/cms/create/createFile",data=utils.init({siteId:utils.getQueryInt("siteId"),isAllChecked:!1,allTemplates:null,templates:null,checkedTemplateIds:[],filterText:""}),methods={apiGet:function(){var t=this;utils.loading(this,!0),$api.get($url,{params:{siteId:this.siteId}}).then(function(e){var i=e.data;t.allTemplates=t.templates=i.templates}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},apiCreate:function(){var t=this;utils.loading(this,!0),$api.post($url,{siteId:this.siteId,templateIds:this.checkedTemplateIds}).then(function(e){location.href=utils.getCmsUrl("createStatus",{siteId:t.siteId})}).catch(function(t){utils.error(t)})},filterNode:function(t,e){return!t||(!t.text||-1!==e.label.indexOf(t.text))},selectAll:function(t){this.checkedTemplateIds=t?_.map(this.templates,function(t){return t.id}):[]},btnCreateClick:function(){this.apiCreate()},getLabel:function(t){return t.templateName+"("+t.createdFileFullName.replace("@","")+")"},handleCheckedTemplatesChange:function(t){var e=t.length;this.isAllChecked=e===this.templates.length}},$vue=new Vue({el:"#main",data:data,methods:methods,watch:{filterText:function(t){this.templates=t?_.filter(this.allTemplates,function(e){return-1!==e.createdFileFullName.indexOf(t)}):this.allTemplates}},created:function(){this.apiGet()}});