From 56c1cb87f819fcc1ef73bf5b6d2fc27098144dee Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 20 Dec 2021 09:58:53 +0800
Subject: [PATCH] 成绩修改新增批量审批

---
 src/api/examapi/modifiedGrades.js      |    8 ++
 src/views/trainExam/modifiedGrades.vue |  212 +++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 190 insertions(+), 30 deletions(-)

diff --git a/src/api/examapi/modifiedGrades.js b/src/api/examapi/modifiedGrades.js
index 9281f63..fadc1e4 100644
--- a/src/api/examapi/modifiedGrades.js
+++ b/src/api/examapi/modifiedGrades.js
@@ -26,4 +26,12 @@
         method: 'post',
         data: row
     })
+}
+
+export const batchAudit = (row) => {
+    return request({
+        url: '/api/scoreAuditRecords/batchAudit',
+        method: 'post',
+        data: row
+    })
 }
\ No newline at end of file
diff --git a/src/views/trainExam/modifiedGrades.vue b/src/views/trainExam/modifiedGrades.vue
index 4817ab8..b34f313 100644
--- a/src/views/trainExam/modifiedGrades.vue
+++ b/src/views/trainExam/modifiedGrades.vue
@@ -32,7 +32,7 @@
             ref="questionBankCrud"
             :page.sync="questionBankPage"
             @on-load="questionBankOnLoad"
-            @selection-change="questionBankSelectionChange"
+            @selection-change="selectionChange"
             @search-change="questionBankSearchChange"
             @search-reset="questionBankSearchReset"
             @current-change="questionBankCurrentChange"
@@ -41,19 +41,17 @@
             @refresh-change="refreshChange"
           >
             <!-- 自定义按钮 -->
+
             <template slot="menuLeft">
-              <!-- <el-button type="danger"
-                                       size="mini"
-                                       icon="el-icon-delete"
-                                       plain
-                                       @click="handleDelete">新增
-                            </el-button> -->
-              <!-- <el-button type="danger"
-                                       size="mini"
-                                       icon="el-icon-delete"
-                                       plain
-                                       @click="handleDelete">删除
-                            </el-button> -->
+              <el-button
+                type="primary"
+                size="small"
+                plain
+                v-if="checks"
+                icon="el-icon-collection-tag"
+                @click="handleBatchAudit"
+                >批量审批
+              </el-button>
             </template>
 
             <template slot-scope="{ type, size, row }" slot="menu">
@@ -86,11 +84,31 @@
         @submit="submit"
       ></avue-form>
     </el-dialog>
+    <el-dialog
+      title="批量审批"
+      append-to-body
+      :visible.sync="dialogBatchAudit"
+      width="900px"
+      @close="closeDialog"
+    >
+    <avue-form
+      ref="formBatchAudit"
+      v-model="batchAudit"
+      :option="optionBatchAudit"
+      @reset-change="emptytChange"
+      @submit="submitBatchAudit"
+    ></avue-form>
+    </el-dialog>
   </el-row>
 </template>
 
 <script>
