export interface IListQuery {
  customerNo: string
  customerName: string
  contacts: string
  createTimeStart: string
  createTimeEnd: string
  formId: string
  approvalStatus: string
  offset: number
  limit: number
  sort?: string
  order?: string
}

export interface ICustomerInfo {
  id: string
  customerNo: string
  customerName: string
  deptId: string
  customerLocation: string
  customerLocationName?: string
  contacts?: string
  mobile?: string
  phone?: string
  postalCode?: string
  address?: string
  file?: string
  approvalStatus?: string
  approvalStatusName?: string
  processId?: string
  taskId?: string
  remark?: string
  createUserId?: number
  createUserName?: string
  createTime?: string
  decisionItem?: number
}

export interface ICustomerInfoStaff {
  id: string
  customerId: string
  staffName: string
  deptName: string
  staffJob?: string
  mobile?: string
  editable: boolean
}

// 验证手机
export const phoneValidator = (rule: any, value: any, callback: any) => {
  const reg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
  if (reg.test(value.trim()) === true || value.trim() === '') {
    callback()
  }
  else {
    callback(new Error('验证失败'))
  }
}

// 验证座机
export const mobileValidator = (rule: any, value: any, callback: any) => {
  const reg = /^(0\d{2,3}(-)?\d{7,8})$/
  if (reg.test(value.trim()) === true) {
    callback()
  }
  else {
    callback(new Error('验证失败'))
  }
}

// 邮编校验
export const postalCodeValidator = (rule: any, value: any, callback: any) => {
  const reg = /^[0-9]{6}$/
  if (reg.test(value.trim()) === true || value.trim() === '') {
    callback()
  }
  else {
    callback(new Error('验证失败'))
  }
}

export const mobileReg = (val: string) => {
  const reg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
  return reg.test(val)
}
