<template>
    <!-- 退料驳回 -->
    <div>
        <TableModel
            :config="config"
            :sendParams="sendParams"
            @getTableSelectionChange="getTableSelectionChange"
        >
            <template slot="export">
                <el-row :gutter="10" class="mb8">
                    <el-button type="warning" plain size="mini"
                        >完成退料</el-button
                    >
                </el-row>
            </template>
            <template slot-scope="{ data }" slot="handle">
                <el-button type="text" size="mini" @click="handlePreview(data)"
                    >查看</el-button
                >
                <el-button type="text" size="mini" @click="handleEdit(data)"
                    >编辑退料</el-button
                >
                <el-button type="text" size="mini" @click="handleRevoke(data)"
                    >撤回</el-button
                >
            </template>
        </TableModel>

        <DialogModel
            :dialogConfig="dialogConfig"
            @closeDialogOuter="closeDialogOuter"
            @closeDialogInner="closeDialogInner"
        >
            <template slot="outerContent">
                <template v-if="dialogConfig.outerTitle === '查看'">
                    <TableModel :config="dialogConfig" />
                </template>
                <template v-if="dialogConfig.outerTitle === '编辑退料'">
                    <TableModel :config="dialogConfig">
                        <template slot="export">
                            <el-row :gutter="10" class="mb8">
                                <el-button type="success" plain size="mini"
                                    >批量合格</el-button
                                >
                                <el-button type="warning" plain size="mini"
                                    >批量维修</el-button
                                >
                                <el-button type="danger" plain size="mini"
                                    >批量预报废</el-button
                                >
                            </el-row>
                        </template>

                        <template slot="handle">
                            <el-button
                                type="text"
                                size="mini"
                                style="color: #95d475"
                                >合格</el-button
                            >
                            <el-button
                                type="text"
                                size="mini"
                                style="color: #eebe77"
                                >维修</el-button
                            >
                            <el-button
                                type="text"
                                size="mini"
                                style="color: #f89898"
                                >预报废</el-button
                            >
                        </template>
                    </TableModel>
                </template>
            </template>
        </DialogModel>
    </div>
</template>

<script>
    import TableModel from '@/components/TableModel'
    import DialogModel from '@/components/DialogModel'
    import SelDepart from '../../component/selDepart.vue'
    import { config, dialogConfig } from './config'
    import { receiveView } from '@/api/claimAndRefund/return'
    export default {
        name: 'auditingReturn',
        components: {
            TableModel,
            DialogModel,
            SelDepart,
        },
        props: {
            sendParams: {
                type: Object,
                default: () => {
                    return {}
                },
            },
        },
        data() {
            return {
                config,
                dialogConfig,
                receiveView,
            }
        },
        methods: {
            /* 按钮操作 */
            handlePreview(row) {
                this.dialogConfig.outerTitle = '查看'
                this.dialogConfig.handleColShow = false
                this.dialogConfig.outerWidth = '70%'
                this.dialogConfig.outerVisible = true
            },
            handleEdit(row) {
                this.dialogConfig.outerTitle = '编辑退料'
                this.dialogConfig.handleColShow = true
                this.dialogConfig.outerWidth = '70%'
                this.dialogConfig.outerVisible = true
            },
            handleRevoke(row) {},

            getTableSelectionChange() {},
            closeDialog(val) {
                this.dialogConfig.outerVisible = val
            },
            /* 外层弹框关闭 */
            closeDialogOuter() {
                this.dialogConfig.outerVisible = false
            },
            /* 内层弹框关闭 */
            closeDialogInner() {
                this.dialogConfig.innerVisible = false
            },
        },
    }
</script>
