<template>
    <div>

        <el-card>
            <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="120px" label-position="left">
                <el-form-item label="组织名称" prop="field101">
                    <el-input v-model="formData.field101" placeholder="请输入组织名称" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="部门名称" prop="field102">
                    <el-input v-model="formData.field102" placeholder="请输入部门名称" 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="系统自动填写" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="汇票承兑银行" prop="field105">
                    <el-input v-model="formData.field105" placeholder="系统自动填写" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="汇票到期日期" prop="field106">
                    <el-input v-model="formData.field106" placeholder="系统自动填写" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="收票账户编码" prop="field107">
                    <el-input v-model="formData.field107" placeholder="请输入收票账户编码" clearable :style="{ width: '100%' }">
                    </el-input>
                </el-form-item>
                <el-form-item label="收票银行" prop="field108">
                    <el-input v-model="formData.field108" placeholder="系统自动填写" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="兑现日期" prop="field109">
                    <el-time-picker v-model="formData.field109" format="HH:mm:ss" value-format="HH:mm:ss"
                        :picker-options='{ "selectableRange": "00:00:00-23:59:59" }' :style="{ width: '100%' }"
                        placeholder="请选择兑现日期" clearable></el-time-picker>
                </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-input v-model="formData.field111" placeholder="系统自动填写" :disabled='true' clearable
                        :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="备注" prop="field112">
                    <el-input v-model="formData.field112" type="textarea" placeholder="请输入备注"
                        :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                </el-form-item>
                <el-form-item label="附件" prop="field113">
                    <el-upload ref="field113" :file-list="field113fileList" :action="field113Action"
                        :before-upload="field113BeforeUpload">
                        <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: {
                field101: undefined,
                field102: undefined,
                field103: undefined,
                field104: undefined,
                field105: undefined,
                field106: undefined,
                field107: undefined,
                field108: undefined,
                field109: null,
                field110: undefined,
                field111: undefined,
                field112: undefined,
                field113: 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: [],
                field108: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field109: [{
                    required: true,
                    message: '请选择兑现日期',
                    trigger: 'change'
                }],
                field110: [{
                    required: true,
                    message: '请输入兑现金额',
                    trigger: 'blur'
                }],
                field111: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field112: [],
            },
            field113Action: 'https://jsonplaceholder.typicode.com/posts/',
            field113fileList: [],
        }
    },
    computed: {},
    watch: {},
    created() { },
    mounted() { },
    methods: {
        submitForm() {
            this.$refs['elForm'].validate(valid => {
                if (!valid) return
                // TODO 提交表单
            })
        },
        resetForm() {
            this.$refs['elForm'].resetFields()
        },
        field113BeforeUpload(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>
  