<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="deviceName" v-model="form.deviceName" placeholder="请输入设备名称"/>
                        <Field label="设备编码" prop="deviceCode" v-model="form.deviceCode" type="textarea" placeholder="请输入设备编码"/>
                        <Field label="设备类型" prop="deviceType" v-model="form.deviceType" type="select" :enumData="dict.deviceType" placeholder="请选择设备类型"/>
                        <Field label="设备的MAC地址" prop="deviceMac" v-model="form.deviceMac" placeholder="请输入设备的MAC地址"/>
                        <Field label="设备访问ip" prop="ip" v-model="form.ip" placeholder="请输入设备访问ip"/>
                        <Field label="中心设备编码" prop="centernum" v-model="form.centernum" placeholder="请输入中心设备编码"/>
                        <Field label="端口" prop="port" v-model="form.port" placeholder="请输入端口"/>
                        <Field label="站点编号" prop="siteNum" v-model="form.siteNum" placeholder="请输入站点编号"/>
                        <Field label="设备生产厂商ID" prop="deviceFirmId" v-model="form.deviceFirmId" placeholder="请输入设备生产厂商ID"/>
                        <Field label="设备生产厂商名称" prop="deviceFirmname" v-model="form.deviceFirmname" placeholder="请输入设备生产厂商名称"/>
                        <Field label="在线状态 " prop="deviceOnlineStatus" v-model="form.deviceOnlineStatus" type="select" :enumData="dict.deviceOnlineStatus" placeholder="请选择在线状态 "/>
                        <Field label="启用状态 " prop="status" v-model="form.status" type="select" :enumData="dict.status" placeholder="请选择启用状态 "/>
                        <Field label="备注" prop="deviceRemark" v-model="form.deviceRemark" type="textarea" placeholder="请输入备注"/>
                        <Field label="最近上线时间" prop="onlineTime" v-model="form.onlineTime" type="date" />
                        <Field label="最近离线时间" prop="offlineTime" v-model="form.offlineTime" type="date" />
            </el-row>

            <form-buttons @submit='submitForm' :noSaveBtn="pageInfo.type === 'view'"/>
        </el-form>
    </layout-form>
</template>

<script>
    import form from "@/assets/mixins/form";
    export default {
        mixins: [form],
        components: {
        },
        methods: {


        },
        data() {
            return {
                toString:[
                    "deviceType",
                    "deviceOnlineStatus",
                    "status",
                ],
                rules: {
                    deviceName: [
                        {required: true,message: "请输入设备名称", trigger: "blur" },
                        {max: 20,message: "最多只能录入20个字符",trigger: "blur",},
                    ],
                    deviceType: [
                        {required: true,message: "请输入设备类型", trigger: "blur" },
                    ],
                    deviceOnlineStatus: [
                        {required: true,message: "请输入在线状态 ", trigger: "blur" },
                    ],
                    status: [
                        {required: true,message: "请输入启用状态 ", trigger: "blur" },
                    ],
                    createTime: [
                        {required: true,message: "请选择创建时间" },
                    ],
                }
            };
        }
    };
</script>