From c88fd286016a3447275551754fa547bb3faecb1d Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Fri, 29 May 2020 18:55:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BA=BA=E5=91=98=E5=9B=9E?= =?UTF-8?q?=E6=98=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/tree/tree-user.html | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cloud-common-plugin/src/main/resources/templates/tree/tree-user.html b/cloud-common-plugin/src/main/resources/templates/tree/tree-user.html index 6bddffe..0170c9e 100644 --- a/cloud-common-plugin/src/main/resources/templates/tree/tree-user.html +++ b/cloud-common-plugin/src/main/resources/templates/tree/tree-user.html @@ -32,7 +32,6 @@
@@ -53,7 +52,7 @@ var selectDepartmentUserArray = []; - top.dialog.dialogData.selectedDepartmentUsers = null; + top.dialog.dialogData.selectedDepartmentUsers = []; function closeBox() { top.dialog.dialogData.selectedUsers = null; @@ -115,6 +114,7 @@ } } } + top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray; } function initCheckData(zTree) { if(selectedUsers) { @@ -127,7 +127,17 @@ selectedUsers: selectedUsers }, null, function(code, data) { for(var i = 0, item; item = data[i++];) { - addSelectDepartmentUserArray(item.userId, item.userName, ('【'+ item.departmentName +'】'+ item.userName), item.departmentId); + var id = item.userId; + var userName = item.userName; + var userTitle = ('【'+ item.departmentName +'】'+ item.userName); + var departmentId = item.departmentId; + addSelectDepartmentUserArray(id, userName, userTitle, departmentId); + top.dialog.dialogData.selectedDepartmentUsers.push({ + userId: id, + userName: userName, + userTitle: userTitle, + departmentId: departmentId, + }); } initSelectNode(zTree); }, function(code, data) { @@ -199,17 +209,18 @@ } } } - top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray; } $(document).on('click', '.remove-selected-user', function() { var zTree = $.fn.zTree.getZTreeObj('leftTree'); removeSelectDepartmentUserArray(this.dataset.userid, this.dataset.departmentid); // 删除选中状态 var node = zTree.getNodeByParam('id', 'u_'+ this.dataset.userid, null); - zTree.checkNode(node, false, true); - top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray; + if(node) { + zTree.checkNode(node, false, true); + } }); $('.confirm').on('click', function() { + top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray; closeBox(); }); $('.close').on('click', function() {