spring
昨天 ec00255aab24865cd785e181704e502354b9c8f6
src/pages/index.vue
@@ -38,7 +38,8 @@
    <!--         </view>-->
    <!--      </view>-->
    <!-- 营销管理模块 -->
    <view class="common-module marketing-module" v-if="hasMarketingItems">
    <view class="common-module marketing-module"
          v-if="hasMarketingItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">营销管理</text>
@@ -62,7 +63,8 @@
      </view>
    </view>
    <!--    &lt;!&ndash; 采购管理模块 &ndash;&gt;-->
    <view class="common-module purchase-module" v-if="hasPurchaseItems">
    <view class="common-module purchase-module"
          v-if="hasPurchaseItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">采购管理</text>
@@ -86,7 +88,8 @@
      </view>
    </view>
    <!-- &lt;!&ndash; 协同办公模块 &ndash;&gt; -->
    <view class="common-module collaboration-module" v-if="hasCollaborationItems">
    <view class="common-module collaboration-module"
          v-if="hasCollaborationItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">协同办公</text>
@@ -110,7 +113,8 @@
      </view>
    </view>
    <!-- 安全生产模块 -->
    <view class="common-module collaboration-module" v-if="hasSafetyItems">
    <view class="common-module collaboration-module"
          v-if="hasSafetyItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">安全生产</text>
@@ -134,7 +138,8 @@
      </view>
    </view>
    <!-- 人力资源模块 -->
    <view class="common-module collaboration-module" v-if="hasHumanResourcesItems">
    <view class="common-module collaboration-module"
          v-if="hasHumanResourcesItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">人力资源</text>
@@ -158,7 +163,8 @@
      </view>
    </view>
    <!-- 生产管控模块 -->
    <view class="common-module equipment-module" v-if="hasProductionItems">
    <view class="common-module equipment-module"
          v-if="hasProductionItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">生产管控</text>
@@ -182,7 +188,8 @@
      </view>
    </view>
    <!-- 设备管理模块 -->
    <view class="common-module equipment-module" v-if="hasEquipmentItems">
    <view class="common-module equipment-module"
          v-if="hasEquipmentItems">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">设备管理</text>
@@ -302,11 +309,15 @@
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "人员薪资",
    },
    {
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "合同管理",
    },
  ]);
  const safetyItems = reactive([
    {
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "规程资质",
      label: "规程与资质",
    },
    {
      icon: "/static/images/icon/caigoutaizhang@2x.png",
@@ -314,28 +325,28 @@
    },
    {
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "危险作业",
      label: "危险作业审批",
    },
    // {
    //   icon: "/static/images/icon/guzhangfenxi@2x.png",
    //   label: "隐患排查上报",
    // },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "危险物料管控",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "隐患排查",
      label: "应急预案查阅",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "危险物料",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "应急预案",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "事故上报",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "安全培训",
    },
    // {
    //   icon: "/static/images/icon/guzhangfenxi@2x.png",
    //   label: "事故上报记录",
    // },
    // {
    //   icon: "/static/images/icon/guzhangfenxi@2x.png",
    //   label: "安全培训考核",
    // },
  ]);
  // 协同办公功能数据
  const collaborationItems = reactive([
@@ -343,10 +354,10 @@
      icon: "/static/images/icon/baoxiaoguanli.png",
      label: "协同审批",
    },
    {
      icon: "/static/images/icon/huiyiliebiao@2x.png",
      label: "会议管理",
    },
    // {
    //   icon: "/static/images/icon/huiyiliebiao@2x.png",
    //   label: "会议管理",
    // },
    {
      icon: "/static/images/icon/tongzhigonggao@2x.png",
      label: "通知公告",
@@ -355,18 +366,18 @@
      icon: "/static/images/icon/zhishiku@2x.png",
      label: "知识库",
    },
    {
      icon: "/static/images/icon/yongyinguanli@2x.png",
      label: "用印管理",
    },
    // {
    //   icon: "/static/images/icon/yongyinguanli@2x.png",
    //   label: "用印管理",
    // },
    {
      icon: "/static/images/icon/guizhangzhidu@2x.png",
      label: "规章制度",
    },
    {
      icon: "/static/images/icon/kehubaifang@2x.png",
      label: "客户拜访",
    },
    // {
    //   icon: "/static/images/icon/kehubaifang@2x.png",
    //   label: "客户拜访",
    // },
  ]);
  // 生产管控功能数据
