|
|
@@ -257,12 +257,9 @@
|
|
|
syncSelectedMarks();
|
|
|
}
|
|
|
|
|
|
- // --- 新增:同步下拉菜单选中状态的函数 ---
|
|
|
function syncSelectedMarks() {
|
|
|
- // 1. 获取表格中所有用户的 UID
|
|
|
- const tableUids = new Set(); // 使用 Set 提高查找效率
|
|
|
+ const tableUids = new Set();
|
|
|
$('#contract-audit-list tr').each(function() {
|
|
|
- // 假设每个权限复选框的 value 都是用户的 uid
|
|
|
const $firstCheckbox = $(this).find('.permission-checkbox').first();
|
|
|
if ($firstCheckbox.length) {
|
|
|
const uid = parseInt($firstCheckbox.val(), 10);
|
|
|
@@ -271,24 +268,19 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- // 2. 遍历下拉菜单中的所有用户项 (dd),并根据 UID 状态更新 .selected-mark
|
|
|
$('.dropdown-menu .book-list dd[data-id]').each(function() {
|
|
|
- const userId = parseInt($(this).data('id'), 10); // 获取 dd 的 data-id
|
|
|
- const $mark = $(this).find('.selected-mark'); // 找到对应的标记 span
|
|
|
+ const userId = parseInt($(this).data('id'), 10);
|
|
|
+ const $mark = $(this).find('.selected-mark');
|
|
|
|
|
|
if (!isNaN(userId) && $mark.length > 0) {
|
|
|
if (tableUids.has(userId)) {
|
|
|
- // 如果用户已在表格中,则显示勾选标记
|
|
|
$mark.show();
|
|
|
} else {
|
|
|
- // 如果用户不在表格中,则隐藏勾选标记
|
|
|
$mark.hide();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- // --- 新增结束 ---
|
|
|
|
|
|
|
|
|
$('body').on('click', '.del-contract-audit-a', function () {
|