处理人员回显问题

This commit is contained in:
wenc000 2020-05-29 18:55:01 +08:00
parent ff8c5f2fa8
commit c88fd28601

View File

@ -32,7 +32,6 @@
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-footer" style="left: 0;"> <div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn confirm">确认</button> <button type="button" class="layui-btn confirm">确认</button>
<button type="button" class="layui-btn layui-btn-primary close">关闭</button>
</div> </div>
</div> </div>
</div> </div>
@ -53,7 +52,7 @@
var selectDepartmentUserArray = []; var selectDepartmentUserArray = [];
top.dialog.dialogData.selectedDepartmentUsers = null; top.dialog.dialogData.selectedDepartmentUsers = [];
function closeBox() { function closeBox() {
top.dialog.dialogData.selectedUsers = null; top.dialog.dialogData.selectedUsers = null;
@ -115,6 +114,7 @@
} }
} }
} }
top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray;
} }
function initCheckData(zTree) { function initCheckData(zTree) {
if(selectedUsers) { if(selectedUsers) {
@ -127,7 +127,17 @@
selectedUsers: selectedUsers selectedUsers: selectedUsers
}, null, function(code, data) { }, null, function(code, data) {
for(var i = 0, item; item = data[i++];) { 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); initSelectNode(zTree);
}, function(code, data) { }, function(code, data) {
@ -199,17 +209,18 @@
} }
} }
} }
top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray;
} }
$(document).on('click', '.remove-selected-user', function() { $(document).on('click', '.remove-selected-user', function() {
var zTree = $.fn.zTree.getZTreeObj('leftTree'); var zTree = $.fn.zTree.getZTreeObj('leftTree');
removeSelectDepartmentUserArray(this.dataset.userid, this.dataset.departmentid); removeSelectDepartmentUserArray(this.dataset.userid, this.dataset.departmentid);
// 删除选中状态 // 删除选中状态
var node = zTree.getNodeByParam('id', 'u_'+ this.dataset.userid, null); var node = zTree.getNodeByParam('id', 'u_'+ this.dataset.userid, null);
zTree.checkNode(node, false, true); if(node) {
top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray; zTree.checkNode(node, false, true);
}
}); });
$('.confirm').on('click', function() { $('.confirm').on('click', function() {
top.dialog.dialogData.selectedDepartmentUsers = selectDepartmentUserArray;
closeBox(); closeBox();
}); });
$('.close').on('click', function() { $('.close').on('click', function() {