<template>
    <layout-form>
        <el-form :model="form" :loading="loading" :rules="rules" size='small' style="width:100%" label-width='120px' ref="form">
            <el-row>
                <Field label="关联主表表名" prop="tableCode" v-model="form.tableCode" placeholder="请输入关联主表表名" />
                <Field label="关联主表某一字段数据" prop="tableDataId" v-model="form.tableDataId" placeholder="请选择关联主表某一字段数据" type="select" :enumData="dict.tableDataId" />
                <Field label="附件分类" prop="attachType" v-model="form.attachType" placeholder="请输入附件分类" />
                <Field label="附件名称" prop="attachName" v-model="form.attachName" placeholder="请输入附件名称" />
                <Field label="附件相对URL" prop="attachUrl" v-model="form.attachUrl" placeholder="请输入附件相对URL" />
                <Field label="备注" prop="remark" v-model="form.remark" placeholder="请输入备注" />
            </el-row>
            <form-buttons @submit='submitForm' />
        </el-form>
    </layout-form>
</template>

<script>
import form from "@/assets/mixins/form";
import valid from "@/assets/utils/vaild";
export default {
    mixins: [form],
    data() {
        return {
            rules: {
                tableCode: [
                    {
                        required: true,
                        message: "请输入关联主表表名",
                        trigger: "blur",
                    },
                    {
                        max: 50,
                        message: "最多只能录入50个字符",
                        trigger: "blur",
                    },
                ],
                tableDataId: [
                    {
                        required: true,
                        message: "请选择关联主表某一字段数据",
                        trigger: "blur",
                    },
                ],
                attachType: [
                    {
                        required: true,
                        message: "请输入附件分类",
                        trigger: "blur",
                    },
                    { type: "integer", trigger: "blur" },
                ],
                attachName: [
                    {
                        required: true,
                        message: "请输入附件名称",
                        trigger: "blur",
                    },
                    {
                        max: 50,
                        message: "最多只能录入50个字符",
                        trigger: "blur",
                    },
                ],
                attachUrl: [
                    {
                        required: true,
                        message: "请输入附件相对URL",
                        trigger: "blur",
                    },
                    {
                        max: 500,
                        message: "最多只能录入500个字符",
                        trigger: "blur",
                    },
                ],
                remark: [
                    { required: true, message: "请输入备注", trigger: "blur" },
                    {
                        max: 200,
                        message: "最多只能录入200个字符",
                        trigger: "blur",
                    },
                ],
            },
        };
    },
};
</script>