Tang 3 年之前
父節點
當前提交
6c39ef99c5
共有 2 個文件被更改,包括 46 次插入25 次删除
  1. 23 13
      src/views/education/dataReview/dataConfig/index.vue
  2. 23 12
      src/views/education/dataReview/stamp/index.vue

+ 23 - 13
src/views/education/dataReview/dataConfig/index.vue

@@ -567,19 +567,13 @@ export default {
       this.$modal.loading("正在导出数据,请稍后...");
       this.$api
         .inquirebaseprofileExport(data)
-        .then((res) => {
-          if (res.code === 200) {
-            let url = baseUrls.baseURL + "common/download?fileName=" + res.msg;
-            let link = document.createElement("a");
-            let fileName = "导出数据" + ".xlsx";
-            document.body.appendChild(link);
-            link.dowmload = fileName;
-            link.href = url;
-            console.log(link);
-            link.click();
-            link.remove();
-            this.$message.success("批量导出成功");
-            this.dialogDR = false;
+        .then(async (res) => {
+          for (let k in res.data) {
+            if (res.data[k].code === 200) {
+              await this.dowmFunc(res, k);
+            } else {
+              this.$message.error("code值错误:", res.data[k].code);
+            }
           }
         })
         .catch((err) => {
@@ -594,6 +588,22 @@ export default {
           this.$modal.closeLoading();
         });
     },
+    dowmFunc(res, k) {
+      return new Promise((resolve, reject) => {
+        let url =
+          baseUrls.baseURL + "common/download?fileName=" + res.data[k].msg;
+        let link = document.createElement("a");
+        let fileName = "导入模板" + ".xlsx";
+        document.body.appendChild(link);
+        link.href = url;
+        link.dowmload = fileName;
+        link.click();
+        link.remove();
+        setTimeout(() => {
+          resolve();
+        }, 200);
+      });
+    },
     moreActive() {
       let data = {
         changeStatus: this.formData.changeStatus || "",

+ 23 - 12
src/views/education/dataReview/stamp/index.vue

@@ -475,18 +475,13 @@ export default {
       this.$modal.loading("正在导出数据,请稍后...");
       this.$api
         .inquirebaseprofileStampexport(data)
-        .then((res) => {
-          if (res.code === 200) {
-            let url = baseUrls.baseURL + "common/download?fileName=" + res.msg;
-            let link = document.createElement("a");
-            let fileName = "导出数据" + ".xlsx";
-            document.body.appendChild(link);
-            link.href = url;
-            link.dowmload = fileName;
-            link.click();
-            link.remove();
-            this.$message.success("批量导出成功");
-            this.dialogDR = false;
+        .then(async (res) => {
+          for (let k in res.data) {
+            if (res.data[k].code === 200) {
+              await this.dowmFunc(res, k);
+            } else {
+              this.$message.error("code值错误:", res.data[k].code);
+            }
           }
         })
         .catch((err) => {
@@ -501,6 +496,22 @@ export default {
           this.$modal.closeLoading();
         });
     },
+    dowmFunc(res, k) {
+      return new Promise((resolve, reject) => {
+        let url =
+          baseUrls.baseURL + "common/download?fileName=" + res.data[k].msg;
+        let link = document.createElement("a");
+        let fileName = "导入模板" + ".xlsx";
+        document.body.appendChild(link);
+        link.href = url;
+        link.dowmload = fileName;
+        link.click();
+        link.remove();
+        setTimeout(() => {
+          resolve();
+        }, 200);
+      });
+    },
     moreActive() {
       let data = {
         changeStatus: this.formData.changeStatus || "",