MWF.xApplication.Execution = MWF.xApplication.Execution || {}; MWF.xDesktop.requireApp("Template", "Explorer", null, false); MWF.xDesktop.requireApp("Execution", "WorkMinder", null, false); MWF.require("MWF.widget.Identity", null,false); MWF.xApplication.Execution.MinderExplorer = new Class({ Extends: MWF.widget.Common, Implements: [Options, Events], options: { "style": "default" }, initialize: function (node, app, actions, options) { this.app = app; this.lp = app.lp; this.path = "/x_component_Execution/$MinderExplorer/"; this.actions = actions; this.options.style = this.getViewStyle(); this.setOptions(options); this.loadCss(); this.node = $(node); }, loadCss: function () { this.cssPath = "/x_component_Execution/$MinderExplorer/" + this.options.style + "/css.wcss"; this._loadCss(); }, load: function () { this.middleContent = this.app.middleContent; //this.middleContent.setStyles({"margin-top":"0px","border":"0px solid #f00"}); this.createNaviContent(); //this.createContentDiv(); this.resizeWindow(); this.app.addEvent("resize", function(){ this.resizeWindow(); }.bind(this)); }, resizeWindow: function(){ var size = this.app.middleContent.getSize(); this.naviDiv.setStyles({"height":(size.y-40)+"px"}); this.naviContentDiv.setStyles({"height":(size.y-180)+"px"}); this.contentDiv.setStyles({"height":(size.y-40)+"px"}); //this.viewContainer.setStyles({"height":(size.y-90)+"px"}); }, createNaviContent: function(){ this.naviDiv = new Element("div.naviDiv",{ "styles":this.css.naviDiv }).inject(this.middleContent); this.naviTitleDiv = new Element("div.naviTitleDiv",{ "styles":this.css.naviTitleDiv, "text": this.lp.minderExplorerTitle }).inject(this.naviDiv); this.naviContentDiv = new Element("div.naviContentDiv",{"styles":this.css.naviContentDiv}).inject(this.naviDiv); this.naviBottomDiv = new Element("div.naviBottomDiv",{"styles":this.css.naviBottomDiv}).inject(this.naviDiv); this.createContentDiv(); var jsonUrl = this.path+"navi.json"; MWF.getJSON(jsonUrl, function(json){ json.each(function(data, i){ var naviContentLi = new Element("li.naviContentLi",{"styles":this.css.naviContentLi}).inject(this.naviContentDiv); naviContentLi.addEvents({ "mouseover" : function(ev){ if(this.bindObj.currentNaviItem != this.node)this.node.setStyles( this.styles ) }.bind({"styles": this.css.naviContentLi_over, "node":naviContentLi, "bindObj": this }) , "mouseout" : function(ev){ if(this.bindObj.currentNaviItem != this.node)this.node.setStyles( this.styles ) }.bind({"styles": this.css.naviContentLi, "node":naviContentLi, "bindObj": this }) , "click" : function(ev){ if( this.bindObj.currentNaviItem )this.bindObj.currentNaviItem.setStyles( this.bindObj.css.naviContentLi ); this.node.setStyles( this.styles ); this.bindObj.currentNaviItem = this.node; if( this.action && this.bindObj[this.action] ){ this.bindObj[this.action](); } }.bind({"styles": this.css.naviContentLi_current, "node":naviContentLi, "bindObj": this, "action" : data.action }) , }) var naviContentImg = new Element("img.naviContentImg",{ "styles":this.css.naviContentImg, "src":"/x_component_Execution/$Main/default/icon/"+data.icon }).inject(naviContentLi); var naviContentSpan = new Element("span.naviContentSpan",{ "styles":this.css.naviContentSpan, "text":data.title }).inject(naviContentLi); if( i == 0 ){ naviContentLi.click(); } }.bind(this)); }.bind(this)); }, createContentDiv: function(){ this.contentDiv = new Element("div.contentDiv",{"styles":this.css.contentDiv}).inject(this.middleContent); }, openCenterWork: function(){ this.contentDiv.empty(); this.loadCategoryBar(); this.loadToolbar(); //this.loadView(); }, loadCategoryBar : function(){ var _self = this; this.categoryBar = new Element("div.categoryBar",{"styles":this.css.categoryBar}).inject(this.contentDiv); this.allCategoryNode = new Element("li.allCategoryNode", { "styles": this.css.categoryNode, "text" : "全部" }).inject(this.categoryBar) this.allCategoryNode.addEvents({ "mouseover" : function(){ if( this.currentCategoryNode != this.allCategoryNode)this.allCategoryNode.setStyles(this.css.categoryNode_over) }.bind(this), "mouseout" : function(){ if( this.currentCategoryNode != this.allCategoryNode)this.allCategoryNode.setStyles(this.css.categoryNode) }.bind(this), "click":function(){ if( this.currentCategoryNode )this.currentCategoryNode.setStyles(this.css.categoryNode); this.currentCategoryNode = this.allCategoryNode; this.allCategoryNode.setStyles(this.css.categoryNode_current); this.loadView( ) }.bind(this) }) this.actions.getCategoryCountAll( function( json ){ json.data = json.data || [] json.data.each( function( d ){ var categoryNode = new Element("li.categoryNode", { "styles": this.css.categoryNode, "text" : d.workTypeName + "(" + d.centerCount +")" }).inject(this.categoryBar); categoryNode.store( "workTypeName" , d.workTypeName ); categoryNode.addEvents({ "mouseover" : function(){ if( _self.currentCategoryNode != this.node)this.node.setStyles(_self.css.categoryNode_over) }.bind({node : categoryNode }), "mouseout" : function(){ if( _self.currentCategoryNode != this.node)this.node.setStyles(_self.css.categoryNode) }.bind({node : categoryNode }), "click":function(){ if( _self.currentCategoryNode )_self.currentCategoryNode.setStyles(_self.css.categoryNode); _self.currentCategoryNode = this.node; this.node.setStyles(_self.css.categoryNode_current); _self.loadView( ) }.bind({ name : d.workTypeName, node : categoryNode }) }) }.bind(this)) }.bind(this), null, false ) this.allCategoryNode.click(); }, loadToolbar: function(){ this.toolbar = new Element("div",{ styles : this.css.toolbar }).inject(this.categoryBar) //this.toolbarTextNode = new Element("div",{ // styles : this.css.toolbarTextNode, // text: this.lp.workTask.centerWork, //}).inject(this.toolbar); this.fileterNode = new Element("div",{ styles : this.css.fileterNode }).inject(this.toolbar); this.loadFilter(); }, loadFilter: function () { var _self = this; var html = "
| " + //" | " + //" | " + //" | " + //" | " + //" | " + //" | " + //" | " + " | " + " | " + " " + " |