From 71891f73bdab2d994fe6d8f4ed4078e9972a28d9 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 27 Oct 2021 17:09:41 +0800
Subject: [PATCH] 导出数据

---
 src/views/qualificationExamination/scoreInquiry.vue |   71 ++++++++++++++++++++++++++++++++++-
 1 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/src/views/qualificationExamination/scoreInquiry.vue b/src/views/qualificationExamination/scoreInquiry.vue
index 6affe39..04216f4 100644
--- a/src/views/qualificationExamination/scoreInquiry.vue
+++ b/src/views/qualificationExamination/scoreInquiry.vue
@@ -18,6 +18,7 @@
       @row-update="rowUpdates"
       @row-save="rowSave"
       @row-del="rowDel"
+      :search.sync="query"
       @search-change="searchChange"
       @search-reset="searchReset"
       @selection-change="selectionChange"
@@ -26,6 +27,17 @@
       @refresh-change="refreshChange"
       @on-load="onLoad"
     >
+      <!-- 自定义按钮 -->
+      <template slot="menuLeft">
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          @click="handleExport"
+          >导出
+        </el-button>
+      </template>
     </avue-crud>
   </basic-container>
 </template>
@@ -42,7 +54,7 @@
 import { datasing } from "./dataqualificationExamination";
 // import { getList } from "@/api/qualificationExamination/qualificationExamination";
 import { getLisperexamScore } from "@/api/qualificationExamination/scoreInquiry";
-
+import Qs from "qs";
 export default {
   data() {
     return {
@@ -208,6 +220,10 @@
             // slot: true,
             // display: false,
           },
+          {
+            label: "是否发证",
+            prop: "isFazheng",
+          },
         ],
       },
       data: [
@@ -223,7 +239,7 @@
     };
   },
   computed: {
-    ...mapGetters(["permission"]),
+    ...mapGetters(["permission", "userInfo"]),
     permissionList() {
       return {
         addBtn: this.vaildData(this.permission.post_add, false),
@@ -241,6 +257,52 @@
     },
   },
   methods: {
+    //导出
+    handleExport() {
+      this.$confirm("是否导出成绩信息?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          //获取查询条件
+          // console.log(this.userInfo, 456);
+          // console.log(this.query, 456);
+          // return;
+          var data = {
+            startTime: this.query.startTime,
+            endTime: this.query.endTime,
+            qualified: this.query.qualified,
+            examName: this.query.examName,
+            securityName: this.query.securityName,
+            jurisdiction: this.userInfo.jurisdiction,
+          };
+          //导出
+          // if (
+          //   this.userInfo.role_name == "保安公司管理员" ||
+          //   this.userInfo.role_name == "保安"
+          // ) {
+          //   //如果是保安公司管理员
+          //   data["deptId"] = this.userInfo.dept_id;
+          // }
+          // if (this.userInfo.role_name == "培训公司管理员") {
+          //   //如果是培训公司管理员
+          //   data["trainUnitId"] = this.userInfo.dept_id;
+          // }
+          // data["examType"] = 2;
+          //序列号url形式,用&拼接
+          data = Qs.stringify(data);
+          window.open(`/api/examScore/export-examScore?` + data);
+        })
+        .catch((action) => {
+          // this.$message({
+          //   type: 'info',
+          //   message: action === 'cancel'
+          //     ? '放弃保存并离开页面'
+          //     : '停留在当前页面'
+          // })
+        });
+    },
     getStartTime() {
       if (
         this.$route.query.startTime != undefined &&
@@ -360,6 +422,11 @@
         this.page.total = data.total;
         this.data = data.records;
         for (var k in this.data) {
+          if (this.data[k].qualified == 0) {
+            this.data[k]["isFazheng"] = "已发证";
+          } else {
+            this.data[k]["isFazheng"] = "未发证";
+          }
           for (var m in this.data[k]) {
             if (this.data[k][m] == -1) {
               this.data[k][m] = "";

--
Gitblit v1.9.3