var $url="/common/editor/layerArticle",data=utils.init({attributeName:utils.getQueryString("attributeName"),siteId:utils.getQueryInt("siteId"),pageType:"card",groups:null,count:null,items:null,urlList:null,renameId:0,renameTitle:"",deleteId:0,selectedGroupId:0,form:{siteId:utils.getQueryInt("siteId"),keyword:"",groupId:0,page:1,perPage:24},isSubmitForm:!1,submitForm:{textId:0,linkText:""}}),methods={insert:function(t){var i='<el-popover  width="600"  trigger="click">   '+t.content+'  <el-button size="small" type="primary" slot="reference">'+t.linkText+"</el-button></el-popover>",e='<a href="javascript:;" data-vue="'+encodeURIComponent(i)+'">'+t.linkText+"</a>";parent.$vue.insertEditor(this.attributeName,e)},apiList:function(t){var i=this;this.form.page=t,utils.loading(this,!0),$api.post($url+"/list",this.form).then(function(t){var e=t.data;i.groups=e.groups,i.count=e.count,i.items=e.items,i.urlList=_.map(i.items,function(t){return t.imageUrl})}).catch(function(t){utils.error(t)}).then(function(){utils.loading(i,!1)})},getGroupName:function(){var t=this;return this.form.groupId>0?_.find(this.groups,function(i){return i.id===t.form.groupId}).groupName:""},btnSelectClick:function(t){this.isSubmitForm=!0,this.submitForm.textId=t.id},btnSelectGroupClick:function(t){this.selectedGroupId=this.selectedGroupId===t?0:t},btnGroupClick:function(t){var i=this;this.form.groupId=t,this.form.page=1,utils.loading(this,!0),$api.post($url+"/list",this.form).then(function(t){var e=t.data;i.groups=e.groups,i.count=e.count,i.items=e.items,i.urlList=_.map(i.items,function(t){return t.imageUrl})}).catch(function(t){i.$notify.error({title:"错误",message:t.message})}).then(function(){utils.loading(i,!1)})},btnDropdownClick:function(t){this.pageType=t},apiSubmit:function(){var t=this;utils.loading(this,!0),$api.get($url+"/"+this.submitForm.textId,{params:{siteId:this.siteId}}).then(function(i){var e=i.data;t.insert({linkText:t.submitForm.linkText,content:e.content}),t.isSubmitForm=!1,utils.closeLayer()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},btnSubmitClick:function(){var t=this;this.$refs.submitForm.validate(function(i){if(!i)return!1;t.apiSubmit()})},btnSearchClick(){utils.loading(this,!0),this.apiList(1)},btnPageClick:function(t){utils.loading(this,!0),this.apiList(t)}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiList(1)}});