import { ProjectStatus } from '@/utils/enums';

export const ProjectUtils = {
  // 获取项目截止时间展示
  getProjectExpireTime(row) {
    switch (row.status) {
      case ProjectStatus.WAIT_START:
        return {
          label: '预计开始时间',
          value: row.expireTime
        };
      case ProjectStatus.IN_PROGRESS:
      case ProjectStatus.COMPLETED:
      case ProjectStatus.DEVELOPMENT_OVERDUE:
        return {
          label: '预计完成时间',
          value: row.expectedCompleteTime
        };
      case ProjectStatus.MAINTENANCE:
      case ProjectStatus.MAINTENANCE_OVERDUE:
        return {
          label: '预计结束时间',
          value: row.maintenanceEndDate
        };
      default:
        return {
          label: '截止时间',
          value: row.expireTime
        };
    }
  },
  // 判断项目是否逾期
  isOverdue(row) {
    const { value } = this.getProjectExpireTime(row);
    return new Date(value) < new Date();
  },
  // 判断项目是否即将到期
  
}