gaoluyang
8 小时以前 e7d45b61ad438bb96c0d0d7f17923f024a1e6aaf
src/pages/works.vue
@@ -1,42 +1,5 @@
<template>
  <view class="content">
    <!--    <view class="header-section">-->
    <!--      <view class="currentFactory">-->
    <!--        <up-text type="primary"-->
    <!--                 :text="userStore.currentFactoryName"-->
    <!--                 @click="show = true"-->
    <!--                 size="18"-->
    <!--                 class="factoryName"-->
    <!--                 suffixIcon="arrow-right"-->
    <!--                 :iconStyle="iconStyle"></up-text>-->
    <!--      </view>-->
    <!--      <up-picker :show="show"-->
    <!--                 :columns="factoryList"-->
    <!--                 @confirm="changeFactory"-->
    <!--                 @cancel="show = false"></up-picker>-->
    <!--    </view>-->
<!--    <view class="hero-section">-->
<!--      <view class="bg-img">-->
<!--        <view class="hero-content">-->
<!--          &lt;!&ndash; 预留:如后续需要可在此放 logo 或简短提示 &ndash;&gt;-->
<!--        </view>-->
<!--        <view class="hero-wave"></view>-->
<!--      </view>-->
<!--    </view>-->
    <!--      <view class="notice-section">-->
    <!--         <view class="notice">-->
    <!--            <view class="notice-content">-->
    <!--               <view class="notice-left">-->
    <!--                  <text class="notice-status">通知</text>-->
    <!--               </view>-->
    <!--               <view class="notice-separator"></view>-->
    <!--               <view class="notice-right">-->
    <!--                  <text class="notice-label">{{currentStatus}}</text>-->
    <!--                  <text class="notice-text">当日销售设备数:<text class="notice-number">{{number}}<text class="notice-unit">个</text></text></text>-->
    <!--               </view>-->
    <!--            </view>-->
    <!--         </view>-->
    <!--      </view>-->
    <!-- 营销管理模块 -->
    <view class="common-module marketing-module"
          v-if="hasMarketingItems">
@@ -289,7 +252,7 @@
      label: "来票台账",
    },
    {
      icon: "/static/images/icon/fukuanjingji.svg",
      icon: "/static/images/icon/fukuandengji.svg",
      label: "付款登记",
    },
    {
@@ -331,66 +294,66 @@
  ]);
  const safetyItems = reactive([
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/guichengzizhi.svg",
      label: "规程与资质",
    },
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/weixianyuan.svg",
      label: "危险源台账",
    },
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/weixianzuoye.svg",
      label: "危险作业审批",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.svg",
      icon: "/static/images/icon/yinhuanpaicha.svg",
      label: "隐患排查上报",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.svg",
      icon: "/static/images/icon/weixianwuliao.svg",
      label: "危险物料管控",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.svg",
      icon: "/static/images/icon/yingjiyuan.svg",
      label: "应急预案查阅",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.svg",
      icon: "/static/images/icon/shigushangbao.svg",
      label: "事故上报记录",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.svg",
      icon: "/static/images/icon/anquanpeixun.svg",
      label: "安全培训考核",
    },
  ]);
  // 协同办公功能数据
  const collaborationItems = reactive([
    {
      icon: "/static/images/icon/baoxiaoguanli.svg",
      icon: "/static/images/icon/xietongshenpi.svg",
      label: "协同审批",
    },
    {
      icon: "/static/images/icon/huiyiliebiao@2x.svg",
      icon: "/static/images/icon/huiyiguanli.svg",
      label: "会议管理",
    },
    {
      icon: "/static/images/icon/tongzhigonggao@2x.svg",
      icon: "/static/images/icon/tongzhigonggao.svg",
      label: "通知公告",
    },
    {
      icon: "/static/images/icon/zhishiku@2x.svg",
      icon: "/static/images/icon/zhishiku.svg",
      label: "知识库",
    },
    {
      icon: "/static/images/icon/yongyinguanli@2x.svg",
      icon: "/static/images/icon/yongyinguanli.svg",
      label: "用印管理",
    },
    {
      icon: "/static/images/icon/guizhangzhidu@2x.svg",
      icon: "/static/images/icon/guizhangzhidu.svg",
      label: "规章制度",
    },
    {
      icon: "/static/images/icon/kehubaifang@2x.svg",
      icon: "/static/images/icon/kehubaifang.svg",
      label: "客户拜访",
    },
  ]);
