<template>
  <div>
    <div class="search-wrap">
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px">
        <el-form-item label="手机号" class="margin-bottom30" prop="tell">
          <el-input v-model="ruleForm.tell" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="账户" class="margin-bottom30" prop="username">
          <el-input v-model="ruleForm.username" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="邮箱" class="margin-bottom30" prop="email">
          <el-input v-model="ruleForm.email" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="密码" class="margin-bottom30" prop="pwd">
          <el-input type="password" v-model="ruleForm.pwd" autocomplete="off" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="车牌号" class="margin-bottom30" prop="carnum">
          <el-input v-model="ruleForm.carnum" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="用户级别" class="margin-bottom30" prop="level">
          <el-input v-model="ruleForm.level" style="width: 300px" disabled></el-input>
        </el-form-item>
        <el-form-item label="注册时间" class="margin-bottom30" prop="starttime">
          <el-input v-model="ruleForm.starttime" style="width: 300px" disabled></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
          <el-button @click="resetForm('ruleForm')">取消</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        ruleForm: {
          tell: '15143323434',
          username: '万八',
          email: '15143323434@163.com',
          pwd: '232342',
          carnum: '京A32345',
          starttime: '2019-08-17',
          level: '普通'
        },
        rules: {
          tell: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          username: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          email: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          pwd: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          carnum: [
            { required: true, message: '请输入活动名称', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],

        }
      }
    },
    methods: {
      onSubmit() {
        console.log('submit!');
      },
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>

<style lang="scss">
  .search-wrap{
    background-color: #FFF;
    padding: 15px;
  }
  .card-second-top{
    margin-top: 15px;
  }
  .el-card__header{
    padding: 10px 20px;
  }
  .el-radio{
    margin-right: 80px;
  }
  .el-radio.is-bordered+.el-radio.is-bordered{
    margin-left: 0px;
    margin-top: 15px;
  }
  .margin-bottom30{
    margin-bottom: 30px;
  }
</style>
