<template>
    <div>
        <el-card>

            <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="130px" label-position="left">
                <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="field101">
                    <el-input v-model="formData.field101" 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="请输入项目估算" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="招标项目资金来源" prop="field105">
                    <el-radio-group v-model="formData.field105" size="medium">
                        <el-radio v-for="(item, index) in field105Options" :key="index" :label="item.value"
                            :disabled="item.disabled">{{ item.label }}</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="投标时间" prop="field107">
                    <el-date-picker v-model="formData.field107" 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="field108">
                    <el-date-picker v-model="formData.field108" 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="field109">
                    <el-radio-group v-model="formData.field109" size="medium">
                        <el-radio v-for="(item, index) in field109Options" :key="index" :label="item.value"
                            :disabled="item.disabled">{{ item.label }}</el-radio>
                    </el-radio-group>
                </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-radio-group v-model="formData.field111" size="medium">
                        <el-radio v-for="(item, index) in field111Options" :key="index" :label="item.value"
                            :disabled="item.disabled">{{ item.label }}</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="保证金金额(元)" prop="field112">
                    <el-input v-model="formData.field112" placeholder="请输入保证金金额(元)" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="开标日期" prop="field113">
                    <el-date-picker v-model="formData.field113" 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="field114">
                    <el-date-picker v-model="formData.field114" 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="field115">
                    <el-radio-group v-model="formData.field115" size="medium">
                        <el-radio v-for="(item, index) in field115Options" :key="index" :label="item.value"
                            :disabled="item.disabled">{{ item.label }}</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item label="项目把握度" prop="field117">
                    <el-select v-model="formData.field117" placeholder="项目把握度" clearable :style="{ width: '100%' }">
                        <el-option v-for="(item, index) in field117Options" :key="index" :label="item.label"
                            :value="item.value" :disabled="item.disabled"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="招标项目概况" prop="field118">
                    <el-input v-model="formData.field118" type="textarea" placeholder="请输入招标项目概况"
                        :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="项目简介" prop="field119">
                    <el-input v-model="formData.field119" type="textarea" placeholder="项目简介"
                        :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="附件" prop="field120">
                    <el-upload ref="field120" :file-list="field120fileList" :action="field120Action"
                        :before-upload="field120BeforeUpload">
                        <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: {
                field102: undefined,
                field101: undefined,
                field103: undefined,
                field104: undefined,
                field105: undefined,
                field107: null,
                field108: null,
                field109: undefined,
                field110: undefined,
                field111: undefined,
                field112: undefined,
                field113: null,
                field114: null,
                field115: undefined,
                field117: undefined,
                field118: undefined,
                field119: undefined,
                field120: null,
            },
            rules: {
                field102: [{
                    required: true,
                    message: '点击选择项目',
                    trigger: 'blur'
                }],
                field101: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field103: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field104: [{
                    required: true,
                    message: '请输入项目估算',
                    trigger: 'blur'
                }],
                field105: [],
                field107: [],
                field108: [],
                field109: [],
                field110: [],
                field111: [],
                field112: [],
                field113: [],
                field114: [],
                field115: [],
                field117: [],
                field118: [],
                field119: [],
            },
            field120Action: 'https://jsonplaceholder.typicode.com/posts/',
            field120fileList: [],
            field105Options: [{
                "label": "自筹",
                "value": 1
            }, {
                "label": "财政拨款",
                "value": 2
            }, {
                "label": "政府补贴",
                "value": 3
            }, {
                "label": "其他",
                "value": 4
            }],
            field109Options: [{
                "label": "公开招标",
                "value": 1
            }, {
                "label": "邀标",
                "value": 2
            }, {
                "label": "议标",
                "value": 3
            }],
            field111Options: [{
                "label": "是",
                "value": 1
            }, {
                "label": "否",
                "value": 2
            }],
            field115Options: [{
                "label": "有",
                "value": 1
            }, {
                "label": "无",
                "value": 2
            }],
            field117Options: [{
                "label": "0%",
                "value": 0
            }, {
                "label": "10%",
                "value": 1
            }, {
                "label": "20%",
                "value": 2
            }, {
                "label": "30%",
                "value": 3
            }, {
                "label": "40%",
                "value": 4
            }, {
                "label": "50%",
                "value": 5
            }, {
                "label": "60%",
                "value": 6
            }, {
                "label": "70%",
                "value": 7
            }, {
                "label": "80%",
                "value": 8
            }, {
                "label": "90%",
                "value": 19
            }, {
                "label": "100%",
                "value": 10
            }],
        }
    },
    computed: {},
    watch: {},
    created() { },
    mounted() { },
    methods: {
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
        resetForm() {
            this.$refs['elForm'].resetFields()
        },
        field120BeforeUpload(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>
  