@@ -410,7 +373,7 @@
    //   label: "工序排产",
    // },
    {
      icon: "/static/images/icon/shengchanbaogong@2x.svg",
      icon: "/static/images/icon/shengchanbaogong.svg",
      label: "生产报工",
    },
    // {
@@ -426,19 +389,19 @@
    //    label: '设备台账',
    // },
    {
      icon: "/static/images/icon/shbeibaoxiu@2x.svg",
      icon: "/static/images/icon/yunxingguanli.svg",
      label: "运行管理",
    },
    {
      icon: "/static/images/icon/shbeibaoxiu@2x.svg",
      icon: "/static/images/icon/shebeibaoxiu.svg",
      label: "设备报修",
    },
    {
      icon: "/static/images/icon/shbeibaoyang@2x.svg",
      icon: "/static/images/icon/shebeibaoyang.svg",
      label: "设备保养",
    },
    {
      icon: "/static/images/icon/xunjianshangchuan@2x.svg",
      icon: "/static/images/icon/xunjianshangchuan.svg",
      label: "设备巡检",
    },
  ]);
@@ -924,11 +887,9 @@
    const collectMenuTitles = routes => {
      if (!Array.isArray(routes)) return;
      routes.forEach(route => {
        // 收集当前路由的标题
        if (route.meta && route.meta.title) {
          allowedMenuTitles.add(route.meta.title);
        }
        // 递归处理子路由
        if (route.children && route.children.length > 0) {
          collectMenuTitles(route.children);
        }
@@ -936,130 +897,32 @@
    };
    collectMenuTitles(routers);
    // 过滤营销管理菜单
    const originalMarketing = [
      { icon: "/static/images/icon/xiaoshoutaizhang.svg", label: "销售台账" },
      { icon: "/static/images/icon/kaipiaodengji.svg", label: "开票登记" },
      { icon: "/static/images/icon/kaipiaotaizhang.svg", label: "开票台账" },
      { icon: "/static/images/icon/huikuandengji.svg", label: "回款登记" },
      { icon: "/static/images/icon/huikuanliushui.svg", label: "回款流水" },
      { icon: "/static/images/icon/kehuwanglai.svg", label: "客户往来" },
    ];
    const filteredMarketing = originalMarketing.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    marketingItems.splice(0, marketingItems.length, ...filteredMarketing);
    // 定义菜单配置映射
    const menuMapping = {
      collaboration: { target: collaborationItems, specialMapping: { "规章制度": "规章制度管理" } },
    };
    // 过滤协同办公菜单
    const originalCollaboration = [
      { icon: "/static/images/icon/baoxiaoguanli.svg", label: "协同审批" },
      { icon: "/static/images/icon/huiyiliebiao@2x.svg", label: "会议管理" },
      { icon: "/static/images/icon/tongzhigonggao@2x.svg", label: "通知公告" },
      { icon: "/static/images/icon/zhishiku@2x.svg", label: "知识库" },
      { icon: "/static/images/icon/yongyinguanli@2x.svg", label: "用印管理" },
      { icon: "/static/images/icon/guizhangzhidu@2x.svg", label: "规章制度" },
      { icon: "/static/images/icon/kehubaifang@2x.svg", label: "客户拜访" },
    ];
    const filteredCollaboration = originalCollaboration.filter(item => {
      // 处理标题不完全匹配的情况
      let matched = allowedMenuTitles.has(item.label);
      // 特殊处理:规章制度 -> 规章制度管理
      if (!matched && item.label === "规章制度") {
        matched = allowedMenuTitles.has("规章制度管理");
      }
      return matched;
    });
    collaborationItems.splice(
      0,
      collaborationItems.length,
      ...filteredCollaboration
    );
    // 通用过滤函数
    const filterArray = (targetArray, specialMapping) => {
      const filtered = targetArray.filter(item => {
        let matched = allowedMenuTitles.has(item.label);
        if (specialMapping && !matched && specialMapping[item.label]) {
          matched = allowedMenuTitles.has(specialMapping[item.label]);
        }
        return matched;
      });
      targetArray.splice(0, targetArray.length, ...filtered);
    };
    // 过滤采购管理菜单
    const originalPurchase = [
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "采购台账" },
      { icon: "/static/images/icon/laipiaodengji.svg", label: "来票登记" },
      { icon: "/static/images/icon/laipiaotaizhang.svg", label: "来票台账" },
      { icon: "/static/images/icon/fukuanjingji.svg", label: "付款登记" },
      { icon: "/static/images/icon/fukuanliushui.svg", label: "付款流水" },
      {
        icon: "/static/images/icon/gongyingshangwanglai@2x.svg",
        label: "供应商往来",
      },
    ];
    const filteredPurchase = originalPurchase.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    purchaseItems.splice(0, purchaseItems.length, ...filteredPurchase);
    // 过滤安全生产菜单
    const originalSafety = [
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "规程与资质" },
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "危险源台账" },
      {
        icon: "/static/images/icon/caigoutaizhang.svg",
        label: "危险作业审批",
      },
      { icon: "/static/images/icon/guzhangfenxi@2x.svg", label: "隐患排查上报" },
      { icon: "/static/images/icon/guzhangfenxi@2x.svg", label: "危险物料管控" },
      { icon: "/static/images/icon/guzhangfenxi@2x.svg", label: "应急预案查阅" },
      { icon: "/static/images/icon/guzhangfenxi@2x.svg", label: "事故上报记录" },
      { icon: "/static/images/icon/guzhangfenxi@2x.svg", label: "安全培训考核" },
    ];
    const filteredSafety = originalSafety.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    safetyItems.splice(0, safetyItems.length, ...filteredSafety);
    // 过滤人力资源菜单
    const originalHumanResources = [
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "打卡签到" },
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "人员薪资" },
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "合同管理" },
    ];
    const filteredHumanResources = originalHumanResources.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    humanResourcesItems.splice(
      0,
      humanResourcesItems.length,
      ...filteredHumanResources
    );
    // 过滤质量管理菜单
    const originalQuality = [
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "原材料检验" },
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "过程检验" },
      { icon: "/static/images/icon/caigoutaizhang.svg", label: "出厂检验" },
    ];
    const filteredQuality = originalQuality.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    qualityItems.splice(0, qualityItems.length, ...filteredQuality);
    // 过滤生产管控菜单
    const originalProduction = [
      {
        icon: "/static/images/icon/shengchanbaogong@2x.svg",
        label: "生产报工",
      },
    ];
    const filteredProduction = originalProduction.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    productionItems.splice(0, productionItems.length, ...filteredProduction);
    // 过滤设备管理菜单
    const originalEquipment = [
      { icon: "/static/images/icon/shbeibaoxiu@2x.svg", label: "运行管理" },
      { icon: "/static/images/icon/shbeibaoxiu@2x.svg", label: "设备报修" },
      { icon: "/static/images/icon/shbeibaoyang@2x.svg", label: "设备保养" },
      { icon: "/static/images/icon/xunjianshangchuan@2x.svg", label: "设备巡检" },
    ];
    const filteredEquipment = originalEquipment.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    equipmentItems.splice(0, equipmentItems.length, ...filteredEquipment);
    // 过滤各个模块
    filterArray(marketingItems);
    filterArray(purchaseItems);
    filterArray(collaborationItems, menuMapping.collaboration.specialMapping);
    filterArray(safetyItems);
    filterArray(humanResourcesItems);
    filterArray(qualityItems);
    filterArray(productionItems);
    filterArray(equipmentItems);
  };
  // 检查模块是否有菜单项需要显示