<template>
    <div>
        <el-card>
            <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px" label-position="left">
                <el-row :gutter="10">

                    <el-col :span="12">
                        <el-form-item label="客户名称" prop="field101">
                            <el-input v-model="formData.field101" placeholder="请输入客户名称" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目类型" prop="field103">
                            <el-select v-model="formData.field103" placeholder="请选择项目类型" clearable
                                :style="{ width: '100%' }">
                                <el-option v-for="(item, index) in field103Options" :key="index" :label="item.label"
                                    :value="item.value" :disabled="item.disabled"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目名称" prop="field104">
                            <el-input v-model="formData.field104" placeholder="请输入项目名称" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="单行文本" prop="field105">
                            <el-input v-model="formData.field105" placeholder="系统自动生成" readonly clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="项目内容" prop="field106">
                            <el-checkbox-group v-model="formData.field106" size="medium">
                                <el-checkbox v-for="(item, index) in field106Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目估算(万元)" prop="field107" label-width="120px">
                            <el-input v-model="formData.field107" placeholder="请输入项目估算项目估算(万元)" clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目估算(外币)" prop="field108" label-width="120px">
                            <el-input v-model="formData.field108" placeholder="请输入项目估算(外币)" clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目所在地" prop="field109">
                            <el-input v-model="formData.field109" placeholder="请输入项目所在地" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="预计工期" prop="field110">
                            <el-input v-model="formData.field110" placeholder="请输入预计工期" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="投标时间" prop="field111">
                            <el-date-picker v-model="formData.field111" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                :style="{ width: '100%' }" placeholder="请选择投标时间" clearable></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="招聘方式" prop="field112">
                            <el-radio-group v-model="formData.field112" size="medium">
                                <el-radio v-for="(item, index) in field112Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="联系人" prop="field113">
                            <el-input v-model="formData.field113" placeholder="请输入联系人" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="联系人职位" prop="field114">
                            <el-input v-model="formData.field114" placeholder="请输入联系人职位" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="联系电话" prop="field115">
                            <el-input v-model="formData.field115" placeholder="请输入联系电话" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="联系人部门" prop="field116">
                            <el-input v-model="formData.field116" placeholder="请输入联系人部门" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="负责人" prop="field117">
                            <el-input v-model="formData.field117" placeholder="请输入负责人" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="关系度" prop="field118">
                            <el-radio-group v-model="formData.field118" size="medium">
                                <el-radio v-for="(item, index) in field118Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="发现时间" prop="field119">
                            <el-date-picker v-model="formData.field119" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                :style="{ width: '100%' }" placeholder="请选择发现时间" clearable></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="信息来源" prop="field120">
                            <el-input v-model="formData.field120" placeholder="请输入信息来源" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="竞争对手" prop="field121">
                            <el-input v-model="formData.field121" placeholder="请输入竞争对手" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目建设资金来源" prop="field122" label-width="136px">
                            <el-radio-group v-model="formData.field122" size="medium">
                                <el-radio v-for="(item, index) in field122Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="建设方付款方式" prop="field123" label-width="120px">
                            <el-input v-model="formData.field123" placeholder="请输入建设方付款方式" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="建设方财务状况" prop="field124" label-width="136px">
                            <el-radio-group v-model="formData.field124" size="medium">
                                <el-radio v-for="(item, index) in field124Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="战略意义" prop="field125">
                            <el-radio-group v-model="formData.field125" size="medium">
                                <el-radio v-for="(item, index) in field125Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="单位性质" prop="field126">
                            <el-radio-group v-model="formData.field126" size="medium">
                                <el-radio v-for="(item, index) in field126Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="所属行业" prop="field127">
                            <el-radio-group v-model="formData.field127" size="medium">
                                <el-radio v-for="(item, index) in field127Options" :key="index" :label="item.value"
                                    :disabled="item.disabled">{{ item.label }}</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="附件" prop="field128">
                            <el-upload ref="field128" :file-list="field128fileList" :action="field128Action"
                                :before-upload="field128BeforeUpload">
                                <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item size="large">
                            <el-button type="primary" @click="submitForm">提交</el-button>
                            <el-button @click="resetForm">重置</el-button>
                        </el-form-item>
                    </el-col>
                </el-row>

            </el-form>
        </el-card>
    </div>
