From a7d9354afebdd05d18ecd31acbd80007c94e4503 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 27 Dec 2021 11:46:21 +0800
Subject: [PATCH] 证书管理新增已制证

---
 src/views/accreditationRecords/accreditationRecords.vue |  113 ++++++++++++++++++++++++++++++++-----
 src/api/accreditationRecords/accreditationRecords.js    |    8 ++
 2 files changed, 105 insertions(+), 16 deletions(-)

diff --git a/src/api/accreditationRecords/accreditationRecords.js b/src/api/accreditationRecords/accreditationRecords.js
index 2570db0..025d0ff 100644
--- a/src/api/accreditationRecords/accreditationRecords.js
+++ b/src/api/accreditationRecords/accreditationRecords.js
@@ -82,4 +82,12 @@
         method: 'post',
         data: row
     })
+}
+
+export const batchAccreditation = (row) => {
+    return request({
+        url: '/api/accreditationRecords/batchAccreditation',
+        method: 'post',
+        data: row
+    })
 }
\ No newline at end of file
diff --git a/src/views/accreditationRecords/accreditationRecords.vue b/src/views/accreditationRecords/accreditationRecords.vue
index 0d6b307..e9e8375 100644
--- a/src/views/accreditationRecords/accreditationRecords.vue
+++ b/src/views/accreditationRecords/accreditationRecords.vue
@@ -46,6 +46,15 @@
           @click="handleExport"
           >保安员证信息导出
         </el-button>
+        <el-button
+          type="primary"
+          size="small"
+          plain
+          v-if="permission.accreditationRecords_status"
+          icon="el-icon-collection-tag"
+          @click="handleBatch"
+          >已制证
+        </el-button>
         <!-- v-if="permission.notice_delete" -->
       </template>
       <template slot-scope="{ row }" slot="category">
@@ -87,6 +96,7 @@
   update,
   add,
   getAccreditationRecords,
+  batchAccreditation
 } from "@/api/accreditationRecords/accreditationRecords";
 import { getDept } from "@/api/system/dept";
 import { mapGetters } from "vuex";
@@ -120,7 +130,8 @@
         filterBtn: true,
         calcHeight: 30,
         dialogWidth: 950,
-        tip: false,
+        tip: true,
+        reserveSelection: true,
         searchShow: true,
         searchMenuSpan: 6,
         border: true,
@@ -189,18 +200,11 @@
             label: "企业名称",
             searchLabelWidth: "110",
             prop: "deptName",
-            // type: "tree",
-            // dicUrl: "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
-            // props: {
-            //     label: "title",
-            //     value: "id",
-            // },
             slot: true,
-            searchLabelWidth: 80,
             searchSpan: 5,
             search: true,
             overHidden: true,
-            minWidth: 200,
+            minWidth: 160,
           },
           {
             label: "性别",
@@ -215,23 +219,26 @@
             search: true,
             searchLabelWidth: 90,
             searchSpan: 5,
+            width:140,
           },
           {
             label: "年龄",
             prop: "age",
+            width:60,
           },
           {
             label: "照片",
             prop: "avatar",
             type: "upload",
             listType: "picture-img",
+            width:60
           },
           {
             label: "保安证编号",
             prop: "securityNumber",
             search: true,
             searchLabelWidth: 90,
-            minWidth: 105,
+            width: 110,
             searchSpan: 5,
             addDisplay: false,
             editDisplay: false,
@@ -243,7 +250,7 @@
             prop: "applyName",
             // search: true,
             searchLabelWidth: 90,
-            width: 80,
+            minWidth: 80,
             // searchSpan: 4,
             addDisplay: false,
             editDisplay: false,
@@ -254,7 +261,7 @@
             prop: "applyUnit",
             search: true,
             searchLabelWidth: 120,
-            minWidth: 105,
+            minWidth: 120,
             searchSpan: 5,
             addDisplay: false,
             editDisplay: false,
@@ -265,7 +272,7 @@
             prop: "createTime",
             // search: true,
             searchLabelWidth: 90,
-            minWidth: 105,
+            width: 140,
             // searchSpan: 4,
             addDisplay: false,
             editDisplay: false,
@@ -295,6 +302,31 @@
               {
                 label: "无",
                 value: 2,
+              },
+            ],
+          },
+          {
+            label: "是否制证",
+            prop: "status",
+            type: "select",
+            slot: true,
+            search: true,
+            editDisplay: false,
+            addDisplay: false,
+            searchSpan: 4,
+            width: 80,
+            dicData: [
+              {
+                label: "全部",
+                value: 3,
+              },
+              {
+                label: "已制证",
+                value: 2,
+              },
+              {
+                label: "未制证",
+                value: 1,
               },
             ],
           },
@@ -334,6 +366,9 @@
     this.getDeptInfo(this.userInfo.dept_id);
   },
   created() {
+    if (this.userInfo.role_name == "上岗证办理管理员") {
+      this.questionBankSearch["status"] = 1;
+    }
     if (this.userInfo.role_name == "公安管理员") {
       //判断是否为市局管理员
       if (this.userInfo.jurisdiction == "1372091709474910209") {
@@ -346,6 +381,45 @@
     }
   },
   methods: {
+    //证书批量修改为已制证
+    handleBatch() {
+      if (this.choiceList.length === 0) {
+        this.$message.warning("请勾选至少一位持证保安员");
+        return;
+      }
+      this.$confirm(
+        "共选择人数" + this.choiceList.length + "人,确定已制证?",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      )
+        .then(() => {
+          let cho = this.choiceList;
+          let str = "";
+          for (let k in cho) {
+            str += cho[k].id;
+            if (k != cho.length - 1) {
+              str += ",";
+            }
+          }
+          const data = {
+            ids: str,
+            createUser: this.userInfo.user_id,
+            type: 1,
+          };
+          return batchAccreditation(data);
+        })
+        .then(() => {
+          this.onLoad(this.page, this.questionBankSearch);
+          this.$refs.crud.toggleSelection();
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
     //获取当前用户部门信息
     getDeptInfo(deptId) {
       var that = this;
@@ -439,7 +513,13 @@
       done();
     },
     selectionChange(list) {
-      this.selectionList = list;
+      // this.selectionList = list;
+      this.choiceList = [];
+      for (let k in list) {
+        this.choiceList.push({
+          id: list[k].id,
+        });
+      }
     },
     selectionClear() {
       this.selectionList = [];
@@ -459,7 +539,7 @@
           return remove(this.ids);
         })
         .then(() => {
-          this.onLoad(this.page);
+          this.onLoad(this.page, this.questionBankSearch);
           this.$message({
             type: "success",
             message: "操作成功!",
@@ -482,7 +562,7 @@
       this.page.pageSize = pageSize;
     },
     refreshChange() {
-      this.onLoad(this.page, this.query);
+      this.onLoad(this.page, this.questionBankSearch);
     },
     onLoad(page, params = {}) {
       params = this.questionBankSearch;
@@ -548,6 +628,7 @@
           startTime: this.questionBankSearch.startTime,
           endTime: this.questionBankSearch.endTime,
           isAvatar: this.questionBankSearch.isAvatar,
+          status: this.questionBankSearch.status,
         };
         //导出
         if (this.userInfo.role_name == "保安公司管理员") {

--
Gitblit v1.9.3