<template>
    <div>
        <div class="describe">上传招标文件</div>
        <div class="padding">
            <div class="details">
                <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
                    <el-form-item label="上传附件" prop="file">
                        <upload :limit="1" accept=".pdf" tip="请上传一个招标文件（pdf），不要超过50M。" :max="50" @input="getfile" :fileList="ruleForm.bidBookPO"></upload>
                    </el-form-item>
                    <el-form-item label="其他附件">
                        <upload :limit="5" tip="最多上传五个附件，单个不超过100M。" :type="1" :max="100" @input="getfile1" :fileList="ruleForm.bidBookAccessoryPOList"> </upload>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>
<script>
import { creatProject } from '@api/purchaser/bid';

import upload from '@components/Upload/specialUpload.vue';
export default {
    components: {
        upload
    },
    props: {
        ruleForm: {
            type: Object,
            default() {
                return {};
            }
        }
    },
    data() {
        let checkidentity = (rule, value, callback) => {
            let le;
            if (this.ruleForm.bidBookPO.length === 0) {
                callback(new Error('请上传附件'));
            } else {
                callback();
            }
        };
        return {
            rules: {
                file: [
                    {
                        required: true,
                        validator: checkidentity,
                        trigger: 'change'
                    }
                ]
            }
        };
    },
    methods: {
        getfile(val) {
            this.ruleForm.bidBookPO = val;
        },
        getfile1(val) {
            this.ruleForm.bidBookAccessoryPOList = val;
        },
        async next() {
            const valid = await this.$refs['ruleForm'].validate();
        },
    }
};
</script>

<style scoped>
.padding {
    padding: 0px 20px 30px 20px;
}

.details > div {
    margin-bottom: 20px;
}

.correct {
    margin-right: 20px;
    margin-top: 5px;
}

.button {
    display: flex;
    justify-content: flex-end;
    padding-bottom: 20px;
    margin-right: 20px;
}
</style>
