Kaynağa Gözat

修改补贴审核

ylong 8 ay önce
ebeveyn
işleme
237f8ad764

+ 124 - 0
src/views/finance/subsidyReview/components/batch-audit.vue

@@ -0,0 +1,124 @@
+<template>
+    <el-dialog
+        v-model="visible"
+        :title="selectedIds.length === 1 ? '审核' : '批量审核'"
+        width="500px"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+    >
+        <el-form
+            ref="formRef"
+            :model="form"
+            :rules="rules"
+            label-width="100px"
+        >
+            <el-form-item label="审核结果" prop="auditResult">
+                <el-radio-group v-model="form.auditResult">
+                    <el-radio :label="2">通过</el-radio>
+                    <el-radio :label="3">拒绝</el-radio>
+                </el-radio-group>
+            </el-form-item>
+        </el-form>
+
+        <template #footer>
+            <div class="dialog-footer">
+                <el-button @click="handleCancel">取消</el-button>
+                <el-button
+                    type="primary"
+                    :loading="loading"
+                    @click="handleConfirm"
+                >
+                    确定
+                </el-button>
+            </div>
+        </template>
+    </el-dialog>
+</template>
+
+<script setup>
+import { ref, reactive } from 'vue';
+import { ElMessage } from 'element-plus';
+import request from '@/utils/request';
+
+const visible = ref(false);
+const loading = ref(false);
+const formRef = ref(null);
+
+// 表单数据
+const form = reactive({
+    auditResult: 2 // 默认选择通过
+});
+
+// 表单验证规则
+const rules = {
+    auditResult: [
+        { required: true, message: '请选择审核结果', trigger: 'change' }
+    ]
+};
+
+// 选中的记录ID列表
+const selectedIds = ref([]);
+
+// 打开弹窗
+const open = (ids = []) => {
+    if (!ids || ids.length === 0) {
+        ElMessage.warning('请先选择要审核的记录');
+        return;
+    }
+    selectedIds.value = ids;
+    form.auditResult = 2; // 重置为默认值
+    visible.value = true;
+};
+
+// 取消
+const handleCancel = () => {
+    visible.value = false;
+    formRef.value?.resetFields();
+};
+
+// 确认审核
+const handleConfirm = async () => {
+    try {
+        await formRef.value?.validate();
+        
+        loading.value = true;
+        
+        const params = {
+            idList: selectedIds.value,
+            auditResult: form.auditResult
+        };
+        
+        const res = await request.post('/order/orderCompensationLog/audit', params);
+        
+        if (res.data.code === 200) {
+            const resultText = form.auditResult === 2 ? '通过' : '拒绝';
+            const actionText = selectedIds.value.length === 1 ? '审核' : '批量审核';
+            ElMessage.success(`${actionText}${resultText}成功`);
+            visible.value = false;
+            // 触发父组件刷新
+            emit('success');
+        } else {
+            ElMessage.error(res.data.msg || '审核失败');
+        }
+    } catch (error) {
+        console.error('批量审核失败:', error);
+        ElMessage.error('批量审核失败');
+    } finally {
+        loading.value = false;
+    }
+};
+
+// 定义事件
+const emit = defineEmits(['success']);
+
+// 暴露方法给父组件
+defineExpose({
+    open
+});
+</script>
+
+<style scoped>
+.dialog-footer {
+    text-align: right;
+}
+</style>

+ 48 - 5
src/views/finance/subsidyReview/index.vue

@@ -40,6 +40,15 @@
                     <el-radio-button label="未提交" value="3" />
                     <el-radio-button label="用户放弃" value="4" />
                 </el-radio-group>
+
+                <el-button 
+                    type="primary" 
+                    @click="handleBatchAudit"
+                    v-permission="'finance:subsidyReview:audit'"
+                    style="margin-left: 20px;"
+                >
+                    批量审核
+                </el-button>
             </template>
 
             <template #type="{ row }">
@@ -90,6 +99,9 @@
         
         <!-- 操作日志弹窗 -->
         <log-dialog ref="logDialogRef" />
+        
+        <!-- 批量审核弹窗 -->
+        <batch-audit ref="batchAuditRef" @success="handleBatchAuditSuccess" />
     </ele-page>
 </template>
 
@@ -100,6 +112,7 @@
     import request from '@/utils/request';
     import OrderDetail from '@/views/recycleOrder/components/order-detail.vue';
     import LogDialog from './components/log-dialog.vue';
+    import BatchAudit from './components/batch-audit.vue';
     import { ElMessage } from 'element-plus';
     defineOptions({ name: 'subsidyReview' });
 
@@ -140,6 +153,7 @@
 
     /** 表格列配置 */
     const columns = ref([
+        { type: 'selection', width: 55, align: 'center' },
         { label: '申请时间', prop: 'submitTime', align: 'center', width: 180 },
         { label: '用户UID', prop: 'userId', align: 'center' },
         { label: '用户昵称', prop: 'nickName', align: 'center' },
@@ -194,11 +208,8 @@
 
     // 审核
     const handleAudit = (row) => {
-        pageRef.value?.messageBoxConfirm({
-            message: '确定审核通过吗?',
-            fetch: () =>
-                request.post(`/order/orderCompensationLog/audit/${row.id}`)
-        });
+        // 使用批量审核的弹窗,传入单个ID
+        batchAuditRef.value?.open([row.id]);
     };
 
     // 日志弹窗引用
@@ -208,4 +219,36 @@
     const handleLog = (row) => {
         logDialogRef.value?.open(row);
     };
+
+    // 批量审核
+    const batchAuditRef = ref(null);
+    const handleBatchAudit = () => {
+        const selectedRows = pageRef.value?.getSelections() || [];
+        if (selectedRows.length === 0) {
+            ElMessage.warning('请先选择要审核的记录');
+            return;
+        }
+        
+        // 只能审核待审核状态的记录
+        const pendingRows = selectedRows.filter(row => row.status == 1);
+        if (pendingRows.length === 0) {
+            ElMessage.warning('请选择待审核状态的记录');
+            return;
+        }
+        
+        if (pendingRows.length !== selectedRows.length) {
+            ElMessage.warning('只能审核待审核状态的记录,已自动过滤其他状态的记录');
+        }
+        
+        const ids = pendingRows.map(row => row.id);
+        batchAuditRef.value?.open(ids);
+    };
+
+    const handleBatchAuditSuccess = () => {
+        // 批量审核成功后刷新表格和统计数据
+        reload();
+        fetchStatistics();
+        // 清空选中状态
+        pageRef.value?.tableRef?.clearSelection();
+    };
 </script>