From 3f85e5410dda49e7e6a6292859649513f3644cb2 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 八月 2026 14:44:12 +0800
Subject: [PATCH] 天津豹鸣app 1.添加扫码查看设备变更记录功能

---
 src/pages/works.vue |  201 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 167 insertions(+), 34 deletions(-)

diff --git a/src/pages/works.vue b/src/pages/works.vue
index 2759b3e..3b7ffa7 100644
--- a/src/pages/works.vue
+++ b/src/pages/works.vue
@@ -336,19 +336,19 @@
   // 宸ヨ壓璁捐鍔熻兘鏁版嵁
   const designItems = reactive([
     {
-      icon: "/static/images/icon/xiaoshoubaojia.svg",
+      icon: "/static/images/icon/jichucanshu.svg",
       label: "鍩虹鍙傛暟",
     },
     {
-      icon: "/static/images/icon/xiaoshoubaojia.svg",
+      icon: "/static/images/icon/gongxuguanli.svg",
       label: "宸ュ簭绠$悊",
     },
     {
-      icon: "/static/images/icon/xiaoshoubaojia.svg",
+      icon: "/static/images/icon/bom.svg",
       label: "BOM",
     },
     {
-      icon: "/static/images/icon/xiaoshoubaojia.svg",
+      icon: "/static/images/icon/gongyiluxian.svg",
       label: "宸ヨ壓璺嚎",
     },
   ]);
@@ -444,11 +444,11 @@
   // 妗f绠$悊鍔熻兘鏁版嵁
   const archiveManagementItems = reactive([
     {
-      icon: "/static/images/icon/gongyingshangdangan.svg",
+      icon: "/static/images/icon/jieyuedengji.svg",
       label: "鍊熼槄鐧昏",
     },
     {
-      icon: "/static/images/icon/hetongguanli.svg",
+      icon: "/static/images/icon/guihuandengji.svg",
       label: "褰掕繕鐧昏",
     },
   ]);
@@ -468,7 +468,7 @@
   // 浠撳偍鐗╂祦鍔熻兘鏁版嵁
   const warehouseLogisticsItems = reactive([
     {
-      icon: "/static/images/icon/xiaoshoutaizhang.svg",
+      icon: "/static/images/icon/kucunguanli.svg",
       label: "搴撳瓨绠$悊",
     },
   ]);
@@ -485,6 +485,21 @@
     {
       icon: "/static/images/icon/hetongguanli.svg",
       label: "鍚堝悓绠$悊",
+    },
+    {
+      icon: "/static/images/icon/hetongguanli.svg",
+      label: "杞鐢宠",
+      path: "/pages/oa/HrManage/regular-apply/index",
+    },
+    {
+      icon: "/static/images/icon/renyuanxinzi.svg",
+      label: "璋冨姩鐢宠",
+      path: "/pages/oa/HrManage/transfer-apply/index",
+    },
+    {
+      icon: "/static/images/icon/gongchuguanli.svg",
+      label: "宸ヤ綔浜ゆ帴",
+      path: "/pages/oa/HrManage/work-handover/index",
     },
   ]);
   const qualityItems = reactive([
@@ -537,10 +552,20 @@
   ]);
   // 鍗忓悓鍔炲叕鍔熻兘鏁版嵁
   const collaborationItems = reactive([
-    {
-      icon: "/static/images/icon/xietongshenpi.svg",
-      label: "鍗忓悓瀹℃壒",
-    },
+    // {
+    //   icon: "/static/images/icon/xietongshenpi.svg",
+    //   label: "鍗忓悓瀹℃壒",
+    // },
+		{
+			icon: "/static/images/icon/guizhangzhidu.svg",
+			label: "瀹℃壒绠$悊",
+			path: "/pages/oa/ApproveManage/approve-template/index",
+		},
+		{
+			icon: "/static/images/icon/xietongshenpi.svg",
+			label: "鍗忓悓瀹℃壒",
+			path: "/pages/oa/ApproveManage/approve-list/index",
+		},
     {
       icon: "/static/images/icon/huiyiguanli.svg",
       label: "浼氳绠$悊",
@@ -565,38 +590,63 @@
       icon: "/static/images/icon/kehubaifang.svg",
       label: "瀹㈡埛鎷滆",
     },
+    {
+      icon: "/static/images/icon/qingjiaguanli.svg",
+      label: "璇峰亣鐢宠",
+      path: "/pages/oa/AttendManage/leave-apply/index",
+    },
+    {
+      icon: "/static/images/icon/dakaqiandao.svg",
+      label: "鍔犵彮鐢宠",
+      path: "/pages/oa/AttendManage/overtime-apply/index",
+    },
+    {
+      icon: "/static/images/icon/chuchaiguanli.svg",
+      label: "宸梾鎶ラ攢",
+      path: "/pages/oa/ReimburseManage/travel-reimburse/index",
+    },
+    {
+      icon: "/static/images/icon/baoxiaoguanli.svg",
+      label: "璐圭敤鎶ラ攢",
+      path: "/pages/oa/ReimburseManage/cost-reimburse/index",
+    },
   ]);
 
   // 鐢熶骇绠℃帶鍔熻兘鏁版嵁
   const productionItems = reactive([
     {
-      icon: "/static/images/icon/shengchandingdan@2x.svg",
-      label: "鐢熶骇璁㈠崟",
-    },
-    // {
-    //   icon: "/static/images/icon/shengchanpaigong@2x.svg",
-    //   label: "鐢熶骇娲惧伐",
-    // },
-    // {
-    //   icon: "/static/images/icon/shengchanpaichan@2x.svg",
-    //   label: "宸ュ簭鎺掍骇",
-    // },
-    {
-      icon: "/static/images/icon/shengchanbaogong.svg",
+      icon: "/static/images/icon/shengchanjihua.svg",
       label: "涓荤敓浜ц鍒�",
     },
+    {
+      icon: "/static/images/icon/shengchandingdan.svg",
+      label: "鐢熶骇璁㈠崟",
+    },
+    {
+      icon: "/static/images/icon/shengchanzhuisu.svg",
+      label: "鐢熶骇杩芥函",
+    },
+    {
+      icon: "/static/images/icon/shengchanshikuang.svg",
+      label: "宸ュ簭鐢熶骇瀹炲喌",
+    },
+    {
+      icon: "/static/images/icon/shengchanpaichan.svg",
+      label: "鐢熶骇鎺掍骇",
+    },
+
     {
       icon: "/static/images/icon/shengchanbaogong.svg",
       label: "鐢熶骇鎶ュ伐",
     },
     {
-      icon: "/static/images/icon/shengchanbaogong.svg",
-      label: "鐢熶骇宸ュ崟",
+      icon: "/static/images/icon/baogongtaizhang.svg",
+      label: "鎶ュ伐鍙拌处",
     },
-    // {
-    //   icon: "/static/images/icon/shengchanhesuan@2x.svg",
-    //   label: "鐢熶骇鏍哥畻",
-    // },
+    {
+      icon: "/static/images/icon/shengchanhesuan.svg",
+      label: "鐢熶骇鏍哥畻",
+    },
   ]);
 
   // 璁惧绠$悊鍔熻兘鏁版嵁
