define(["ember","app","broad","../../helpers/page_manage","../../helpers/download_manage"],function(a,b,c,d,e){return b.GrowthIndexController=a.ObjectController.extend({needs:["growthBrowse"],activeIndex:0,activeTmpl:function(){return this.get("model").objectAt(this.get("activeIndex"))}.property("model","activeIndex"),preAble:function(){return 2<=this.get("model.length")&&1<=this.get("activeIndex")}.property("model.length","activeIndex"),nextAble:function(){return this.get("model.length")-1>this.get("activeIndex")}.property("model.length","activeIndex"),_download:function(a){c.trigger("loading"),e.downloadGrowth(this.store,a.get("entity.Term"),a.get("entity.Session"),a.get("entity")).then(function(){a.setProperties({"state.state":"init",isUpdated:!1})})["finally"](function(){c.trigger("loaded")})},actions:{download:function(a,b){var c=this;b?this.get("dialogManager").confirm("您已经下载过成长档案："+a.get("entity.TemplateName")+"， 此操作将获取最新在线数据覆盖本地数据，确定要重新下载吗？",{},{title:"下载提示",front:!0}).then(function(){c._download(a)}):c._download(a)},browse:function(a){c.trigger("loading");var b=this;d.fetchPages(this.store,a,this.get("session.online")).then(function(a){var d=[].concat(a),e=b.get("controllers.growthBrowse"),f={width:"100%",height:"100%",front:!0,frame:!1};e.set("pages",d),b.get("dialogManager").custom("growth/browse",e,f),e.set("dialogid",Math.random()),c.trigger("loaded")},function(a){console.log(a),c.trigger("loaded")})},redirect:function(a){this.transitionToRoute("growth.browse",{queryParams:{templateid:a}})},pre:function(){this.get("preAble")&&this.decrementProperty("activeIndex")},next:function(){this.get("nextAble")&&this.incrementProperty("activeIndex")}}})});