export const addressTypeOptions = [
  { label: '常规地址', value: '常规地址' },
  { label: '港口/码头', value: '港口/码头' },
  { label: '铁路车站', value: '铁路车站' },
  { label: '空港机场', value: '空港机场' },
];

export const createOption = ({ validateLongitude, validateLatitude }) => ({
  height: 'auto',
  calcHeight: 32,
  dialogWidth: 980,
  tip: false,
  searchShow: true,
  searchMenuSpan: 24,
  searchIcon: true,
  searchIndex: 8,
  searchMenuPosition: 'right',
  border: true,
  index: true,
  indexLabel: '序号',
  indexWidth: 70,
  selection: true,
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  dialogClickModal: false,
  menuWidth: 180,
  column: [
    {
      label: '地址名称',
      prop: 'addressName',
      search: true,
      minWidth: 150,
      rules: [{ required: true, message: '请输入地址名称', trigger: 'blur' }],
    },
    {
      label: '地址编号',
      prop: 'addressCode',
      minWidth: 120,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '类型',
      prop: 'addressType',
      type: 'select',
      search: true,
      dicData: addressTypeOptions,
      rules: [{ required: true, message: '请选择类型', trigger: 'change' }],
    },
    {
      label: '来源主数据',
      prop: 'sourceId',
      formslot: true,
      hide: true,
      span: 24,
    },
    {
      label: '站点编码',
      prop: 'siteCodeDisplay',
      search: false,
      minWidth: 120,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '站点编码',
      prop: 'siteCode',
      search: true,
      hide: true,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '详细地址',
      prop: 'detailAddress',
      search: true,
      formslot: true,
      type: 'textarea',
      minRows: 3,
      span: 24,
      minWidth: 220,
      rules: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
    },
    {
      label: '经度',
      prop: 'longitude',
      formslot: true,
      minWidth: 120,
      rules: [{ validator: validateLongitude, trigger: 'blur' }],
    },
    {
      label: '纬度',
      prop: 'latitude',
      formslot: true,
      minWidth: 120,
      rules: [{ validator: validateLatitude, trigger: 'blur' }],
    },
    {
      label: '行政区划',
      prop: 'regionName',
      search: true,
      minWidth: 150,
      rules: [{ required: true, message: '请输入行政区划', trigger: 'blur' }],
    },
    {
      label: '组织',
      prop: 'deptId',
      type: 'select',
      search: true,
      hide: true,
      display: false,
      dicData: [],
    },
    {
      label: '组织',
      prop: 'deptName',
      minWidth: 150,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '联系人',
      prop: 'contactName',
      search: true,
      minWidth: 110,
    },
    {
      label: '联系方式',
      prop: 'contactPhone',
      search: true,
      minWidth: 130,
    },
    {
      label: '备注',
      prop: 'remark',
      type: 'textarea',
      minRows: 4,
      span: 24,
      hide: true,
      maxlength: 200,
      showWordLimit: true,
      rules: [{ max: 200, message: '备注不能超过200个字', trigger: 'blur' }],
    },
    {
      label: '更新人',
      prop: 'updateUserName',
      minWidth: 120,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '更新时间',
      prop: 'updateTime',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      minWidth: 160,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '创建时间',
      prop: 'createTime',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      minWidth: 160,
      addDisplay: false,
      editDisplay: false,
    },
  ],
});
