spring
5 天以前 755e7038caf74126eb4d696ef88f11f0871ff0ee
src/pages/index/index.vue
@@ -93,6 +93,7 @@
import WorkerCallingCard from "@/components/worker-calling-card/index.vue";
import HomeApi from "@/api/home";
import { useUserStore } from "@/store/modules/user";
import { setTeamId, setPrepareId } from "@/utils/cache";
const visitStatsData = ref<VisitStatsVO>({
  todayUvCount: 0,
@@ -120,6 +121,18 @@
    userInfo.value.roles.some((role: any) => role.roleKey === "qualitative-inspector")
  );
  return userInfo.value.roles.some((role: any) => role.roleKey === "qualitative-inspector");
});
// 判断是否为出库角色
const isStorage = computed(() => {
  if (!userInfo.value || !userInfo.value.roles || !Array.isArray(userInfo.value.roles)) {
    return false;
  }
  console.log(
    "userInfo.value.roles",
    userInfo.value.roles.some((role: any) => role.roleKey === "storage")
  );
  return userInfo.value.roles.some((role: any) => role.roleKey === "storage");
});
const fileProgress = reactive({
@@ -188,16 +201,22 @@
  //   url: "/pages/work/config/index",
  //   prem: "sys:config:query",
  // },
  {
    icon: "/static/icons/log.png",
    title: "时效报工",
    url: "/pages/timely/index",
    show: false,
  },
  // {
  //   icon: "/static/icons/log.png",
  //   title: "时效报工",
  //   url: "/pages/timely/index",
  //   show: false,
  // },
  {
    icon: "/static/icons/routingInspection.png",
    title: "巡检",
    url: "/pages/routingInspection/index",
    show: false,
  },
  {
    icon: "/static/icons/log.png",
    title: "出库",
    url: "/pages/outbound/index",
    show: false,
  },
]);
@@ -249,14 +268,26 @@
  checkVersion();
  const { data } = await HomeApi.getIndex();
  // 判断是否为巡检员角色
  if (data.deviceGroupName == "时效组") {
    navList[1].show = true;
  } else {
  // 存储班组ID和生产准备ID
  if (data) {
    if (data.id) {
      setTeamId(data.id);
    }
    if (data.prepareId) {
      setPrepareId(data.prepareId);
    }
  }
  if (data.deviceGroupName.includes("丝") || data.deviceGroupName.includes("绞")) {
    // 如果是丝或绞,显示生产管理菜单
    navList[0].show = true;
  }
  if (isInspector.value) {
    // 如果是巡检员,显示巡检菜单
    navList[1].show = true;
  }
  if (isStorage.value) {
    // 如果是出库角色,显示出库菜单
    navList[2].show = true;
  }
};