<template>
    <el-dialog :title="negative.extensionApplyFlag ? `办结审批`: `申请延期审批`" v-model="show">
        <el-form
            label-position="top"
            ref="formRef"
            :model="form"
            style="height: 400px"
        >
            <el-form-item
                prop="comments"
                :rules="{
                    required: true,
                    message: '请输入审批意见',
                    trigger: ['blur', 'change'],
                }"
            >
                <template #label>
                    <h3 class="inline-block mb-10">
                        审批意见
                    </h3>
                </template>
                <el-input
                    type="textarea"
                    placeholder="请输入审批意见"
                    :autosize="{ minRows: 5 }"
                    v-model="form.comments"
                />
            </el-form-item>
        </el-form>
        <footer class="flex end">
            <el-button type="primary" size="large" @click="submit"
                >提交</el-button
            >
        </footer>
    </el-dialog>
</template>
<script setup>
const emit = defineEmits(["submit"]);

const negative = inject("negative");

const show = ref(false);
const form = ref({});
const formRef = ref(null);

async function submit() {
    await formRef.value.validate();
    show.value = false;
    emit("submit", form.value);
}

function open() {
    show.value = true;
}

defineExpose({
    open,
});
</script>
<style lang="scss" scoped>
</style>