From 4488f711dbc01a8db6753907cae2ef4021dede68 Mon Sep 17 00:00:00 2001
From: FUYU <fuyu@prec-tech.com>
Date: 星期三, 13 十二月 2023 16:30:27 +0800
Subject: [PATCH] 修改前备份

---
 force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js b/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
index c3c47b7..dddc5bf 100644
--- a/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
+++ b/force-app/main/default/aura/DealerPersonnelInformationImport/DealerPersonnelInformationImportHelper.js
@@ -89,6 +89,9 @@
         reader.onloadend = function () {};
         reader.readAsDataURL(file);
     },
+    isNumber: function (str) {
+        return /^\d+$/.test(str);
+    },
     saveRecords: function (component, event, helper) {
         component.set('v.login', true);
         var action = component.get('c.processData');
@@ -113,6 +116,13 @@
                         res1 += ress[i].substr(7) + '\n';
                         if (ress[i] != '') {
                             let errorData = {};
+                            if (
+                                !this.isNumber(
+                                    ress[i].substr(7).substring(1, 2)
+                                )
+                            ) {
+                                continue;
+                            }
                             let index = errorDataRow.indexOf(
                                 ress[i].substr(7).substring(1, 2)
                             );
@@ -123,11 +133,11 @@
                                 errorDataRow.push(errorData.errorRow);
                                 errorData.errorInfo = ress[i]
                                     .substr(7)
-                                    .substring(6);
+                                    .substring(5);
                                 errorDatas.push(errorData);
                             } else {
                                 errorDatas[index].errorInfo +=
-                                    '; ' + ress[i].substr(7).substring(6);
+                                    '; ' + ress[i].substr(7).substring(5);
                             }
                         }
                     }
@@ -140,7 +150,7 @@
                             fieldName: 'errorRow',
                             type: 'text',
                             hideDefaultActions: true,
-                            initialWidth: 50
+                            initialWidth: 100
                         },
                         {
                             label: '閿欒淇℃伅',
@@ -161,16 +171,19 @@
                             fieldName: 'field' + i,
                             type: 'text',
                             hideDefaultActions: true,
-                            wrapText: true
+                            wrapText: true,
+                            initialWidth: 120
                         });
                     }
 
                     for (var i = 0; i < errorDatas.length; i++) {
                         let data = fileContentData[errorDatas[i].errorRow];
                         console.log('data = ' + JSON.stringify(data));
-                        for (var j = 0; j < data.split(',').length; j++) {
-                            let label = 'field' + j;
-                            errorDatas[i][label] = data.split(',')[j];
+                        if (data) {
+                            for (var j = 0; j < data.split(',').length; j++) {
+                                let label = 'field' + j;
+                                errorDatas[i][label] = data.split(',')[j];
+                            }
                         }
                     }
                     console.log('errorDatas = ' + JSON.stringify(errorDatas));
@@ -184,12 +197,14 @@
                     component.set('v.errorMessage', res1 + '璇蜂慨鏀瑰悗閲嶆柊涓婁紶');
                     this.showErrorToast(component);
                     component.set('v.login', false);
+                    component.find('save_con').set('v.disabled', true);
                 } else {
                     // this.success('瀵煎叆鎴愬姛');
                     component.set('v.successMessage', '瀵煎叆鎴愬姛');
                     this.showSuccessToast01(component);
                     component.set('v.showMain', true);
                     component.set('v.login', false);
+                    component.find('save_con').set('v.disabled', false);
                 }
             } else if (state === 'INCOMPLETE') {
                 component.set('v.login', false);
@@ -251,7 +266,7 @@
             $A.getCallback(function () {
                 $A.util.addClass(component.find('errorDiv'), 'slds-hide');
             }),
-            4000
+            7000
         );
     },
     success: function (message) {
@@ -343,9 +358,10 @@
     downloadCSV: function (component, csv) {
         var link = document.createElement('a');
         // 璁剧疆瀛楃闆嗗拰鏂囦欢澶�
-        let bom = '\uFEFF';
+        var bom = '\uFEFF';
         link.href =
             'data:text/csv;charset=utf-8,' + encodeURIComponent(bom + csv);
+        //link.href = URL.createObjectURL(csvFile);
         link.download = 'data.csv';
         document.body.appendChild(link);
         link.click();

--
Gitblit v1.9.1