<template>
    <j-modal
            :title="title"
            :width="width"
            :visible="visible"
            switchFullscreen
            :footer="null"
            @ok="handleOk"
            :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
            @cancel="handleCancel"
            cancelText="关闭">
        <agreement-unit-detail-form ref="realDetailForm" @ok="submitCallback" :disabled="disableSubmit"></agreement-unit-detail-form>
    </j-modal>
</template>

<script>

    import agreementUnitDetailForm from './agreementUnitDetailForm'
    export default {
        name: 'agreementUnitDetailModal',
        components: {
            agreementUnitDetailForm
        },
        data () {
            return {
                title:'',
                width:1400,
                visible: false,
                disableSubmit: false
            }
        },
        methods: {
            add () {
                this.visible=true
                this.$nextTick(()=>{
                    this.$refs.realDetailForm.add();
                })
            },
            edit (record) {
                this.visible=true
                this.$nextTick(()=>{
                    this.$refs.realDetailForm.edit(record);
                })
            },
            close () {
                this.$emit('close');
                this.visible = false;
            },
            handleOk () {
                this.$refs.realDetailForm.submitForm();
            },
            submitCallback(){
                this.$emit('ok');
                this.visible = false;
            },
            handleCancel () {
                this.close()
            }
        }
    }
</script>

