// 工单状态 ,查询用
export enum OrderStatusEnum {
    WAITING = '',
    DETECTING = '3,9',
    TOBECONFIRM = 4,
    REPAIRING = 5,
    COMPLETE = 6
}

// 巡检工单状态
export enum InspectionOrderStatusEnum {
    WAITING = '',
    TOINSPECTING = 6,
    INSPECTING = 3,
    COMPLETE = 4
}
// 工单类型
export enum WorkOrderTypeEnum {
    OVERHAUL = 1,
    REPAIR = 2,
    INSPECTION = 3
}

export const workOrderTypeMap: Record<number, string> = {
    [WorkOrderTypeEnum.OVERHAUL]: '检修单',
    [WorkOrderTypeEnum.REPAIR]: '维修单',
    [WorkOrderTypeEnum.INSPECTION]: '巡检单'
}

// 是否维修
export enum RepairTypeEnum {
    YES = 1,
    NO = 0
}

// 配送方式
export enum DeliveryMethodEnum {
    LOGISTICS = 0,
    VISIT = 1,
    HOMEDILIVERY = 2
}
export const deliveryMethodMap: Record<number, string> = {
    [DeliveryMethodEnum.LOGISTICS]: '快递物流',
    [DeliveryMethodEnum.VISIT]: '上门取件',
    [DeliveryMethodEnum.HOMEDILIVERY]: '送货上门'
}

// 模块返修物流方式
export enum LogisticsModeEnum {
    LOGISTICS = 0,
    TACKBACK = 1
}
export const logisticsModeMap: Record<number, string> = {
    [LogisticsModeEnum.LOGISTICS]: '快递物流',
    [LogisticsModeEnum.TACKBACK]: '自领带回'
}

// 配件领用的状态
export enum ReceiveFlowEnum {
    TOAUDIT = 0,
    NOPASS = 1,
    TOBERECEIVE = 2,
    TOCONFIRM = 3,
    COMPLETE = 4
}
export const receiveFlowColor: Record<number, string> = {
    [ReceiveFlowEnum.TOAUDIT]: '#FDBA33',
    [ReceiveFlowEnum.NOPASS]: '#F5222D',
    [ReceiveFlowEnum.TOBERECEIVE]: '#8E5FA2',
    [ReceiveFlowEnum.TOCONFIRM]: '#4F8BC9',
    [ReceiveFlowEnum.COMPLETE]: '#46B97B'
}

export const receiveFlowMap: Record<number, string> = {
    [ReceiveFlowEnum.TOAUDIT]: '未审核',
    [ReceiveFlowEnum.NOPASS]: '未通过',
    [ReceiveFlowEnum.TOBERECEIVE]: '待领取',
    [ReceiveFlowEnum.TOCONFIRM]: '待确认',
    [ReceiveFlowEnum.COMPLETE]: '已完成'
}

// 维修单审核的状态
export enum RepaireOrderAuditEnum {
    TOAUDIT = 0,
    TOINSTORAGE = 1,
    NOPASS = 2,
    COMPLETE = 3
}
export const repaireOrderAuditColor: Record<number, string> = {
    [RepaireOrderAuditEnum.TOAUDIT]: '#FDBA33',
    [RepaireOrderAuditEnum.TOINSTORAGE]: '#8E5FA2',
    [RepaireOrderAuditEnum.NOPASS]: '#F5222D',
    [RepaireOrderAuditEnum.COMPLETE]: '#46B97B'
}

export const repaireOrderAuditMap: Record<number, string> = {
    [RepaireOrderAuditEnum.TOAUDIT]: '待审核',
    [RepaireOrderAuditEnum.TOINSTORAGE]: '待入库',
    [RepaireOrderAuditEnum.NOPASS]: '审核未通过',
    [RepaireOrderAuditEnum.COMPLETE]: '已完成'
}

// 检修工单状态
export enum WorkOrderStatusEnum {
    CREATED = 0,
    WAITING = 1,
    OVERTIME = 2,
    DETECTING = 3,
    TOBECOMFIRMED = 4,
    INMAINTENANCE = 5,
    COMPLETE = 6,
    RETURNEDORDER = 7,
    CLOSED = 8,
    SENDBACK = 9
}

