Query.min.js 2.4 KB

1
  1. MWF.xApplication.Selector=MWF.xApplication.Selector||{};MWF.xDesktop.requireApp("Selector","Person",null,false);MWF.xApplication.Selector.Query=new Class({Extends:MWF.xApplication.Selector.Person,options:{style:"default",count:0,title:MWF.xApplication.Selector.LP.selectView,values:[],names:[],expand:false},loadSelectItems:function(e){this.queryAction.listApplication(function(e){if(e.data.length){e.data.each(function(e){e.applicationName=e.name;var t=this._newItem(e,this,this.itemAreaNode);this.items.push(t)}.bind(this))}}.bind(this))},_scrollEvent:function(e){return true},_getChildrenItemIds:function(e){return e.viewList||[]},_newItemCategory:function(e,t,i,n){return false},_listItemByKey:function(e,t,i){return false},_getItem:function(t,e,i,n){this.items.each(function(e){if(i==e.data.id){if(t)t.apply(this,[e.data])}}.bind(this))},_newItemSelected:function(e,t,i){return new MWF.xApplication.Selector.Query.ItemSelected(e,t,i)},_listItemByPinyin:function(e,t,i){return false},_newItem:function(e,t,i,n){return new MWF.xApplication.Selector.Query.Item(e,t,i,n)}});MWF.xApplication.Selector.Query.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/applicationicon.png)")},loadSubItem:function(){return false},checkSelectedSingle:function(){var e=this.selector.options.values.filter(function(e,t){if(typeOf(e)==="object")return this.data.id===e.id||this.data.name===e.name;if(typeOf(e)==="string")return this.data.id===e||this.data.name===e;return false}.bind(this));if(e.length){this.selectedSingle()}},checkSelected:function(){var e=this.selector.selectedItems.filter(function(e,t){return e.data.id===this.data.id||e.data.name===this.data.name}.bind(this));if(e.length){e[0].addItem(this);this.selectedItem=e[0];this.setSelected()}}});MWF.xApplication.Selector.Query.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/applicationicon.png)")},check:function(){if(this.selector.items.length){var e=this.selector.items.filter(function(e,t){return e.data.id===this.data.id||e.data.name===this.data.name}.bind(this));this.items=e;if(e.length){e.each(function(e){e.selectedItem=this;e.setSelected()}.bind(this))}}}});