<template>
    <div>
        <el-card>

            <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px" label-position="left">
                <el-form-item label="投标标号" prop="field101">
                    <el-input v-model="formData.field101" placeholder="点继续选择" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="项目名称" prop="field102">
                    <el-input v-model="formData.field102" placeholder="系统自动获取" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="项目编码" prop="field103">
                    <el-input v-model="formData.field103" placeholder="系统自动获取" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="客户名称" prop="field104">
                    <el-input v-model="formData.field104" placeholder="系统自动获取" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="投标时间" prop="field105">
                    <el-date-picker v-model="formData.field105" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                        :style="{ width: '100%' }" placeholder="请选择投标时间" clearable></el-date-picker>
                </el-form-item>
                <el-form-item label="开标时间" prop="field106">
                    <el-date-picker v-model="formData.field106" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                        :style="{ width: '100%' }" placeholder="请选择开标时间" clearable></el-date-picker>
                </el-form-item>
                <el-form-item label="是否中标" prop="field107">
                    <el-radio-group v-model="formData.field107" size="medium">
                        <el-radio v-for="(item, index) in field107Options" :key="index" :label="item.value"
                            :disabled="item.disabled">{{ item.label }}</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="中标单位" prop="field108">
                    <el-input v-model="formData.field108" placeholder="请输入中标单位" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="中标金额" prop="field109">
                    <el-input v-model="formData.field109" placeholder="请输入中标金额" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="中标金额大写" prop="field110">
                    <el-input v-model="formData.field110" placeholder="请输入中标金额大写" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="投标总结" prop="field111">
                    <el-input v-model="formData.field111" type="textarea" placeholder="请输入投标总结"
                        :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="附件" prop="field112">
                    <el-upload ref="field112" :file-list="field112fileList" :action="field112Action"
                        :before-upload="field112BeforeUpload">
                        <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item size="large">
                    <el-button type="primary" @click="submitForm">提交</el-button>
                    <el-button @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>

        </el-card>

    </div>
</template>
<script>
export default {
    components: {},
    props: [],
    data() {
        return {
            formData: {
                field101: undefined,
                field102: undefined,
                field103: undefined,
                field104: undefined,
                field105: null,
                field106: null,
                field107: undefined,
                field108: undefined,
                field109: undefined,
                field110: undefined,
                field111: undefined,
                field112: null,
            },
            rules: {
                field101: [],
                field102: [{
                    required: true,
                    message: '系统自动获取',
                    trigger: 'blur'
                }],
                field103: [{
                    required: true,
                    message: '系统自动获取',
                    trigger: 'blur'
                }],
                field104: [{
                    required: true,
                    message: '系统自动获取',
                    trigger: 'blur'
                }],
                field105: [],
                field106: [],
                field107: [{
                    required: true,
                    message: '是否中标不能为空',
                    trigger: 'change'
                }],
                field108: [{
                    required: true,
                    message: '请输入中标单位',
                    trigger: 'blur'
                }],
                field109: [{
                    required: true,
                    message: '请输入中标金额',
                    trigger: 'blur'
                }],
                field110: [],
                field111: [],
            },
            field112Action: 'https://jsonplaceholder.typicode.com/posts/',
            field112fileList: [],
            field107Options: [{
                "label": "是",
                "value": 1
            }, {
                "label": "否",
                "value": 2
            }],
        }
    },
    computed: {},
    watch: {},
    created() { },
    mounted() { },
    methods: {
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
        resetForm() {
            this.$refs['elForm'].resetFields()
        },
        field112BeforeUpload(file) {
            let isRightSize = file.size / 1024 / 1024 < 2
            if (!isRightSize) {
                this.$message.error('文件大小超过 2MB')
            }
            return isRightSize
        },
    }
}

</script>
<style>
.el-upload__tip {
    line-height: 1.2;
}
</style>
  