|
@@ -11,31 +11,33 @@
|
|
|
$(document).ready(function () {
|
|
|
let timer = null;
|
|
|
let oldSearchVal = null;
|
|
|
+ const needYB = ['ledger', 'revise', 'change'];
|
|
|
$('body').on('input propertychange', '.gr-search', function(e) {
|
|
|
oldSearchVal = e.target.value;
|
|
|
timer && clearTimeout(timer);
|
|
|
timer = setTimeout(() => {
|
|
|
const newVal = $(this).val();
|
|
|
+ const code = $(this).attr('data-code');
|
|
|
let html = '';
|
|
|
if (newVal && newVal === oldSearchVal) {
|
|
|
- accountList.filter(item => item && cur_uid !== item.id && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
|
|
|
+ accountList.filter(item => item && (item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1)) && (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>
|
|
|
<span class="text-muted">${item.role || ''}</span>
|
|
|
</dd>`
|
|
|
- })
|
|
|
- $('.book-list').empty();
|
|
|
- $('.book-list').append(html);
|
|
|
+ });
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').empty();
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').append(html);
|
|
|
} else {
|
|
|
- if (!$('.acc-btn').length) {
|
|
|
+ if (!$('#' + code + '_dropdownMenu .acc-btn').length) {
|
|
|
accountGroup.forEach((group, idx) => {
|
|
|
if (!group) return;
|
|
|
html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
|
|
|
</a> ${group.groupName}</dt>
|
|
|
- <div class="dd-content" data-toggleid="${idx}">`
|
|
|
+ <div class="dd-content" data-toggleid="${idx}">`;
|
|
|
group.groupList.forEach(item => {
|
|
|
- if (item.id !== cur_uid) {
|
|
|
+ if ((item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1))) {
|
|
|
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>
|
|
@@ -45,8 +47,8 @@ $(document).ready(function () {
|
|
|
});
|
|
|
html += '</div>';
|
|
|
});
|
|
|
- $('.book-list').empty();
|
|
|
- $('.book-list').append(html);
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').empty();
|
|
|
+ $('#' + code + '_dropdownMenu .book-list').append(html);
|
|
|
}
|
|
|
}
|
|
|
}, 400);
|
|
@@ -224,7 +226,7 @@ $(document).ready(function () {
|
|
|
let didivhtml = '';
|
|
|
if(group) {
|
|
|
group.groupList.forEach(item => {
|
|
|
- didivhtml += item.id !== cur_uid ? '<dd class="border-bottom p-2 mb-0 " data-id="' + item.id + '" >\n' +
|
|
|
+ didivhtml += (item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1)) ? '<dd class="border-bottom p-2 mb-0 " data-id="' + item.id + '" >\n' +
|
|
|
'<p class="mb-0 d-flex"><span class="text-primary">' + item.name + '</span><span\n' +
|
|
|
' class="ml-auto">' + item.mobile + '</span></p>\n' +
|
|
|
' <span class="text-muted">' + item.role + '</span>\n' +
|
|
@@ -243,9 +245,9 @@ $(document).ready(function () {
|
|
|
' <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="' + code + '_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n' +
|
|
|
' 选择审批人\n' +
|
|
|
' </button>\n' +
|
|
|
- ' <div class="dropdown-menu dropdown-menu-right" aria-labelledby="' + code + '_dropdownMenuButton" style="width:220px">\n' +
|
|
|
+ ' <div class="dropdown-menu dropdown-menu-right" id="' + code + '_dropdownMenu" aria-labelledby="' + code + '_dropdownMenuButton" style="width:220px">\n' +
|
|
|
' <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"\n' +
|
|
|
- ' placeholder="姓名/手机 检索" autocomplete="off"></div>\n' +
|
|
|
+ ' placeholder="姓名/手机 检索" autocomplete="off" data-code="' + code + '"></div>\n' +
|
|
|
' <dl class="list-unstyled book-list">\n' + divhtml +
|
|
|
' </dl>\n' +
|
|
|
' </div>\n' +
|