From a4a5a2594b7f262efca1713eb24ade353f4ee054 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 13 Aug 2021 20:59:19 +0800
Subject: [PATCH] 批量报名修改

---
 src/api/securityGuard/securityGuard.js |    7 +
 src/views/companyApply/index.vue       |  130 +++++++++++++++++++++++++++++++++----------
 2 files changed, 104 insertions(+), 33 deletions(-)

diff --git a/src/api/securityGuard/securityGuard.js b/src/api/securityGuard/securityGuard.js
index b9a409b..97a0d98 100644
--- a/src/api/securityGuard/securityGuard.js
+++ b/src/api/securityGuard/securityGuard.js
@@ -43,11 +43,14 @@
 }
 
 
-export const addBatchApply = (row) => {
+export const addBatchApply = (ids, deptId) => {
     return request({
         url: '/api/apply/batchApply',
         method: 'post',
-        data: row
+        params: {
+            ids,
+            deptId
+        }
     })
 }
 
diff --git a/src/views/companyApply/index.vue b/src/views/companyApply/index.vue
index 01b9afb..bf11c8e 100644
--- a/src/views/companyApply/index.vue
+++ b/src/views/companyApply/index.vue
@@ -560,40 +560,108 @@
 
     //批量报名
     handleBatchApply() {
-      this.dialogBatchFormVisible = true;
+      // this.dialogBatchFormVisible = true;
+      if (this.questionBankSelectionList.length === 0) {
+          this.$confirm("确定全部人员报名?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }).then(() => {
+            var userIds = "";
+            addBatchApply(userIds,this.userInfo.dept_id).then(
+              (res) => {
+                this.questionBankOnLoad(this.questionBankPage);
+                if (res.data.data == 201) {
+                  this.$message({
+                    type: "warning",
+                    message: "已报名,不能重复报名",
+                  });
+                } else if (res.data.data == 201) {
+                  this.$message({
+                    type: "warning",
+                    message: "报名失败",
+                  });
+                } else {
+                  this.$message({
+                    type: "success",
+                    message: "报名成功",
+                  });
+                  this.$refs.formBatchApply.resetFields();
+                  this.dialogBatchFormVisible = false;
+                }
+              },
+              (error) => {
+                window.console.log(error);
+              }
+            );
+        })
+      }else{
+        this.$confirm("确定选择人员报名?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }).then(() => {
+            addBatchApply(this.ids,this.userInfo.dept_id).then(
+              (res) => {
+                this.questionBankOnLoad(this.questionBankPage);
+                if (res.data.data == 201) {
+                  this.$message({
+                    type: "warning", 
+                    message: "已报名,不能重复报名",
+                  });
+                } else if (res.data.data == 201) {
+                  this.$message({
+                    type: "warning",
+                    message: "报名失败",
+                  });
+                } else {
+                  this.$message({
+                    type: "success",
+                    message: "报名成功",
+                  });
+                  this.$refs.formBatchApply.resetFields();
+                  this.dialogBatchFormVisible = false;
+                }
+              },
+              (error) => {
+                window.console.log(error);
+              }
+            );
+        })
+      }
     },
 
     //批量报名提交
-    submitBatchApply(){
-        addBatchApply({
-          userIds: this.BatchApply.userId.join(","),
-        }).then(
-          (res) => {
-            this.questionBankOnLoad(this.questionBankPage);
-            if (res.data.data == 201) {
-              this.$message({
-                type: "warning",
-                message: "已报名,不能重复报名",
-              });
-            } else if (res.data.data == 201) {
-              this.$message({
-                type: "warning",
-                message: "报名失败",
-              });
-            } else {
-              this.$message({
-                type: "success",
-                message: "报名成功",
-              });
-              this.$refs.formBatchApply.resetFields();
-              this.dialogBatchFormVisible = false;
-            }
-          },
-          (error) => {
-            window.console.log(error);
-          }
-        );
-    },
+    // submitBatchApply(){
+    //     addBatchApply({
+    //       userIds: this.BatchApply.userId.join(","),
+    //     }).then(
+    //       (res) => {
+    //         this.questionBankOnLoad(this.questionBankPage);
+    //         if (res.data.data == 201) {
+    //           this.$message({
+    //             type: "warning",
+    //             message: "已报名,不能重复报名",
+    //           });
+    //         } else if (res.data.data == 201) {
+    //           this.$message({
+    //             type: "warning",
+    //             message: "报名失败",
+    //           });
+    //         } else {
+    //           this.$message({
+    //             type: "success",
+    //             message: "报名成功",
+    //           });
+    //           this.$refs.formBatchApply.resetFields();
+    //           this.dialogBatchFormVisible = false;
+    //         }
+    //       },
+    //       (error) => {
+    //         window.console.log(error);
+    //       }
+    //     );
+    // },
 
     //关闭窗口清除数据
     closeDialog(){

--
Gitblit v1.9.3