/** 检修工单状态 */
export const workOrderColor: Record<number, string> = {
    [WorkOrderStatusEnum.CREATED]: '#2977FB',
    [WorkOrderStatusEnum.WAITING]: '#2977FB',
    [WorkOrderStatusEnum.OVERTIME]: '#F52B36',
    [WorkOrderStatusEnum.DETECTING]: '#DFBA4B',
    [WorkOrderStatusEnum.TOBECOMFIRMED]: '#91BBFF',
    [WorkOrderStatusEnum.INMAINTENANCE]: '#F9C963',
    [WorkOrderStatusEnum.COMPLETE]: '#76CA9D',
    [WorkOrderStatusEnum.RETURNEDORDER]: '#0E66FB',
    [WorkOrderStatusEnum.CLOSED]: '#FD384D',
    [WorkOrderStatusEnum.SENDBACK]: '#ee4555'
}

export const workOrderStatusMap: Record<number, string> = {
    [WorkOrderStatusEnum.CREATED]: '待抢单',
    [WorkOrderStatusEnum.WAITING]: '待接单',
    [WorkOrderStatusEnum.OVERTIME]: '接单超时',
    [WorkOrderStatusEnum.DETECTING]: '检测中',
    [WorkOrderStatusEnum.TOBECOMFIRMED]: '待确认',
    [WorkOrderStatusEnum.INMAINTENANCE]: '维修中',
    [WorkOrderStatusEnum.COMPLETE]: '已完成',
    [WorkOrderStatusEnum.RETURNEDORDER]: '已退单',
    [WorkOrderStatusEnum.CLOSED]: '已关闭',
    [WorkOrderStatusEnum.SENDBACK]: '已退回'
}

export enum InspectWorkOrderStatusEnum {
    CREATED = 0,
    WAITING = 1,
    OVERTIME = 2,
    INSPECTING = 3,
    COMPLETE = 4,
    RETURNEDORDER = 5,
    TOINSPECT = 6
}

/** 巡检工单状态 */
export const inspectWorkOrderColor: Record<number, string> = {
    [InspectWorkOrderStatusEnum.CREATED]: '#2977FB',
    [InspectWorkOrderStatusEnum.WAITING]: '#2977FB',
    [InspectWorkOrderStatusEnum.OVERTIME]: '#F52B36',
    [InspectWorkOrderStatusEnum.INSPECTING]: '#DFBA4B',
    [InspectWorkOrderStatusEnum.COMPLETE]: '#76CA9D',
    [InspectWorkOrderStatusEnum.RETURNEDORDER]: '#BFB500',
    [InspectWorkOrderStatusEnum.TOINSPECT]: '#91BBFF'
}

export const inspectWorkOrderStatusMap: Record<number, string> = {
    [InspectWorkOrderStatusEnum.CREATED]: '待抢单',
    [InspectWorkOrderStatusEnum.WAITING]: '待接单',
    [InspectWorkOrderStatusEnum.OVERTIME]: '接单超时',
    [InspectWorkOrderStatusEnum.INSPECTING]: '巡检中',
    [InspectWorkOrderStatusEnum.COMPLETE]: '已完成',
    [InspectWorkOrderStatusEnum.RETURNEDORDER]: '已退单',
    [InspectWorkOrderStatusEnum.TOINSPECT]: '待巡检'
}

export enum RepairOrderStatusEnum {
    WAITING = 0,
    TOREPAIR = 1,
    CHECKING = 2,
    INREVIEW = 3,
    REPAIRING = 4,
    TESTING = 5,
    COMPLETE = 6
}

