import { isValidateMobile } from '@/utils/validate'

const truck = [
  { field: 'truckName', name: '卡车品牌', type: 'autocomplete', required: true, placeholder: '请输入卡车品牌', rules: [{ required: true, message: '请输入卡车品牌' }] },
  { field: 'carNumber', name: '车牌号', required: true, readonly: 'edit', placeholder: '请输入车牌号', rules: [{ required: true, message: '请输入车牌号' }] },
  { field: 'linked', name: '车辆类型', type: 'radio', required: true, rules: [{ required: true, message: '请选择' }], list: [{ name: '其他', value: 1 }, { name: '自营', value: 0 }] },
  { field: 'frameNumber', name: '车架号', required: true, placeholder: '请输入车架号', rules: [{ required: true, message: '请输入车架号' }] },
  { field: 'deadWeight', name: '载重量(吨)', type: 'number', required: true, placeholder: '请输入载重量', rules: [{ required: true, message: '请输入载重量' }] },
  { field: 'capacity', name: '储气罐容量(升)', type: 'number', required: true, placeholder: '请输入储气罐容量', rules: [{ required: true, message: '请输入储气罐容量' }] },
  { field: 'purchaseDate', type: 'date', readonly: 'add', name: '购车日期', required: true, placeholder: '请选择购车时间', rules: [{ required: true, message: '请选择购车时间' }] },
  { field: 'trailerNumber', name: '挂车牌号', placeholder: '请输入挂车牌号', style: 'margin-top: 10px;' },
  { field: 'color', name: '颜色', placeholder: '请输入颜色' },
  { field: 'manufacturer', name: '生产厂家', type: 'autocomplete', placeholder: '请输入生产厂家' },
  // { field: 'status', queryType: 'edit', active: 0, inactive: 1, type: 'switch', name: '车辆状态', style: 'margin-top: 10px;' },
  { field: 'status', type: 'radio', name: '车辆状态', style: 'margin-top: 10px;', required: true, list: [{ name: '停用', value: 1 }, { name: '启用', value: 0 }] },
  { field: 'autoAccount', name: '圈存方式', type: 'radio', required: true, rules: [{ required: true, message: '请选择' }], list: [{ name: '自动圈存', value: 1 }, { name: '手动圈存', value: 0 }] }
]

const driver = [
  { field: 'userName', name: '姓名', required: true, placeholder: '请输入姓名', rules: [{ required: true, message: '请输入姓名' }] },
  { field: 'mobile', name: '手机号', required: true, placeholder: '请输入手机号', rules: [{ required: true, message: '请输入手机号' }, { validator: isValidateMobile, message: '请输入正确手机号码' }] },
  { field: 'userCode', name: '登录名称', placeholder: '请输入登录名称', style: 'margin-top: 10px;' },
  { field: 'status', queryType: 'edit', active: 0, inactive: 1, type: 'switch', name: '账号状态', style: 'margin-top: 10px;' },
  { field: 'resetPwd', queryType: 'edit', type: 'btn', name: '重置密码' }
]

const cashier = [
  { field: 'userName', name: '姓名', required: true, placeholder: '请输入姓名', rules: [{ required: true, message: '请输入姓名' }] },
  { field: 'mobile', name: '手机号', required: true, placeholder: '请输入手机号', rules: [{ required: true, message: '请输入手机号' }, { validator: isValidateMobile, message: '请输入正确手机号码' }] },
  { field: 'userCode', name: '登录名称', placeholder: '请输入登录名称', style: 'margin-top: 10px;' },
  { field: 'status', queryType: 'edit', active: 0, inactive: 1, type: 'switch', name: '账号状态', style: 'margin-top: 10px;' },
  { field: 'resetPwd', queryType: 'edit', type: 'btn', name: '重置密码' }
]

const printer = [
  { field: 'printName', readonly: 'edit', name: '打印机名称', required: true, labelWidth: '5.8rem', placeholder: '请输入打印机名称', rules: [{ required: true, message: '请输入打印机名称' }] },
  { field: 'machineCode', readonly: 'edit', name: '终端号', required: true, labelWidth: '5.8rem', placeholder: '请输入终端号', rules: [{ required: true, message: '请输入终端号' }] },
  { field: 'msign', readonly: 'edit', name: '密钥', required: true, labelWidth: '5.8rem', placeholder: '请输入密钥', rules: [{ required: true, message: '请输入密钥' }] },
  { field: 'phone', readonly: 'edit', name: '流量卡号', required: true, labelWidth: '5.8rem', placeholder: '请输入流量卡号', rules: [{ required: true, message: '请输入流量卡号' }] },
  { field: 'status', type: 'label', queryType: 'edit', disabled: 'edit', name: '状态', list: [{ name: '离线', value: 0 }, { name: '在线', value: 1 }, { name: '缺纸', value: 2 }], labelWidth: '5.8rem' },
  { field: 'print', type: 'radio', labelWidth: '4rem', name: '打印小票', required: true, list: [{ name: '是', value: 1 }, { name: '否', value: 0 }], style: 'margin-top: 10px;' },
  { field: 'voice', type: 'radio', labelWidth: '4rem', name: '语音播报', required: true, list: [{ name: '关闭', value: 0 }, { name: '小', value: 1 }, { name: '中', value: 2 }, { name: '大', value: 3 }] }
]

const stock = [
  { field: 'planTime', type: 'datetime', name: '期望到站时间', required: true, labelWidth: '6.5rem', placeholder: '请选择期望到站时间', rules: [{ required: true, message: '请选择期望到站时间' }] },
  { field: 'downloadContactName', name: '卸车联系人', required: true, labelWidth: '6.5rem', placeholder: '请输入卸车联系人', rules: [{ required: true, message: '请输入卸车联系人' }] },
  { field: 'downloadContactPhone', name: '卸车联系电话', required: true, labelWidth: '6.5rem', placeholder: '请输入卸车联系电话', rules: [{ required: true, message: '请输入卸车联系电话' }, { validator: isValidateMobile, message: '请输入正确手机号码' }] },
  { field: 'businessContactName', readonly: 'add', name: '平台联系人', placeholder: '请输入平台联系人', labelWidth: '6.5rem' },
  { field: 'businessContactPhone', readonly: 'add', name: '平台联系电话', placeholder: '请输入平台联系电话', labelWidth: '6.5rem' }
]

export {
  truck,
  driver,
  cashier,
  printer,
  stock
}
