import {
  orderStatus
} from '@/assets/js/blockSort'
export const employee = () => {
  return [{
    field: 'index',
    label: '序号',
    align: 'center',
  }, {
    field: 'nickName',
    label: '姓名',
    align: 'center',
  }, {
    field: 'username',
    label: '用户名',
    align: 'center',
  }, {
    field: 'type',
    label: '类型',
    align: 'center',
    options: orderStatus()
  }, {
    field: 'phone',
    label: '电话号码',
    align: 'center',
  }, {
    field: 'action',
    label: '操作',
    colWidth: '260px',
    align: 'center',
    labelButton: [{
      type: 'edit',
      label: '编辑',
      icon: 'el-icon-edit',
      style: 'primary',
    }, {
      type: 'reset',
      label: '重置密码',
      icon: 'el-icon-refresh-left',
      style: 'warning',
    }, {
      type: 'del',
      label: '删除',
      icon: 'el-icon-delete',
      style: 'danger',
    }]
  }]
}

export const formRules = () => {
  return [{
      field: 'deptId',
      type: 'select',
      label: '公司',
      placeholder: '请选择公司',
      colWidth: 24,
      multiple: false,
      rules: [{
        required: true,
        message: '请选择公司',
        trigger: 'change'
      }],
      options: [],
    }, {
      field: 'name',
      label: '姓名',
      placeholder: '请输入姓名',
      type: 'input',
      colWidth: 24,
      rules: [{
        required: true,
        message: '请输入姓名',
        trigger: 'blur'
      }]
    }, {
      field: 'username',
      label: '用户名',
      placeholder: '请输入用户名',
      type: 'input',
      colWidth: 24,
      rules: [{
        required: true,
        message: '请输入用户名',
        trigger: 'blur'
      }]
    }, {
      field: 'phone',
      label: '电话号码',
      placeholder: '请输入电话号码',
      type: 'input',
      colWidth: 24,
      rules: [{
        required: true,
        message: '请输入电话号码',
        trigger: 'blur'
      }, {
        pattern: /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/,
        message: '请输入正确电话号码',
        trigger: "blur"
      }]
    }, {
      field: 'newPassword',
      label: '密码',
      placeholder: '请输入密码',
      type: 'input',
      colWidth: 24,
      rules: [{
        required: true,
        message: '请输入密码',
        trigger: 'blur'
      }, {
        min: 6,
        message: '长度不能小于6个字符',
        trigger: 'blur'
      }]
    }, {
      field: 'password',
      label: '确定密码',
      placeholder: '请再次输入密码',
      type: 'input',
      colWidth: 24,
      rules: [{
        required: true,
        message: '请再次输入密码',
        trigger: 'blur'
      }, {
        min: 6,
        message: '长度不能小于6个字符',
        trigger: 'blur'
      }]
    },
    {
      field: 'type',
      label: '客户类型',
      placeholder: '客户类型',
      type: 'radio',
      colWidth: 24,
      rules: [{
        required: true,
        message: '选择客户类型',
        trigger: 'change'
      }],
      options: orderStatus()
    },
  ]
}

export const formRulesil = () => {
  return [{
      field: 'name',
      label: '姓名',
      placeholder: '请输入姓名',
      type: 'input',
      colWidth: 24,
      rules: [{
        required: true,
        message: '请输入姓名',
        trigger: 'blur'
      }]
    }, {
      field: 'phone',
      label: '电话号码',
      placeholder: '请输入电话号码',
      type: 'input',
      colWidth: 24,
      rules: [{
        required: true,
        message: '请输入电话号码',
        trigger: 'blur'
      }, {
        pattern: /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/,
        message: '请输入正确电话号码',
        trigger: "blur"
      }]
    },
    {
      field: 'type',
      label: '客户类型',
      placeholder: '客户类型',
      type: 'radio',
      colWidth: 24,
      rules: [{
        required: true,
        message: '选择客户类型',
        trigger: 'change'
      }],
      options: orderStatus()
    },
  ]
}
