/**
 * 预防检查任务单表格配置
 */
import type { TableColumnProps } from '@/types/basic-table';

export const TABLE_MANAGEMENT_HEIGHT_DEFAULT = 'calc(65vh - 50px)';
export const TABLE_MANAGEMENT_HEIGHT_NOT_PERMISSION = 'calc(70vh - 50px)';

// 基础表格样式配置
const TABLE_OPTIONS_DEFAULT = {
  emptyText: '暂无数据',
  loading: true
};
// 任务管理表格样式配置
export const TABLE_OPTIONS_MANAGEMENT = {
  ...TABLE_OPTIONS_DEFAULT,
};
// 任务执行表格样式配置
export const TABLE_OPTIONS_EXECUTION = {
  ...TABLE_OPTIONS_DEFAULT,
  maxHeight: TABLE_MANAGEMENT_HEIGHT_NOT_PERMISSION,
};

// 基础表格列配置
const BASIC_TABLE_COLUMNS = {
  TASK_NAME: {
    prop: 'name',
    label: '任务名称',
    slot: 'taskName',
    width: '220px',
  },
  SELF_CHECK_UNIT: {
    prop: 'deptName',
    label: '被检查（自查）所/部/中心',
    minWidth: '200px',
  },
  INSPECT_TYPE: {
    prop: 'inspectType',
    label: '检查类型',
    slot: 'inspectType',
    minWidth: '120px',
  },
  DUE_COMPLETE_TIME: {
    prop: 'dueCompleteTime',
    label: '应完成时间',
    minWidth: '200px',
  },
  TASK_STAGE: {
    prop: 'taskState',
    label: '任务阶段',
    slot: 'taskStage',
    minWidth: '120px',
  },
  ACTION: {
    prop: 'action',
    label: '操作',
    align: 'center',
    slot: 'action',
    width: '250px',
    fixed: 'right',
  },
};

// 任务管理表格列配置
export const TASK_MANAGEMENT_TABLE_COLUMNS: TableColumnProps[] = [
  {
    prop: 'select',
    label: '',
    type: 'selection',
    align: 'center',
    width: '80px',
  },
  BASIC_TABLE_COLUMNS.TASK_NAME,
  BASIC_TABLE_COLUMNS.SELF_CHECK_UNIT,
  BASIC_TABLE_COLUMNS.INSPECT_TYPE,
  BASIC_TABLE_COLUMNS.DUE_COMPLETE_TIME,
  {
    prop: 'effectStatus',
    label: '生效状态',
    slot: 'effectStatus',
    width: '120px',
  },
  BASIC_TABLE_COLUMNS.TASK_STAGE,
  {
    label: '执行人员',
    slot: 'executive',
    minWidth: '300px'
  },
  {
    prop: 'updatedAt',
    label: '创建时间',
    minWidth: '200px',
  },
  BASIC_TABLE_COLUMNS.ACTION,
];

// 任务执行表格列配置
export const TASK_EXECUTION_TABLE_COLUMNS: TableColumnProps[] = [
  BASIC_TABLE_COLUMNS.TASK_NAME,
  BASIC_TABLE_COLUMNS.SELF_CHECK_UNIT,
  BASIC_TABLE_COLUMNS.INSPECT_TYPE,
  BASIC_TABLE_COLUMNS.DUE_COMPLETE_TIME,
  BASIC_TABLE_COLUMNS.TASK_STAGE,
  BASIC_TABLE_COLUMNS.ACTION,
];
