<template>
    <div>
        <el-card>
            <div slot="header" class="clearfix">
                <span>礼堂申请基本信息</span>
            </div>
            <el-form ref="form" :model="infoForm" :rules="rules" label-width="100px">
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="活动名称">
                            <el-input :value="infoForm.activityName"></el-input>
                        </el-form-item>
                        <el-form-item label="活动场地">
                            <el-input :value="infoForm.activityArea"></el-input>
                        </el-form-item>
                        <el-form-item label="负责人">
                            <el-input :value="infoForm.specificUserName"></el-input>
                        </el-form-item>
                        <el-form-item label="活动人数">
                            <el-input :value="infoForm.activityNumber"></el-input>
                        </el-form-item>
                        <el-form-item label="是否彩排">
                            <el-input :value="displayIsRehearsal" readonly></el-input>
                        </el-form-item>


                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="是否录像">
                            <el-input :value="displayIsRecording" readonly></el-input>
                        </el-form-item>
                        <el-form-item label="是否直播">
                            <el-input :value="displayIsLive" readonly></el-input>
                        </el-form-item>
                        <el-form-item label="申请部门">
                            <el-input :value="infoForm.applyDept"></el-input>
                        </el-form-item>
                        <el-form-item label="申请人">
                            <el-input :value="infoForm.applyName"></el-input>
                        </el-form-item>
                        <el-form-item label="申请时间">
                            <el-input :value="infoForm.applyTime"></el-input>
                        </el-form-item>

                    </el-col>
                </el-row>
            </el-form>
        </el-card>
        <TaskResolve v-if="!$attrs.readOnly" :taskId="this.$attrs.taskId" :instanceId="instanceId" :id="id"
            v-on="this.$listeners"></TaskResolve>

    </div>
</template>

<script>
import {

    getAuditor,// 查看详情

} from "@/api/smartSchool/personWork/auditoriumReservation";
import TaskResolve from "@/views/smartSchool/indexMould/myTask/audApplicationapproval/components/autaskResolve.vue"

export default {
    name: "auinfo",
    dicts: ['biz_leave_type', 'course_num'],
    components: { TaskResolve },
    computed: {
        displayIsRehearsal() {
            return this.infoForm.isRehearsal === 0 ? '否' : '是';
        },
        displayIsRecording() {
            return this.infoForm.isRehearsal === 0 ? '否' : '是';
        },
        displayIsLive() {
            return this.infoForm.isLive === 0 ? '否' : '是';
        }
    },


    props: {
        id: {
            type: [String, Number],
            default: ''
        },
        row: {},
        instanceId: {
            type: [String, Number],
            default: ''
        },

    },
    data() {
        const limitStartTime = {
            disabledDate: time => {
                if (this.infoForm.realityEndTime) {
                    return Date.parse(time) > Date.parse(this.infoForm.realityEndTime);
                }
                return false;
                // return Date.parse(time) < Date.parse(new Date());
            }
        };
        const limitEndTime = {
            disabledDate: time => {
                if (this.infoForm.realityStartTime) {
                    return Date.parse(time) < Date.parse(this.infoForm.realityStartTime);
                }
                return false;
            }
        };
        return {
            disable: true,
            limitEndTime,
            limitStartTime,
            infoForm: {},
            rules: {
                realityStartTime: [
                    { required: true, message: '实际开始时间不能为空', trigger: 'change' }
                ],
                realityEndTime: [
                    { required: true, message: '实际结束时间不能为空', trigger: 'change' }
                ]
            },

        }
    },
    created() {
        this.getDetailInfo();
    },
    methods: {
        /** 获取详情 */
        getDetailInfo() {
            getAuditor(this.id).then(res => {
                this.infoForm = res.data;
                if (this.infoForm.isRehearsal == 1) {

                }
                console.log(111, this.infoForm);
            })
        },

        /** 销假 */
        // handleRevoke() {
        //   this.$refs.form.validate(valid => {
        //     if (valid) {
        //       this.$modal.loading('正在销假，请稍等...');
        //       cancelLeave(this.$attrs.taskId, this.infoForm).then(response => {
        //         this.$modal.closeLoading();
        //         this.$message.success('销假成功');
        //         this.$emit('submit');
        //       }).catch(error => {
        //         this.$modal.closeLoading();
        //       })
        //     }
        //   })
        // }
    }
}
</script>

<style scoped></style>