@@ -605,6 +655,10 @@
     // 	icon: '/static/images/icon/shebeitaizhang@2x.svg',
     // 	label: '璁惧鍙拌处',
     // },
+    {
+      icon: "/static/images/icon/saomashebei.svg",
+      label: "鎵爜鏌ヨ澶�",
+    },
     {
       icon: "/static/images/icon/yunxingguanli.svg",
       label: "杩愯绠$悊",
@@ -623,8 +677,48 @@
     },
   ]);
 
+  // 鎵爜鏌ヨ澶囷細瑙f瀽 deviceId 鍚庤烦杞埌璁惧淇℃伅椤�
+  const getDeviceIdFromScan = scanResult => {
+    if (!scanResult) return null;
+    const match = scanResult.match(/deviceId=(\d+)/);
+    if (match && match[1]) return match[1];
+    if (/^\d+$/.test(scanResult.trim())) return scanResult.trim();
+    try {
+      const obj = JSON.parse(scanResult);
+      if (obj.deviceId) return String(obj.deviceId);
+    } catch (e) {
+      // 蹇界暐闈� JSON 鍐呭
+    }
+    return null;
+  };
+
+  const startScanDevice = () => {
+    uni.scanCode({
+      scanType: ["qrCode", "barCode"],
+      success: res => {
+        console.log("鎵爜缁撴灉:", res.result);
+        const deviceId = getDeviceIdFromScan(res.result);
+        if (!deviceId) {
+          uni.showToast({ title: "鏈瘑鍒埌璁惧ID", icon: "none" });
+          return;
+        }
+        uni.navigateTo({
+          url: `/pages/equipmentManagement/deviceInfo/index?deviceId=${deviceId}`,
+        });
+      },
+      fail: err => {
+        console.error("鎵爜澶辫触:", err);
+        uni.showToast({ title: "鎵爜澶辫触锛岃閲嶈瘯", icon: "none" });
+      },
+    });
+  };
+
   // 澶勭悊甯哥敤鍔熻兘鐐瑰嚮
   const handleCommonItemClick = item => {
+    if (item.path) {
+      uni.navigateTo({ url: item.path });
+      return;
+    }
     // 鏍规嵁涓嶅悓鐨勫姛鑳介」杩涜璺宠浆
     switch (item.label) {
       case "瀹㈡埛妗f":
@@ -837,9 +931,9 @@
           url: "/pages/productionManagement/productionDispatching/index",
         });
         break;
