//通用颜色定义
export const priorityList = [{
		value: 0,
		name: '0',
		color: '#D7D7D7',
		icon: ''
	},
	{
		value: 1,
		name: '低',
		color: '#fdd000',
		icon: ''
	},
	{
		value: 2,
		name: '中',
		color: '#FF9900',
		icon: ''
	},
	{
		value: 3,
		name: '高',
		color: '#E60000',
		icon: ''
	}
];
export const eventsnamecolourList = [{
		menu_name: "新警告",
        code: "warn",
        color: "#C00000",
	},
	{
        menu_name: "排故中",
        code: "troubleShooting",
        color: "#00B050",
	},
	{
		menu_name: "监控",
        code: "monitor",
        color: "#00B0F2",
	},
	{
		menu_name: "故障再现",
        code: "reppearFault",
        color: "#C00000",
	}
];
// 返回级别颜色
export function stylepriority(i, type) {
	if (type == 'color') {
		if (i != null && i != '') {
			return "color:" + priorityList[i].color;
		}
	} else if (type == 'name') {
		return priorityList[i].name;
	}
};
//计算航段
export function legHandler(leg, totalLeg) {
	
	if (!leg) {
		leg === 0 ? leg = 0 : leg = totalLeg = 0;
	}
	if (!totalLeg) {
		totalLeg === 0 ? totalLeg = 0 : leg = totalLeg = 0;
	}
	return Math.min(0, leg - totalLeg);
};

//活动状态  items.activity
export function activityup(activityitem) {
	if (activityitem == 1) {
		return 'active'
	} else if (activityitem == 2) {
		return 'inactive'
	} else if (activityitem == 3) {
		return 'latched'
	} else if (activityitem == 4) {
		return 'total_active'
	}else {
		return '--'
	}
	
}

//管控状态
export function chstatus(statuNameList,statu) {
	
	// //更改前
	// for (let i = 0; i < statuNameList.length; i++) {
	// 	if(statu == statuNameList[i].statusCode){
	// 		return  statuNameList[i].statuName
	// 	}
	// }
	for (let i = 0; i < statuNameList.length; i++) {
		if(statu == statuNameList[i].code){			
			return  statuNameList[i].name
		}
	}	
}

//
export const itemlistpro1 = [
				      {
				        value: 1,
				        label: '机号',
				        name: 'tailnumberSort',
						disabled:false
				      },
				      {
				        value: 2,
				        label: '航班',
				        name: 'flightNoSort',
						disabled:false
				      },
				      {
				        value: 3,
				        label: '时间',
				        name: 'msgTimeSort',
						disabled:false
				      },
				      {
				        value: 4,
				        label: '机队',
				        name: 'fleetSort',
						disabled:false
				      },
				      {
				        value: 5,
				        label: '类型',
				        name: 'nameSort',
						disabled:false
				      },
				      {
				        value: 6,
				        label: '事件代码',
				        name: 'codeSort',
						disabled:false
				      },
				      {
				        value: 7,
				        label: '名称',
				        name: 'descriptionSort',
						disabled:false
				      },
				      {
				        value: 8,
				        label: '活动状态',
				        name: 'activitySort',
						disabled:false
				      },
				      {
				        value: 9,
				        label: '航段',
				        name: 'legSort',
						disabled:false
				      },
				      {
				        value: 10,
				        label: '管控状态',
				        name: 'controlStateCodeSort',
						disabled:false
				      },
					];
