import {
  auditColumns,
  createCrudOption,
  templateTypeOptions,
  transportTypeOptions,
  selectRule,
  textRule,
} from './common';

export const config = {
  title: '发货模板',
  permission: 'shipping_template',
  exportUrl: '/blade-transport/shipping-template/export-shipping-template',
  exportName: '发货模板',
  enableAllDept: false,
  actions: ['copy'],
};

export const option = createCrudOption([
  {
    label: '模板编号',
    prop: 'templateCode',
    search: true,
    minWidth: 150,
    addDisplay: false,
    editDisabled: true,
  },
  {
    label: '模板名称',
    prop: 'templateName',
    search: true,
    minWidth: 150,
    rules: textRule('模板名称', 50, true),
  },
  {
    label: '模板类型',
    prop: 'templateType',
    type: 'select',
    search: true,
    dicData: templateTypeOptions,
    minWidth: 120,
    value: '运输计划',
    rules: selectRule('模板类型'),
  },
  {
    label: '项目',
    prop: 'projectName',
    search: true,
    minWidth: 150,
    rules: textRule('项目', 100, true),
  },
  {
    label: '项目ID',
    prop: 'projectId',
    hide: true,
  },
  {
    label: '客户合同',
    prop: 'contractName',
    minWidth: 160,
    rules: textRule('客户合同', 100, true),
  },
  {
    label: '客户合同ID',
    prop: 'contractId',
    hide: true,
  },
  {
    label: '运输类型',
    prop: 'transportType',
    type: 'select',
    dicData: transportTypeOptions,
    minWidth: 130,
    rules: selectRule('运输类型'),
  },
  {
    label: '发货地',
    prop: 'departureName',
    minWidth: 140,
    rules: textRule('发货地', 100, true),
  },
  {
    label: '发货地址',
    prop: 'departureAddress',
    minWidth: 220,
    rules: textRule('发货地址', 255, true),
  },
  {
    label: '发货联系人',
    prop: 'departureContact',
    minWidth: 120,
    rules: textRule('发货联系人', 20),
  },
  {
    label: '发货联系方式',
    prop: 'departurePhone',
    minWidth: 140,
    rules: textRule('发货联系方式', 20),
  },
  {
    label: '收货地',
    prop: 'arrivalName',
    minWidth: 140,
    rules: textRule('收货地', 100, true),
  },
  {
    label: '收货地址',
    prop: 'arrivalAddress',
    minWidth: 220,
    rules: textRule('收货地址', 255, true),
  },
  {
    label: '收货联系人',
    prop: 'arrivalContact',
    minWidth: 120,
    rules: textRule('收货联系人', 20),
  },
  {
    label: '收货联系方式',
    prop: 'arrivalPhone',
    minWidth: 140,
    rules: textRule('收货联系方式', 20),
  },
  {
    label: '货物信息JSON',
    prop: 'goodsJson',
    type: 'textarea',
    minRows: 5,
    span: 24,
    hide: true,
  },
  {
    label: '运费信息JSON',
    prop: 'freightJson',
    type: 'textarea',
    minRows: 4,
    span: 24,
    hide: true,
  },
  {
    label: '附件JSON',
    prop: 'attachmentsJson',
    type: 'textarea',
    minRows: 3,
    span: 24,
    hide: true,
  },
  {
    label: '所属组织',
    prop: 'deptName',
    minWidth: 150,
    addDisplay: false,
    editDisplay: false,
  },
  {
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    minRows: 4,
    span: 24,
    hide: true,
    maxlength: 200,
    showWordLimit: true,
    rules: textRule('备注', 200),
  },
  ...auditColumns,
]);
