gaoluyang
9 天以前 b9c1609389907ebd10f2f523c2d0922c0c7b1682
src/pages/works.vue
@@ -1,42 +1,27 @@
<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 collaboration-module"
          v-if="hasCollaborationItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">协同办公</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in collaborationItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 营销管理模块 -->
    <view class="common-module marketing-module"
          v-if="hasMarketingItems">
@@ -59,7 +44,7 @@
        </up-grid>
      </view>
    </view>
    <!--    &lt;!&ndash; 采购管理模块 &ndash;&gt;-->
    <!-- 采购管理模块 -->
    <view class="common-module purchase-module"
          v-if="hasPurchaseItems">
      <view class="module-header">
@@ -71,72 +56,6 @@
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in purchaseItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- &lt;!&ndash; 协同办公模块 &ndash;&gt; -->
    <view class="common-module collaboration-module"
          v-if="hasCollaborationItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">协同办公</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in collaborationItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 安全生产模块 -->
    <view class="common-module collaboration-module"
          v-if="hasSafetyItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">安全生产</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in safetyItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 质量管理模块 -->
    <view class="common-module collaboration-module"
          v-if="hasQualityItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">质量管理</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in qualityItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
@@ -191,6 +110,94 @@
        </up-grid>
      </view>
    </view>
    <!-- 财务管理模块 -->
    <view class="common-module finance-module"
          v-if="hasFinanceManagementItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">财务管理</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in financeManagementItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 档案管理模块 -->
    <view class="common-module archive-module"
          v-if="hasArchiveManagementItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">档案管理</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in archiveManagementItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 售后服务模块 -->
    <view class="common-module after-sales-module"
          v-if="hasAfterSalesServiceItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">售后服务</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in afterSalesServiceItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 质量管理模块 -->
    <view class="common-module collaboration-module"
          v-if="hasQualityItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">质量管理</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in qualityItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 设备管理模块 -->
    <view class="common-module equipment-module"
          v-if="hasEquipmentItems">
@@ -203,6 +210,28 @@
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in equipmentItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
              <image :src="item.icon" class="item-icon"></image>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- 安全生产模块 -->
    <view class="common-module collaboration-module"
          v-if="hasSafetyItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">安全生产</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in safetyItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container">
@@ -253,6 +282,26 @@
      label: "销售台账",
    },
    {
      icon: "/static/images/icon/kehuwanglai.svg",
      label: "客户往来",
    },
  ]);
  // 采购管理功能数据
  const purchaseItems = reactive([
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      label: "采购台账",
    },
    {
      icon: "/static/images/icon/gongyingshangwanglai.svg",
      label: "供应商往来",
    },
  ]);
  // 财务管理功能数据
  const financeManagementItems = reactive([
    {
      icon: "/static/images/icon/kaipiaodengji.svg",
      label: "开票登记",
    },
@@ -269,18 +318,6 @@
      label: "回款流水",
    },
    {
      icon: "/static/images/icon/kehuwanglai.svg",
      label: "客户往来",
    },
  ]);
  // 采购管理功能数据
  const purchaseItems = reactive([
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      label: "采购台账",
    },
    {
      icon: "/static/images/icon/laipiaodengji.svg",
      label: "来票登记",
    },
@@ -289,108 +326,113 @@
      label: "来票台账",
    },
    {
      icon: "/static/images/icon/fukuanjingji.svg",
      icon: "/static/images/icon/fukuandengji.svg",
      label: "付款登记",
    },
    {
      icon: "/static/images/icon/fukuanliushui.svg",
      label: "付款流水",
    },
    {
      icon: "/static/images/icon/gongyingshangwanglai.svg",
      label: "供应商往来",
    },
  ]);
  // 档案管理功能数据
  const archiveManagementItems = reactive([
  ]);
  // 售后服务功能数据
  const afterSalesServiceItems = reactive([
  ]);
  const humanResourcesItems = reactive([
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/dakaqiandao.svg",
      label: "打卡签到",
    },
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/renyuanxinzi.svg",
      label: "人员薪资",
    },
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/hetongguanli.svg",
      label: "合同管理",
    },
  ]);
  const qualityItems = reactive([
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/yuancailiaojianyan.svg",
      label: "原材料检验",
    },
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/guochengjianyan.svg",
      label: "过程检验",
    },
    {
      icon: "/static/images/icon/caigoutaizhang.svg",
      icon: "/static/images/icon/chuchangjianyan.svg",
      label: "出厂检验",
    },
  ]);
  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 +452,7 @@
    //   label: "工序排产",
    // },
    {
      icon: "/static/images/icon/shengchanbaogong@2x.svg",
      icon: "/static/images/icon/shengchanbaogong.svg",
      label: "生产报工",
    },
    // {
@@ -426,19 +468,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 +966,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,135 +976,43 @@
    };
    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(financeManagementItems);
    filterArray(archiveManagementItems);
    filterArray(afterSalesServiceItems);
    filterArray(collaborationItems, menuMapping.collaboration.specialMapping);
    filterArray(safetyItems);
    filterArray(humanResourcesItems);
    filterArray(qualityItems);
    filterArray(productionItems);
    filterArray(equipmentItems);
  };
  // 检查模块是否有菜单项需要显示
  const hasMarketingItems = computed(() => marketingItems.length > 0);
  const hasPurchaseItems = computed(() => purchaseItems.length > 0);
  const hasFinanceManagementItems = computed(() => financeManagementItems.length > 0);
  const hasArchiveManagementItems = computed(() => true);
  const hasAfterSalesServiceItems = computed(() => true);
  const hasCollaborationItems = computed(() => collaborationItems.length > 0);
  const hasSafetyItems = computed(() => safetyItems.length > 0);
  const hasQualityItems = computed(() => qualityItems.length > 0);