From 74b1ec958590e07f073113914de2fe6b8ee1dabc Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Wed, 27 Dec 2023 09:53:38 +0800
Subject: [PATCH] 制证批量导入,打印显示制证时间

---
 src/views/accreditationRecords/accreditationRecordsPaper.vue |   97 +++++++++++++++++++++++++++++++++++++++++++++---
 src/views/securityGuard/securityCertificate.vue              |   14 +++++-
 2 files changed, 102 insertions(+), 9 deletions(-)

diff --git a/src/views/accreditationRecords/accreditationRecordsPaper.vue b/src/views/accreditationRecords/accreditationRecordsPaper.vue
index 1b9e33e..81a781b 100644
--- a/src/views/accreditationRecords/accreditationRecordsPaper.vue
+++ b/src/views/accreditationRecords/accreditationRecordsPaper.vue
@@ -72,6 +72,9 @@
           @click="handleExportPaper"
           >证书打印信息导出
         </el-button>
+        <el-button type="success" size="small" plain icon="el-icon-upload2"  v-if="permission.accreditationRecords_paperTimeImport || check"
+                   @click="handleImport1">发证时间导入
+        </el-button>
         <el-button
           type="primary"
           size="small"
@@ -167,6 +170,17 @@
         @submit="submitBatchAudit"
       ></avue-form>
     </el-dialog>
+
+    <el-dialog title="发证时间导入" append-to-body :visible.sync="excelBox1" width="555px">
+      <avue-form :option="excelOption1" v-model="excelForm1" :upload-after="uploadAfter1">
+        <template slot="excelTemplate">
+          <el-button type="primary" @click="handleTemplate1">
+            点击下载<i class="el-icon-download el-icon--right"></i>
+          </el-button>
+        </template>
+      </avue-form>
+    </el-dialog>
+
     <div style="position: fixed; top: 9999px; width: 100%; height: 100%">
       <div class="certificate_box" id="certificateDom">
         <div class="security_main" ref="certificateBox">
@@ -655,7 +669,35 @@
           }
         ]
       },
-      data: []
+      data: [],
+
+      excelBox1: false,
+      excelForm1: {},
+      excelOption1: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: "文件上传",
+            prop: "excelFile",
+            type: "upload",
+            drag: true,
+            loadText: "文件上传中,请稍等",
+            span: 24,
+            propsHttp: {
+              res: "data"
+            },
+            tip: "请上传 .xls,.xlsx 标准格式文件",
+            action: "/api/blade-user/import-security-paperTime?deptId=" + this.deptIds
+          },
+          {
+            label: "模板下载",
+            prop: "excelTemplate",
+            formslot: true,
+            span: 24
+          }
+        ]
+      },
     };
   },
   computed: {
@@ -706,6 +748,31 @@
     }
   },
   methods: {
+
+    handleTemplate1() {
+      window.open(
+        `/api/blade-user/export-template-security-paperTime?${this.website.tokenHeader
+        }=${getToken()}`
+      );
+    },
+
+    uploadAfter1(res, done, loading, column) {
+      window.console.log(column);
+      this.excelBox1 = false;
+
+      this.$message({
+        type: "success",
+        message: "导入成功!"
+      });
+
+      this.refreshChange();
+      done();
+    },
+
+    handleImport1() {
+      this.excelBox1 = true;
+    },
+
     //获取当前用户部门信息
     getDeptInfo(deptId) {
       var that = this;
@@ -752,10 +819,22 @@
     //行点击事件
     certificateClick(row) {
       if (row) {
-        var time = this.getNewTime();
-        this.certificateYear = time[0];
-        this.certificateMonth = time[1];
-        this.certificateObj = row;
+        //说明导入了制证时间
+        if (row.userPaperTime != null && row.userPaperTime != ""){
+          let date = row.userPaperTime.split(" ")[0]
+          let dateArr = date.split("-")
+
+          this.certificateYear = dateArr[0];
+          this.certificateMonth = dateArr[1];
+          this.certificateObj = row;
+
+        }else{
+          var time = this.getNewTime();
+          this.certificateYear = time[0];
+          this.certificateMonth = time[1];
+          this.certificateObj = row;
+        }
+
         setTimeout(() => {
           this.Print();
         }, 500);
@@ -785,7 +864,13 @@
           // console.log('打印开始', Date.parse(new Date()));
         },
         onEnd: () => {
-          this.updateUserInfo();
+          //说明导入了制证时间
+          if (this.certificateObj.userPaperTime != "" || this.certificateObj.userPaperTime != null){
+
+          }else{
+            //更新制证时间
+            this.updateUserInfo();
+          }
           // console.log('打印完成', Date.parse(new Date()));
         }
       });
diff --git a/src/views/securityGuard/securityCertificate.vue b/src/views/securityGuard/securityCertificate.vue
index 25c4783..bcd81ed 100644
--- a/src/views/securityGuard/securityCertificate.vue
+++ b/src/views/securityGuard/securityCertificate.vue
@@ -74,9 +74,17 @@
     components: { dictVertical },
     props: ["data"],
     created () {
-        var time = this.getNewTime()
-        this.year = time[0]
-        this.month = time[1]
+        if (this.data.paperTime != null && this.data.paperTime != ''){
+          let date = this.data.paperTime.split(" ")[0]
+          let dateArr = date.split("-")
+
+          this.year = dateArr[0];
+          this.month = dateArr[1];
+        }else{
+          var time = this.getNewTime()
+          this.year = time[0]
+          this.month = time[1]
+        }
     },
     computed: {
         ...mapGetters(["userInfo", "permission"]),

--
Gitblit v1.9.3