-      case "宸ュ簭鎺掍骇":
+      case "宸ヨ壓璺嚎":
         uni.navigateTo({
-          url: "/pages/productionManagement/processScheduling/index",
+          url: "/pages/productionManagement/processRoute/index",
         });
         break;
       case "鐢熶骇宸ュ崟":
@@ -852,18 +946,41 @@
           url: "/pages/productionManagement/mainProductionPlan/index",
         });
         break;
+      case "鐢熶骇鎺掍骇":
+        uni.navigateTo({
+          url: "/pages/productionManagement/productionScheduling/index",
+        });
+        break;
       case "鐢熶骇鎶ュ伐":
         getcode();
+        break;
+      case "鎶ュ伐鍙拌处":
+        uni.navigateTo({
+          url: "/pages/productionManagement/productionReporting/ledger",
+        });
         break;
       case "鐢熶骇鏍哥畻":
         uni.navigateTo({
           url: "/pages/productionManagement/productionAccounting/index",
         });
         break;
+      case "鐢熶骇杩芥函":
+        uni.navigateTo({
+          url: "/pages/productionManagement/productionTraceability/index",
+        });
+        break;
+      case "宸ュ簭鐢熶骇瀹炲喌":
+        uni.navigateTo({
+          url: "/pages/productionManagement/processStatistics/index",
+        });
+        break;
       case "璁惧鍙拌处":
         uni.navigateTo({
           url: "/pages/equipmentManagement/ledger/index",
         });
+        break;
+      case "鎵爜鏌ヨ澶�":
+        startScanDevice();
         break;
       case "杩愯绠$悊":
         uni.navigateTo({
@@ -1046,7 +1163,7 @@
         factoryList.value = [];
       });
   }
-  const getcode = () => {
+  const getcode = async () => {
     uni.scanCode({
       success: async res => {
         // 瑙f瀽浜岀淮鐮佸唴瀹�
@@ -1070,6 +1187,11 @@
               // 鏂版帴鍙h繑鍥炵殑鏄崟涓璞★紝涓嶆槸鏁扮粍
               const workData = workRes.data;
               console.log("宸ュ崟鏁版嵁:", workData);
+
+              if (workData.endOrder === true) {
+                modal.msgError("璇ヨ鍗曞凡缁撴潫锛屾棤娉曟姤宸�");
+                return;
+              }
 
               orderRow = JSON.stringify(workData);
 
@@ -1179,7 +1301,7 @@
 
     // 鏀堕泦鎵�鏈夋湁鏉冮檺鐨勮彍鍗曟爣棰橈紙鏍规嵁 meta.title锛�
     const allowedMenuTitles = new Set();
-    const alwaysShowTitles = new Set(["閲囪喘閫�璐у崟", "渚涘簲鍟嗙鐞�"]);
+    const alwaysShowTitles = new Set(["閲囪喘閫�璐у崟", "渚涘簲鍟嗙鐞�", "鎵爜鏌ヨ澶�"]);
     const collectMenuTitles = routes => {
       if (!Array.isArray(routes)) return;
       routes.forEach(route => {
@@ -1205,6 +1327,7 @@
     // 閫氱敤杩囨护鍑芥暟
     const filterArray = (targetArray, specialMapping) => {
       const filtered = targetArray.filter(item => {
+        if (alwaysShowTitles.has(item.label)) return true;
         let matched = allowedMenuTitles.has(item.label);
         if (specialMapping && !matched && specialMapping[item.label]) {
           matched = allowedMenuTitles.has(specialMapping[item.label]);
@@ -1216,6 +1339,7 @@
 
     // 杩囨护鍚勪釜妯″潡
     filterArray(marketingItems);
+    filterArray(designItems);
     filterArray(purchaseItems, menuMapping.purchase.specialMapping);
     filterArray(financeManagementItems);
     filterArray(collaborationItems, menuMapping.collaboration.specialMapping);
@@ -1226,6 +1350,7 @@
     filterArray(productionItems);
     filterArray(equipmentItems);
     filterArray(archiveManagementItems);
+    filterArray(afterSalesServiceItems);
   };
 
   // 妫�鏌ユā鍧楁槸鍚︽湁鑿滃崟椤归渶瑕佹樉绀�
@@ -1616,6 +1741,10 @@
     --module-color: #4caf50;
   }
 
+  .oa-module {
+    --module-color: #673ab7;
+  }
+
   .production-module {
     --module-color: #ff9800;
   }
@@ -1858,6 +1987,10 @@
     --module-color: #4caf50;
   }
 
+  .oa-module {
+    --module-color: #673ab7;
+  }
+
   .production-module {
     --module-color: #ff9800;
   }

--
Gitblit v1.9.3