Kaynağa Gözat

fix: 更新导航类型处理逻辑,优化用户选择标记更新

caipin 1 ay önce
ebeveyn
işleme
87c26fd89a
1 değiştirilmiş dosya ile 18 ekleme ve 6 silme
  1. 18 6
      app/public/js/setting_manage.js

+ 18 - 6
app/public/js/setting_manage.js

@@ -263,10 +263,11 @@ $(document).ready(() => {
             else if (href === '#tzpro') currentNavType = 'schedule';
             else if (href === '#htgl') currentNavType = 'contract';
             else if (href === '#sgrz') currentNavType = 'construction';
-            else if (href === '#zlgl') currentNavType = 'quality';
-            else if (href === '#zlxj') currentNavType = 'inspection';
+            else if (href === '#quality') currentNavType = 'quality';
+            else if (href === '#safe') currentNavType = 'inspection';
+            console.log('currentNavType', currentNavType);
             if(currentNavType) {
-                setTimeout(() => updateSelectedMarks(currentNavType), 0);
+                setTimeout(() => updateSelectedMarks(), 0);
             }
         }
         
@@ -423,6 +424,7 @@ $(document).ready(() => {
         }
         const id = parseInt($('#remove_user_id').val());
         const showId = parseInt($('#show_id').val());
+        console.log(type);
         if (type === 'contract') {
             postData('/sp/' + spid + '/contract/tender/' + cur_tenderid + '/audit/save', { type: 'del-audit', id }, function (data) {
                 $('#'+ type + '-users').find('tr[data-uid="'+ id +'"]').remove();
@@ -585,6 +587,7 @@ $(document).ready(() => {
                 return item.id === id;
             });
             const type = $('#add_user_dropdownMenuButton').attr('data-type');
+            console.log('type', type);
             if (type === 'tourist') {
                 const saIdList = [];
                 for (let i = 0; i < $('#tourist-users tr').length; i++) {
@@ -684,6 +687,7 @@ $(document).ready(() => {
                 };
                 postData('/sp/' + spid + '/contract/tender/' + cur_tenderid + '/audit/save', prop, function (datas) {
                     setContractHtml(datas);
+                    updateSelectedMarks();
                 });
             } else if (type === 'construction') {
                 const user = _.find(accountList, function (item) {
@@ -1092,8 +1096,8 @@ function updateSelectedMarks(forcedType = null) {
             case 'tzpro': currentType = 'schedule'; break;
             case 'htgl': currentType = 'contract'; break;
             case 'sgrz': currentType = 'construction'; break;
-            case 'zlgl': currentType = 'quality'; break;
-            case 'zlxj': currentType = 'inspection'; break;
+            case 'quality': currentType = 'quality'; break;
+            case 'safe': currentType = 'inspection'; break;
             default: currentType = null;
         }
     }
@@ -1343,8 +1347,16 @@ function setTenderPermissionsHtml(auditList, key, keys) {
     const html = [];
     for (const m of auditList) {
         html.push(getUserPermissionsHtml(m, key, keys));
+        if (Array.isArray(auditList)) {
+            auditList.forEach(function(sa) {
+                if (sa.uid !== undefined && sa.uid !== null) {
+                    selectedUserIdsByType[key].push(parseInt(sa.uid, 10)); 
+                }
+            });
+        }
     }
     $('#' + key + '-users').html(html.join(''));
+    updateSelectedMarks();
 }
 
 const getUserPermissionsHtml = function(user, key, keys) {
@@ -1359,7 +1371,7 @@ const getUserPermissionsHtml = function(user, key, keys) {
             html.push(`<td class="text-center"><input type="checkbox" data-key="${block.key}" data-block="${p.key}" data-value="${p.value}" ${checked}></td>`);
         }
     }
-    html.push(`<td class="text-center"><a href="#remove-user1" data-id="${user.uid}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-${key}-user">移除</a></td>`);
+    html.push(`<td class="text-center"><a href="#remove-user1" data-id="${user.uid}" data-show-id="${user.uid}" data-toggle="modal" data-target="#remove-user" class="btn btn-sm btn-outline-danger remove-${key}-user">移除</a></td>`);
     html.push('</tr>');
     return html.join('');
 };