提交 ab5960ac 编写于 作者: U unknown

选人界面,自定义选择器当左侧无候选项时显示:无待选项

上级 90820037
......@@ -112,6 +112,12 @@
"overflow": "hidden",
"padding" : "20px"
},
"noSelectableItemText" : {
"margin" : "10px auto",
"text-align" : "center",
"width" : "200px",
"color" : "#999"
},
"contentNode_embedded": {
"overflow": "hidden",
"padding" : "5px 0px 0px 0px"
......
......@@ -85,6 +85,9 @@
"contentNode": {
"overflow": "hidden"
},
"noSelectableItemText" : {
"display" : "none"
},
"contentNode_embedded": {
"overflow": "hidden",
"padding" : "5px 0px 0px 0px"
......
......@@ -148,6 +148,12 @@
"contentNode": {
"overflow": "hidden"
},
"noSelectableItemText" : {
"margin" : "10px auto",
"text-align" : "center",
"width" : "200px",
"color" : "#999"
},
"selectNode": {
"width": "331px",
"height": "410px",
......@@ -276,7 +282,7 @@
"padding": "0px 9px",
"height": "40px",
"border-bottom": "1px solid #999",
"background-color": "#EEE",
"background-color": "#EEE"
},
"letterNode": {
"height": "20px",
......
......@@ -119,6 +119,12 @@
"contentNode": {
"overflow": "hidden"
},
"noSelectableItemText" : {
"margin" : "10px auto",
"text-align" : "center",
"width" : "200px",
"color" : "#999"
},
"selectNode": {
"height": "410px",
"margin": "0px",
......
......@@ -47,6 +47,12 @@
"contentNode": {
"overflow": "hidden"
},
"noSelectableItemText" : {
"margin" : "10px auto",
"text-align" : "center",
"width" : "200px",
"color" : "#999"
},
"selectNode": {
"width": "40%",
"height": "80%",
......
......@@ -119,6 +119,12 @@
"contentNode": {
"overflow": "hidden"
},
"noSelectableItemText" : {
"margin" : "10px auto",
"text-align" : "center",
"width" : "200px",
"color" : "#999"
},
"selectNode": {
//"width": "200px",
"width": "54%",
......
......@@ -84,6 +84,13 @@ MWF.xApplication.Selector.Identity = new Class({
}.bind(this));
}else{
// this.loadInclude( function () {
// this.includeLoaded = true;
// if( this.unitLoaded ){
// afterLoadSelectItemFun();
// }
// }.bind(this));
this.orgAction.listTopUnit(function(json){
json.data.each(function(data){
if( !this.isExcluded( data ) ){
......@@ -91,8 +98,13 @@ MWF.xApplication.Selector.Identity = new Class({
this.subCategorys.push( category );
}
}.bind(this));
loadUnitSuccess();
}.bind(this), loadUnitFailure);
// this.unitLoaded = true;
// if( this.includeLoaded ){
afterLoadSelectItemFun();
// }
}.bind(this));
}
},
......@@ -419,6 +431,7 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_expand);
this.isExpand = true;
}
// this.checkSelectAll();
}else{
var display = this.children.getStyle("display");
if (display === "none"){
......
......@@ -19,6 +19,9 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
"exclude" : []
},
loadSelectItems: function(addToNext){
var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
if( this.options.resultType === "person" ){
if( this.titleTextNode ){
this.titleTextNode.set("text", MWF.xApplication.Selector.LP.selectPerson );
......@@ -27,7 +30,27 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
}
}
if (this.options.dutys.length){
this.loadInclude();
var dutyLoaded = 0;
var loadDutySuccess = function () {
dutyLoaded++;
if( dutyLoaded === this.options.dutys.length ){
this.dutyLoaded = true;
if( this.includeLoaded ){
afterLoadSelectItemFun();
}
}
}.bind(this);
this.loadInclude( function () {
this.includeLoaded = true;
if( this.dutyLoaded ){
afterLoadSelectItemFun();
}
}.bind(this));
// this.loadInclude();
this.options.dutys.each(function(duty){
var data = {"name": duty, "id":duty};
var category = this._newItemCategory("ItemCategory",data, this, this.itemAreaNode);
......@@ -37,6 +60,7 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
// this.action.getUnitduty(function(dutyData){
// var category = this._newItemCategory("ItemCategory", dutyData.data, this, this.itemAreaNode);
// }.bind(this), null, duty);
loadDutySuccess();
}.bind(this));
}
},
......
......@@ -30,7 +30,12 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
}
if (this.options.dutys.length){
this.loadInclude();
this.loadInclude( function () {
this.includeLoaded = true;
if( this.dutyLoaded ){
this.afterLoadSelectItem();
}
}.bind(this));
if( this.options.units.length ){
var units = [];
......@@ -91,6 +96,11 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
}else{
this._loadSelectItemsByIdentityUnit(unitTree);
}
this.dutyLoaded = true;
if( this.includeLoaded ){
this.afterLoadSelectItem();
}
},
_loadSelectItemsByIdentityUnit : function( unitTree ){
if( !unitTree.unitList )return;
......
......@@ -1362,9 +1362,10 @@ MWF.xApplication.Selector.Person = new Class({
}
},
afterLoadSelectItem : function(){
if( this.items.length === 0 ){ //&& this.subCategorys.length === 0
if( this.subItems.length === 0 && this.subCategorys.length === 0 ){
this.noSelectableItemTextDiv = new Element("div", {
text : this.lp.noSelectableItemText
text : MWF.SelectorLP.noSelectableItemText,
styles : this.css.noSelectableItemText
}).inject( this.itemAreaNode );
}
this.fireEvent("afterLoadSelectItem", [this]);
......@@ -1748,9 +1749,9 @@ MWF.xApplication.Selector.Person.Item = new Class({
if( ( this.selector.options.count.toInt() === 1 || this.selector.options.noSelectedContainer ) && this.selector.css.selectorItemActionNode_single_selected ){
this.actionNode.setStyles( this.selector.css.selectorItemActionNode_single_selected );
}
// if( this.category ){
// this.category.checkSelectAll();
// }
if( this.category ){
this.category.checkSelectAll();
}
},
setEvent: function(){
this.node.addEvents({
......@@ -1875,9 +1876,9 @@ MWF.xApplication.Selector.Person.Item = new Class({
this.selectedItem.check();
this.selector.selectedItems.push(this.selectedItem);
if( this.category ){
this.category.checkSelectAll();
}
// if( this.category ){
// this.category.checkSelectAll();
// }
this.selector.fireEvent("selectItem",[this])
}else{
......@@ -2256,21 +2257,27 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
}).inject(this.node, "after");
if (!this.selector.options.expand) this.children.setStyle("display", "none");
var subIdList = this.selector._getChildrenItemIds(this.data);
if (subIdList){
var count = subIdList.length;
this.childrenHeight = count*this.selector.options.itemHeight;
this.children.setStyle("height", ""+this.childrenHeight+"px");
}
if( this.selector.options.expandEmptyCategory && !this._hasChildItem() ){ //点击允许展开空分类
this.children.hide();
this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_collapse);
this.isExpand = false;
}else{
var subIdList = this.selector._getChildrenItemIds(this.data);
if (subIdList){
var count = subIdList.length;
this.childrenHeight = count*this.selector.options.itemHeight;
this.children.setStyle("height", ""+this.childrenHeight+"px");
}
if (!this._hasChild()){
this.actionNode.setStyle("background", "transparent");
this.textNode.setStyle("color", "#777");
}
if ( !this._hasChild()){
this.actionNode.setStyle("background", "transparent");
this.textNode.setStyle("color", "#777");
}
if( this.selectAllNode ){
if( this.selector.options.selectAllRange === "direct" && !this._hasChildItem() ){
this.selectAllNode.setStyle("display", "none");
if( this.selectAllNode ){
if( this.selector.options.selectAllRange === "direct" && !this._hasChildItem() ){
this.selectAllNode.setStyle("display", "none");
}
}
}
......@@ -2433,7 +2440,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
}
},
clickItem: function( callback ){
if (this._hasChild()){
if (this._hasChild() || this.selector.options.expandEmptyCategory ){
if (!this.fx){
this.fx = new Fx.Tween(this.children, {
"duration": 200
......
......@@ -17,7 +17,19 @@ MWF.xApplication.Selector.Unit = new Class({
},
loadSelectItems: function(addToNext){
var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
if (this.options.units.length){
var unitLoaded = 0;
var loadUnitSuccess = function () {
unitLoaded++;
if( unitLoaded === this.options.units.length ){
afterLoadSelectItemFun();
}
}.bind(this);
var loadUnitFailure = loadUnitSuccess;
this.options.units.each(function(unit){
var container = new Element("div").inject( this.itemAreaNode );
......@@ -49,11 +61,13 @@ MWF.xApplication.Selector.Unit = new Class({
}
}else{
var item = this._newItem( data, this, container );
this.items.push( item );
this.subItems.push(item);
}
}.bind(this));
}
}.bind(this), null, unit);
loadUnitSuccess();
}.bind(this), loadUnitFailure, unit);
}else{
......@@ -68,11 +82,13 @@ MWF.xApplication.Selector.Unit = new Class({
}
}else{
var item = this._newItem(data, this, container );
this.items.push( item );
this.subItems.push(item);
}
}.bind(this));
}
}.bind(this), null, unit.id);
loadUnitSuccess();
}.bind(this), loadUnitFailure, unit.id);
//if (unit.subDirectUnitCount) var category = this._newItemCategory("ItemCategory", unit, this, this.itemAreaNode);
}
......@@ -89,6 +105,7 @@ MWF.xApplication.Selector.Unit = new Class({
// if (flag){
if( !this.isExcluded( data ) ) {
var unit = this._newItem(data, this, this.itemAreaNode, 1);
this.items.push( unit );
this.subItems.push(unit);
}
//unit.loadSubItem();
......@@ -97,6 +114,7 @@ MWF.xApplication.Selector.Unit = new Class({
// }
}.bind(this));
afterLoadSelectItemFun();
}.bind(this));
}
},
......@@ -234,7 +252,6 @@ MWF.xApplication.Selector.Unit.Item = new Class({
this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/"+style+"/icon/departmenticon.png)");
},
loadSubItem: function(){
debugger;
if( !this.selector.options.expandSubEnable )return;
this.isExpand = (this.selector.options.expand);
if ( this._hasChild() || this.selector.options.expandEmptyCategory ){
......@@ -243,6 +260,9 @@ MWF.xApplication.Selector.Unit.Item = new Class({
if (this.level <= this.selector.options.defaultExpandLevel && this._hasChild() ){
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_expand);
this.loadSubItems();
}else{
this.isExpand = false;
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_collapse);
}
}else if (this.level===1 && this._hasChild() ){
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_expand);
......@@ -455,6 +475,7 @@ MWF.xApplication.Selector.Unit.Item = new Class({
subJson.data.each(function(subData){
if( !this.selector.isExcluded( subData ) ) {
var category = this.selector._newItem(subData, this.selector, this.children, this.level + 1, this);
this.selector.items.push( category );
if( !this.subItems )this.subItems = [];
this.subItems.push( category );
}
......@@ -637,6 +658,7 @@ MWF.xApplication.Selector.Unit.Item = new Class({
var category = this.selector._newItem(subData, this.selector, this.children, this.level + 1, this, true);
category.justItem = true;
category.load();
this.selector.items.push( category );
if( !this.subItems )this.subItems = [];
this.subItems.push( category );
//}
......@@ -684,6 +706,7 @@ MWF.xApplication.Selector.Unit.SearchItem = new Class({
}else{
category = this.selector._newItem(subData, this.selector, this.children, this.level + 1, this);
}
this.selector.items.push( category );
if( !this.subItems )this.subItems = [];
this.subItems.push( category );
}
......@@ -723,6 +746,7 @@ MWF.xApplication.Selector.Unit.ItemCategory = new Class({
subJson.data.each(function(subData){
if( !this.selector.isExcluded( subData ) ) {
var category = this.selector._newItem(subData, this.selector, this.children, this.level+1, this);
this.selector.items.push( category );
if(this.subItems)this.subItems.push( category );
this.subCategorys.push( category );
}
......@@ -783,6 +807,7 @@ MWF.xApplication.Selector.Unit.ItemCategory = new Class({
var category = this.selector._newItem(subData, this.selector, this.children, this.level+1, this, true);
category.justItem = true;
category.load();
this.selector.items.push( category );
if(this.subItems)this.subItems.push( category );
//this.subCategorys.push( category );
}
......
......@@ -17,6 +17,8 @@ MWF.xApplication.Selector.UnitWithType = new Class({
},
loadSelectItems: function(addToNext){
var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
var data = {};
data.type = this.options.unitType;
data.unitList = [];
......@@ -35,6 +37,7 @@ MWF.xApplication.Selector.UnitWithType = new Class({
if( !this.isExcluded( data ) ) {
if ( !this.options.expandSubEnable || (!this.options.unitType) || data.typeList.indexOf(this.options.unitType)!==-1){
var unit = this._newItem(data, this, this.itemAreaNode, 1);
this.items.push(unit);
this.subItems.push(unit);
}else{
if (data.woSubDirectUnitList.length){
......@@ -45,7 +48,8 @@ MWF.xApplication.Selector.UnitWithType = new Class({
}
}.bind(this));
}
}.bind(this), null, data);
afterLoadSelectItemFun();
}.bind(this), afterLoadSelectItemFun, data);
},
_scrollEvent: function(y){
......@@ -190,6 +194,7 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
if( !this.selector.isExcluded( subData ) ) {
if ((!this.selector.options.unitType) || subData.typeList.indexOf(this.selector.options.unitType) !== -1) {
var unit = this.selector._newItem(subData, this.selector, this.children, this.level + 1, this);
this.selector.items.push( unit );
if( !this.subItems )this.subItems = [];
this.subItems.push( unit );
} else {
......@@ -241,8 +246,9 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
if( !this.selector.isExcluded( subData ) ) {
if ((!this.selector.options.unitType) || subData.typeList.indexOf(this.selector.options.unitType) !== -1) {
var unit = this.selector._newItem(subData, this.selector, this.children, this.level + 1, this, true);
category.justItem = true;
category.load();
unit.justItem = true;
unit.load();
this.selector.items.push( unit );
if( !this.subItems )this.subItems = [];
this.subItems.push( unit );
}
......
......@@ -15,7 +15,7 @@ MWF.xApplication.Selector.LP = MWF.SelectorLP = {
"selectTable": "选择数据表",
"selectCMSApplication": "选择内容管理应用",
"selectCMSCategory": "选择内容管理栏目",
"noSelectableItemText" : "可选项,请联系管理员",
"noSelectableItemText" : "待选项",
"searchDescription" : "搜索内容",
......
......@@ -68,31 +68,36 @@ MWF.xApplication.Template.Selector.Custom = new Class({
this.container = $(container);
this.selectedItems = [];
this.items = [];
this.categorys = [];
// this.categorys = [];
this.subCategorys = []; //直接的分类
this.subItems = []; //直接的选择项
},
loadSelectItems: function (addToNext) {
debugger;
if (!this.options.category) {
this.options.selectableItems.each(function (it) {
var name = typeOf(it) === "string" ? it : it.name;
var id = typeOf(it) === "string" ? it : it.id;
var item = this._newItem({name: name, id: id}, this, this.itemAreaNode);
this.items.push(item);
this.subItems.push( item );
}.bind(this))
} else {
this.options.selectableItems.each(function (item, index) {
if (item.isItem) {
var item = this._newItem(item, this, this.itemAreaNode);
this.items.push(item);
this.subItems.push( item );
}else{
// if ( (item.subItemList && item.subItemList.length > 0) || item.subCategoryList && item.subCategoryList.length > 0 ) {
if( this.options.categorySelectable ){
var category = this._newItemCategorySelectable(item, this, this.itemAreaNode);
this.items.push(category);
this.categorys.push( category );
this.subItems.push( category );
this.subCategorys.push( category );
}else{
var category = this._newItemCategory(item, this, this.itemAreaNode);
this.categorys.push( category );
this.subCategorys.push( category );
}
// item.subItemList.each(function (subItem, index) {
// var item = this._newItem(subItem, this, category.children, 2, category);
......@@ -103,6 +108,7 @@ MWF.xApplication.Template.Selector.Custom = new Class({
}
}.bind(this));
}
if(this.afterLoadSelectItem)this.afterLoadSelectItem();
},
_scrollEvent: function (y) {
return true;
......@@ -310,22 +316,32 @@ MWF.xApplication.Template.Selector.Custom.ItemCategory = new Class({
return this.data.name;
},
clickItem: function (callback) {
if (this._hasChild()) {
if (this._hasChild() || this.selector.options.expandEmptyCategory ) {
var firstLoaded = !this.loaded;
if( !firstLoaded || this.selector.options.expandEmptyCategory ){
if(this.isExpand){
this.selector.fireEvent("collapse", [this] );
}else{
this.selector.fireEvent("expand", [this] );
}
}
this.loadSub(function () {
if (firstLoaded) {
if (firstLoaded && this._hasChild() ) {
if (!this.selector.isFlatCategory) {
this.children.setStyles({"display": "block", "height": "auto"});
this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_expand);
this.isExpand = true;
}
// this.checkSelectAll();
} else {
var display = this.children.getStyle("display");
if (display === "none") {
// this.selector.fireEvent("expand", [this] );
this.children.setStyles({"display": "block", "height": "auto"});
this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_expand);
this.isExpand = true;
} else {
// this.selector.fireEvent("collapse", [this] );
this.children.setStyles({"display": "none", "height": "0px"});
this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_collapse);
this.isExpand = false;
......@@ -390,7 +406,13 @@ MWF.xApplication.Template.Selector.Custom.ItemCategory = new Class({
check: function () {
},
afterLoad: function(){
if ( this.level <= this.selector.options.defaultExpandLevel ) this.clickItem();
if ( this.level <= this.selector.options.defaultExpandLevel && (this._hasChild()) ){
this.clickItem();
}else{
this.children.hide();
this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_collapse);
this.isExpand = false;
}
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册