import { auditColumns, createCrudOption, phoneRule, textRule } from './common';

export const config = {
  title: '常用线路',
  permission: 'common_route',
  exportUrl: '/blade-transport/common-route/export-common-route',
  exportName: '常用线路',
  enableAllDept: false,
};

export const option = createCrudOption([
  {
    label: '线路名称',
    prop: 'routeName',
    search: true,
    searchOrder: 1,
    span: 24,
    minWidth: 150,
    rules: textRule('线路名称', 100, true),
  },
  {
    label: '线路编号',
    prop: 'routeCode',
    search: true,
    searchOrder: 2,
    minWidth: 120,
    addDisplay: false,
    editDisabled: true,
  },
  {
    label: '发货地',
    prop: 'departureName',
    search: true,
    searchOrder: 3,
    minWidth: 140,
    addDisplay: false,
    editDisplay: false,
  },
  {
    label: '发货地址',
    prop: 'departureAddress',
    formslot: true,
    search: true,
    searchOrder: 4,
    span: 24,
    minWidth: 220,
    rules: textRule('发货地址', 255, true),
  },
  {
    label: '发货经度',
    prop: 'departureLongitude',
    type: 'number',
    precision: 6,
    minWidth: 120,
    hide: true,
  },
  {
    label: '发货纬度',
    prop: 'departureLatitude',
    type: 'number',
    precision: 6,
    minWidth: 120,
    hide: true,
  },
  {
    label: '发货联系人',
    prop: 'departureContact',
    minWidth: 120,
    rules: textRule('发货联系人', 50),
  },
  {
    label: '发货联系方式',
    prop: 'departurePhone',
    minWidth: 140,
    rules: [phoneRule('发货联系方式'), ...textRule('发货联系方式', 50)],
  },
  {
    label: '收货地',
    prop: 'arrivalName',
    search: true,
    searchOrder: 5,
    minWidth: 140,
    addDisplay: false,
    editDisplay: false,
  },
  {
    label: '收货地址',
    prop: 'arrivalAddress',
    formslot: true,
    search: true,
    searchOrder: 6,
    span: 24,
    minWidth: 220,
    rules: textRule('收货地址', 255, true),
  },
  {
    label: '收货经度',
    prop: 'arrivalLongitude',
    type: 'number',
    precision: 6,
    minWidth: 120,
    hide: true,
  },
  {
    label: '收货纬度',
    prop: 'arrivalLatitude',
    type: 'number',
    precision: 6,
    minWidth: 120,
    hide: true,
  },
  {
    label: '收货联系人',
    prop: 'arrivalContact',
    minWidth: 120,
    rules: textRule('收货联系人', 50),
  },
  {
    label: '收货联系方式',
    prop: 'arrivalPhone',
    minWidth: 140,
    rules: [phoneRule('收货联系方式'), ...textRule('收货联系方式', 50)],
  },
  {
    label: '组织',
    prop: 'deptName',
    search: true,
    searchOrder: 7,
    minWidth: 150,
    addDisplay: false,
    editDisplay: false,
  },
  {
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    minRows: 4,
    span: 24,
    hide: true,
    maxlength: 500,
    showWordLimit: true,
    rules: textRule('备注', 500),
  },
  ...auditColumns,
]);
