Browse Source

printing fix.

deason 6 years ago
parent
commit
8238e0b21b

+ 64 - 48
src/modules/print/view/CourseStatistic.vue

@@ -617,6 +617,11 @@ export default {
       this.courseList = [];
       let url = CORE_API + "/course/query?enable=true";
 
+      let orgId = this.formSearch.orgId;
+      if (!checkEmptyNumber(orgId)) {
+        url += "&rootOrgId=" + orgId;
+      }
+
       if (!checkEmptyStr(query)) {
         url += "&name=" + query;
       }
@@ -626,56 +631,67 @@ export default {
       });
     },
     refreshStatistic() {
-      /* 刷新当前统计信息 */
-      this.$confirm("刷新当前统计信息?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          if (this.selectElements.length == 0) {
-            this.$notify({
-              title: "提示",
-              message: "请选择要刷新的项!",
-              type: "warning"
-            });
-            return;
-          }
-
-          let params = {};
-          params.orgId = this.selectElements[0].orgId;
-          params.examId = this.selectElements[0].examId;
-          params.couses = [];
-          this.selectElements.forEach(element => {
-            params.couses.push({
-              courseId: element.courseId,
-              paperType: element.paperType
-            });
+      let checkUrl = PRINT_API + "/course/statistic/refresh/check";
+      this.$http.get(checkUrl).then(response => {
+        if (response.data.data) {
+          this.$notify({
+            title: "提示",
+            message: "尚有课程统计任务正在刷新中,请稍后再刷新!",
+            type: "warning"
           });
-
-          let url = PRINT_API + "/course/statistic/refresh";
-          this.$http.post(url, params).then(
-            () => {
-              this.$notify({
-                title: "提示",
-                type: "success",
-                message: "刷新成功!"
-              });
-              this.searchRecords(this.formSearch.pageNo);
-            },
-            error => {
-              console.log(error.response);
-              this.$notify({
-                title: "错误",
-                type: "error",
-                message: error.response.data.desc
+        } else {
+          /* 刷新当前统计信息 */
+          this.$confirm("刷新当前统计信息?", "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+            .then(() => {
+              if (this.selectElements.length == 0) {
+                this.$notify({
+                  title: "提示",
+                  message: "请选择要刷新的项!",
+                  type: "warning"
+                });
+                return;
+              }
+
+              let params = {};
+              params.orgId = this.selectElements[0].orgId;
+              params.examId = this.selectElements[0].examId;
+              params.couses = [];
+              this.selectElements.forEach(element => {
+                params.couses.push({
+                  courseId: element.courseId,
+                  paperType: element.paperType
+                });
               });
-            }
-          );
-        })
-        .catch(() => {
-          //ignore
-        });
+
+              let url = PRINT_API + "/course/statistic/refresh";
+              this.$http.post(url, params).then(
+                () => {
+                  this.$notify({
+                    title: "提示",
+                    type: "success",
+                    message: "刷新成功!"
+                  });
+                  this.searchRecords(this.formSearch.pageNo);
+                },
+                error => {
+                  console.log(error.response);
+                  this.$notify({
+                    title: "错误",
+                    type: "error",
+                    message: error.response.data.desc
+                  });
+                }
+              );
+            })
+            .catch(() => {
+              //ignore
+            });
+        }
+      });
     },
     preview(row) {
       /* 预览试卷PDF */

+ 4 - 2
src/modules/print/view/Project.vue

@@ -645,7 +645,8 @@ export default {
       /* 查询项目经理列表 */
       this.pmList = [];
       let url =
-        CORE_API + "/user/query?rootOrgCode=qmth&roleCode=PRINT_PROJECT_LEADER";
+        CORE_API +
+        "/user/query?enable=true&rootOrgCode=qmth&roleCode=PRINT_PROJECT_LEADER";
 
       if (!checkEmptyStr(query)) {
         url += "&name=" + query;
@@ -659,7 +660,8 @@ export default {
       /* 查询印刷供应商列表 */
       this.supplierList = [];
       let url =
-        CORE_API + "/user/query?rootOrgCode=qmth-print&roleCode=PRINT_SUPPLIER";
+        CORE_API +
+        "/user/query?enable=true&rootOrgCode=qmth-print&roleCode=PRINT_SUPPLIER";
 
       if (!checkEmptyStr(query)) {
         url += "&name=" + query;

+ 64 - 53
src/modules/print/view/ProjectStatistic.vue

@@ -603,61 +603,72 @@ export default {
       });
     },
     refreshStatistic() {
-      /* 刷新当前统计信息 */
-      let orgId = this.formSearch.orgId;
-      if (checkEmptyNumber(orgId)) {
-        this.$notify({
-          title: "提示",
-          message: "请选择学校!",
-          type: "warning"
-        });
-        return;
-      }
+      let checkUrl = PRINT_API + "/printing/project/statistic/refresh/check";
+      this.$http.get(checkUrl).then(response => {
+        if (response.data.data) {
+          this.$notify({
+            title: "提示",
+            message: "尚有项目统计任务正在刷新中,请稍后再刷新!",
+            type: "warning"
+          });
+        } else {
+          /* 刷新当前统计信息 */
+          let orgId = this.formSearch.orgId;
+          if (checkEmptyNumber(orgId)) {
+            this.$notify({
+              title: "提示",
+              message: "请选择学校!",
+              type: "warning"
+            });
+            return;
+          }
 
-      let examId = this.formSearch.examId;
-      if (checkEmptyNumber(examId)) {
-        this.$notify({
-          title: "提示",
-          message: "请选择考试!",
-          type: "warning"
-        });
-        return;
-      }
+          let examId = this.formSearch.examId;
+          if (checkEmptyNumber(examId)) {
+            this.$notify({
+              title: "提示",
+              message: "请选择考试!",
+              type: "warning"
+            });
+            return;
+          }
 
-      this.$confirm("刷新当前统计信息?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-        .then(() => {
-          let url =
-            PRINT_API +
-            "/printing/project/statistic/refresh/" +
-            orgId +
-            "/" +
-            examId;
-          this.$http.post(url).then(
-            () => {
-              this.$notify({
-                title: "提示",
-                message: "刷新成功!",
-                type: "success"
-              });
-              this.searchRecords();
-            },
-            error => {
-              console.log(error.response);
-              this.$notify({
-                title: "错误",
-                type: "error",
-                message: error.response.data.desc
-              });
-            }
-          );
-        })
-        .catch(() => {
-          // ignore
-        });
+          this.$confirm("刷新当前统计信息?", "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+            .then(() => {
+              let url =
+                PRINT_API +
+                "/printing/project/statistic/refresh/" +
+                orgId +
+                "/" +
+                examId;
+              this.$http.post(url).then(
+                () => {
+                  this.$notify({
+                    title: "提示",
+                    message: "刷新成功!",
+                    type: "success"
+                  });
+                  this.searchRecords();
+                },
+                error => {
+                  console.log(error.response);
+                  this.$notify({
+                    title: "错误",
+                    type: "error",
+                    message: error.response.data.desc
+                  });
+                }
+              );
+            })
+            .catch(() => {
+              // ignore
+            });
+        }
+      });
     },
     editBackupSetting() {
       /* 保存备份设置 */