
<template>
    <layout-form>
        <el-form :model="form" :loading="loading" :rules="rules" size='small' label-width='100px' ref="form">
            <el-row>
                <Field label="事件编码" prop="eventCode" v-model="form.eventCode" :span='24' :disabled="pageInfo.type === 'view'" :enumData='dict.eventCode' type='select' />
                <Field label="字段编码" prop="fieldCode" v-model="form.fieldCode" :disabled="pageInfo.type === 'view'" />
                <Field label="字段名称" prop="fieldName" v-model="form.fieldName" :disabled="pageInfo.type === 'view'" />
                <Field label="数据类型" prop="fieldType" v-model="form.fieldType" :disabled="pageInfo.type === 'view'" :enumData='dict.fieldType' type='select' />
                <Field label="数据长度" prop="fieldLen" v-model="form.fieldLen" :disabled="pageInfo.type === 'view'" />
                <Field label="允许为空" prop="fieldNull" v-model="form.fieldNull" :disabled="pageInfo.type === 'view'" :enumData='dict.fieldNull' type='select' />
                <Field label="输入方式" prop="inputType" v-model="form.inputType" :disabled="pageInfo.type === 'view'" :enumData='dict.inputType' type='select' />
                <Field label="数据来源" prop="dataSource" v-model="form.dataSource" :disabled="pageInfo.type === 'view'"/>

                <Field label="排序号" prop="fieldOrderNo" v-model="form.fieldOrderNo" :disabled="pageInfo.type === 'view'" />
                <Field label="是否启用" prop="enabled" v-model="form.enabled" :disabled="pageInfo.type === 'view'" :enumData='dict.enabled' type='select' />
                <Field label="备注" prop="remark" v-model="form.remark" :span='24' :disabled="pageInfo.type === 'view'" />
            </el-row>
            <form-buttons @submit='submitForm' />
        </el-form>
    </layout-form>
</template>

<script>
import form from "@/assets/mixins/form";
export default {
    mixins: [form],
    data() {
        return {
            toString: ["eventCode", "fieldType", "fieldNull", "enabled", "inputType"],
            rules: {
                eventCode: [
                    {
                        required: true,
                        message: "请输入事件编码",
                        trigger: "blur",
                    },
                ],
                fieldCode: [
                    {
                        required: true,
                        message: "请输入字段编码",
                        trigger: "blur",
                    },
                ],
                fieldName: [
                    {
                        required: true,
                        message: "请输入字段名称",
                        trigger: "blur",
                    },
                ],
                fieldType: [
                    {
                        required: true,
                        message: "请输入数据类型",
                        trigger: "blur",
                    },
                ],
                fieldLen: [
                    {
                        required: true,
                        message: "请输入数据长度",
                        trigger: "blur",
                    },
                ],
                fieldNull: [
                    {
                        required: true,
                        message: "请输入允许为空",
                        trigger: "blur",
                    },
                ],
                fieldOrderNo: [
                    {
                        required: true,
                        message: "请输入排序号",
                        trigger: "blur",
                    },
                ],
                enabled: [
                    {
                        required: true,
                        message: "请输入是否启用",
                        trigger: "blur",
                    },
                ],
              inputType: [
                {
                  required: true,
                  message: "请选择输入方式",
                  trigger: "blur",
                },
              ],
            },
        };
    },
};
</script>
