<template>
    <el-dialog custom-class="approve-reject-dialog"
        title="审批驳回"
        :visible.sync="isDetailDialogShow"
        :close-on-click-modal="false"
        :modal-append-to-body="false"
        @close="$emit('close')"
        width="692px"
        v-dialogDrag
        center
    >
        <div class="dialog-content-wrap">
            <el-input type="textarea" v-model="content" :disabled="!isEdit" :rows="10" :placeholder="isEdit?'请输入驳回理由':'无'"></el-input>
        </div>
        <div class="dialog-btn-wrap">
            
            <template v-if="isEdit">
                <el-button @click="$emit('close')">取消</el-button>
                <el-button type="primary" @click="handleConfirm">确认</el-button>
            </template>
            <el-button v-else @click="$emit('close')">知道了</el-button>
        </div>
    </el-dialog>
</template>

<script>
export default {
    props:{
        isDetailDialogShow:{
            type:Boolean,
            default:false
        },
        isEdit:{
            type:Boolean,
            default:true
        },
        data:{
            type:Object,
            default:()=>{return{}}
        }
    },
    watch:{
        isDetailDialogShow(val){
            if(val){
                this.content = this.data.ApproveRemark||''
            }
        }
    },
    data() {
        return {
            content:''
        };
    },
    methods: {
        handleConfirm(){
            /* if(!this.content.length){
                this.$message.warning("请输入驳回理由")
                return
            } */
            this.$emit('edit',this.content)
        }
    },
};
</script>

<style lang="scss">
.approve-reject-dialog{
    .dialog-content-wrap{
        .el-textarea{
            textarea{
                resize: none !important;
            }
        }
    }
    .dialog-btn-wrap{
        text-align: center;
        margin-top: 20px;
        padding-bottom: 25px;
    }
}
</style>
