import {
  urbanArea
} from '@/assets/js/districtCode'
export const formRules = () => {
  return [{
    field: 'type',
    label: '类型',
    placeholder: '类型',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: true,
      message: '选择客户类型',
      trigger: 'change,blur'
    }],
    options: [{
        label: '商户',
        value: 0,
      },
      {
        label: '私人',
        value: 1,
      },
    ]
  }, {
    field: 'name',
    label: '名字',
    placeholder: '名字',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入名字',
      trigger: 'blur'
    }]
  }, {
    field: 'principalPhone',
    label: '电话',
    placeholder: '电话',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入电话',
      trigger: 'blur'
    }]
  }, {
    field: 'cityRegion',
    type: 'cascader',
    label: '所在城市/地区',
    placeholder: '请选择',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请选择所在城市/地区',
      trigger: 'change,blur'
    }],
    options: urbanArea(),
  }, {
    field: 'address',
    label: '地址',
    placeholder: '地址',
    type: 'input',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请输入地址',
      trigger: 'blur'
    }]
  }, {
    field: 'remark',
    label: '备注',
    placeholder: '备注',
    type: 'textarea',
    colWidth: 24,
  }, {
    field: 'fileList',
    crosswise: true,
    label: '现场图片',
    type: 'upload',
    colWidth: 24,
    rules: [{
      type: 'array',
      required: false,
      message: '请上传现场图片',
      trigger: 'change,blur'
    }],
  }, ]
}

export const employee = () => {
  return [{
    field: 'index',
    label: '序号',
    align: 'center',
  }, {
    field: 'name',
    operation: true,
    label: '名字',
    align: 'center',
    colWidth: '130px',
  }, {
    field: 'principalPhone',
    label: '电话',
    align: 'center',
    colWidth: '130px',
  }, {
    field: 'city',
    label: '所在地市',
    align: 'center',
    colWidth: '130px',
    options: urbanArea(),
  }, {
    field: 'area',
    label: '所属区/县',
    align: 'center',
    colWidth: '130px',
    options: urbanArea(),
  }, {
    field: 'address',
    label: '地址',
    align: 'center',
    colWidth: '200px',
  }, {
    field: 'lng',
    label: '经度',
    align: 'center',
    colWidth: '130px',
  }, {
    field: 'lat',
    label: '纬度',
    align: 'center',
    colWidth: '130px',
  }, {
    field: 'type',
    label: '类型',
    align: 'center',
    colWidth: '130px',
    options: [{
        bgcolor: '#409EFF',
        label: '商户',
        value: 0,
      },
      {
        bgcolor: '#67C23A',
        label: '私人',
        value: 1,
      },
    ]
  }, {
    field: 'remark',
    label: '备注',
    align: 'center',
  }, {
    field: 'action',
    label: '操作',
    colWidth: '200px',
    align: 'center',
    labelButton: [{
      type: 'edit',
      label: '编辑',
      icon: 'el-icon-edit',
      style: 'primary',
    }, {
      type: 'logs',
      label: '查看',
      icon: 'el-icon-tickets',
      style: 'info',
    }, {
      type: 'del',
      label: '删除',
      icon: 'el-icon-delete',
      style: 'danger',
    }]
  }]
}
