<template>
  <layout-form>
    <el-form :model="form" :loading="loading" :rules="rules" size='small'  label-width='100px' ref="form">
      <el-row>
        <Field label="仓库名称" prop="name" v-model="form.name" placeholder="请输入仓库名称" :disabled="pageInfo.type == 'view'"/>
				<Field label="仓库编码" prop="code" v-model="form.code" placeholder="请输入仓库编码" :disabled="pageInfo.type !== 'add'"/>
				<Field label="仓库地址" prop="address" v-model="form.address" placeholder="请输入仓库地址" :disabled="pageInfo.type == 'view'"/>
				<Field label="联系人" prop="contactsUser" v-model="form.contactsUser" placeholder="请输入仓库联系人" :disabled="pageInfo.type == 'view'"/>
				<Field label="联系电话" prop="contactsPhone" v-model="form.contactsPhone" placeholder="请输入仓库联系电话" :disabled="pageInfo.type == 'view'"/>
				<Field label="是否启用" prop="status" v-model="form.status" placeholder="请输入启用停用" :enumData='dict.status' type='select' :disabled="pageInfo.type == 'view'" />
				<Field label="备注" prop="remark" v-model="form.remark" :span="24" placeholder="请输入备注" type="textarea" :disabled="pageInfo.type == 'view'"/>
      </el-row>
      <form-buttons @submit='submitForm' v-if="pageInfo.type != 'view'" />
      <el-button @click="$router.go(-1)" size='small' icon='el-icon-circle-close-outline' v-if="pageInfo.type == 'view'">返回</el-button>

    </el-form>
  </layout-form>
</template>

<script>
import form from "@/assets/mixins/form";
import valid from "@/assets/utils/vaild";
export default {
  mixins: [form],
  data() {
    return {
      toString: ["status"],
      rules: {
        name:[{required: true, message: '请输入仓库名称', trigger: 'blur'},
								{max: 50, message: '最多只能录入50个字符', trigger: 'blur'}],
				code:[{max: 50, message: '最多只能录入50个字符', trigger: 'blur'}],
				address:[{required: true, message: '请输入仓库地址', trigger: 'blur'},
								{max: 100, message: '最多只能录入100个字符', trigger: 'blur'}],
				contactsUser:[{required: true, message: '请输入仓库联系人', trigger: 'blur'},
								{max: 50, message: '最多只能录入50个字符', trigger: 'blur'}],
				contactsPhone:[{required: true, message: '请输入仓库联系电话', trigger: 'blur'},
								{validator: this.phone, trigger: 'blur'},
								{max: 50, message: '最多只能录入50个字符', trigger: 'blur'}],
				status:[{required: true, message: '请输入启用停用', trigger: 'blur'}],
				updateTime:[{required: true, message: '请输入变更时间', trigger: 'blur'}],
				updateUser:[{required: true, message: '请输入变更用户loginName', trigger: 'blur'},
								{max: 50, message: '最多只能录入50个字符', trigger: 'blur'}]
      }
    };
  }
};
</script>