فهرست منبع

允许人员选择器人员选项进行平铺

unknown 5 سال پیش
والد
کامیت
f25b355692

+ 2 - 1
o2web/source/x_component_Selector/Group.js

@@ -9,7 +9,8 @@ MWF.xApplication.Selector.Group = new Class({
         "roles": [],
         "roles": [],
         "values": [],
         "values": [],
         "names": [],
         "names": [],
-        "include" : []
+        "include" : [],
+        "selectType" : "group"
     },
     },
     checkLoadSelectItems: function(){
     checkLoadSelectItems: function(){
         if( this.options.include && this.options.include.length ){
         if( this.options.include && this.options.include.length ){

+ 2 - 1
o2web/source/x_component_Selector/Identity.js

@@ -16,7 +16,8 @@ MWF.xApplication.Selector.Identity = new Class({
         "exclude" : [], //排除的可选项
         "exclude" : [], //排除的可选项
         "resultType" : "", //可以设置成个人,那么结果返回个人
         "resultType" : "", //可以设置成个人,那么结果返回个人
         "expandSubEnable" : true, //是否允许展开下一层,
         "expandSubEnable" : true, //是否允许展开下一层,
-        "selectAllEnable" : true //分类是否允许全选下一层
+        "selectAllEnable" : true,  //分类是否允许全选下一层
+        "selectType" : "identity"
     },
     },
     loadSelectItems: function(addToNext){
     loadSelectItems: function(addToNext){
         debugger;
         debugger;

+ 2 - 1
o2web/source/x_component_Selector/IdentityWidthDuty.js

@@ -16,7 +16,8 @@ MWF.xApplication.Selector.IdentityWidthDuty = new Class({
         "resultType" : "", //可以设置成个人,那么结果返回个人
         "resultType" : "", //可以设置成个人,那么结果返回个人
         "expandSubEnable": true,
         "expandSubEnable": true,
         "selectAllEnable" : true, //分类是否允许全选下一层
         "selectAllEnable" : true, //分类是否允许全选下一层
-        "exclude" : []
+        "exclude" : [],
+        "selectType" : "identity"
     },
     },
     loadSelectItems: function(addToNext){
     loadSelectItems: function(addToNext){
 
 

+ 2 - 1
o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js

@@ -17,7 +17,8 @@ MWF.xApplication.Selector.IdentityWidthDutyCategoryByUnit = new Class({
         "expandSubEnable": true,
         "expandSubEnable": true,
         "selectAllEnable" : true, //分类是否允许全选下一层
         "selectAllEnable" : true, //分类是否允许全选下一层
         "exclude" : [],
         "exclude" : [],
-        "dutyUnitLevelBy" : "duty" //组织层级是按身份所在群组还是职务
+        "dutyUnitLevelBy" : "duty", //组织层级是按身份所在群组还是职务,
+        "selectType" : "identity"
     },
     },
     loadSelectItems: function(addToNext){
     loadSelectItems: function(addToNext){
         //根据组织分类展现职务
         //根据组织分类展现职务

+ 35 - 6
o2web/source/x_component_Selector/Person.js

@@ -33,9 +33,11 @@ MWF.xApplication.Selector.Person = new Class({
         "injectToBody" : false, //当传入HTML URL的时候是否插入到document.body, false的时候插入到this.container
         "injectToBody" : false, //当传入HTML URL的时候是否插入到document.body, false的时候插入到this.container
         "selectSingleItem" : false, //当只有一个候选项的时候,是否默认选中
         "selectSingleItem" : false, //当只有一个候选项的时候,是否默认选中
 
 
-        "flatCategory" : false, //扁平化展现分类
+        "flatCategory" : false, //扁平化展现分类,
+        "selectType" : "person",
 
 
         "itemHeight" : 29,
         "itemHeight" : 29,
+        "identityItemWidth" : 0, //选项宽度,如果不为0,设置为float:left,
 
 
         "showEmptyText" : true
         "showEmptyText" : true
     },
     },
@@ -444,6 +446,9 @@ MWF.xApplication.Selector.Person = new Class({
         this.cancelActionNode.addEvent("click", function(){this.fireEvent("cancel"); this.close();}.bind(this));
         this.cancelActionNode.addEvent("click", function(){this.fireEvent("cancel"); this.close();}.bind(this));
     },
     },
     loadContent: function( contentNode, isHTML ){
     loadContent: function( contentNode, isHTML ){
+
+        this.fireEvent("queryLoadContent",[this]);
+
         if( contentNode )this.contentNode = contentNode;
         if( contentNode )this.contentNode = contentNode;
         if( this.options.contentUrl || isHTML ){
         if( this.options.contentUrl || isHTML ){
             if (this.options.count.toInt()!==1) this.loadSelectedNodeHTML();
             if (this.options.count.toInt()!==1) this.loadSelectedNodeHTML();
@@ -1765,8 +1770,12 @@ MWF.xApplication.Selector.Person.Item = new Class({
         this.levelNode = new Element("div", {
         this.levelNode = new Element("div", {
             "styles": this.selector.css.selectorItemLevelNode
             "styles": this.selector.css.selectorItemLevelNode
         }).inject(this.node);
         }).inject(this.node);
-        var indent = this.selector.options.level1Indent + (this.level-1)*this.selector.options.indent;
-        this.levelNode.setStyle("width", ""+indent+"px");
+
+
+        if( this.selector.options.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");
+        }
 
 
         this.iconNode = new Element("div", {
         this.iconNode = new Element("div", {
             "styles": this.selector.css.selectorItemIconNode
             "styles": this.selector.css.selectorItemIconNode
@@ -1789,6 +1798,13 @@ MWF.xApplication.Selector.Person.Item = new Class({
         var m = this.textNode.getStyle("margin-left").toFloat()+indent;
         var m = this.textNode.getStyle("margin-left").toFloat()+indent;
         this.textNode.setStyle("margin-left", ""+m+"px");
         this.textNode.setStyle("margin-left", ""+m+"px");
 
 
+        if( this.selector.options.identityItemWidth && this.selector.options.selectType === "identity"){
+            this.node.setStyles({
+                "float" : "left",
+                "min-width" : this.selector.options.identityItemWidth + "px"
+            })
+        }
+
         if(this.postLoad)this.postLoad();
         if(this.postLoad)this.postLoad();
 
 
         this.loadSubItem();
         this.loadSubItem();
@@ -2324,8 +2340,13 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
         this.levelNode = new Element("div", {
         this.levelNode = new Element("div", {
             "styles": this.selector.css.selectorItemLevelNode
             "styles": this.selector.css.selectorItemLevelNode
         }).inject(this.node);
         }).inject(this.node);
-        var indent = this.selector.options.level1Indent + (this.level-1)*this.selector.options.indent;
-        this.levelNode.setStyle("width", ""+indent+"px");
+
+        if(this.selector.options.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{
+            this.node.setStyle("clear","both");
+        }
 
 
         this.iconNode = new Element("div", {
         this.iconNode = new Element("div", {
             "styles": this.selector.css.selectorItemCategoryIconNode || this.selector.css.selectorItemIconNode
             "styles": this.selector.css.selectorItemCategoryIconNode || this.selector.css.selectorItemIconNode
@@ -2379,7 +2400,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
         var m = this.textNode.getStyle("margin-left").toFloat()+indent;
         var m = this.textNode.getStyle("margin-left").toFloat()+indent;
         this.textNode.setStyle("margin-left", ""+m+"px");
         this.textNode.setStyle("margin-left", ""+m+"px");
 
 
-        this.children = new Element("div", {
+        this.children = new Element("div.children", {
             "styles": this.selector.css.selectorItemCategoryChildrenNode
             "styles": this.selector.css.selectorItemCategoryChildrenNode
         }).inject(this.node, "after");
         }).inject(this.node, "after");
         if (!this.selector.options.expand) this.children.setStyle("display", "none");
         if (!this.selector.options.expand) this.children.setStyle("display", "none");
@@ -2396,6 +2417,14 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
                 this.children.setStyle("height", ""+this.childrenHeight+"px");
                 this.children.setStyle("height", ""+this.childrenHeight+"px");
             }
             }
 
 
+            if(this.selector.options.identityItemWidth && this.selector.options.selectType === "identity"){
+                var indent = this.level === 0 ? this.selector.options.level1Indent : this.selector.options.indent;
+                this.children.setStyles({
+                    "padding-left": "" + indent + "px",
+                    "overflow" : "hidden"
+                });
+            }
+
             if ( !this._hasChild()){
             if ( !this._hasChild()){
                 this.actionNode.setStyle("background", "transparent");
                 this.actionNode.setStyle("background", "transparent");
                 this.textNode.setStyle("color", "#777");
                 this.textNode.setStyle("color", "#777");

+ 2 - 1
o2web/source/x_component_Selector/Role.js

@@ -8,7 +8,8 @@ MWF.xApplication.Selector.Role = new Class({
         "groups": [],
         "groups": [],
         "roles": [],
         "roles": [],
         "values": [],
         "values": [],
-        "names": []
+        "names": [],
+        "selectType" : "role"
     },
     },
 
 
     _listItemByKey: function(callback, failure, key){
     _listItemByKey: function(callback, failure, key){

+ 2 - 1
o2web/source/x_component_Selector/Unit.js

@@ -13,7 +13,8 @@ MWF.xApplication.Selector.Unit = new Class({
         "expand": true,
         "expand": true,
         "exclude" : [],
         "exclude" : [],
         "expandSubEnable" : true, //是否允许展开下一层
         "expandSubEnable" : true, //是否允许展开下一层
-        "selectAllEnable" : true //分类是否允许全选下一层
+        "selectAllEnable" : true, //分类是否允许全选下一层
+        "selectType" : "unit"
     },
     },
 
 
     loadSelectItems: function(addToNext){
     loadSelectItems: function(addToNext){

+ 1 - 0
o2web/source/x_component_Selector/UnitWithType.js

@@ -12,6 +12,7 @@ MWF.xApplication.Selector.UnitWithType = new Class({
         "zIndex": 1000,
         "zIndex": 1000,
         "expand": true,
         "expand": true,
         "exclude" : [],
         "exclude" : [],
+        "selectType" : "unit",
         "expandSubEnable" : true, //是否允许展开下一层
         "expandSubEnable" : true, //是否允许展开下一层
         "selectAllEnable" : true //分类是否允许全选下一层
         "selectAllEnable" : true //分类是否允许全选下一层
     },
     },