<template>
    <div>
        <el-card>
            <div slot="header" class="clearfix">
                <span>科室预算审批基本信息</span>
            </div>
            <el-form ref="form" :model="infoForm" :rules="rules" label-width="90px">
                <el-col :span="12">
                    <el-form-item label="科室">
                        <el-input :value="infoForm.deptName"></el-input>
                    </el-form-item>
                    <el-form-item label="填报人">
                        <el-input :value="infoForm.informant"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="分管领导">
                        <el-input :value="infoForm.leadershipName"></el-input>
                    </el-form-item>
                    <el-form-item label="填报时间">
                        <el-input :value="infoForm.tbTime"></el-input>
                    </el-form-item>
                </el-col>
            </el-form>
            <div style="height:10px"></div>
            <el-table border :data="projectDetail" style="width: 100%">
                <el-table-column prop="projectName" label="项目名称" align="center">
                    <template slot-scope="scope">
                        <span>{{ scope.row.projectName }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="content" label="申报政策依据、理由及主要内容" align="center">
                    <template slot-scope="{ row }">
                        <span>{{ row.content }}</span>

                    </template>
                </el-table-column>
                <el-table-column prop="projectExpenditures" label="项目支出明细" align="center">
                    <template slot-scope="{ row }">
                        <span>{{ row.projectExpenditures }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="isGovernmentPurchase" label="是否政府采购" align="center">
                    <template slot-scope="{ row }">
                        <span v-if="row.isGovernmentPurchase === '1' ">是</span>
                        <span v-else-if="row.isGovernmentPurchase === '0'">否</span>
                    </template>
                </el-table-column>
                <el-table-column prop="applyMoney" label="申请金额" align="center">
                    <template slot-scope="{ row }">
                        <span>{{ row.applyMoney }}</span>

                    </template>
                </el-table-column>
                <el-table-column prop="remark" label="备注" align="center">
                    <template slot-scope="{ row }">
                        <span>{{ row.remark }}</span>
                    </template>
                </el-table-column>
            </el-table>


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

    </div>
</template>

<script>
import {
    queryDepart,//查看本单位预算填报列表;
} from '@/api/smartSchool/officialWork/budgetFilling'
import TaskResolve from "@/views/smartSchool/indexMould/myTask/depBudgetapproval/components/detaskResolve.vue"

export default {
    name: "deinfo",
    dicts: ['biz_leave_type', 'course_num'],
    components: { TaskResolve },
    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: {},
            projectDetail: [],
            rules: {
                realityStartTime: [
                    { required: true, message: '实际开始时间不能为空', trigger: 'change' }
                ],
                realityEndTime: [
                    { required: true, message: '实际结束时间不能为空', trigger: 'change' }
                ]
            },

        }
    },
    created() {
        this.getDetailInfo();
    },
    methods: {
        /** 获取详情 */
        getDetailInfo() {
            queryDepart(this.id).then(res => {
                this.infoForm = res.data
                this.projectDetail = res.data.schoolDepartmentBudgetProjectmxList
            })
        },

        /** 销假 */
        // 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>
.long-label .el-form-item__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    /* 根据需要调整最大宽度 */
}
</style>
