const moudleGroups = [{
	name: '系统管理',
	color: '#007AFF',
	items: [{
		name: '用户管理',
		icon: 'person-filled',
		path: '',
		params: ''

	},
	{
		name: '角色管理',
		icon: 'staff-filled',
		path: '',
		params: ''

	}, {
		name: '菜单管理',
		icon: 'color',
		path: '',
		params: ''

	}, {
		name: '部门管理',
		icon: 'settings-filled',
		path: '',
		params: ''

	}, {
		name: '岗位管理',
		icon: 'heart-filled',
		path: '',
		params: ''

	}, {
		name: '字典管理',
		icon: 'bars',
		path: `/pages_system/pages/dict/index`
		, params: ''

	}, {
		name: '参数设置',
		icon: 'gear-filled',
		path: '',
		params: ''
	},
	{
		name: '通知公告',
		icon: 'chat-filled', 
		path: '',
		params: ''
	}
		, {
		name: '日志管理',
		icon: 'wallet-filled',
		path: '',
		params: ''
	},
	]
}, {
	name: '流量计算',
	color: '#007AFF',
	items: [{
		name: '差压式流量计算',
		icon: 'smallcircle',
		path: `/pages_caltools/pages/main`,
		params: 0
	},
	{
		name: '速度式流量计算',
		icon: 'paperplane',
		path: `/pages_caltools/pages/main`,
		params: 1
	},
	]
},
{
	name: '参数计算',
	color: '#5AC8FA',
	items: [{
		name: '压缩因子',
		icon: 'pyq',
		path: `/pages_caltools/pages/main`,
		params: 4
	},
	{
		name: '声速计算',
		icon: 'sound',
		path: `/pages_caltools/pages/main`,
		params: 5
	},
	{
		name: '发热量',
		icon: 'fire',
		path: `/pages_caltools/pages/main`,
		params: 6
	},
	{
		name: '其他参数',
		icon: 'more',
		path: `/pages_caltools/pages/main`,
		params: 7
	}
	]
}
];

export default moudleGroups

/**
 * 通用方法：从模块组中提取数据
 * @param {Array} groupNames - 要提取的模块组名称数组
 * @param {boolean} mergeItems - 是否合并items，true为合并，false为保持原结构
 * @param {Function} transformFn - 可选的转换函数，用于自定义输出格式
 * @returns {Array} 提取后的数据
 */
export function extractModuleData(groupNames, mergeItems = false, transformFn = null) {
	if (!Array.isArray(groupNames) || groupNames.length === 0) {
		return [];
	}

	// 过滤出指定的模块组
	const filteredGroups = moudleGroups.filter(group => groupNames.includes(group.name));

	if (mergeItems) {
		// 合并所有items
		const mergedItems = filteredGroups.flatMap(group => group.items || []);
		return transformFn ? transformFn(mergedItems) : mergedItems;
	} else {
		// 保持原结构
		return transformFn ? transformFn(filteredGroups) : filteredGroups;
	}
}