QueryView.min.js 3.1 KB

1
  1. MWF.xApplication.Selector=MWF.xApplication.Selector||{};MWF.xDesktop.requireApp("Selector","Person",null,false);MWF.xApplication.Selector.QueryView=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){if(e.viewList&&e.viewList.length){var t=this._newItemCategory(e,this,this.itemAreaNode);e.viewList.each(function(i){i.applicationName=e.name;var n=this._newItem(i,this,t.children);this.items.push(n)}.bind(this))}}.bind(this))}}.bind(this))},_scrollEvent:function(e){return true},_getChildrenItemIds:function(e){return e.viewList||[]},_newItemCategory:function(e,t,i,n){return new MWF.xApplication.Selector.QueryView.ItemCategory(e,t,i,n)},_listItemByKey:function(e,t,i){return false},_getItem:function(e,t,i,n){this.queryAction.getView(function(t){if(e)e.apply(this,[t])}.bind(this),t,typeOf(i)==="string"?i:i.id,n)},_newItemSelected:function(e,t,i){return new MWF.xApplication.Selector.QueryView.ItemSelected(e,t,i)},_listItemByPinyin:function(e,t,i){return false},_newItem:function(e,t,i,n){return new MWF.xApplication.Selector.QueryView.Item(e,t,i,n)}});MWF.xApplication.Selector.QueryView.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 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.QueryView.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 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))}}}});MWF.xApplication.Selector.QueryView.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.viewList&&this.data.viewList.length},check:function(){}});