/**
 * 隐患等级、风险等级、风险点等级、危险源等级、级别转换
 */
export function levelConversion(level) {
	let levelStr;
	if (level == 1) {
		levelStr = '重大'
	} else if (level == 2) {
		levelStr = '较大'
	} else if (level == 3) {
		levelStr = '一般'
	} else if (level == 4) {
		levelStr = '低'
	} else {
		levelStr = '暂无'
	}
	return levelStr;
}

/**
 * 构建树JS
 * @param {Object} data
 */
export function toTreeText(data) {
	var val = []
	data.forEach(function(item) {
		var items = {}
		items.value = item.groupId
		items.text = item.groupName
		if (item.children) {
			items.children = toTreeText(item.children)
			val.push(items)
		} else {
			val.push(items)
		}
	})
	return val
}


