import { useColumnPermission } from '/@/stores/columnPermission';

type permissionType = 'is_create' | 'is_query' | 'is_update';

export const columnPermission = (key: string, type: permissionType): boolean => {
	const permissions = useColumnPermission().permission || [];
	// console.log("查看当前权限列表", permissions);  // 查看当前权限列表
	const result = !!permissions.some((i) => i.field_name === key && i[type]);
	// console.log(key, type, result); // 查看传入的字段名、权限类型和计算结果
	return !!permissions.some((i) => i.field_name === key && i[type]);
};
