提交 b25d8bd5 编写于 作者: U unknown

选人显示状态

上级 f2bd376c
......@@ -10,7 +10,10 @@ MWF.xApplication.Selector.Application = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "application";
this.className = "Application"
},
loadSelectItems: function(addToNext){
this.processAction.listApplications(function(json){
json.data.each(function(data){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.CMSApplication = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "application";
this.className = "CMSApplication"
},
loadSelectItems: function(addToNext){
this.cmsAction.listCMSApplication(function(json){
json.data.each(function(data){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.CMSCategory = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "cmscategory";
this.className = "CMSCategory"
},
loadSelectItems: function(addToNext){
this.cmsAction.listCMSApplication(function(json){
if (json.data.length){
......
......@@ -14,6 +14,10 @@ MWF.xApplication.Selector.CMSFormField = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "formfield";
this.className = "CMSFormField";
},
getFields : function(){
var dataTypes = {
"string": ["htmledit", "radio", "select", "textarea", "textfield"],
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.CMSView = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "cmsview";
this.className = "CMSView";
},
loadSelectItems: function(addToNext){
this.cmsAction.listCMSApplicationView(function(json){
if (json.data.length){
......
......@@ -12,6 +12,10 @@ MWF.xApplication.Selector.Dictionary = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "dictionary";
this.className = "Dictionary";
},
loadSelectItems: function(addToNext){
var json = {};
this.options.appType.each( function (type) {
......
......@@ -9,7 +9,10 @@ MWF.xApplication.Selector.Duty = new Class({
"values": [],
"expand": false
},
_init : function(){
this.selectType = "duty";
this.className = "Duty";
},
loadSelectItems: function(addToNext){
this.orgAction.listUnitdutyName(function(json){
json.data.nameList.each(function(data){
......
......@@ -13,7 +13,10 @@ MWF.xApplication.Selector.FormField = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "formfield";
this.className = "FormField";
},
loadSelectItems: function(addToNext){
if (this.options.application){
this.designerAction.listFormField(this.options.application, function(json){
......
......@@ -12,6 +12,10 @@ MWF.xApplication.Selector.FormStyle = new Class({
"mode" : "pc",
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "formstyle";
this.className = "FormStyle";
},
loadSelectItems: function(addToNext){
var stylesUrl = "../x_component_process_FormDesigner/Module/Form/skin/config.json";
MWF.getJSON(stylesUrl,{
......
......@@ -12,6 +12,10 @@ MWF.xApplication.Selector.Group = new Class({
"include" : [],
"selectType" : "group"
},
_init : function(){
this.selectType = "group";
this.className = "Group";
},
checkLoadSelectItems: function(){
if( this.options.include && this.options.include.length ){
this.loadInclude();
......
......@@ -16,8 +16,11 @@ MWF.xApplication.Selector.Identity = new Class({
"exclude" : [], //排除的可选项
"resultType" : "", //可以设置成个人,那么结果返回个人
"expandSubEnable" : true, //是否允许展开下一层,
"selectAllEnable" : true, //分类是否允许全选下一层
"selectType" : "identity"
"selectAllEnable" : true //分类是否允许全选下一层
},
_init : function(){
this.selectType = "identity";
this.className = "Identity";
},
loadSelectItems : function(){
if( this.options.isCheckStatus || this.options.showSelectedCount ) {
......@@ -51,6 +54,7 @@ MWF.xApplication.Selector.Identity = new Class({
var caculate = function () {
if (unitLoaded && groupLoaded && selectedIdentityLoaded && excludeIdentityLoaded) {
this.caculateNestedSubCount(unitTree, groupTree, function () {
debugger;
this._loadSelectItems()
}.bind(this))
......@@ -316,8 +320,8 @@ MWF.xApplication.Selector.Identity = new Class({
_listItemByPinyin: function(callback, failure, key){
this._listItem( "pinyin", callback, failure, key );
},
_newItem: function(data, selector, container, level, category){
return new MWF.xApplication.Selector.Identity.Item(data, selector, container, level, category);
_newItem: function(data, selector, container, level, category, delay){
return new MWF.xApplication.Selector.Identity.Item(data, selector, container, level, category, delay);
},
_newItemSearch: function(data, selector, container, level){
return new MWF.xApplication.Selector.Identity.SearchItem(data, selector, container, level);
......@@ -374,6 +378,31 @@ MWF.xApplication.Selector.Identity = new Class({
// }.bind(this));
//}
getIdentityAllLevelName : function(identityList, byGroup, callback){
var result = {
unitMap : {},
groupMap : {}
};
this.listIndetityObject( identityList, function ( list, map ) {
list.each( function (id) {
if(id.unitLevelName){
result.unitMap[ id.unitLevelName ] = ( result.unitMap[ id.unitLevelName ] || 0 )+1;
}
}.bind(this));
if( byGroup ) {
this.listLevelNameGroupMap(list, function ( levelNameGroupMap ) {
for( var key in levelNameGroupMap ){
var group = levelNameGroupMap[key]
var identityCount = group["identityList"].length;
if(identityCount)result.groupMap[key] = identityCount;
}
if( callback )callback( result );
}.bind(this));
}else{
if( callback )callback( result );
}
}.bind(this));
},
getIdentityCountMap : function( identityList, byGroup, callback ){
var result = {
unitMap : {},
......@@ -750,7 +779,7 @@ MWF.xApplication.Selector.Identity.ItemSelected = new Class({
item.selectedItem = this;
item.setSelected();
if( this.selector.options.showSelectedCount ){
if(item.category)item.category._addSelectedCount( 1, true );
if(item.category && item.category._addSelectedCount )item.category._addSelectedCount( 1, true );
}
}.bind(this));
}
......@@ -767,7 +796,11 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
}).inject(this.container);
},
_getShowName: function(){
return "" + this._getTotalCount() + "-" + this._getSelectedCount() + "-" + this.data.name ;
if( this._getTotalCount && this._getSelectedCount ){
return "" + this._getTotalCount() + "-" + this._getSelectedCount() + "-" + this.data.name ;
}else{
return this.data.name;
}
},
_getTotalCount : function(){
if( !this.selector.allUnitObject )return "n";
......@@ -1050,6 +1083,7 @@ MWF.xApplication.Selector.Identity.ItemGroupCategory = new Class({
return count;
},
_getSelectedCount : function(){
debugger;
if( typeOf(this.selectedCount) === "number" )return this.selectedCount;
if( !this.selector.allGroupObjectByDn )return 0;
var group = this.selector.allGroupObjectByDn[this.data.distinguishedName];
......
......@@ -19,6 +19,10 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
"exclude" : [],
"selectType" : "identity"
},
_init : function(){
this.selectType = "identity";
this.className = "IdentityWidthDuty"
},
loadSelectItems: function(addToNext){
var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
......@@ -186,8 +190,8 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
if (callback) callback.apply(this, [json]);
}.bind(this), failure, key);
},
_newItem: function(data, selector, container, level, category){
return new MWF.xApplication.Selector.IdentityWidthDuty.Item(data, selector, container, level, category);
_newItem: function(data, selector, container, level, category, delay){
return new MWF.xApplication.Selector.IdentityWidthDuty.Item(data, selector, container, level, category, delay);
},
_newItemSearch: function(data, selector, container, level){
return new MWF.xApplication.Selector.IdentityWidthDuty.SearchItem(data, selector, container, level);
......@@ -247,8 +251,12 @@ MWF.xApplication.Selector.IdentityWidthDuty.ItemCategory = new Class({
var style = this.selector.options.style;
this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/"+style+"/icon/companyicon.png)");
},
_addSelectedCount : function(){
this.selectedCountNode.set("text", this._getSelectedCount());
},
_getSelectedCount : function(){
var list = this.subItems.filter( function (item) { return item.isSelected; });
return list.length;
},
_getNestItemCount : function(){
return this.subItems.length;
......
......@@ -20,6 +20,10 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
"dutyUnitLevelBy" : "duty", //组织层级是按身份所在群组还是职务,
"selectType" : "identity"
},
_init : function(){
this.selectType = "identity";
this.className = "IdentityWidthDutyCategoryByUnit";
},
loadSelectItems: function(addToNext){
//根据组织分类展现职务
if( this.options.resultType === "person" ){
......@@ -390,8 +394,8 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
if (callback) callback.apply(this, [json]);
}.bind(this), failure, key);
},
_newItem: function(data, selector, container, level, category){
return new MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Item(data, selector, container, level, category);
_newItem: function(data, selector, container, level, category, delay){
return new MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.Item(data, selector, container, level, category, delay);
},
_newItemSearch: function(data, selector, container, level){
return new MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit.SearchItem(data, selector, container, level);
......
......@@ -83,6 +83,11 @@ MWF.xApplication.Selector.Person = new Class({
this.subCategorys = []; //直接的分类
this.subItems = []; //直接的选择项
this._init();
},
_init : function(){
this.selectType = "person";
this.className = "Person"
},
load: function(){
this.fireEvent("queryLoad",[this]);
......@@ -1806,7 +1811,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
}).inject(this.node);
if( this.selector.options.selectType !== "identity" || this.selector.options.identityItemWidth === 0 ) {
if( this.selector.selectType !== "identity" || this.selector.options.identityItemWidth === 0 ) {
var indent = this.selector.options.level1Indent + (this.level - 1) * this.selector.options.indent;
this.levelNode.setStyle("width", "" + indent + "px");
}
......@@ -1832,7 +1837,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
var m = this.textNode.getStyle("margin-left").toFloat()+indent;
this.textNode.setStyle("margin-left", ""+m+"px");
if( this.selector.options.identityItemWidth && this.selector.options.selectType === "identity"){
if( this.selector.options.identityItemWidth && this.selector.selectType === "identity"){
this.node.setStyles({
"float" : "left",
"min-width" : this.selector.options.identityItemWidth + "px"
......@@ -2011,7 +2016,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
this.selector.fireEvent("unselectItem",[this]);
if( checkValid )this.selector.fireEvent("valid", [this.selector, this]);
},
selected: function( checkValid, callback, selectedNode ){
selected: function( checkValid, callback, selectedNode, byelectAll ){
debugger;
var count = this.selector.options.maxCount || this.selector.options.count;
count = count.toInt();
......@@ -2107,7 +2112,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
}
}
if( this.selector.options.showSelectedCount ){
if(item.category)item.category._addSelectedCount( -1, true );
if(item.category && item.category._addSelectedCount )item.category._addSelectedCount( -1, true );
}
}.bind(this));
......@@ -2383,7 +2388,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
"styles": this.selector.css.selectorItemLevelNode
}).inject(this.node);
if(this.selector.options.selectType !== "identity" || this.selector.options.identityItemWidth === 0 ){
if(this.selector.selectType !== "identity" || this.selector.options.identityItemWidth === 0 ){
var indent = this.selector.options.level1Indent + (this.level - 1) * this.selector.options.indent;
this.levelNode.setStyle("width", "" + indent + "px");
}else{
......@@ -2442,9 +2447,11 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
var m = this.textNode.getStyle("margin-left").toFloat()+indent;
this.textNode.setStyle("margin-left", ""+m+"px");
this.selectedCountNode = new Element("span", {
"text": this._getSelectedCount()
}).inject(this.textNode);
if( this.selector.options.showSelectedCount && this._getSelectedCount ){
this.selectedCountNode = new Element("span", {
"text": this._getSelectedCount()
}).inject(this.textNode);
}
this.children = new Element("div.children", {
"styles": this.selector.css.selectorItemCategoryChildrenNode
......@@ -2463,7 +2470,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
this.children.setStyle("height", ""+this.childrenHeight+"px");
}
if(this.selector.options.identityItemWidth && this.selector.options.selectType === "identity"){
if(this.selector.options.identityItemWidth && this.selector.selectType === "identity"){
var indent = this.level === 0 ? this.selector.options.level1Indent : this.selector.options.indent;
this.children.setStyles({
"padding-left": "" + indent + "px",
......@@ -2501,7 +2508,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
var c = ( this._getSelectedCount() || 0 ) + count;
this.selectedCount = c;
this.selectedCountNode.set("text", c);
if( nested && this.category ){
if( nested && this.category && this.category._addSelectedCount ){
this.category._addSelectedCount(count, nested);
}
},
......@@ -2537,20 +2544,23 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
selectAllNested : function( ev, checkValid, selectedNode ){
var node;
if(selectedNode)node = new Element("div.categorySelectedNode").inject( selectedNode );
this.selectAll(ev, checkValid, node);
if( this.subCategorys && this.subCategorys.length ){
this.subCategorys.each( function( category ){
if(selectedNode)var node = new Element("div.categorySelectedNode").inject( selectedNode );
category.selectAllNested(ev, checkValid, node)
})
}
this.selectAll(ev, checkValid, node, function () {
if( this.subCategorys && this.subCategorys.length ){
this.subCategorys.each( function( category ){
if(selectedNode)var node = new Element("div.categorySelectedNode").inject( selectedNode );
category.selectAllNested(ev, checkValid, node)
})
}
}.bind(this));
},
selectAll: function(ev, checkValid, selectedNode){
selectAll: function(ev, checkValid, selectedNode, callback){
if( this.loaded || this.selector.isFlatCategory ){
this._selectAll( ev, checkValid, selectedNode );
if(callback)callback();
}else{
this.clickItem( function(){
this._selectAll( ev, checkValid, selectedNode );
if(callback)callback();
//this.children.setStyles({
// "display": "none",
// "height": "0px"
......
......@@ -10,7 +10,10 @@ MWF.xApplication.Selector.Portal = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "portal";
this.className = "Portal";
},
loadSelectItems: function(addToNext){
this.portalDesignerAction.listApplication(function(json){
json.data.each(function(data){
......
......@@ -13,7 +13,10 @@ MWF.xApplication.Selector.PortalFile = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "file";
this.className = "PortalFile";
},
loadSelectItems: function(addToNext){
if (this.options.isImage) this.options.accept = ["png","jpg","bmp","gif","jpeg","jpe"];
this.portalAction.listApplication(function(json){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.Process = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "process";
this.className = "Process";
},
loadSelectItems: function(addToNext){
this.processAction.listApplicationStartable(function(json){
if (json.data.length){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.ProcessFile = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "file";
this.className = "ProcessFile";
},
loadSelectItems: function(addToNext){
if (this.options.isImage) this.options.accept = ["png","jpg","bmp","gif","jpeg","jpe"];
this.processAction.listApplication(function(json){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.Query = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "query";
this.className = "Query";
},
loadSelectItems: function(addToNext){
this.queryAction.listApplication(function(json){
if (json.data.length){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.QueryStat = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "querystat";
this.className = "QueryStat";
},
loadSelectItems: function(addToNext){
this.queryAction.listApplication(function(json){
if (json.data.length){
......
......@@ -11,6 +11,10 @@ MWF.xApplication.Selector.QueryTable = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "querytable";
this.className = "QueryTable";
},
loadSelectItems: function(addToNext){
this.queryAction.listApplication(function(json){
if (json.data.length){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.QueryView = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "queryview";
this.className = "QueryView";
},
loadSelectItems: function(addToNext){
this.queryAction.listApplication(function(json){
if (json.data.length){
......
......@@ -11,7 +11,10 @@ MWF.xApplication.Selector.Role = new Class({
"names": [],
"selectType" : "role"
},
_init : function(){
this.selectType = "role";
this.className = "Role";
},
_listItemByKey: function(callback, failure, key){
if (this.options.units.length || this.options.roles.length) key = this.getLikeKey(key);
this.orgAction.listRoleByKey(function(json){
......
......@@ -12,6 +12,10 @@ MWF.xApplication.Selector.Script = new Class({
"expand": false,
"forceSearchInItem" : true
},
_init : function(){
this.selectType = "script";
this.className = "Script";
},
loadSelectItems: function(addToNext){
var json = {};
this.options.appType.each( function (type) {
......
......@@ -16,7 +16,10 @@ MWF.xApplication.Selector.Unit = new Class({
"selectAllEnable" : true, //分类是否允许全选下一层
"selectType" : "unit"
},
_init : function(){
this.selectType = "unit";
this.className = "Unit";
},
loadSelectItems: function(addToNext){
var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
......@@ -401,26 +404,29 @@ MWF.xApplication.Selector.Unit.Item = new Class({
selectAllNested : function(ev, checkValid, selectedNode){
var node;
if( selectedNode )node = new Element("div.categorySelectedNode").inject( selectedNode );
this.selectAll(ev, checkValid, node);
if( this.subCategorys && this.subCategorys.length ){
this.subCategorys.each( function( category ){
if(selectedNode)var node = new Element("div.categorySelectedNode").inject( selectedNode );
if(category.selectAllNested)category.selectAllNested(ev, checkValid, node)
})
}
if( this.subItems && this.subItems.length ){
this.subItems.each( function( item ){
if(selectedNode)var node = new Element("div.categorySelectedNode").inject( selectedNode );
if(item.selectAllNested)item.selectAllNested(ev, checkValid, node)
})
}
this.selectAll(ev, checkValid, node, function () {
if( this.subCategorys && this.subCategorys.length ){
this.subCategorys.each( function( category ){
if(selectedNode)var node = new Element("div.categorySelectedNode").inject( selectedNode );
if(category.selectAllNested)category.selectAllNested(ev, checkValid, node)
})
}
if( this.subItems && this.subItems.length ){
this.subItems.each( function( item ){
if(selectedNode)var node = new Element("div.categorySelectedNode").inject( selectedNode );
if(item.selectAllNested)item.selectAllNested(ev, checkValid, node)
})
}
}.bind(this));
},
selectAll: function(ev, checkValid, selectedNode){
selectAll: function(ev, checkValid, selectedNode, callback){
if( this.loaded || this.selector.isFlatCategory ){
this._selectAll( ev, checkValid, selectedNode )
this._selectAll( ev, checkValid, selectedNode );
if(callback)callback();
}else{
this.loadSubItems(function(){
this._selectAll( ev, checkValid, selectedNode )
this._selectAll( ev, checkValid, selectedNode );
if(callback)callback();
}.bind(this));
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_expand);
this.isExpand = true;
......
......@@ -16,7 +16,10 @@ MWF.xApplication.Selector.UnitWithType = new Class({
"expandSubEnable" : true, //是否允许展开下一层
"selectAllEnable" : true //分类是否允许全选下一层
},
_init : function(){
this.selectType = "unit";
this.className = "UnitWithType";
},
loadSelectItems: function(addToNext){
var afterLoadSelectItemFun = this.afterLoadSelectItem.bind(this);
......@@ -59,8 +62,8 @@ MWF.xApplication.Selector.UnitWithType = new Class({
_getChildrenItemIds: function(){
return null;
},
_newItemCategory: function(type, data, selector, item, level, category){
return new MWF.xApplication.Selector.UnitWithType[type](data, selector, item, level, category)
_newItemCategory: function(type, data, selector, item, level, category, delay){
return new MWF.xApplication.Selector.UnitWithType[type](data, selector, item, level, category, delay)
},
_listItemByKey: function(callback, failure, key){
......
......@@ -10,7 +10,10 @@ MWF.xApplication.Selector.View = new Class({
"names": [],
"expand": false
},
_init : function(){
this.selectType = "view";
this.className = "View";
},
loadSelectItems: function(addToNext){
this.designerAction.listView(function(json){
if (json.data.length){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册