@@ -386,10 +397,14 @@
    //   label: "工序排产",
    //   bgColor: "#E91E63",
    // },
    // {
    //   icon: "/static/images/icon/shengchanbaogong@2x.png",
    //   label: "生产报工",
    //   bgColor: "#673AB7",
    // },
    {
      icon: "/static/images/icon/shengchanbaogong@2x.png",
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "生产报工",
      bgColor: "#673AB7",
    },
    // {
    //   icon: "/static/images/icon/shengchanhesuan@2x.png",
@@ -418,28 +433,12 @@
    },
    {
      icon: "/static/images/icon/xunjianshangchuan@2x.png",
      label: "巡检上传",
      label: "巡检管理",
    },
    // {
    //   icon: "/static/images/icon/guzhangfenxi@2x.png",
    //   label: "分析追溯",
    //   bgColor: "#ff9800",
    // },
    // {
    //   icon: "/static/images/icon/zhinengpaidan@2x.png",
    //   label: "智能派单",
    //   bgColor: "#ff6b35",
    // },
    // {
    //   icon: "/static/images/icon/zuoyezhidao@2x.png",
    //   label: "作业指导",
    //   bgColor: "#4caf50",
    // },
    // {
    //   icon: "/static/images/icon/jieguoyanzheng@2x.png",
    //   label: "结果验证",
    //   bgColor: "#9c27b0",
    // },
    {
      icon: "/static/images/icon/xunjianshangchuan@2x.png",
      label: "巡检任务管理",
    }
  ]);
  // 处理常用功能点击
@@ -626,8 +625,13 @@
          url: "/pages/productionManagement/processScheduling/index",
        });
        break;
      // case "生产报工":
      //   getcode();
      //   break;
      case "生产报工":
        getcode();
        uni.navigateTo({
          url: "/pages/productionManagement/workOrder/index",
        });
        break;
      case "生产核算":
        uni.navigateTo({
@@ -654,9 +658,14 @@
          url: "/pages/equipmentManagement/upkeep/index",
        });
        break;
      case "巡检上传":
      case "巡检管理":
        uni.navigateTo({
          url: "/pages/inspectionUpload/index",
        });
        break;
      case "巡检任务管理":
        uni.navigateTo({
          url: "/pages/inspectionManagement/index",
        });
        break;
      case "分析追溯":
@@ -679,7 +688,7 @@
          url: "/pages/equipmentManagement/verification/index",
        });
        break;
      case "规程资质":
      case "规程与资质":
        uni.navigateTo({
          url: "/pages/safeProduction/safeQualifications/index",
        });
@@ -689,32 +698,32 @@
          url: "/pages/safeProduction/hazardSourceLedger/index",
        });
        break;
      case "危险作业":
      case "危险作业审批":
        uni.navigateTo({
          url: "/pages/cooperativeOffice/collaborativeApproval/index8",
        });
        break;
      case "隐患排查":
      case "隐患排查上报":
        uni.navigateTo({
          url: "/pages/safeProduction/dangerInvestigation/index",
        });
        break;
      case "危险物料":
      case "危险物料管控":
        uni.navigateTo({
          url: "/pages/safeProduction/hazardousMaterialsControl/index",
        });
        break;
      case "应急预案":
      case "应急预案查阅":
        uni.navigateTo({
          url: "/pages/safeProduction/emergencyPlanReview/index",
        });
        break;
      case "事故上报":
      case "事故上报记录":
        uni.navigateTo({
          url: "/pages/safeProduction/accidentReportingRecord/index",
        });
        break;
      case "安全培训":
      case "安全培训考核":
        uni.navigateTo({
          url: "/pages/safeProduction/safetyTrainingAssessment/index",
        });
@@ -727,6 +736,11 @@
      case "人员薪资":
        uni.navigateTo({
          url: "/pages/humanResources/monthlyStatistics/index",
        });
        break;
      case "合同管理":
        uni.navigateTo({
          url: "/pages/humanResources/contractManagement/index",
        });
        break;
      default:
