gaoluyang
2 天以前 8151c3253dc287a79914bc08414af17dfb380c96
src/views/mes/home/modules/alert-panel.vue
@@ -7,6 +7,10 @@
import { Badge, Card } from 'ant-design-vue';
import { useHomeAccess } from '#/utils/use-home-access';
import { HOME_BLOCK_MENUS } from '../data';
defineOptions({ name: 'MesHomeAlertPanel' });
const props = defineProps<{
@@ -17,37 +21,41 @@
  navigate: [name: string];
}>();
/** 待办提醒列表:标签、描述、图标、目标路由名称、数量 */
const alertItems = computed(() => [
  {
    count: props.summary.andonActiveCount,
    desc: '未处置的安灯呼叫',
    icon: 'lucide:bell-ring',
    iconClass: 'bg-red-50 text-red-500',
    label: '安灯报警',
    routeName: 'MesProAndonRecord',
  },
  {
    count: props.summary.repairActiveCount,
    desc: '待处理的维修订单',
    icon: 'lucide:wrench',
    iconClass: 'bg-orange-50 text-orange-500',
    label: '设备维修',
    routeName: 'MesDvRepair',
  },
  {
    count: props.summary.workOrderPrepareCount,
    desc: '草稿状态的生产订单',
    icon: 'lucide:clipboard-list',
    iconClass: 'bg-blue-50 text-blue-500',
    label: '待排产订单',
    routeName: 'MesProWorkOrder',
  },
]);
const { canSeeMenu } = useHomeAccess();
/** 待办提醒列表:标签、描述、图标、目标路由名称、数量;菜单没开的条目不展示 */
const alertItems = computed(() =>
  [
    {
      count: props.summary.andonActiveCount,
      desc: '未处置的安灯呼叫',
      icon: 'lucide:bell-ring',
      iconClass: 'bg-red-50 text-red-500',
      label: '安灯报警',
      routeName: HOME_BLOCK_MENUS.andon,
    },
    {
      count: props.summary.repairActiveCount,
      desc: '待处理的维修订单',
      icon: 'lucide:wrench',
      iconClass: 'bg-orange-50 text-orange-500',
      label: '设备维修',
      routeName: HOME_BLOCK_MENUS.repair,
    },
    {
      count: props.summary.workOrderPrepareCount,
      desc: '草稿状态的生产订单',
      icon: 'lucide:clipboard-list',
      iconClass: 'bg-blue-50 text-blue-500',
      label: '待排产订单',
      routeName: HOME_BLOCK_MENUS.workOrder,
    },
  ].filter((item) => canSeeMenu(item.routeName)),
);
</script>
<template>
  <Card title="待办与异常" class="h-full">
  <Card v-if="alertItems.length" title="待办与异常" class="h-full">
    <div class="flex flex-col">
      <div
        v-for="item in alertItems"