阅读:1172
回复:2
|
[技术实例]V10.3选人控件显示上级部门名称
这个需求在公司人员多的时候,有重名的时候。搜索人员的时候出来几个相同的人名,就不知道选哪个人了,手机端是自带人员所属组织架构的,但是PC端没有。
提供简单的修改方法(人员显示上级部门,部门和用户组不显示,如有需求,自己修改下即可) 效果图: 图片:Snipaste_2018-06-26_11-53-09.png ![]() 修改Portal/WFRes/_Scripts/MVCSheet/Controls/SheetUser.js添加组织机构选择列项中 AddListItem方法: 即可 //添加组织机构选择列项 AddListItem: function (node, searchkey) { var displayText = node.Text; if (searchkey) { displayText = displayText.replace(searchkey, "<span class="bg-info">" + searchkey + "</span>"); if (node.Code != "" && node.Text.indexOf("[" + node.Code + "]") == -1 && node.ExtendObject.UnitType == "U") { displayText += "[" + node.Code.replace(searchkey, "<span class="bg-info">" + searchkey + "</span>") + "]"; } } if (this.IsMobile) { var item = $("<div></div>"); item.css("border-bottom", "1px solid #ccc"); item.height("50px"); item.css("clear", "both"); var checkid = $.MvcSheetUI.NewGuid(); var checkbox = $("<input type="checkbox" objectid="" + node.ObjectID + "" id="" + checkid + "" />"); item.append(checkbox); item.append($("<label type="checkbox" label-for="" + checkid + "">" + displayText + "</label>").css("float", "none").css("left", "25px")); this.OrgListPanel.append(item); var thatSheetUser = this; item.bind("touchstart", function () { checkbox.click(); thatSheetUser.UnitCheckboxClick.apply(checkbox.get(0), [thatSheetUser, { ObjectID: node.ObjectID, Name: node.Text }]); }); } else { debugger; //获取上级部门名称 var DepartmentName = node.ExtendObject.DepartmentName == undefined ? "" : node.ExtendObject.DepartmentName + "-"; var item = $("<div>").addClass("task").append("<i class="task-sort-icon fa " + node.Icon + ""></i>").append(" <span class="task-title" style="word-break:break-all;">" + DepartmentName + displayText + "</span>"); item.css("padding", "5px 10px 5px 10px").css("border-bottom", "1px solid #e4e4e4").css("cursor", "pointer"); var checkid = $.MvcSheetUI.NewGuid(); var checkbox = $("<input type="checkbox" objectid="" + node.ObjectID + "" id="" + checkid + "" />").css("height", "auto").css("margin", "0px").show(); var checkItem = $("<div>").addClass("action-checkbox pull-right").append(checkbox); item.click(function (e) { if (e.target.tagName.toLowerCase() != "input") { $(this).find("input").click(); } }); this.OrgListPanel.append(item.append(checkItem)); checkbox.attr("checked", this.Choices[node.ObjectID] != undefined); checkbox.click({ that: this, option: { ObjectID: node.ObjectID, Name: node.Text } }, function (e) { e.data.that.UnitCheckboxClick.apply(this, [e.data.that, e.data.option]); }); } } |
|
1楼#
发布于:2018-06-27 10:26
![]() |
|
|