import {
  auditColumns,
  createCrudOption,
  nodeOptions,
  processStatusOptions,
  selectRule,
  textRule,
} from './common';
import { applyTableMenuWidth } from '@/utils/table-menu';

export const config = {
  title: '过程配置',
  permission: 'process_config',
  exportUrl: '/blade-transport/process-config/export-process-config',
  exportName: '过程配置',
  enableAllDept: false,
  actions: ['copy', 'enable', 'disable'],
  statusProp: 'status',
  statusTextProp: 'statusName',
  deleteStatus: [0, 2],
};

export const option = applyTableMenuWidth({
  ...createCrudOption([
    {
      label: '',
      prop: 'basicInfo',
      formslot: true,
      span: 24,
      hide: true,
    },
    {
      label: '配置编号',
      prop: 'configCode',
      search: true,
      searchOrder: 4,
      minWidth: 130,
      addDisplay: false,
      editDisplay: false,
      editDisabled: true,
    },
    {
      label: '配置名称',
      prop: 'configName',
      search: true,
      searchOrder: 6,
      span: 12,
      minWidth: 150,
      addDisplay: false,
      editDisplay: false,
      rules: textRule('配置名称', 100, true),
    },
    {
      label: '项目ID集合',
      prop: 'projectIds',
      hide: true,
      display: false,
      addDisplay: false,
      editDisplay: false,
      rules: textRule('项目ID集合', 1000, true),
    },
    {
      label: '项目',
      prop: 'projectNames',
      formslot: true,
      search: true,
      searchOrder: 5,
      searchType: 'select',
      type: 'textarea',
      minRows: 2,
      span: 12,
      minWidth: 180,
      dicData: [],
      filterable: true,
      addDisplay: false,
      editDisplay: false,
      rules: textRule('项目', 1000, true),
    },
    {
      label: '包含过程节点',
      prop: 'includedNodes',
      search: true,
      searchOrder: 3,
      type: 'select',
      multiple: true,
      dicData: nodeOptions,
      minWidth: 180,
      rules: selectRule('包含过程节点'),
    },
    {
      label: '默认完成运输天数',
      prop: 'defaultFinishDays',
      formslot: true,
      type: 'number',
      min: 1,
      max: 999,
      span: 12,
      minWidth: 150,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '状态',
      prop: 'status',
      type: 'select',
      search: true,
      searchOrder: 1,
      dicData: processStatusOptions,
      slot: true,
      minWidth: 100,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '组织',
      prop: 'deptName',
      search: true,
      searchOrder: 2,
      minWidth: 150,
      addDisplay: false,
      editDisplay: false,
    },
    {
      label: '',
      prop: 'nodeConfigJson',
      formslot: true,
      span: 24,
      hide: true,
    },
    {
      label: '备注',
      prop: 'remark',
      type: 'textarea',
      minRows: 4,
      span: 24,
      hide: true,
      addDisplay: false,
      editDisplay: false,
      maxlength: 500,
      showWordLimit: true,
      rules: textRule('备注', 500),
    },
    ...auditColumns,
  ]),
  dialogTop: '10px',
  dialogWidth: '96%',
  searchSpan: 8,
}, 5);
