You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
792 B
29 lines
792 B
import { MenuType, tabsType } from "./menu";
|
|
|
|
// 通过url获取菜单类型
|
|
export const getMenuType = (url: string) => {
|
|
for (const key in MenuType) {
|
|
const menuItems = MenuType[key];
|
|
for (const item of menuItems) {
|
|
if (item.url === url || (item.data && item.data.some(dataItem => dataItem.url === url))) {
|
|
return key;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// 通过菜单名称获取到下拉框的key值
|
|
export const getTabKey = (name: string) => {
|
|
for (const [key, items] of Object.entries(tabsType)) {
|
|
if (items.some((item: { name: string; }) => item.name === name)) {
|
|
return key;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// 设置表格行样式颜色
|
|
export const rowClassName = (record: any, index: any) => {
|
|
return index % 2 === 0 ? 'even-row' : 'odd-row';
|
|
}; |