Browse Source

fix:修改前端分发bug

GTong 7 months ago
parent
commit
a45446b41d

BIN
lic_go


+ 2 - 1
static/license_info/license_info.js

@@ -614,7 +614,8 @@ async function fetchPermissionsByRole(role) {
 
  
 
-         if (!hasReadLicensePermission || !hasReadLicenseAllPermission) {
+         if (!hasReadLicensePermission && !hasReadLicenseAllPermission) {
+           
             if (hasReadRolePermission) {
                 document.getElementById('role-management-link').click();
             }else if (hasReadUserPermission){

+ 8 - 3
static/license_info/license_info_distribution.js

@@ -347,8 +347,12 @@ function distributeEmails(item, emails, usersInfo) {
     })
     .then(response => {
         if (!response.ok) {
-            hideLoadingModal();
-            throw new Error('Network response was not ok');
+       
+            // 如果 response 不成功,返回错误信息供 catch 处理
+            return response.json().then(errData => {
+                console.log("检查一致性不通过 : ",errData)
+                throw new Error(errData.error || 'Network response was not ok');
+            });
         }
         return response.json();
     })
@@ -362,7 +366,8 @@ function distributeEmails(item, emails, usersInfo) {
         // 处理错误
         hideLoadingModal();
         console.error('分发邮件失败:', error);
-        alert('分发邮件失败:', error);
+        alert('分发邮件失败: ' + error.message);
+        location.reload();
     });
 }
 

+ 3 - 3
static/license_info/license_info_modal.js

@@ -293,7 +293,7 @@ function downloadAllLicenses(sortedApplicationArray) {
 
     // 初始化计数器,从1开始
     let idCounter = 1;
-    let Project = sortedApplicationArray[0].Project;
+    let Project = sortedApplicationArray[0].GlxmName;
     console.log("Project", Project);
 
     // 遍历 sortedApplicationArray,下载 lic1 和 lic2 数据
@@ -305,11 +305,11 @@ function downloadAllLicenses(sortedApplicationArray) {
 
             // 使用递增的 idCounter 替换 row.oa_id
             if (row.lic1) {
-                const filename1 = `${idCounter}_license.dat_1_${mainMac}`;
+                const filename1 = `${idCounter}_license_1_${mainMac}.dat`;
                 zip.file(filename1, row.lic1);
             }
             if (row.lic2) {
-                const filename2 = `${idCounter}_license.dat_2_${secondMac}`;
+                const filename2 = `${idCounter}_license_2_${secondMac}.dat`;
                 zip.file(filename2, row.lic2);
             }