|
|
@@ -140,7 +140,9 @@
|
|
|
<% group.groupList.forEach(item => { %>
|
|
|
<dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
|
|
|
<p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
|
|
|
- class="ml-auto"><%- item.mobile %></span></p>
|
|
|
+ class="ml-auto"><%- item.mobile %></span>
|
|
|
+ <span class="selected-mark text-success ml-2" style="display: <% if (permissionAudits.some(pa => pa.uid == item.id)) { %>inline-block<% } else { %>none<% } %>;"><i class="fa fa-check"></i></span>
|
|
|
+ </p>
|
|
|
<span class="text-muted"><%- item.role %></span>
|
|
|
</dd>
|
|
|
<% });%>
|
|
|
@@ -262,12 +264,15 @@
|
|
|
accountList.filter(item => item && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
|
|
|
html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
|
|
|
<p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
|
|
|
- class="ml-auto">${item.mobile || ''}</span></p>
|
|
|
+ class="ml-auto">${item.mobile || ''}</span>
|
|
|
+ <span class="selected-mark text-success ml-2" style="display:none;"><i class="fa fa-check"></i></span>
|
|
|
+ </p>
|
|
|
<span class="text-muted">${item.role || ''}</span>
|
|
|
</dd>`
|
|
|
})
|
|
|
$('.book-list').empty()
|
|
|
$('.book-list').append(html)
|
|
|
+ syncUserSelectionMarks(permissionAudits);
|
|
|
} else {
|
|
|
if (!$('.acc-btn').length) {
|
|
|
accountGroup.forEach((group, idx) => {
|
|
|
@@ -279,7 +284,9 @@
|
|
|
group.groupList.forEach(item => {
|
|
|
html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
|
|
|
<p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
|
|
|
- class="ml-auto">${item.mobile || ''}</span></p>
|
|
|
+ class="ml-auto">${item.mobile || ''}</span>
|
|
|
+ <span class="selected-mark text-success ml-2" style="display:none;"><i class="fa fa-check"></i></span>
|
|
|
+ </p>
|
|
|
<span class="text-muted">${item.role || ''}</span>
|
|
|
</dd>`
|
|
|
});
|
|
|
@@ -287,6 +294,7 @@
|
|
|
})
|
|
|
$('.book-list').empty()
|
|
|
$('.book-list').append(html)
|
|
|
+ syncUserSelectionMarks(permissionAudits);
|
|
|
}
|
|
|
}
|
|
|
}, 400);
|
|
|
@@ -310,7 +318,8 @@
|
|
|
return false
|
|
|
});
|
|
|
// 添加到成员中
|
|
|
- $('dl').on('click', 'dd', function () {
|
|
|
+ $('dl').on('click', 'dd', function (e) {
|
|
|
+ e.stopPropagation();
|
|
|
const id = parseInt($(this).data('id'));
|
|
|
const groupName = $(this).data('groupname');
|
|
|
console.log(groupName);
|
|
|
@@ -318,6 +327,8 @@
|
|
|
postData('/sp/' + spid + '/payment/permission/save', { type: 'add-audit', id: id }, function (result) {
|
|
|
permissionAudits = result;
|
|
|
setList(permissionAudits);
|
|
|
+ console.log(permissionAudits);
|
|
|
+ syncUserSelectionMarks(permissionAudits);
|
|
|
})
|
|
|
} else if (groupName && groupName !== '') {
|
|
|
const groupAuditList = _.filter(accountList, { company: groupName });
|
|
|
@@ -330,6 +341,7 @@
|
|
|
// toastr.success(`成功添加 位用户`);
|
|
|
permissionAudits = result;
|
|
|
setList(permissionAudits);
|
|
|
+ syncUserSelectionMarks(permissionAudits);
|
|
|
})
|
|
|
} else {
|
|
|
toastr.warning('暂无用户添加');
|
|
|
@@ -337,6 +349,25 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ function syncUserSelectionMarks(currentPermissionAudits) {
|
|
|
+ let currentAuditorIds = new Set();
|
|
|
+ if (Array.isArray(currentPermissionAudits)) {
|
|
|
+ currentAuditorIds = new Set(currentPermissionAudits.map(pa => pa.uid));
|
|
|
+ }
|
|
|
+ $('.book-list dd[data-id]').each(function() {
|
|
|
+ const userId = parseInt($(this).data('id'));
|
|
|
+ if (isNaN(userId)) return;
|
|
|
+
|
|
|
+ const selectedMark = $(this).find('.selected-mark');
|
|
|
+ if (currentAuditorIds.has(userId)) {
|
|
|
+ selectedMark.show();
|
|
|
+ } else {
|
|
|
+ selectedMark.hide();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
function setList(datas) {
|
|
|
let list = '';
|
|
|
for (const pa of datas) {
|
|
|
@@ -398,7 +429,7 @@
|
|
|
$('#del-permission-audit').modal('hide');
|
|
|
permissionAudits = result;
|
|
|
setList(permissionAudits);
|
|
|
-
|
|
|
+ syncUserSelectionMarks(permissionAudits);
|
|
|
})
|
|
|
});
|
|
|
|