<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
                                suffix-icon='el-icon-search' :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
                                suffix-icon='el-icon-search' :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
                                suffix-icon='el-icon-search' :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="系统自动获取" :disabled='true' clearable
                                suffix-icon='el-icon-search' :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
                                suffix-icon='el-icon-search' :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
                                suffix-icon='el-icon-search' :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="合同类型" prop="field107">
                            <el-select v-model="formData.field107" placeholder="请选择合同类型" clearable
                                :style="{ width: '100%' }">
                                <el-option v-for="(item, index) in field107Options" :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="field108" label-width="115px">
                            <el-radio-group v-model="formData.field108" size="medium">
                                <el-radio v-for="(item, index) in field108Options" :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="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-input v-model="formData.field111" placeholder="请输入通讯地址" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="通讯地址" prop="field112">
                            <el-input v-model="formData.field112" placeholder="请输入通讯地址" clearable
                                :style="{ width: '100%' }">
                            </el-input>
                        </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-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-input v-model="formData.field119" placeholder="请输入邮箱" clearable :style="{ width: '100%' }">
                            </el-input>
                        </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">
                            <el-input v-model="formData.field122" placeholder="请输入金额大写" :disabled='true' clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="业务负责人" prop="field123">
                            <el-input v-model="formData.field123" placeholder="点击选择业务负责人" :disabled='true' clearable
                                suffix-icon='el-icon-search' :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="状态" prop="field124">
                            <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-date-picker v-model="formData.field125" 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="field126">
                            <el-date-picker v-model="formData.field126" 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="24">
                        <el-form-item label="主要条款" prop="field127">
                            <el-input v-model="formData.field127" type="textarea" placeholder="请输入主要条款"
                                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="备注" prop="field128">
                            <el-input v-model="formData.field128" type="textarea" placeholder="请输入备注"
                                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="附件" prop="field129">
                            <el-upload ref="field129" :file-list="field129fileList" :action="field129Action"
                                :before-upload="field129BeforeUpload">
                                <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,
                field107: undefined,
                field108: undefined,
                field109: undefined,
                field110: undefined,
                field111: undefined,
                field112: undefined,
                field113: undefined,
                field114: undefined,
                field115: undefined,
                field116: undefined,
                field117: undefined,
                field118: undefined,
                field119: undefined,
                field120: undefined,
                field121: undefined,
                field122: undefined,
                field123: undefined,
                field124: undefined,
                field125: null,
                field126: null,
                field127: undefined,
                field128: undefined,
                field129: null,
            },
            rules: {
                field101: [{
                    required: true,
                    message: '点击选择客户',
                    trigger: 'blur'
                }],
                field102: [{
                    required: true,
                    message: '点击选择投标编号',
                    trigger: 'blur'
                }],
                field103: [{
                    required: true,
                    message: '点击选择项目名称',
                    trigger: 'blur'
                }],
                field104: [{
                    required: true,
                    message: '系统自动获取',
                    trigger: 'blur'
                }],
                field105: [{
                    required: true,
                    message: '请输入合同名称',
                    trigger: 'blur'
                }],
                field106: [{
                    required: true,
                    message: '请输入合同编号',
                    trigger: 'blur'
                }],
                field107: [{
                    required: true,
                    message: '请选择合同类型',
                    trigger: 'change'
                }],
                field108: [{
                    required: true,
                    message: '合同计价方式不能为空',
                    trigger: 'change'
                }],
                field109: [],
                field110: [],
                field111: [],
                field112: [],
                field113: [],
                field114: [],
                field115: [],
                field116: [],
                field117: [],
                field118: [],
                field119: [],
                field120: [],
                field121: [{
                    required: true,
                    message: '请输入金额',
                    trigger: 'blur'
                }],
                field122: [],
                field123: [{
                    required: true,
                    message: '点击选择业务负责人',
                    trigger: 'blur'
                }],
                field124: [],
                field125: [],
                field126: [{
                    required: true,
                    message: '请选择签约日期',
                    trigger: 'change'
                }],
                field127: [],
                field128: [],
            },
            field129Action: 'https://jsonplaceholder.typicode.com/posts/',
            field129fileList: [],
            field107Options: [{
                "label": "选项一",
                "value": 1
            }, {
                "label": "选项二",
                "value": 2
            }],
            field108Options: [{
                "label": "总价合同",
                "value": 1
            }, {
                "label": "清单计价",
                "value": 2
            }],
            field124Options: [{
                "label": "执行中",
                "value": 1
            }, {
                "label": "结束`",
                "value": 2
            }, {
                "label": "意外终止",
                "value": 3
            }],
        }
    },
    computed: {},
    watch: {},
    created() { },
    mounted() { },
    methods: {
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
        resetForm() {
            this.$refs['elForm'].resetFields()
        },
        field129BeforeUpload(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>
  