fix
13404089107
2025-12-18 433523a6a30642fa9a35739f783ddf188823bc31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<template>
    <a-modal
        wrapClassName="handle-modal-wrapper"
        :width="520"
        :title="'批量处理意见'"
        :visible="visible"
        :confirm-loading="confirmLoading"
        :maskClosable="false"
        :closable="true"
        :cancelText="'驳回'"
        :okText="'通过'"
        @ok="handleOk"
        @cancel="handleCancel">
        <div class="handle-modal-body">
            <a-spin :spinning="confirmLoading">
                <a-form :form="form">
                    <a-form-item label="">
                        <a-textarea :auto-size="{ minRows: 5, maxRows: 5 }" placeholder="输入处理意见..." v-decorator="['content', validateRules.content]"/>
                    </a-form-item>
                </a-form>
            </a-spin>
        </div>
        <template slot="footer" v-if="batchType == 1">
            <a-button type="primary" @click="handleSubmit(2)">提交</a-button>
        </template>
        <template slot="footer" v-if="batchType == 2">
            <a-button type="default" @click="handleSubmit(4)">驳回</a-button>
            <a-button type="primary" @click="handleSubmit(3)">通过</a-button>
        </template>
    </a-modal>
</template>
 
<script>
    import {batchHandleByWarningRecord} from "../../../api/WarningAction"
 
    export default {
        name: "BatchProcessModal",
        props: {
            batchType: {
                type: Number,
                default: 1,
                required: true,
            },
        },
        data() {
            return {
                visible: false,
                confirmLoading: false,
                form: this.$form.createForm(this),
                validateRules: {
                    content: {
                        rules: [{required: true, message: '请输入处理意见'}]
                    },
                },
                selectionRows: [],
            }
        },
        methods: {
            show(selectionRows) {
                this.selectionRows = [].concat(selectionRows);
                this.form.resetFields();
                this.visible = true;
            },
            // 提交2 通过3 驳回4
            handleSubmit(status) {
                let _scope = this;
                let selectionRows = this.selectionRows;
                let list = [];
                this.form.validateFields((err, values) => {
                    if (!err) {
                        for (let i = 0; i < selectionRows.length; i++) {
                            list.push({
                                warningRecordId: selectionRows[i].id
                            });
                        }
                        let formData = {
                            status: status,
                            list: list
                        };
                        if (values.content !== undefined) {
                            formData = Object.assign({}, formData, values);
                        }
                        batchHandleByWarningRecord(formData).then((response) => {
                            if (response.success) {
                                _scope.$message.success(response.message || '操作成功!');
                                _scope.handleCancel();
                                this.$emit('ok');
                            } else {
                                _scope.$message.warning(response.message || '网络超时');
                            }
                        });
                    }
                });
            },
            // 确认
            handleOk() {
                this.visible = false;
            },
            // 取消
            handleCancel() {
                this.visible = false;
            },
        },
    }
</script>