|
@@ -2,18 +2,32 @@ $(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
// 选择账号
|
|
|
const refreshUnitUsersHtml = function () {
|
|
|
+ const keyword = $('#sb-keyword').val();
|
|
|
const select = $('#sel-batch-unit').val();
|
|
|
const selectGroup = accountGroup.find(x => { return x.name === select; });
|
|
|
const html = [];
|
|
|
if (selectGroup) {
|
|
|
- for (const u of selectGroup.groupList) {
|
|
|
+ const filter = keyword ? selectGroup.groupList.filter(x => {
|
|
|
+ return x.role.indexOf(keyword) >= 0 || x.name.indexOf(keyword) >= 0;
|
|
|
+ }) : selectGroup.groupList;
|
|
|
+ for (const u of filter) {
|
|
|
html.push(`<tr class="text-center">`);
|
|
|
html.push(`<td><input type="checkbox" name="sel-batch-check" id="${u.id}" unit="${selectGroup.name}" ${(u.select ? 'checked' : '')} ${u.sp_exist ? 'disabled' : ''}></td>`);
|
|
|
html.push(`<td>${u.name}</td>`);
|
|
|
html.push(`<td>${u.role}</td>`);
|
|
|
+ html.push(`<td>${u.company}</td>`);
|
|
|
html.push('<tr>');
|
|
|
}
|
|
|
}
|
|
|
+ const noCompanyAccount = accountList.filter(x => { return !x.company; });
|
|
|
+ for (const u of noCompanyAccount) {
|
|
|
+ html.push(`<tr class="text-center table-secondary">`);
|
|
|
+ html.push(`<td><input type="checkbox" name="sel-batch-check" id="${u.id}" unit="${selectGroup.name}" ${(u.select ? 'checked' : '')} disabled></td>`);
|
|
|
+ html.push(`<td>${u.name}</td>`);
|
|
|
+ html.push(`<td>${u.role}</td>`);
|
|
|
+ html.push(`<td>${u.company}</td>`);
|
|
|
+ html.push('<tr>');
|
|
|
+ }
|
|
|
$('#sel-batch-users').html(html.join(''));
|
|
|
};
|
|
|
$('#sel-batch').on('show.bs.modal', function() {
|
|
@@ -25,6 +39,12 @@ $(document).ready(() => {
|
|
|
$('#sel-batch-unit').change(function() {
|
|
|
refreshUnitUsersHtml();
|
|
|
});
|
|
|
+ $('#sb-search').click(function() {
|
|
|
+ refreshUnitUsersHtml();
|
|
|
+ });
|
|
|
+ $('#sb-keyword').change(function() {
|
|
|
+ refreshUnitUsersHtml();
|
|
|
+ });
|
|
|
$('body').on('click', '[name=sel-batch-check]', function() {
|
|
|
const select = $('#sel-batch-unit').val();
|
|
|
const selectGroup = accountGroup.find(x => { return x.name === select; });
|