Sfoglia il codice sorgente

系统日志导出,重新生成pdf调整

zhangjie 1 anno fa
parent
commit
efc5169ea1

+ 10 - 0
src/modules/admin/api.js

@@ -117,3 +117,13 @@ export const schoolSetSyncUpdate = (datas) => {
 export const schoolSetDataBackup = (schoolId) => {
   return $postParam("/api/admin/set/backup", { schoolId });
 };
+
+export const systemLogExport = () => {
+  return $postParam(
+    "/api/admin/common/log/download",
+    {},
+    {
+      responseType: "blob",
+    }
+  );
+};

+ 24 - 1
src/modules/admin/views/SchoolManage.vue

@@ -23,6 +23,13 @@
         </el-form-item>
       </el-form>
       <div class="part-box-action">
+        <el-button
+          type="primary"
+          icon="el-icon-download"
+          :loading="downloading"
+          @click="downloadLog"
+          >系统日志下载</el-button
+        >
         <el-button
           type="primary"
           icon="el-icon-refresh"
@@ -102,9 +109,10 @@
 </template>
 
 <script>
-import { schoolList, schoolSync } from "../api";
+import { schoolList, schoolSync, systemLogExport } from "../api";
 import ModifySchool from "../components/ModifySchool.vue";
 import ModifySchoolSet from "../components/ModifySchoolSet.vue";
+import { downloadByApi } from "@/plugins/download";
 
 export default {
   name: "school-manage",
@@ -118,6 +126,7 @@ export default {
       },
       curSchool: {},
       loading: false,
+      downloading: false,
     };
   },
   mounted() {
@@ -139,6 +148,20 @@ export default {
         (item) => item.id === this.filter.schoolId
       );
     },
+    async downloadLog() {
+      if (this.downloading) return;
+      this.downloading = true;
+
+      const res = await downloadByApi(() => {
+        return systemLogExport();
+      }).catch((e) => {
+        this.$message.error(e || "下载失败,请重新尝试!");
+      });
+      this.downloading = false;
+
+      if (!res) return;
+      this.$message.success("下载成功!");
+    },
     async toSyncSchool() {
       if (this.loading) return;
       this.loading = true;

+ 2 - 2
src/modules/print/api.js

@@ -122,8 +122,8 @@ export const getPrintTaskPdf = (examDetailId) => {
 export const downloadPrintTaskPdf = (ids) => {
   return $post("/api/admin/exam/print/task_download_pdf", { ids });
 };
-export const rebuildPrintTaskPdf = (id) => {
-  return $postParam("/api/admin/data/task/reset_create_pdf", { id });
+export const rebuildPrintTaskPdf = (id, type) => {
+  return $postParam("/api/admin/data/task/reset_create_pdf", { id, type });
 };
 export const printTaskTemplateView = (printPlanId) => {
   return $post("/api/admin/exam/print/template_view", { printPlanId });

+ 33 - 15
src/modules/print/views/PrintTaskManage.vue

@@ -327,7 +327,7 @@
               "
               class="btn-primary"
               type="text"
-              @click="toViewPdf(scope.row)"
+              @click="toActionPdf(scope.row, 'view')"
               >查看pdf</el-button
             >
             <el-button
@@ -338,7 +338,7 @@
               "
               class="btn-primary"
               type="text"
-              @click="toRebuildPdf(scope.row)"
+              @click="toActionPdf(scope.row, 'build')"
               >重新生成pdf</el-button
             >
             <el-button
@@ -409,19 +409,27 @@
       :visible.sync="padViewDialogVisible"
       title="请选择PDF类型"
       top="10vh"
-      width="540px"
+      width="600px"
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       append-to-body
     >
-      <el-button
-        v-for="item in pdfList"
-        :key="item.name"
-        type="primary"
-        size="large"
-        @click="viewPdf(item)"
-        >{{ item.type | printPdfTypeFilter }}</el-button
-      >
+      <div class="text-center">
+        <el-button
+          v-if="actionType === 'build'"
+          size="large"
+          @click="actionPdf({ type: undefined })"
+          >全部</el-button
+        >
+        <el-button
+          v-for="item in pdfList"
+          :key="item.name"
+          type="primary"
+          size="large"
+          @click="actionPdf(item)"
+          >{{ item.type | printPdfTypeFilter }}</el-button
+        >
+      </div>
       <div slot="footer"></div>
     </el-dialog>
     <!-- data-task-dialog -->
@@ -483,6 +491,7 @@ export default {
       // view-pdf
       padViewDialogVisible: false,
       pdfList: [],
+      actionType: "view",
       // view-template
       curTask: {},
       // date-picker
@@ -619,7 +628,9 @@ export default {
         })
         .catch(() => {});
     },
-    async toViewPdf(row) {
+    async toActionPdf(row, actionType) {
+      this.curTask = row;
+      this.actionType = actionType;
       this.pdfList = [];
       let result = true;
       const data = await getPrintTaskPdf(row.examDetailId).catch(() => {
@@ -631,13 +642,20 @@ export default {
         return;
       }
       if (data.length === 1) {
-        this.viewPdf(data[0]);
+        this.actionPdf(data[0]);
       } else {
         this.pdfList = data;
         this.padViewDialogVisible = true;
       }
     },
-    async toRebuildPdf(row) {
+    actionPdf(item) {
+      if (this.actionType === "view") {
+        this.viewPdf(item);
+      } else {
+        this.rebuildPdf(item);
+      }
+    },
+    async rebuildPdf(item) {
       const action = await this.$confirm(
         `确定要重新生成该印刷任务PDF吗?`,
         "提示",
@@ -647,7 +665,7 @@ export default {
       ).catch(() => {});
       if (action !== "confirm") return;
 
-      const res = await rebuildPrintTaskPdf(row.taskId);
+      const res = await rebuildPrintTaskPdf(this.curTask.taskId, item.type);
       if (!res) return;
       this.$message.success("操作成功!");
     },