/** 维修工单状态 */
export const repairOrderColor: Record<number, string> = {
    [RepairOrderStatusEnum.WAITING]: '#2977FB',
    [RepairOrderStatusEnum.TOREPAIR]: '#DFBA49',
    [RepairOrderStatusEnum.CHECKING]: '#8E5FA2',
    [RepairOrderStatusEnum.INREVIEW]: '#6AA3FF',
    [RepairOrderStatusEnum.REPAIRING]: '#F9C85E',
    [RepairOrderStatusEnum.TESTING]: '#4F8BC9',
    [RepairOrderStatusEnum.COMPLETE]: '#76CA9D'
}
export const repairOrderStatusMap: Record<number, string> = {
    [RepairOrderStatusEnum.WAITING]: '待派单',
    [RepairOrderStatusEnum.TOREPAIR]: '待维修',
    [RepairOrderStatusEnum.CHECKING]: '排查中',
    [RepairOrderStatusEnum.INREVIEW]: '审核中',
    [RepairOrderStatusEnum.REPAIRING]: '维修中',
    [RepairOrderStatusEnum.TESTING]: '测试中',
    [RepairOrderStatusEnum.COMPLETE]: '已完成'
}
// 维修工单步骤
export enum RepairStepEnum {
    DISMANTLE = 0,
    CLEAN = 1,
    FAULTCHECK = 2,
    SIGN = 3,
    SPAREPARTS = 4,
    BEFOREREPAIR = 5,
    ONREPAIRING = 6,
    AFTERREPAIR = 7,
    FEATURE = 8,
    DCPFC = 9,
    ANTIPAINTGLUE = 10,
    MODULEASSEMBLY = 11,
    AGING = 12,
    FILLIN = 13,
    INSTORAGE = 14
}
export const repairStepMap: Record<number, string> = {
    [RepairStepEnum.DISMANTLE]: '拆机',
    [RepairStepEnum.CLEAN]: '除尘',
    [RepairStepEnum.FAULTCHECK]: '故障排查',
    [RepairStepEnum.SIGN]: '确认签名',
    [RepairStepEnum.SPAREPARTS]: '重领配件',
    [RepairStepEnum.BEFOREREPAIR]: '上传维修前图片',
    [RepairStepEnum.ONREPAIRING]: '上传维修中图片',
    [RepairStepEnum.AFTERREPAIR]: '上传维修后图片',
    [RepairStepEnum.FEATURE]: '功能测试',
    [RepairStepEnum.DCPFC]: 'DC&PFC组装',
    [RepairStepEnum.ANTIPAINTGLUE]: '补强三防漆和点胶',
    [RepairStepEnum.MODULEASSEMBLY]: '模块装配',
    [RepairStepEnum.AGING]: '老化测试',
    [RepairStepEnum.FILLIN]: '填写维修信息',
    [RepairStepEnum.INSTORAGE]: '良品入库'
}

// 优先级
export enum PriorityEnum {
    UTGENT = 1,
    NORMAL = 0
}

export const priorityColor: Record<number, string> = {
    [PriorityEnum.UTGENT]: '#FDBA33',
    [PriorityEnum.NORMAL]: '#0E66FB'
}
export const priorityMap: Record<number, string> = {
    [PriorityEnum.UTGENT]: '加急',
    [PriorityEnum.NORMAL]: '普通'
}

// 是否
export enum YesOrNoEnum {
    YES = 0,
    NO = 1
}

export const yesOrNoColor: Record<number, string> = {
    [YesOrNoEnum.YES]: '#0E66FB',
    [YesOrNoEnum.NO]: '#FDBA33'
}
export const yesOrNoMap: Record<number, string> = {
    [YesOrNoEnum.YES]: '是',
    [YesOrNoEnum.NO]: '否'
}

export const normalColor: Record<number, string> = {
    [YesOrNoEnum.YES]: '#76CA9D',
    [YesOrNoEnum.NO]: '#FDBA33'
}
export const normalMap: Record<number, string> = {
    [YesOrNoEnum.YES]: '正常',
    [YesOrNoEnum.NO]: '异常'
}

// 常见问题
export enum FaultTypeEnum {
    PROBLEM = 0, //常见故障
    OVERHAUL = 1, //检修结论
    REPAIR = 2, //维修结论
    SCRAP = 3, //报废类型
    PHENOMENON = 4, //故障现象
    CAUSEOFDAMAGE = 5, //损坏原因
    SUGGESTION = 6 //运维建议
}

export const faultTypeMap: Record<number, string> = {
    [FaultTypeEnum.PROBLEM]: '常见故障',
    [FaultTypeEnum.OVERHAUL]: '常见检修结论',
    [FaultTypeEnum.REPAIR]: '常见维修结论',
    [FaultTypeEnum.SCRAP]: '报废类型',
    [FaultTypeEnum.PHENOMENON]: '故障现象',
    [FaultTypeEnum.CAUSEOFDAMAGE]: '损坏原因',
    [FaultTypeEnum.SUGGESTION]: '运维建议'
}

