<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="点击选择" :disabled='true' clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <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-col>
                    <el-col :span="12">
                        <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-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="请输入联系人" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="联系方式" prop="field106">
                            <el-input v-model="formData.field106" placeholder="请输入联系方式" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目角色" prop="field108">
                            <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="field107">
                            <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="field109">
                            <el-date-picker v-model="formData.field109" 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="field110">
                            <el-input v-model="formData.field110" placeholder="请输入类型" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="主题" prop="field111">
                            <el-input v-model="formData.field111" placeholder="请输入主题" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="行动描述" prop="field113">
                            <el-input v-model="formData.field113" type="textarea" placeholder="请输入行动描述"
                                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="项目把握度" prop="field114">
                            <el-select v-model="formData.field114" placeholder="请选择项目把握度" clearable
                                :style="{ width: '100%' }">
                                <el-option v-for="(item, index) in field114Options" :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="field116">
                            <el-select v-model="formData.field116" placeholder="请选择状态" clearable :style="{ width: '100%' }">
                                <el-option v-for="(item, index) in field116Options" :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="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-input v-model="formData.field118" placeholder="请输入备注" clearable :style="{ width: '100%' }">
                            </el-input>
                        </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-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-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,
                field102: undefined,
                field103: undefined,
                field104: undefined,
                field105: undefined,
                field106: undefined,
                field108: undefined,
                field107: undefined,
                field109: null,
                field110: undefined,
                field111: undefined,
                field113: undefined,
                field114: undefined,
                field116: undefined,
                field117: undefined,
                field118: undefined,
                field119: null,
                field120: null,
            },
            rules: {
                field101: [{
                    required: true,
                    message: '点击选择',
                    trigger: 'blur'
                }],
                field102: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field103: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field104: [],
                field105: [],
                field106: [],
                field108: [],
                field107: [],
                field109: [{
                    required: true,
                    message: '请选择日期',
                    trigger: 'change'
                }],
                field110: [{
                    required: true,
                    message: '请输入类型',
                    trigger: 'blur'
                }],
                field111: [{
                    required: true,
                    message: '请输入主题',
                    trigger: 'blur'
                }],
                field113: [],
                field114: [{
                    required: true,
                    message: '请选择项目把握度',
                    trigger: 'change'
                }],
                field116: [],
                field117: [],
                field118: [],
                field119: [],
            },
            field120Action: 'https://jsonplaceholder.typicode.com/posts/',
            field120fileList: [],
            field114Options: [{
                "label": "选项一",
                "value": 1
            }, {
                "label": "选项二",
                "value": 2
            }],
            field116Options: [{
                "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()
        },
        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>
  