import { defineAsyncComponent } from 'vue';
// 无权限页面
export const NoAuthPage = defineAsyncComponent(
  () => import('@/views/platform/components/NoAuthPage.vue'),
);

// 按照权限过滤源数据
export const getPageLinksData = data => {
  // TODO: 先关掉权限
  //const menuAuth = JSON.parse(window.localStorage.getItem('menuAuth') || '[]');
  const menuAuth = JSON.parse(
    '["849667bf","6936859b","fde63530","c1eaa502","560f8e0c","7b6b1f1f","5809fc37","a7facd5f","560f8e0b","ObjectInspectorParent","ObjectInspectorParent:ICPX_INDEX_MANAGEMENT_MODEL","4240ee0c","0a52d0b7","17d0d4e9","864baf4d","7cb24a59","848c72e6","513fd674","7fde8dd0","d5cfc9dd","7fc57aa9","27f0eec0","236c3bba","a415913b","7bb0105a","cddefd23"]',
  );
  const menuPageLinks = data?.pageLinkList?.filter(page => menuAuth.indexOf(page.uniqueKey) >= 0);
  return {
    ...data,
    pageLinkList: data?.pageLinkList, //menuPageLinks,
  };
};

// tab实现权限判断,用于if判断
const usersPermissionsData: any = JSON.parse(window.localStorage.getItem('usersPermissions'));
export const hasPermission = val => {
  // TODO: 先关闭权限
  return true;
  // const isShow = false;
  // let permissionStr = '';
  // if (usersPermissionsData.length == 0) {
  //   return isShow;
  // } else {
  //   permissionStr = usersPermissionsData.toString();
  // }
  // if (permissionStr.indexOf(val) > -1) {
  //   return true;
  // }
  // return isShow;
};
