Browse Source

fix:把代码放到上传判断之后

ly 11 months ago
parent
commit
62265d5eb8
1 changed files with 22 additions and 22 deletions
  1. 22 22
      src/views/business/upgrade/order/importExcelDialog.vue

+ 22 - 22
src/views/business/upgrade/order/importExcelDialog.vue

@@ -251,7 +251,7 @@ function cancel() {
 }
 
 function submitForm() {
-  fullLoading.value = true;
+
   submitFileForm();
 }
 
@@ -268,8 +268,17 @@ const importTemplate = () => {
 function handleBeforeUpload(file) {
   const formData = new FormData();
   formData.append("file", file);
+  if (
+    file.type !==
+      "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
+    file.type !== "application/vnd.ms-excel"
+  ) {
+    proxy.$modal.msgError("请选择excel文件");
+    return false;
+  }
+  fullLoading.value = true;
   if(checksuccess.value === 0){
-      checkInput(formData).then(res =>{
+    checkInput(formData).then(res =>{
       fullLoading.value = false;
       inputData.value = res.data;
       if(res.data != null && res.msg !== "错误数据"){
@@ -278,25 +287,17 @@ function handleBeforeUpload(file) {
         return Promise.reject(res.data);
       }
     }).then(()=>{
-        workOrderDialog.value.open()
-      }).catch((res)=>{
-        fullLoading.value = false;
-        proxy.$alert(
-            "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-            res +
-            "</div>",
-            "导入结果",
-            { dangerouslyUseHTMLString: true }
-        );
-      })
-    return false;
-  }
-  if (
-    file.type !==
-      "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
-    file.type !== "application/vnd.ms-excel"
-  ) {
-    proxy.$modal.msgError("请选择excel文件");
+      workOrderDialog.value.open()
+    }).catch((res)=>{
+      fullLoading.value = false;
+      proxy.$alert(
+          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+          res +
+          "</div>",
+          "导入结果",
+          { dangerouslyUseHTMLString: true }
+      );
+    })
     return false;
   }
   return true;
@@ -342,7 +343,6 @@ const handleFileSuccess = (response, file, fileList) => {
 };
 /** 提交上传文件 */
 function submitFileForm() {
-
   proxy.$refs["uploadRef"].submit();
 }