From 591508b5bf159c8325ea90ef6992a5ab3d65c5a8 Mon Sep 17 00:00:00 2001
From: BAOLH <baolh@yhzhg.cn>
Date: Tue, 29 Apr 2025 03:59:55 +0000
Subject: [PATCH] 报销功能初版添加(批量审核补充)

---
 eladmin-web-master/src/views/project/projectReimburse/index.vue |   73 +++++++++++++++++++++++++++++++++++-
 1 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/eladmin-web-master/src/views/project/projectReimburse/index.vue b/eladmin-web-master/src/views/project/projectReimburse/index.vue
index cdec335..aa743aa 100644
--- a/eladmin-web-master/src/views/project/projectReimburse/index.vue
+++ b/eladmin-web-master/src/views/project/projectReimburse/index.vue
@@ -33,7 +33,32 @@
         <rrOperation :crud="crud" />
       </div>
       <!-- 如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right' -->
-      <crudOperation :permission="permission" />
+      <crudOperation :permission="permission">
+        <el-button
+          slot="right"
+          class="filter-item"
+          size="mini"
+          type="primary"
+          icon="el-icon-circle-check"
+          :disabled="crud.selections.length < 1 || !crud.selections.every(item => item.approvalStatus === dictReimburseApproveStatusReviewed)"
+          style="margin-left: 4px !important;"
+          @click="batchApprove(1, crud.selections)"
+        >
+          批量同意
+        </el-button>
+        <el-button
+          slot="right"
+          class="filter-item"
+          size="mini"
+          type="primary"
+          icon="el-icon-error"
+          :disabled="crud.selections.length < 1 || !crud.selections.every(item => item.approvalStatus === dictReimburseApproveStatusReviewed)"
+          style="margin-left: 4px !important;"
+          @click="batchApprove(2, crud.selections)"
+        >
+          批量拒绝
+        </el-button>
+      </crudOperation>
       <!-- 表单组件 -->
       <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
         <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
@@ -612,7 +637,7 @@
       that.$refs[`popover_${id}`].showPopper = false
     },
 
-    // 取消撤销
+    // 执行撤销
     handleRevoke(data) {
       const that = this
 
@@ -643,6 +668,50 @@
       that.approveModal.visible = false
     },
 
+    // 批量审核
+    batchApprove(type, data) {
+      const that = this
+
+      const msg = type === 2 ? '批量拒绝' : '批量同意'
+      const msgType = type === 2 ? 'error' : 'success'
+      const msgConfig = type === 2 ? {
+        showInput: true,
+        inputValidator: (val) => {
+          return val !== null && val.trim() !== ''
+        },
+        inputErrorMessage: '请输入拒绝原因'
+      } : {
+        showInput: false
+      }
+      // 确认框
+      that.$prompt('此操作将' + msg + '审核内容是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: msgType,
+        ...msgConfig
+      }).then(reasonVal => {
+        const ids = []
+        // 循环数据
+        for (let i = 0; i < data.length; i++) {
+          // ID列表
+          if (data[i].wecomSpNo) {
+            continue
+          }
+          ids.push(data[i].id)
+        }
+        const paramType = type === 2 ? that.dictReimburseApproveStatusRefuse : that.dictReimburseApproveStatusAgree
+        that.crud.crudMethod.batchApprove({ type: paramType, ids: ids, reason: reasonVal.value ? reasonVal.value.trim() : undefined }).then(res => {
+          // 消息提示
+          that.$message({
+            type: 'success',
+            message: msg + '!'
+          })
+          // 刷新数据
+          that.crud.refresh()
+        })
+      })
+    },
+
     // 获取文件信息
     getFileInfo(info) {
       const that = this

--
Gitblit v1.9.3