// 接单状态
export enum ReceiveOrderStatusEnum {
    ONLEAVE = 0,
    WORKING = 1,
    AVALIABLE = 2
}

export const receiveOrderStatusMap: Record<number, string> = {
    [ReceiveOrderStatusEnum.ONLEAVE]: '休假/停止接单中',
    [ReceiveOrderStatusEnum.WORKING]: '作业中',
    [ReceiveOrderStatusEnum.AVALIABLE]: '可接单'
}

// 工单来源
export enum OrderSourceEnum {
    CLIENT = 0,
    SYSTEM = 1,
    REPAIR = 2,
    OVERHAUL = 3,
    CUSTOMER = 4,
    MANAGER = 5
}

export const orderSourceMap: Record<number, string> = {
    [OrderSourceEnum.CLIENT]: '客户上报',
    [OrderSourceEnum.SYSTEM]: '系统创建',
    [OrderSourceEnum.REPAIR]: '维修员创建',
    [OrderSourceEnum.OVERHAUL]: '检修员创建',
    [OrderSourceEnum.CUSTOMER]: '客服创建',
    [OrderSourceEnum.MANAGER]: '维修主管创建'
}

// 技术等级
export enum TechnicalEnum {
    PRIMARY = 0,
    MIDDLE = 1,
    ADVANCED = 2
}

export const technicalMap: Record<number, string> = {
    [TechnicalEnum.PRIMARY]: '初级',
    [TechnicalEnum.MIDDLE]: '中级',
    [TechnicalEnum.ADVANCED]: '高级'
}

// 仓库类型
export enum StashTypeEnum {
    MY = 0,
    COMMON = 1
}
// 仓库类型
export const stashTypeMap: Record<number, string> = {
    [StashTypeEnum.MY]: '我的仓库',
    [StashTypeEnum.COMMON]: '公共仓库'
}
// 角色id
export enum RoleIdEnum {
    REPAIR = 7,
    OVERHAUL = 6,
    MANAGER = 10
}

// 改派处理
export enum DispatchEnum {
    AGREE = 0,
    DISAGREE = 1
}
// 是否超时
export enum OvertimeEnum {
    YES = 0,
    NO = 1
}

export const dispatchMap: Record<number, string> = {
    [DispatchEnum.AGREE]: '同意',
    [DispatchEnum.DISAGREE]: '不同意'
}

export const agreeMap: Record<number, string> = {
    [DispatchEnum.AGREE]: '通过',
    [DispatchEnum.DISAGREE]: '不通过'
}

export const RoleEnum: Record<number, number> = {
    [RoleIdEnum.MANAGER]: 2,
    [RoleIdEnum.REPAIR]: 1
}

// 是否学徒
export enum ApprenticeEnum {
    YES = 1,
    NO = 0
}

// 入库类型
export enum InstorageTypeEnum {
    UNABLE = 1,
    OTHER = 0
}
export const inStorageMap: Record<number, string> = {
    [InstorageTypeEnum.UNABLE]: '无法处理',
    [InstorageTypeEnum.OTHER]: '其他'
}

// 信息核对类型
export enum InfoCheckEnum {
    IN = 0,
    RETURN = 1
}
export const infoCheckMap: Record<number, string> = {
    [InfoCheckEnum.IN]: '入库',
    [InfoCheckEnum.RETURN]: '返修'
}

//排查结果
export enum CheckResultEnum {
    REPAIR = 1,
    SCRAP = 0
}

export const checkResultColor: Record<number, string> = {
    [CheckResultEnum.REPAIR]: '#0E66FB',
    [CheckResultEnum.SCRAP]: '#F5222D'
}
export const checkResultMap: Record<number, string> = {
    [CheckResultEnum.REPAIR]: '维修',
    [CheckResultEnum.SCRAP]: '报废'
}

// 维修单审核事项类别
export enum AuditItemsClassifyEnum {
    WITHDRAW = 0, //退仓
    MATERIAL = 1, //领料
    INSTORAGE = 2, //良品入库
    SCRAP = 3 //报废
}

export const auditItemsClassifyMap: Record<number, string> = {
    [AuditItemsClassifyEnum.WITHDRAW]: '退仓',
    [AuditItemsClassifyEnum.MATERIAL]: '领料',
    [AuditItemsClassifyEnum.INSTORAGE]: '良品',
    [AuditItemsClassifyEnum.SCRAP]: '报废'
}

