<template>
  <el-dialog :close-on-click-modal="false" custom-class="edit-dialog" width="60%" :close-on-press-escape="false" :visible.sync="dialogVisible" :title="title">
    <EditDialogContent>
      <el-form ref="form" :model="form" label-width="180" :rules="rules">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工号" prop="workNumber">
              <el-input v-model="form.workNumber" placeholder="请输入工号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="司机姓名" prop="driverName">
              <el-input v-model="form.driverName" placeholder="请输入司机姓名" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="出生年月" prop="birthdate">
              <el-date-picker clearable
                v-model="form.birthdate"
                style="width:100%;"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择出生年月">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="性别" prop="sex">
              <el-input v-model="form.sex" placeholder="请输入性别" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="手机号码" prop="mobileNumber">
              <el-input v-model="form.mobileNumber" placeholder="请输入手机号码" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="身份证号" prop="idNumber">
              <el-input v-model="form.idNumber" placeholder="请输入身份证号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </EditDialogContent>
    <span slot="footer" class="dialog-footer">
      <el-button @click="closeVisible">取消</el-button>
      <el-button type="primary" @click="submitForm">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import EditDialogContent from '@/components/EditDialogContent';
import TableEditMixin from '@/mixins/table-edit-mixin';
import { addDriver, updateDriver } from "@/api/gangkou/drvier/driver";

export default {
  name: 'EditDialog',
  mixins: [TableEditMixin],
  components: {EditDialogContent},
  pageInfo: {
    defaultForm: {
      workNumber: null,
      driverName: null,
      birthdate: null,
      idNumber: null,
      sex: null,
      mobileNumber: null,
      isGenerate: null,
      remark: null,
    },
    title: '司机档案',
    updateApi: updateDriver,
    addApi: addDriver,
  },
  data() {
    return {
      rules: {
        workNumber: [
          { required: true, message: "工号不能为空", trigger: "blur" }
        ],
        driverName: [
          { required: true, message: "司机姓名不能为空", trigger: "blur" }
        ],
        idNumber: [
          { required: true, message: "身份证号不能为空", trigger: "blur" }
        ],
        mobileNumber: [
          { required: true, message: "手机号码不能为空", trigger: "blur" }
        ],
      }
    }
  },
  methods: {
  }
}
</script>

<style scoped lang="scss">
</style>