-import { getList, update, applyAudit } from "@/api/examapi/modifiedGrades";
+import {
+  getList,
+  update,
+  applyAudit,
+  batchAudit,
+} from "@/api/examapi/modifiedGrades";
 import { mapGetters } from "vuex";
 import { getRoleDetail } from "@/api/system/role";
 export default {
@@ -98,6 +116,77 @@
     return {
       Audit: {},
       dialogFormVisible: false,
+      dialogBatchAudit: false,
+      batchAudit: {
+        number: 0,
+      },
+      optionBatchAudit: {
+        height: "auto",
+        filterBtn: true,
+        calcHeight: 30,
+        dialogWidth: 950,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true, //liu
+        index: true,
+        stripe: true,
+        viewBtn: true,
+        selection: false,
+        excelBtn: false,
+        menuWidth: 380,
+        dialogClickModal: false,
+        ...this.$store.state.control.clearOtherBut,
+        column: [
+          {
+            label: "所选保安人数",
+            prop: "number",
+            span: 24,
+            value: 0,
+            disabled: true,
+            labelWidth: 110,
+          },
+          {
+            label: "审核状态",
+            search: true,
+            searchSpan: 5,
+            span: 24,
+            prop: "status",
+            slot: true,
+            editDisplay: false,
+            addDisplay: false,
+            type: "select",
+            rules: [
+              {
+                required: true,
+                message: "请选择审核类型",
+                trigger: "blur",
+              },
+            ],
+            dicData: [
+              {
+                label: "待审核",
+                value: 1,
+              },
+              {
+                label: "审核通过",
+                value: 2,
+              },
+              {
+                label: "审核不通过",
+                value: 3,
+              },
+            ],
+          },
+          {
+            label: "审核明细",
+            span: 24,
+            type: "textarea",
+            prop: "auditDetail",
+          },
+        ],
+      },
+      choiceList: [],
       optionAudit: {
         height: "auto",
         calcHeight: 30,
@@ -165,17 +254,16 @@
         delBtn: false,
         editBtn: true,
         addBtn: false,
-        selection: false,
         check: false,
-        // 导出按钮
-        // excelBtn: true,
-        // excelBtnText: "成绩导出",
+        checks: false,
+        selection: true,
+        reserveSelection: true,
+        tip: false,
         viewBtn: true,
         // title: '成绩',
         align: "center",
         height: "auto",
         calcHeight: 80,
-        tip: false,
         searchShow: true,
         searchMenuSpan: 4,
         index: true,
@@ -352,9 +440,9 @@
           {
             label: "申请人所在单位",
             prop: "applyUnitName",
-            search:true,
-            searchLabelWidth:120,
-            searchSpan:4,
+            search: true,
+            searchLabelWidth: 120,
+            searchSpan: 4,
             slot: true,
             // 表单新增时是否禁止
             addDisabled: false,
@@ -368,7 +456,7 @@
             editDisplay: true,
             // 表单编辑时是否为查看模式
             editDetail: false,
-            overHidden:true,
+            overHidden: true,
           },
           {
             label: "申请理由",
@@ -514,8 +602,16 @@
         this.check = false;
       }
     }
+    //批量审批
+    //判断是否为超级管理员
+    if (this.userInfo.role_name == "administrator") {
+      this.checks = true;
+      this.questionBankOption.tip = true
+    }
   },
-  mounted() {},
+  mounted() {
+    
+  },
   computed: {
     ...mapGetters(["userInfo", "permission"]),
     permissionList() {
@@ -604,7 +700,27 @@
         }
       );
     },
-
+    //成绩修改批量审核
+    handleBatchAudit() {
+      if (this.choiceList.length == 0) {
+        this.$message({
+          message: "未选择考试的人员",
+          type: "warning",
+        });
+        return;
+      }
+      this.dialogBatchAudit = true;
+      this.batchAudit.number = this.choiceList.length;
+    },
+    selectionChange(list) {
+      // this.selectionList = list;
+      this.choiceList = [];
+      for (let k in list) {
+        this.choiceList.push({
+          id: list[k].id,
+        });
+      }
+    },
     questionBankOnLoad(page, params = {}) {
       //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
       var that = this;
@@ -643,11 +759,11 @@
 
     questionBankSelectionClear() {
       this.questionBankSelectionList = [];
-      this.$refs.questionBankCrud.toggleSelection();
+      // this.$refs.questionBankCrud.toggleSelection();
     },
-    questionBankSelectionChange(list) {
-      this.questionBankSelectionList = list;
-    },
+    // questionBankSelectionChange(list) {
+    //   this.questionBankSelectionList = list;
+    // },
     questionBankSearchChange(params, done) {
       this.questionBankQuery = params;
       this.questionBankPage.currentPage = 1;
@@ -684,7 +800,43 @@
         }
       );
     },
-
+    //批量审批
+    submitBatchAudit(row, done, loading) {
+      var that = this;
+      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,
+        status: row.status,
+        auditDetail: row.auditDetail,
+        auditUser: this.userInfo.Id,
+      };
+      //提交申请
+      batchAudit(data).then(
+        () => {
+          this.questionBankOnLoad(this.page);
+          that.$refs.formBatchAudit.resetFields();
+          that.dialogBatchAudit = false;
+          this.$message({
+            type: "success",
+            message: "操作成功",
+          });
+          //清除选项
+          that.$refs.questionBankCrud.toggleSelection();
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
     refreshChange() {
       this.questionBankOnLoad(this.questionBankPage, this.questionBankQuery);
     },

--
Gitblit v1.9.3