Ver Fonte

在个人中新增列示所拥用的角色

unknown há 5 anos atrás
pai
commit
9c0f63d997

+ 3 - 0
o2web/source/x_component_Org/$Explorer.js

@@ -573,6 +573,9 @@ MWF.xApplication.Org.$Explorer = new Class({
     openUnit: function(data, node){
         this.openContent("UnitExplorer", "UnitContent", data, node);
     },
+    openRole: function(data, node){
+        this.openContent("RoleExplorer", "RoleContent", data, node);
+    },
     openContent: function(explorerClazz, contentClazz, data, node){
         MWF.xDesktop.requireApp("Org", explorerClazz, function(){
             var contentNode = new Element("div", {"styles": this.css.popContentNode}).inject(this.propertyContentNode, "top");

+ 59 - 65
o2web/source/x_component_Org/PersonExplorer.js

@@ -127,6 +127,18 @@ MWF.xApplication.Org.PersonExplorer.PersonContent = new Class({
     _showItemPropertyBottom: function(){
         this.bottomInfor = new MWF.xApplication.Org.PersonExplorer.PersonContent.BottomInfor(this);
     },
+    loadItemPropertyTab: function(callback){
+        this.propertyTabContainerNode = new Element("div", {"styles": this.item.style.tabTitleNode}).inject(this.propertyContentNode, "top");
+
+        MWF.require("MWF.widget.Tab", function(){
+            this.propertyTab = new MWF.widget.Tab(this.propertyContentNode, {"style": "unit"});
+            this.propertyTab.load();
+
+            this.propertyTab.tabNodeContainer.inject(this.propertyTabContainerNode);
+            this.propertyTab.tabNodeContainer.setStyle("width","480px");
+            if (callback) callback();
+        }.bind(this));
+    },
     _loadTabs: function(){
         this.baseContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
         this.basePage = this.propertyTab.addTab(this.baseContentNode, this.explorer.app.lp.personBaseText);
@@ -180,6 +192,19 @@ MWF.xApplication.Org.PersonExplorer.PersonContent = new Class({
             }
         }
 
+        if( this.roleDataList ){
+            var roleCount = this.roleDataList.length;
+            if (roleCount){
+                if (!this.roleCountNode){
+                    this.roleCountNode = new Element("div", {"styles": this.item.style.tabCountNode, "text": roleCount}).inject(this.rolePage.tabNode);
+                }else{
+                    this.roleCountNode.set("text", roleCount);
+                }
+            }else{
+                if (this.roleCountNode) this.roleCountNode.destroy();
+            }
+        }
+
         // var groupCount = this.data.groupList.length;
         // if (groupCount){
         //     this.groupCountNode = new Element("div", {"styles": this.item.style.tabCountNode, "text": groupCount}).inject(this.groupMemberPage.tabNode);
@@ -431,80 +456,49 @@ MWF.xApplication.Org.PersonExplorer.PersonContent = new Class({
         this.roleList = new MWF.xApplication.Org.List(this.roleContentNode, this, {
             "action": false,
             "canEdit": false,
-            "saveAction": "saveIdentity",
             "data": {
-                "person": this.data.id,
-                "name": "",
-                "attributeList": []
+                // "person": this.data.id,
+                // "name": "",
+                // "unique": "",
+                // "orderNumber": "",
+                // "attributeList": [],
+                // "description":""
             },
-            "attr": ["name", {
-                "get": function(){ return ""; },
-                "events": {
-                    "init": function(){
-                        var contentNode = this.td;
-                        new MWF.widget.O2Unit(this.data.woUnit, contentNode, {"style": "xform"});
-                    }
-                }
-            }, {
-                "get": function(){ return this.distinguishedName; },
-                "set": function(value){ this.distinguishedName = value; }
-            }, {
-                "get": function(){ return ""; },
-                "events": {
-                    "init": function(){
-                        var contentNode = this.td;
-                        if (this.data.woUnitDutyList){
-                            this.data.woUnitDutyList.each(function(duty){
-                                new MWF.widget.O2Duty(duty, contentNode, {"style": "xform"});
-                            }.bind(this));
+            "attr": ["name",
+                "distinguishedName",
+                "description",{
+                    "getHtml": function(){
+                        if (_self.data.control.allowEdit){
+                            return "<div style='width:24px; height:24px; cursor: pointer; background:url(../x_component_Org/$Explorer/"+
+                                _self.explorer.app.options.style+"/icon/open.png) center center no-repeat'></div>";
                         }
-                    }
-                }
-            }, {
-                "getHtml": function(){
-                    if (this.major){
-                        return "<div style='width:24px; height:24px; background:url(../x_component_Org/$Explorer/"+
-                            _self.explorer.app.options.style+"/icon/mainid.png) center center no-repeat'></div>";
-                    }else{
-                        return "<div title='"+_self.explorer.app.lp.setIdentityMain+"' style='width:24px; height:24px; cursor: pointer; background:url(../x_component_Org/$Explorer/"+
-                            _self.explorer.app.options.style+"/icon/select.png) center center no-repeat'></div>";
-                    }
-                },
-                "events": {
-                    "click": function(){
-                        if (!this.data.major){
-                            if (_self.data.control.allowEdit){_self.setMainIdentity(this.data, this.td, this.item);}
+                        return "";
+                    },
+                    "events": {
+                        "click": function(){
+                            debugger;
+                            _self.explorer.openRole(this.data, this.td);
                         }
                     }
-                }
-            },{
-                "getHtml": function(){
-                    if (_self.data.control.allowEdit){
-                        return "<div style='width:24px; height:24px; cursor: pointer; background:url(../x_component_Org/$Explorer/"+
-                            _self.explorer.app.options.style+"/icon/edit.png) center center no-repeat'></div>";
-                    }
-                    return "";
-                },
-                "events": {
-                    "click": function(){
-                        debugger;
-                        if (_self.data.control.allowEdit){_self.editIdentity(this.data, this.td, this.item);}
-                    }
-                }
-            }]
+                }]
         });
-        this.identityList.load([
-            {"style": "width: 12%", "text": this.explorer.app.lp.IdentityName},
-            {"style": "width: 12%", "text": this.explorer.app.lp.IdentityInUnit},
-            {"style": "width: 44%", "text": this.explorer.app.lp.personUnique},
-            {"style": "width: 20%", "text": this.explorer.app.lp.IdentityDuty},
-            {"style": "width: 10%", "text": this.explorer.app.lp.IdentityMain},
+        this.roleList.load([
+            {"style": "width: 15%", "text": this.explorer.app.lp.roleName},
+            {"style": "width: 30%", "text": this.explorer.app.lp.roleFullName},
+            {"style": "", "text": this.explorer.app.lp.description},
             {"style": "width: 30px", "text": ""}
         ]);
 
-        this.data.woIdentityList.each(function(item){
-            this.identityList.push(item);
-        }.bind(this));
+        o2.Actions.load("x_organization_assemble_control").RoleAction.listWithPerson(this.data.id, function (json) {
+            this.roleDataList = json.data;
+            json.data.each( function ( item ) {
+                this.roleList.push(item);
+            }.bind(this))
+        }.bind(this), null, false);
+
+        // this.data.woPersonAttributeList.each(function(item){
+        //     this.roleList.push(item);
+        // }.bind(this));
     }
 });
 MWF.xApplication.Org.PersonExplorer.PersonContent.TitleInfor = new Class({

+ 2 - 0
o2web/source/x_component_Org/lp/zh-cn.js

@@ -211,6 +211,8 @@ MWF.xApplication.Org.LP = {
     "personReadLogin": "用户于{date}最后一次登录,地址为:{ip},客户端:{client}",
     "personReadCreate": "用户创建于{date},最后修改于:{date2}",
     "personReadPassword": "密码到期时间{date},密码最后修改于:{date2}",
+    "roleName": "角色名",
+    "roleFullName": "角色全称",
 
     "attributeName": "属性",
     "attributeValue": "值",