Parcourir la source

账号管理,搜索,可搜索非本单位账号

MaiXinRong il y a 1 mois
Parent
commit
b297b7d230
1 fichiers modifiés avec 16 ajouts et 1 suppressions
  1. 16 1
      app/public/js/sp_setting_permission.js

+ 16 - 1
app/public/js/sp_setting_permission.js

@@ -3,9 +3,9 @@ $(document).ready(() => {
     // 选择账号
     const refreshUnitUsersHtml = function () {
         const keyword = $('#sb-keyword').val();
+        const html = [];
         const select = $('#sel-batch-unit').val();
         const selectGroup = accountGroup.find(x => { return x.name === select; });
-        const html = [];
         if (selectGroup) {
             const filter = keyword ? selectGroup.groupList.filter(x => {
                 return x.role.indexOf(keyword) >= 0 || x.name.indexOf(keyword) >= 0;
@@ -33,6 +33,21 @@ $(document).ready(() => {
             html.push(`<td>${u.company}</td>`);
             html.push('<tr>');
         }
+        const otherCompanyAccount = accountList.filter(x => {
+            if (!keyword) return false;
+            if (!x.company || x.company === selectGroup.name) return false;
+            const unit = accountGroup.find(y => { return y.name === x.company; });
+            if (!unit) return false;
+            return x.role.indexOf(keyword) >= 0 || x.name.indexOf(keyword) >= 0;
+        });
+        for (const u of otherCompanyAccount) {
+            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() {