Explorar o código

修改作战单元导出bug

xyh hai 1 ano
pai
achega
8690ccb61a
Modificáronse 1 ficheiros con 31 adicións e 25 borrados
  1. 31 25
      src/views/onlineForm/formRender/onlineFormMixins.js

+ 31 - 25
src/views/onlineForm/formRender/onlineFormMixins.js

@@ -810,6 +810,7 @@ const OnlineFormMixins = {
             }
 
             fileInfoStr = row.components_json;
+            console.log('fileInfoStr :>> ', fileInfoStr);
             let fileInfoArr1 = JSON.parse(fileInfoStr);
             let fileInfo1 = fileInfoArr1[0]; // 假设只有一个文件
             await axios.get('http://localhost:8084/admin/online/onlineOperation/downloadDatasource/mainUnit', {
@@ -832,27 +833,31 @@ const OnlineFormMixins = {
                 console.error(error);
               });
             fileInfoStr = row.toll_json;
-            let fileInfoArr2 = JSON.parse(fileInfoStr);
+            
+            if (fileInfoStr != undefined && fileInfoStr!=null){
+              let fileInfoArr2 = JSON.parse(fileInfoStr);
             let fileInfo2 = fileInfoArr2[0]; // 假设只有一个文件
-            await axios.get('http://localhost:8084/admin/online/onlineOperation/downloadDatasource/mainUnit', {
-              params: {
-                datasourceId: '1657931215497334784',
-                fieldName: 'toll_json',
-                asImage: false,
-                dataId: row.id,
-                filename: fileInfo2.filename,
-                Authorization: getToken(),
-                MenuId: '1657932967709773824'
-              }
-            })
-              .then(response => {
-                // 处理成功的响应
-                this.toll_json.push(response.data);
+              await axios.get('http://localhost:8084/admin/online/onlineOperation/downloadDatasource/mainUnit', {
+                params: {
+                  datasourceId: '1657931215497334784',
+                  fieldName: 'toll_json',
+                  asImage: false,
+                  dataId: row.id,
+                  filename: fileInfo2.filename,
+                  Authorization: getToken(),
+                  MenuId: '1657932967709773824'
+                }
               })
-              .catch(error => {
-                // 处理错误
-                console.error(error);
-              });
+                .then(response => {
+                  // 处理成功的响应
+                  this.toll_json.push(response.data);
+                })
+                .catch(error => {
+                  // 处理错误
+                  console.error(error);
+                });
+            }
+           console.log(' 开始data');
             const data = {
               id: row.id,
               name: row.name,
@@ -876,6 +881,7 @@ const OnlineFormMixins = {
               components_ids: row.components_ids,
               components_json: this.components_json
             };
+
             const jsonData = JSON.stringify(data);
             const blob = new Blob([jsonData], { type: 'application/json' });
             const url = URL.createObjectURL(blob);
@@ -1300,12 +1306,12 @@ const OnlineFormMixins = {
           }
         }
 
-        httpCall.then(res => {
-          this.formData = {
-            ...this.formData,
-            ...res.data
-          }
-        })
+        // httpCall.then(res => {
+        //   this.formData = {
+        //     ...this.formData,
+        //     ...res.data
+        //   }
+        // })
       }
     },