瀏覽代碼

Merge branch 'feature/Org_person_role' into 'develop'

Merge of feature/[组织管理]在个人中新增列示所拥用的角色 to develop

See merge request o2oa/o2oa!1053
蔡祥熠 5 年之前
父節點
當前提交
25b45ab7c3

+ 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");

+ 78 - 0
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);
@@ -137,6 +149,9 @@ MWF.xApplication.Org.PersonExplorer.PersonContent = new Class({
         this.identityContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
         this.identityPage = this.propertyTab.addTab(this.identityContentNode, this.explorer.app.lp.personIdentityText);
 
+        this.roleContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
+        this.rolePage = this.propertyTab.addTab(this.roleContentNode, this.explorer.app.lp.personRoleText);
+
         // this.managerContentNode = new Element("div", {"styles": this.item.style.tabContentNode});
         // this.managerPage = this.propertyTab.addTab(this.managerContentNode, this.explorer.app.lp.controllerListText);
     },
@@ -144,6 +159,7 @@ MWF.xApplication.Org.PersonExplorer.PersonContent = new Class({
         this._listBaseInfor();
         this._listAttribute();
         this._listIdentity();
+        this._listRole();
         this.loadListCount();
 
         //
@@ -176,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);
@@ -421,6 +450,55 @@ MWF.xApplication.Org.PersonExplorer.PersonContent = new Class({
                 }.bind(this), null, this.data.id);
             }.bind(this));
         }
+    },
+    _listRole: function(){
+        var _self = this;
+        this.roleList = new MWF.xApplication.Org.List(this.roleContentNode, this, {
+            "action": false,
+            "canEdit": false,
+            "data": {
+                // "person": this.data.id,
+                // "name": "",
+                // "unique": "",
+                // "orderNumber": "",
+                // "attributeList": [],
+                // "description":""
+            },
+            "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>";
+                        }
+                        return "";
+                    },
+                    "events": {
+                        "click": function(){
+                            debugger;
+                            _self.explorer.openRole(this.data, this.td);
+                        }
+                    }
+                }]
+        });
+        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": ""}
+        ]);
+
+        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({

+ 3 - 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": "值",
@@ -220,6 +222,7 @@ MWF.xApplication.Org.LP = {
     "personAttributeText": "个人属性",
     "personIdentityText": "个人身份",
     "controllerListText": "管理者",
+    "personRoleText" : "个人角色",
 
     "IdentityName": "身份名称",
     "IdentityInUnit": "所在组织",

+ 1 - 1
o2web/source/x_component_Selector/Person.js

@@ -1362,7 +1362,7 @@ MWF.xApplication.Selector.Person = new Class({
         }
     },
     afterLoadSelectItem : function(){
-        if( this.subItems.length === 0 && this.subCategorys.length === 0  ){
+        if( this.subItems.length === 0 && this.subCategorys.length === 0 && this.items.length === 0 ){
            this.noSelectableItemTextDiv = new Element("div", {
                text : MWF.SelectorLP.noSelectableItemText,
                styles : this.css.noSelectableItemText