QueryStat.min.js 3.1 KB

1
  1. MWF.xApplication.Selector=MWF.xApplication.Selector||{};MWF.xDesktop.requireApp("Selector","Person",null,false);MWF.xApplication.Selector.QueryStat=new Class({Extends:MWF.xApplication.Selector.Person,options:{style:"default",count:0,title:MWF.xApplication.Selector.LP.selectView,values:[],names:[],expand:false},loadSelectItems:function(t){this.queryAction.listApplication(function(t){if(t.data.length){t.data.each(function(t){if(t.statList&&t.statList.length){var e=this._newItemCategory(t,this,this.itemAreaNode);t.statList.each(function(n){n.applicationName=t.name;var i=this._newItem(n,this,e.children);this.items.push(i)}.bind(this))}}.bind(this))}}.bind(this))},_scrollEvent:function(t){return true},_getChildrenItemIds:function(t){return t.statList||[]},_newItemCategory:function(t,e,n,i){return new MWF.xApplication.Selector.QueryStat.ItemCategory(t,e,n,i)},_listItemByKey:function(t,e,n){return false},_getItem:function(t,e,n,i){this.queryAction.getStat(function(e){if(t)t.apply(this,[e])}.bind(this),e,typeOf(n)==="string"?n:n.id,i)},_newItemSelected:function(t,e,n){return new MWF.xApplication.Selector.QueryStat.ItemSelected(t,e,n)},_listItemByPinyin:function(t,e,n){return false},_newItem:function(t,e,n,i){return new MWF.xApplication.Selector.QueryStat.Item(t,e,n,i)}});MWF.xApplication.Selector.QueryStat.Item=new Class({Extends:MWF.xApplication.Selector.Person.Item,_getShowName:function(){return this.data.name},_setIcon:function(){this.iconNode.setStyle("background-image","url("+"/x_component_Selector/$Selector/default/icon/view.png)")},loadSubItem:function(){return false},checkSelectedSingle:function(){var t=this.selector.options.values.filter(function(t,e){if(typeOf(t)==="object")return this.data.id===t.id||this.data.name===t.name;if(typeOf(t)==="string")return this.data.id===t||this.data.name===t;return false}.bind(this));if(t.length){this.selectedSingle()}},checkSelected:function(){var t=this.selector.selectedItems.filter(function(t,e){return t.data.id===this.data.id||t.data.name===this.data.name}.bind(this));if(t.length){t[0].addItem(this);this.selectedItem=t[0];this.setSelected()}}});MWF.xApplication.Selector.QueryStat.ItemSelected=new Class({Extends:MWF.xApplication.Selector.Person.ItemSelected,_getShowName:function(){return this.data.name},_setIcon:function(){this.iconNode.setStyle("background-image","url("+"/x_component_Selector/$Selector/default/icon/view.png)")},check:function(){if(this.selector.items.length){var t=this.selector.items.filter(function(t,e){return t.data.id===this.data.id||t.data.name===this.data.name}.bind(this));this.items=t;if(t.length){t.each(function(t){t.selectedItem=this;t.setSelected()}.bind(this))}}}});MWF.xApplication.Selector.QueryStat.ItemCategory=new Class({Extends:MWF.xApplication.Selector.Person.ItemCategory,_getShowName:function(){return this.data.name},createNode:function(){this.node=new Element("div",{styles:this.selector.css.selectorItemCategory_department}).inject(this.container)},_setIcon:function(){this.iconNode.setStyle("background-image","url("+"/x_component_Selector/$Selector/default/icon/applicationicon.png)")},_hasChild:function(){return this.data.statList&&this.data.statList.length},check:function(){}});