<template>
  <div id="index">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="one">
          <el-form
            label-position="top"
            ref="ruleFormRef"
            :model="form"
            :rules="rules"
            label-width="80px"
            class="form"
          >
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="姓名" prop="name">
                  <el-input clearable v-model="form.name" placeholder="请输入姓名"> </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="电话号" prop="phone">
                  <el-input clearable v-model="form.phone" placeholder="请输入电话号"> </el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="证件类型" prop="cardType">
                  <el-select clearable v-model="form.cardType" placeholder="请选择证件类型">
                    <el-option
                      v-for="(item, index) in cardTypeList"
                      :key="index"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件号码" prop="card">
                  <el-input clearable v-model="form.card" placeholder="请输入证件号码"> </el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="微信/QQ" prop="communication">
                  <el-input clearable v-model="form.communication" placeholder="请输入微信/QQ">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="电子邮箱" prop="email">
                  <el-input clearable v-model="form.email" placeholder="请输入电子邮箱"> </el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="备注" prop="brief">
              <el-input
                v-model="form.remark"
                :autosize="{ minRows: 2, maxRows: 8 }"
                type="textarea"
                placeholder="请输入备注"
              />
            </el-form-item>
            <el-form-item>
              <el-col :span="24" class="button">
                <el-button type="primary" @click="submitForm(ruleFormRef)">保存</el-button>
              </el-col>
            </el-form-item>
          </el-form>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
const ruleFormRef = inject('ruleFormRef')
const form = inject('form')
const rules = inject('rules')
const cardTypeList = inject('cardTypeList')
const submitForm = inject('submitForm')
</script>
<style scoped lang="scss">
.main {
  .one {
    .button {
      text-align: center;
    }
  }
}
</style>