</template>
<script>
export default {
    components: {},
    props: [],
    data() {
        return {
            formData: {
                field101: undefined,
                field103: undefined,
                field104: undefined,
                field105: undefined,
                field106: [],
                field107: undefined,
                field108: undefined,
                field109: undefined,
                field110: undefined,
                field111: null,
                field112: undefined,
                field113: undefined,
                field114: undefined,
                field115: undefined,
                field116: undefined,
                field117: undefined,
                field118: undefined,
                field119: null,
                field120: undefined,
                field121: undefined,
                field122: undefined,
                field123: undefined,
                field124: undefined,
                field125: undefined,
                field126: undefined,
                field127: 5,
                field128: null,
            },
            rules: {
                field101: [{
                    required: true,
                    message: '请输入客户名称',
                    trigger: 'blur'
                }],
                field103: [{
                    required: true,
                    message: '请选择项目类型',
                    trigger: 'change'
                }],
                field104: [{
                    required: true,
                    message: '请输入项目名称',
                    trigger: 'blur'
                }],
                field105: [],
                field106: [{
                    required: true,
                    type: 'array',
                    message: '请至少选择一个项目内容',
                    trigger: 'change'
                }],
                field107: [],
                field108: [],
                field109: [],
                field110: [],
                field111: [],
                field112: [],
                field113: [],
                field114: [],
                field115: [],
                field116: [],
                field117: [],
                field118: [],
                field119: [{
                    required: true,
                    message: '请选择发现时间',
                    trigger: 'change'
                }],
                field120: [{
                    required: true,
                    message: '请输入信息来源',
                    trigger: 'blur'
                }],
                field121: [],
                field122: [],
                field123: [],
                field124: [],
                field125: [],
                field126: [],
                field127: [],
            },
            field128Action: 'https://jsonplaceholder.typicode.com/posts/',
            field128fileList: [],
            field103Options: [{
                "label": "选项一",
                "value": 1
            }, {
                "label": "选项二",
                "value": 2
            }],
            field106Options: [{
                "label": "备品备件",
                "value": 1
            }, {
                "label": "硬件成套",
                "value": 2
            }, {
                "label": "编程测试",
                "value": 3
            }, {
                "label": "系统升级",
                "value": 4
            }, {
                "label": "安装施工",
                "value": 5
            }, {
                "label": "系统开发",
                "value": 6
            }, {
                "label": "现场服务",
                "value": 7
            }, {
                "label": "基建技改",
                "value": 8
            }, {
                "label": "其他",
                "value": 9
            }],
            field112Options: [{
                "label": "公开招标",
                "value": 1
            }, {
                "label": "邀标",
                "value": 2
            }, {
                "label": "议标",
                "value": 3
            }],
            field118Options: [{
                "label": "不认识",
                "value": 1
            }, {
                "label": "初始",
                "value": 2
            }, {
                "label": "普通",
                "value": 3
            }, {
                "label": "要好",
                "value": 4
            }, {
                "label": "密切",
                "value": 5
            }],
            field122Options: [{
                "label": "自筹",
                "value": 1
            }, {
                "label": "财政拨款",
                "value": 2
            }, {
                "label": "政府补贴",
                "value": 3
            }, {
                "label": "其他",
                "value": 4
            }],
            field124Options: [{
                "label": "优",
                "value": 1
            }, {
                "label": "良好",
                "value": 2
            }, {
                "label": "不还",
                "value": 3
            }, {
                "label": "未知",
                "value": 4
            }],
            field125Options: [{
                "label": "持续合作",
                "value": 1
            }, {
                "label": "潜力",
                "value": 2
            }, {
                "label": "样板示范",
                "value": 3
            }],
            field126Options: [{
                "label": "国有企业",
                "value": 1
            }, {
                "label": "政府",
                "value": 2
            }, {
                "label": "部队",
                "value": 3
            }, {
                "label": "其他",
                "value": 4
            }, {
                "label": "集体企业",
                "value": ""
            }],
            field127Options: [{
                "label": "钢铁",
                "value": 1
            }, {
                "label": "光伏",
                "value": 2
            }, {
                "label": "石化",
                "value": 3
            }, {
                "label": "电力",
                "value": 4
            }, {
                "label": "有色",
                "value": 5
            }, {
                "label": "食品医疗",
                "value": 6
            }, {
                "label": "其他",
                "value": 7
            }],
        }
    },
    computed: {},
    watch: {},
    created() { },
    mounted() { },
    methods: {
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
        resetForm() {
            this.$refs['elForm'].resetFields()
        },
        field128BeforeUpload(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>
  