//维修单审核状态
export enum RepaireOrderAuditStatusEnum {
    TOAUDIT = 0,
    STOCKPENDING = 1,
    NOPASS = 2,
    COMPLETED = 3,
    QUANTITY = 7,
    QUANTITYNOPASS = 8
}

export const RepaireOrderAuditStatusMap: Record<number, string> = {
    [RepaireOrderAuditStatusEnum.TOAUDIT]: '待审核',
    [RepaireOrderAuditStatusEnum.STOCKPENDING]: '待入库',
    [RepaireOrderAuditStatusEnum.NOPASS]: '审核未通过',
    [RepaireOrderAuditStatusEnum.COMPLETED]: '已完成',
    [RepaireOrderAuditStatusEnum.QUANTITY]: '待质检',
    [RepaireOrderAuditStatusEnum.QUANTITYNOPASS]: '质检未通过'
}

export const RepaireOrderAuditStatusColor: Record<number, string> = {
    [RepaireOrderAuditStatusEnum.TOAUDIT]: '#F9C85E',
    [RepaireOrderAuditStatusEnum.STOCKPENDING]: '#0E66FB',
    [RepaireOrderAuditStatusEnum.NOPASS]: '#F5222D',
    [RepaireOrderAuditStatusEnum.COMPLETED]: '#46B97B',
    [RepaireOrderAuditStatusEnum.QUANTITY]: '#64B6E8',
    [RepaireOrderAuditStatusEnum.QUANTITYNOPASS]: '#F5222D'
}

export const RepaireOrderAuditStatusBgColor: Record<number, string> = {
    [RepaireOrderAuditStatusEnum.TOAUDIT]: '#fff7d8',
    [RepaireOrderAuditStatusEnum.STOCKPENDING]: '#e8f2ff',
    [RepaireOrderAuditStatusEnum.NOPASS]: '#F3DFE0',
    [RepaireOrderAuditStatusEnum.COMPLETED]: '#76CA9D',
    [RepaireOrderAuditStatusEnum.QUANTITY]: '#f2f4f5',
    [RepaireOrderAuditStatusEnum.QUANTITYNOPASS]: '#F3DFE0'
}

//领料申请状态
export enum MaterialApplyStatusEnum {
    TOAUDIT = 0,
    TORECEIVE = 4,
    TOCONFIRM = 5,
    NOPASS = 2,
    COMPLETED = 3,
    CANCELED = 6
}

export const materialApplyStatusMap: Record<number, string> = {
    [MaterialApplyStatusEnum.TOAUDIT]: '待审核',
    [MaterialApplyStatusEnum.TORECEIVE]: '待领取',
    [MaterialApplyStatusEnum.TOCONFIRM]: '待确认',
    [MaterialApplyStatusEnum.NOPASS]: '审核未通过',
    [MaterialApplyStatusEnum.COMPLETED]: '已完成',
    [MaterialApplyStatusEnum.CANCELED]: '已取消'
}

export const materialApplyStatusColor: Record<number, string> = {
    [MaterialApplyStatusEnum.TOAUDIT]: '#F9C85E',
    [MaterialApplyStatusEnum.TORECEIVE]: '#8E5FA2',
    [MaterialApplyStatusEnum.TOCONFIRM]: '#4F8BC9',
    [MaterialApplyStatusEnum.NOPASS]: '#F5222D',
    [MaterialApplyStatusEnum.COMPLETED]: '#46B97B',
    [MaterialApplyStatusEnum.CANCELED]: '#FF6600'
}

export const materialApplyStatusBgColor: Record<number, string> = {
    [MaterialApplyStatusEnum.TOAUDIT]: '#fff7d8',
    [MaterialApplyStatusEnum.TORECEIVE]: '#E9D5F1',
    [MaterialApplyStatusEnum.TOCONFIRM]: '#DFECFA',
    [MaterialApplyStatusEnum.NOPASS]: '#F3DFE0',
    [MaterialApplyStatusEnum.COMPLETED]: '#76CA9D',
    [MaterialApplyStatusEnum.CANCELED]: '#F3E7DE'
}
