<template>
    <div>
        <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="120px" label-position="left">
            <el-card>
                <div class="tit">供应商退款记录</div>
                <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="系统自动填写" :disabled='true' 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="系统自动填写" :disabled='true' 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="系统自动填写" :disabled='true' 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">
                            <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="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="field118">
                            <el-input v-model="formData.field118" placeholder="系统自动转换" :disabled='true' clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="退款日期" prop="field115">
                            <el-date-picker v-model="formData.field115" 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="field117">
                            <el-select v-model="formData.field117" placeholder="请选择退款方式" clearable
                                :style="{ width: '100%' }">
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="退款原因" prop="field119">
                            <el-input v-model="formData.field119" 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="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 label="附件" prop="field121">
                            <el-upload ref="field121" :file-list="field121fileList" :action="field121Action"
                                :before-upload="field121BeforeUpload">
                                <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-card>
            <el-card>
                <div class="tit">收款账户</div>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="账户编码" prop="field128">
                            <el-input v-model="formData.field128" placeholder="点击选择收款账户" :disabled='true' clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <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="24">
                        <el-form-item label="账号" prop="field124">
                            <el-input v-model="formData.field124" placeholder="系统自动填写" :disabled='true' clearable
                                :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="是否计意" prop="field129">
                            <el-radio-group v-model="formData.field129" size="medium">
                                <el-radio v-for="(item, index) in field129Options" :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 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: undefined,
                field103: undefined,
                field104: undefined,
                field105: undefined,
                field106: undefined,
                field107: undefined,
                field108: undefined,
                field111: undefined,
                field118: undefined,
                field115: undefined,
                field117: undefined,
                field119: undefined,
                field120: undefined,
                field121: null,
                field128: undefined,
                field122: undefined,
                field124: undefined,
                field129: undefined,
            },
            rules: {
                field101: [{
                    required: true,
                    message: '点击选择供应商',
                    trigger: 'blur'
                }],
                field102: [],
                field103: [{
                    required: true,
                    message: '点击选择采购/分包合同',
                    trigger: 'blur'
                }],
                field104: [],
                field105: [],
                field106: [],
                field107: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field108: [{
                    required: true,
                    message: '系统自动填写',
                    trigger: 'blur'
                }],
                field111: [{
                    required: true,
                    message: '请选择退款金额',
                    trigger: 'blur'
                }],
                field118: [],
                field115: [{
                    required: true,
                    message: '请输入退款日期',
                    trigger: 'change'
                }],
                field117: [{
                    required: true,
                    message: '请选择退款方式',
                    trigger: 'change'
                }],
                field119: [],
                field120: [],
                field128: [{
                    required: true,
                    message: '点击选择收款账户',
                    trigger: 'blur'
                }],
                field122: [],
                field124: [],
                field129: [],
            },
            field121Action: 'https://jsonplaceholder.typicode.com/posts/',
            field121fileList: [],
            field111Options: [{
                "label": "选项一",
                "value": 1
            }, {
                "label": "选项二",
                "value": 2
            }],
            field129Options: [{
                "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()
        },
        field121BeforeUpload(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;
}

.tit {
    font-size: 17px;
    margin-bottom: 10px;
}
</style>
  