<template>
    <el-dialog title="分批" append-to-body :modelValue="showAbnormal" @close="closeDialog" class="dialog">

        <el-form :model="batchesForm" :rules="batchesRules" label-width="100px" class="form">
            <el-form-item>
                <el-popover placement="left-start" width="250" trigger="hover" content="需要重新排产订单会释放已排产资源，在人工处理异常后进行排产">
                    <el-button slot="reference"><img src="@/assets/question_mark.png" alt="说明" class="img"></el-button>
                </el-popover>
            </el-form-item>
            <el-form-item label="异常描述" prop="memo">
                <el-input type="textarea" placeholder="请输入异常描述" v-model="batchesForm.memo"></el-input>
            </el-form-item>
            <el-form-item label="分批原因" prop="radio">
                <el-radio-group v-model="batchesForm.radio">
                    <el-radio v-model="radio" label="1">需要</el-radio>
                    <el-radio v-model="radio" label="2">不需要</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="当前工序" prop="currentProcess">
                <el-radio-group v-model="batchesForm.currentProcess">
                    <el-radio v-model="radio" label="1">已完成</el-radio>
                    <el-radio v-model="radio" label="2">未完成</el-radio>
                </el-radio-group>
            </el-form-item>
        </el-form>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="closeDialog">取 消</el-button>
                <el-button type="primary" @click="closeDialog">保 存</el-button>
            </span>
        </template>
    </el-dialog>
</template>

<script>
export default {
    props: {
        showAbnormal: {
            type: Boolean,
            default: false
        },
    },
    data() {
        return {
            isOpen: false,
            batchesForm: {},
            batchesRules: {
                memo: [{ required: true, message: '请输入异常描述', trigger: 'blur' }],
                radio: [{ required: true, message: '请选择分批原因', trigger: 'blur' }],
                currentProcess: [{ required: true, message: '请选择当前工序', trigger: 'blur' }],
            }
        }
    },
    mounted() {

    },
    methods: {
        // 关闭弹窗
        closeDialog() {
            this.$emit('closeDialog');
            this.$refs.batchesForm.resetFields();
        },
    }
}
</script>

<style>
.dialog {
    height: 300px;
    position: relative;
}

.form {
    position: relative;
}

.img {
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}
</style>