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

                <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="field102">
                            <el-date-picker v-model="formData.field102" 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="field103">
                            <el-input v-model="formData.field103" placeholder="请输入联系人" 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="field107">
                            <el-input v-model="formData.field107" placeholder="请系统自动合计" :disabled='true' 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="请系统自动合计含税金额大写" :disabled='true' 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-input v-model="formData.field111" placeholder="系统自动合计" :disabled='true' clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="合计金额大写" prop="field112" label-width="120px">
                            <el-input v-model="formData.field112" placeholder="系统自动合计" :disabled='true' 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="24">
                        <el-form-item label="备注" prop="field114">
                            <el-input v-model="formData.field114" 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="field115">
                            <el-upload ref="field115" :file-list="field115fileList" :action="field115Action"
                                :before-upload="field115BeforeUpload">
                                <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="产品名称" prop="field116">
                            <el-input v-model="formData.field116" placeholder="系统自动合计" :disabled='true' 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="系统自动合计" :disabled='true' 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="系统自动合计" :disabled='true' 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="系统自动合计" :disabled='true' clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="参数说明" prop="field120">
                            <el-input v-model="formData.field120" 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 size="large">
                            <el-button type="primary" @click="submitForm">提交</el-button>
                            <el-button @click="resetForm">重置</el-button>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-card>

        </el-form>
    </div>
</template>
<script>
export default {
    components: {},
    props: [],
    data() {
        return {
            formData: {
                field101: undefined,
                field102: null,
                field103: undefined,
                field104: undefined,
                field105: undefined,
                field106: undefined,
                field107: undefined,
                field108: undefined,
                field109: 0,
                field110: "",
                field111: undefined,
                field112: undefined,
                field113: undefined,
                field114: undefined,
                field115: null,
                field116: undefined,
                field117: undefined,
                field119: undefined,
                field118: undefined,
                field120: undefined,
            },
            rules: {
                field101: [{
                    required: true,
                    message: '请输入客户名称',
                    trigger: 'blur'
                }],
                field102: [{
                    required: true,
                    message: '请选择报价日期',
                    trigger: 'change'
                }],
                field103: [],
                field104: [],
                field105: [],
                field106: [],
                field107: [{
                    required: true,
                    message: '请系统自动合计',
                    trigger: 'blur'
                }],
                field108: [{
                    required: true,
                    message: '请系统自动合计含税金额大写',
                    trigger: 'blur'
                }],
                field109: [{
                    required: true,
                    message: '请输入运费',
                    trigger: 'blur'
                }],
                field110: [{
                    required: true,
                    message: '请输入其他费用',
                    trigger: 'blur'
                }],
                field111: [{
                    required: true,
                    message: '系统自动合计',
                    trigger: 'blur'
                }],
                field112: [{
                    required: true,
                    message: '系统自动合计',
                    trigger: 'blur'
                }],
                field113: [],
                field114: [],
                field116: [],
                field117: [],
                field119: [],
                field118: [],
                field120: [],
            },
            field115Action: 'https://jsonplaceholder.typicode.com/posts/',
            field115fileList: [],
        }
    },
    computed: {},
    watch: {},
    created() { },
    mounted() { },
    methods: {
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
        resetForm() {
            this.$refs['elForm'].resetFields()
        },
        field115BeforeUpload(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>
  