소스 검색

add:智慧考场

Tang 3 년 전
부모
커밋
c1fa7a1cca
2개의 변경된 파일31개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 2
      src/utils/request.js
  2. 29 4
      src/views/education/examManagement/examArrangement/applicableProducts/downMaterial.vue

+ 2 - 2
src/utils/request.js

@@ -7,8 +7,8 @@ import methods from '@/utils/methodsTool';
 
 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 // 创建axios实例
-export const baseURL = process.env.VUE_APP_BASE_API
-// export const baseURL = 'http://192.168.1.24:5030/'
+// export const baseURL = process.env.VUE_APP_BASE_API
+export const baseURL = 'http://192.168.1.24:5030/'
 export const BASE_IMG_URL = process.env.VUE_APP_IMG_API
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分

+ 29 - 4
src/views/education/examManagement/examArrangement/applicableProducts/downMaterial.vue

@@ -143,8 +143,30 @@ export default {
     userDowm() {
       var data = JSON.parse(JSON.stringify(this.listData));
       delete data.index;
-      this.$api.inquiresystemsubscribelistUserExport(data).then((res) => {
-        let url = baseUrls.baseURL + "common/download?fileName=" + res.msg;
+      this.$api
+        .inquiresystemsubscribelistUserExport(data)
+        .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) => {
+          let { message } = err;
+          if (message.includes("timeout")) {
+            this.$message.error(
+              "数据体量过大,无法正常导出,请调整导出的日期范围,缩小数据体量"
+            );
+          }
+        });
+    },
+    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);
@@ -152,6 +174,9 @@ export default {
         link.dowmload = fileName;
         link.click();
         link.remove();
+        setTimeout(() => {
+          resolve();
+        }, 200);
       });
     },
     //学员签到表
@@ -170,14 +195,14 @@ export default {
       });
     },
     openBox(row) {
-      this.listData= {
+      this.listData = {
         applyId: row.applyId,
         siteId: "",
         applySiteExamTime: "",
         applySiteStartTime: "",
         applySiteEndTime: "",
         index: "",
-      }
+      };
       this.getAddress();
       this.dialogVisible = true;
     },