@@ -831,8 +845,6 @@
            return;
          }
        }
        console.log(orderRow, "orderRow======@@@@@@@@");
        // 扫码成功后跳转到生产报工页面,并传递orderRow参数
        uni.navigateTo({
          url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`,
@@ -868,13 +880,16 @@
  };
  function loginSuccess(result) {
    // 获取路由权限
    userStore.getRouters().then(() => {
      console.log("路由权限获取成功");
      // 过滤菜单项
      filterMenuItemsByRoutes();
    }).catch(error => {
      console.error("获取路由权限失败:", error);
    });
    userStore
      .getRouters()
      .then(() => {
        console.log("路由权限获取成功");
        // 过滤菜单项
        filterMenuItemsByRoutes();
      })
      .catch(error => {
        console.error("获取路由权限失败:", error);
      });
    uni.reLaunch({
      url: "/pages/index",
    });
@@ -890,16 +905,16 @@
  // 根据路由权限过滤菜单项
  const filterMenuItemsByRoutes = () => {
    const routers = userStore.routers || [];
    // 如果没有路由权限数据,不进行过滤(显示所有菜单)
    if (!routers || routers.length === 0) {
      console.log("暂无路由权限数据,显示所有菜单");
      return;
    }
    // 收集所有有权限的菜单标题(根据 meta.title)
    const allowedMenuTitles = new Set();
    const collectMenuTitles = (routes) => {
    const collectMenuTitles = routes => {
      if (!Array.isArray(routes)) return;
      routes.forEach(route => {
        // 收集当前路由的标题
@@ -913,10 +928,6 @@
      });
    };
    collectMenuTitles(routers);
    console.log("允许的菜单标题:", Array.from(allowedMenuTitles));
    console.log("过滤前 - 营销管理:", marketingItems.length, "采购管理:", purchaseItems.length, "协同办公:", collaborationItems.length);
    console.log("过滤前 - 安全生产:", safetyItems.length, "人力资源:", humanResourcesItems.length, "生产管控:", productionItems.length, "设备管理:", equipmentItems.length);
    // 过滤营销管理菜单
    const originalMarketing = [
@@ -951,7 +962,11 @@
      }
      return matched;
    });
    collaborationItems.splice(0, collaborationItems.length, ...filteredCollaboration);
    collaborationItems.splice(
      0,
      collaborationItems.length,
      ...filteredCollaboration
    );
    // 过滤采购管理菜单
    const originalPurchase = [
@@ -960,7 +975,10 @@
      { icon: "/static/images/icon/laipiaotaizhang@2x.png", label: "来票台账" },
      { icon: "/static/images/icon/fukuanjingji@2x.png", label: "付款登记" },
      { icon: "/static/images/icon/fukuanliushui@2x.png", label: "付款流水" },
      { icon: "/static/images/icon/gongyingshangwanglai@2x.png", label: "供应商往来" },
      {
        icon: "/static/images/icon/gongyingshangwanglai@2x.png",
        label: "供应商往来",
      },
    ];
    const filteredPurchase = originalPurchase.filter(item => {
      return allowedMenuTitles.has(item.label);
@@ -969,14 +987,17 @@
    // 过滤安全生产菜单
    const originalSafety = [
      { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "规程资质" },
      { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "规程与资质" },
      { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "危险源台账" },
      { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "危险作业" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "隐患排查" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "危险物料" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "应急预案" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "事故上报" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "安全培训" },
      {
        icon: "/static/images/icon/caigoutaizhang@2x.png",
        label: "危险作业审批",
      },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "隐患排查上报" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "危险物料管控" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "应急预案查阅" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "事故上报记录" },
      { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "安全培训考核" },
    ];
    const filteredSafety = originalSafety.filter(item => {
      return allowedMenuTitles.has(item.label);
@@ -987,15 +1008,28 @@
    const originalHumanResources = [
      { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "打卡签到" },
      { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "人员薪资" },
      { icon: "/static/images/icon/caigoutaizhang@2x.png", label: "合同管理" },
    ];
    const filteredHumanResources = originalHumanResources.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    humanResourcesItems.splice(0, humanResourcesItems.length, ...filteredHumanResources);
    humanResourcesItems.splice(
      0,
      humanResourcesItems.length,
      ...filteredHumanResources
    );
    // 过滤生产管控菜单
    const originalProduction = [
      { icon: "/static/images/icon/shengchanbaogong@2x.png", label: "生产报工", bgColor: "#673AB7" },
      // {
      //   icon: "/static/images/icon/shengchanbaogong@2x.png",
      //   label: "生产报工",
      //   bgColor: "#673AB7",
      // },
      {
        icon: "/static/images/icon/caigoutaizhang@2x.png",
        label: "生产报工",
      },
    ];
    const filteredProduction = originalProduction.filter(item => {
      return allowedMenuTitles.has(item.label);
@@ -1007,16 +1041,19 @@
      { icon: "/static/images/icon/shbeibaoxiu@2x.png", label: "运行管理" },
      { icon: "/static/images/icon/shbeibaoxiu@2x.png", label: "设备报修" },
      { icon: "/static/images/icon/shbeibaoyang@2x.png", label: "设备保养" },
      { icon: "/static/images/icon/xunjianshangchuan@2x.png", label: "巡检上传" },
      { icon: "/static/images/icon/xunjianshangchuan@2x.png", label: "巡检管理" },
      { icon: "/static/images/icon/xunjianshangchuan@2x.png", label: "巡检任务管理" },
    ];
    const filteredEquipment = originalEquipment.filter(item => {
      return allowedMenuTitles.has(item.label);
    });
    if (filteredEquipment.some(i => i.label === "巡检管理")) {
      const task = originalEquipment.find(i => i.label === "巡检任务管理");
      if (task && !filteredEquipment.some(i => i.label === "巡检任务管理")) {
        filteredEquipment.push(task);
      }
    }
    equipmentItems.splice(0, equipmentItems.length, ...filteredEquipment);
    console.log("过滤后 - 营销管理:", marketingItems.length, "采购管理:", purchaseItems.length, "协同办公:", collaborationItems.length);
    console.log("过滤后 - 安全生产:", safetyItems.length, "人力资源:", humanResourcesItems.length, "生产管控:", productionItems.length, "设备管理:", equipmentItems.length);
    console.log("生产管控菜单项:", productionItems.map(item => item.label));
  };
  // 检查模块是否有菜单项需要显示
@@ -1031,11 +1068,14 @@
  onMounted(() => {
    // 每次进入首页都强制刷新用户信息和路由权限,不做本地缓存判断
    userStore.getInfo().then(() => {
      userStore.getRouters().then(() => {
        filterMenuItemsByRoutes();
      }).catch(error => {
        console.error("获取路由权限失败:", error);
      });
      userStore
        .getRouters()
        .then(() => {
          filterMenuItemsByRoutes();
        })
        .catch(error => {
          console.error("获取路由权限失败:", error);
        });
    });
    getUserLoginFacotryList();
    // 启动通知状态定时器
@@ -1048,7 +1088,7 @@
  .content {
    background: #f6f7fb;
    min-height: 100vh;
    padding: 12px;
    // padding: 12px;
    /* 为所有设备设置基础padding-top(包含安全区) */
    padding-top: calc(env(safe-area-inset-top) + 30px);
    position: relative;
@@ -1122,6 +1162,7 @@
  }
  .hero-section {
    margin: 0 12px;
    margin-bottom: 12px;
    animation: fadeInUp 0.6s ease-out 0.1s both;
  }
@@ -1174,7 +1215,9 @@
  .hero-content {
    position: relative;
    z-index: 1;
    padding: 14px 14px 18px 14px;
    margin: 0 12px;
    height: 100%;
  }
  .hero-wave {
@@ -1350,7 +1393,7 @@
  .common-module {
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fbff 100%);
    border-radius: 14px;
    // border-radius: 14px;
    padding: 12px;
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.06);
    border: none;
@@ -1628,8 +1671,9 @@
  .common-module {
    margin-bottom: 12px;
    background: #ffffff;
    border-radius: 16px;
    padding: 12px;
    // border-radius: 16px;
    // padding: 0px;
    padding: 12px 0;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.18);
    position: relative;
@@ -1678,7 +1722,8 @@
  }
  .module-header {
    margin-bottom: 10px;
    margin-bottom: 18px;
    padding-left: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
@@ -1703,8 +1748,8 @@
  }
  .icon-container {
    width: 52px;
    height: 52px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
@@ -1751,9 +1796,9 @@
  }
  .item-label {
    font-size: 12px;
    font-size: 22rpx;
    margin-top: 4px;
    margin-bottom: 6px;
    margin-bottom: 20px;
  }
  .grid-text {
    font-size: 0.875rem;
@@ -1767,4 +1812,4 @@
      box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.4);
    }
  }
</style>
</style>