From 83afaa6677d935255c46e374b2469c6caf55182b Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 19 Dec 2023 11:48:13 +0800
Subject: [PATCH] 审批功能

---
 src/views/securityGuard/securityGuard.vue |   95 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index d1da295..a314430 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -28,6 +28,9 @@
           :before-close="beforeClose">
           <!-- @row-update="rowUpdate" -->
           <template slot="menuLeft">
+            <el-button type="primary" size="small" plain icon="el-icon-s-check"
+                       @click="handleBatchAudit">批量审批
+            </el-button>
             <el-button type="success" size="small" plain icon="el-icon-upload2" v-if="permission.securityGuard_import"
               @click="handleImport1">保安员批量导入
             </el-button>
@@ -51,6 +54,7 @@
             <el-button type="warning" size="small" plain icon="el-icon-download" v-if="permission.export_security_info"
               @click="handleExportSecurityInfo">保安信息导出
             </el-button>
+
 
             <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.securityGuard_delete"
               @click="handleDelete">注 销
@@ -80,26 +84,37 @@
                   @click.stop="rowClick(row)">查看
                 </el-button>
                 <br v-if="permission.securityGuard_view" />
+
                 <el-button icon="el-icon-scissors" :size="size" :type="type"
                   v-if="permission.securityGuard_delete && row.status != 2" @click="$refs.crud.rowEdit(row, index)">编辑
                 </el-button>
                 <br v-if="permission.securityGuard_delete && row.status != 2" />
+
+                <el-button icon="el-icon-s-check" :size="size" :type="type"
+                           v-if="permission.securityGuard_delete && row.status != 2" @click="handleAudit(row)">审批
+                </el-button>
+                <br v-if="permission.securityGuard_delete && row.status != 2" />
+
                 <el-button icon="el-icon-close" :size="size" :type="type"
                   v-if="permission.securityGuard_delete && row.status != 2" @click="$refs.crud.rowDel(row, index)">注销
                 </el-button>
                 <br v-if="permission.securityGuard_delete && row.status != 2" />
+
                 <el-button icon="el-icon-circle-close" :size="size" :type="type"
                   v-if="permission.securityGuard_delete && row.status != 2" @click.stop="rowStatus(row)">离职
                 </el-button>
                 <br v-if="permission.securityGuard_delete && row.status != 2" />
+
                 <el-button icon="el-icon-search" :size="size" :type="type" v-if="row.status == 2"
                   @click.stop="rowDellook(row)">离职查询
                 </el-button>
                 <br v-if="row.status == 2" />
+
                 <el-button icon="el-icon-user" :size="size" :type="type" v-if="permission.securityGuard_check"
                   @click.stop="rowCheck(row)">异常
                 </el-button>
                 <br v-if="permission.securityGuard_check" />
+
                 <el-button icon="el-icon-money" :size="size" :type="type" v-if="permission.securityGuard_check_apply"
                   @click.stop="rowCheckApply(row)">证件核实申请
                 </el-button>
@@ -344,7 +359,7 @@
   getUserPractitionersInfo,
   updatePaperTime,
   getzhiwen, //指纹
-  checkAccountByUser
+  checkAccountByUser, batchAudit
 } from "@/api/system/user";
 import { securityApply } from "@/api/accreditationRecords/accreditationRecords";
 import { add } from "@/api/securityapplyRecord/securityapplyRecord";
@@ -1577,7 +1592,6 @@
       this.search["userType"] = 7;
     }
     this.deptIds = this.userInfo.dept_id;
-
     // this.beginzhiwen();
     // this.olondSFZ(); //检查身份证设备是否存在
   },
@@ -2415,6 +2429,83 @@
       this.sortName = "";
       // this.$refs.crud.toggleSelection();
     },
+    handleBatchAudit(){
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("请选择审批结果", {
+        distinguishCancelAndClose: true,
+        confirmButtonText: "审批通过",
+        cancelButtonText: "不通过",
+        type: "warning"
+      })
+        .then(() => {
+          //审核通过
+          batchAudit(this.ids,1)
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+
+        }).catch(action => {
+          console.log(action)
+          if (action == 'cancel'){
+            //审核不通过
+            batchAudit(this.ids,2)
+              .then(() => {
+                this.onLoad(this.page);
+                this.$message({
+                  type: "success",
+                  message: "操作成功!"
+                });
+                this.$refs.crud.toggleSelection();
+              });
+          }
+      })
+
+    },
+
+    handleAudit(row){
+      this.$confirm("请选择审批结果", {
+        distinguishCancelAndClose: true,
+        confirmButtonText: "审批通过",
+        cancelButtonText: "不通过",
+        type: "warning"
+      })
+        .then(() => {
+          //审核通过
+          batchAudit(row.id,1)
+            .then(() => {
+              this.onLoad(this.page);
+              this.$message({
+                type: "success",
+                message: "操作成功!"
+              });
+              this.$refs.crud.toggleSelection();
+            });
+
+        }).catch(action => {
+        console.log(action)
+        if (action == 'cancel'){
+          //审核不通过
+          batchAudit(row.id,2)
+            .then(() => {
+              this.onLoad(this.page);
+              this.$message({
+                type: "success",
+                message: "操作成功!"
+              });
+              this.$refs.crud.toggleSelection();
+            });
+        }
+      })
+    },
+
     handleDelete() {
       if (this.selectionList.length === 0) {
         this.$message.warning("请选择至少一条数据");

--
Gitblit v1.9.3