From a984f4167d833d04ab3d38c2914b33b775bc252f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 03 Nov 2021 19:58:43 +0800
Subject: [PATCH] 制证申请,导出

---
 src/views/accreditationRecords/accreditationRecords.vue |  104 +++++++++++++++++++++++++++++-----
 src/views/securityGuard/securityGuard.vue               |    7 ++
 src/views/trainExam/performance.vue                     |    2 
 src/api/accreditationRecords/accreditationRecords.js    |   11 +++
 4 files changed, 106 insertions(+), 18 deletions(-)

diff --git a/src/api/accreditationRecords/accreditationRecords.js b/src/api/accreditationRecords/accreditationRecords.js
index 113bd65..d67b8c3 100644
--- a/src/api/accreditationRecords/accreditationRecords.js
+++ b/src/api/accreditationRecords/accreditationRecords.js
@@ -13,6 +13,17 @@
     })
 }
 
+export const getAccreditationRecords = (id) => {
+    return request({
+        url: '/api/accreditationRecords/details',
+        method: 'get',
+        params: {
+            id,
+        }
+    })
+}
+
+
 export const remove = (ids) => {
     return request({
         url: '/api/accreditationRecords/remove',
diff --git a/src/views/accreditationRecords/accreditationRecords.vue b/src/views/accreditationRecords/accreditationRecords.vue
index 96cf922..c39d753 100644
--- a/src/views/accreditationRecords/accreditationRecords.vue
+++ b/src/views/accreditationRecords/accreditationRecords.vue
@@ -9,6 +9,7 @@
       @row-del="rowDel"
       v-model="form"
       :permission="permissionList"
+      :search.sync="questionBankSearch"
       @row-update="rowUpdate"
       @row-save="rowSave"
       :before-open="beforeOpen"
@@ -31,6 +32,15 @@
           plain
           @click="handleDelete"
           >删 除
+        </el-button>
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          v-if="permission.trainExam_performance_export"
+          @click="handleExport"
+          >保安员证信息导出
         </el-button>
         <!-- v-if="permission.notice_delete" -->
       </template>
@@ -70,16 +80,18 @@
   remove,
   update,
   add,
+  getAccreditationRecords
 } from "@/api/accreditationRecords/accreditationRecords";
 import { getDept } from "@/api/system/dept";
 import { mapGetters } from "vuex";
 import { mapState } from "vuex";
-
+import Qs from "qs";
 export default {
   data() {
     return {
       form: {},
       query: {},
+      questionBankSearch: {},
       loading: true,
       deptCategory: "",
       deptId: "",
@@ -105,7 +117,7 @@
         index: true,
         stripe: true,
         viewBtn: true,
-        selection: true,
+        // selection: true,
         excelBtn: false,
         addBtnText: "发布",
         addTitle: "发布",
@@ -114,13 +126,34 @@
         dialogClickModal: false,
         column: [
           {
+            label: "通知时间",
+            prop: "releaseTimeRange",
+            type: "datetime",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            searchRange: true,
+            hide: true,
+            addDisplay: false,
+            editDisplay: false,
+            viewDisplay: false,
+            search: true,
+            searchSpan:6,
+            rules: [
+              {
+                required: true,
+                message: "请输入通知时间",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
             label: "姓名",
             prop: "realName",
             search: true,
             searchSpan: 3,
             width:100,
             searchLabelWidth: 50,
-            display: false,
+            // display: false,
           },
           // {
           //   label: "所属保安公司",
@@ -153,7 +186,6 @@
               // },
               slot: true,
               searchSpan: 5,
-              display: false,
               search: true,
               minWidth: 200
           },
@@ -170,12 +202,10 @@
             search: true,
             searchLabelWidth: 90,
             searchSpan: 5,
-            display: false,
           },
           {
             label: "年龄",
             prop: "age",
-            display: false,
           },
           {
             label: "保安证编号",
@@ -363,7 +393,7 @@
     },
     beforeOpen(done, type) {
       if (["edit", "view"].includes(type)) {
-        getNotice(this.form.id).then((res) => {
+        getAccreditationRecords(this.form.id).then((res) => {
           this.form = res.data.data;
         });
       }
@@ -391,21 +421,21 @@
           ? (that.deptCategory = true)
           : (that.deptCategory = false);
 
-        // const { releaseTimeRange } = this.query;
+        const { releaseTimeRange } = this.query;
         params["jurisdiction"] = this.jurisdiction;
         params["type"] = 1;
         let values = {
           ...params,
         };
-        // if (releaseTimeRange) {
-        //   values = {
-        //     ...params,
-        //     startTime: releaseTimeRange[0],
-        //     endTime: releaseTimeRange[1],
-        //     ...this.query,
-        //   };
-        //   values.releaseTimeRange = null;
-        // }
+        if (releaseTimeRange) {
+          values = {
+            ...params,
+            startTime: releaseTimeRange[0],
+            endTime: releaseTimeRange[1],
+            ...this.query,
+          };
+          values.releaseTimeRange = null;
+        }
         this.loading = true;
         getList(page.currentPage, page.pageSize, values).then((res) => {
           const data = res.data.data;
@@ -416,6 +446,46 @@
         });
       });
     },
+    //保安员证信息导出
+    handleExport() {
+      this.$confirm("是否导出保安员证信息数据?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        //获取查询条件
+        console.log(this.questionBankSearch, 456);
+        const { releaseTimeRange } = this.questionBankSearch;
+        if (releaseTimeRange) {
+            this.questionBankSearch['startTime'] = releaseTimeRange[0];
+            this.questionBankSearch['endTime'] = releaseTimeRange[1];
+        }
+        var data = {
+          deptName: this.questionBankSearch.deptName,
+          idCardNo: this.questionBankSearch.idCardNo,
+          realName: this.questionBankSearch.realName,
+          securityNumber: this.questionBankSearch.securityNumber,
+          startTime: this.questionBankSearch.securityName,
+          endTime: this.questionBankSearch.examName,
+        };
+        //导出
+        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/accreditationRecords/export-security-paper?` + data);
+      });
+    },
   },
 };
 </script>
diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index 26a1a35..91b4c74 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -791,6 +791,13 @@
               {
                 label: "联系地址",
                 prop: "address",
+                rules: [
+                  {
+                    required: true,
+                    message: "请输入联系地址",
+                    trigger: "click",
+                  },
+                ],
               },
               {
                 label: "户口所在地",
diff --git a/src/views/trainExam/performance.vue b/src/views/trainExam/performance.vue
index 6655733..bd5c09c 100644
--- a/src/views/trainExam/performance.vue
+++ b/src/views/trainExam/performance.vue
@@ -797,7 +797,7 @@
         type: "warning",
       }).then(() => {
         //获取查询条件
-        console.log(this.questionBankSearch, 456);
+        // console.log(this.questionBankSearch, 456);
         var data = {
           account: this.questionBankSearch.account,
           companyName: this.questionBankSearch.companyName,

--
Gitblit v1.9.3