var $url="/cms/contents/editorLayerTranslate",data=utils.init({siteId:utils.getQueryInt("siteId"),channelId:utils.getQueryInt("channelId"),transSites:null,transChannels:null,form:{transSiteIds:null,transChannelIds:null,transType:"Copy"}}),methods={apiGet:function(){var t=this;utils.loading(this,!0),$api.get($url,{params:{siteId:this.siteId,channelId:this.channelId}}).then(function(n){var i=n.data;t.transSites=i.transSites,t.form.transSiteIds=[t.siteId],t.apiGetOptions()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},apiGetOptions:function(){var t=this;$api.post($url+"/actions/options",{siteId:this.siteId,channelId:this.channelId,transSiteId:this.form.transSiteIds[this.form.transSiteIds.length-1]}).then(function(n){var i=n.data;t.transChannels=[i.transChannels],t.form.transChannelIds=null}).catch(function(n){utils.loading(t,!1),utils.error(n)})},apiSubmit:function(){var t=this,n=[];this.form.transChannelIds.forEach(function(t){var i=t[t.length-1];n.push(i)});var i=this.form.transSiteIds[this.form.transSiteIds.length-1];utils.loading(this,!0),$api.post($url,{siteId:this.siteId,channelId:this.channelId,transSiteId:i,transChannelIds:n,transType:this.form.transType}).then(function(n){n.data.channels.forEach(function(n){parent.$vue.addTranslation(i,n.id,t.form.transType,n.name)}),utils.closeLayer()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},handleTransSiteIdChange:function(){this.apiGetOptions()},btnSubmitClick:function(){var t=this;this.$refs.form.validate(function(n){n&&t.apiSubmit()})},btnCancelClick:function(){utils.closeLayer()}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});