From ccebf340a1086d9b4c463f27fafb531b3780d0fd Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 29 十月 2026 10:16:24 +0800
Subject: [PATCH] feat(safety): 新增安全生产模块前端 + 修正数采标识展示

---
 src/views/mes/dv/collect/index.vue |   73 ++++++++++++++++++++++++++----------
 1 files changed, 53 insertions(+), 20 deletions(-)

diff --git a/src/views/mes/dv/collect/index.vue b/src/views/mes/dv/collect/index.vue
index abbc449..c07a14a 100644
--- a/src/views/mes/dv/collect/index.vue
+++ b/src/views/mes/dv/collect/index.vue
@@ -207,43 +207,57 @@
     .map((k) => ({ key: k, value: data[k] }));
 }
 
+/**
+ * 鏁伴噰鏍囪瘑鏄惁涓庤澶囧悕绉扮浉鍚屻��
+ *
+ * <p>璁惧缃戝叧锛圛oTGateway锛変笂鎶ョ殑涓婚鍥哄畾涓� gateway/attributes锛�
+ * 鎶ユ枃棣栧眰 key 鍙栫殑鏄綉鍏抽噷閰嶇疆鐨勩�岃澶囧悕绉般�嶏紝鎵�浠ユ湰椤圭洰鐨� collect_device_code
+ * 鍙兘绛変簬璁惧鍚嶇О锛堝銆�630妗嗙粸鏈�2銆嶏級锛屽苟涓嶆槸 C01 杩欑被鐭紪鐮併��
+ * 杩欓噷鎹鍖哄垎灞曠ず锛岄伩鍏嶇敤鎴疯浠ヤ负銆屾暟閲囩紪鐮併�嶅垪濉敊浜嗐��</p>
+ */
+function isCollectCodeSameAsName(row: MesCollectApi.CollectDevice) {
+  return Boolean(row.collectDeviceCode) &&
+    row.collectDeviceCode === row.machineryName;
+}
+
 /** 琛ㄦ牸鍒� */
 const columns = [
   {
-    title: '璁惧',
+    title: '璁惧鍚嶇О',
     dataIndex: 'machineryName',
-    width: 170,
+    width: 165,
     fixed: 'left' as const,
-    customRender: ({ record }: any) => record,
   },
   {
-    title: '鏁伴噰缂栫爜',
+    title: '璁惧缂栫爜',
+    dataIndex: 'machineryCode',
+    width: 150,
+  },
+  {
+    title: '鏁伴噰鏍囪瘑',
     dataIndex: 'collectDeviceCode',
-    width: 130,
+    width: 150,
   },
   {
     title: '鐘舵��',
     dataIndex: 'online',
-    width: 110,
-    customRender: ({ record }: any) => record,
+    width: 100,
   },
   {
     title: '褰撳墠鏁版嵁',
     dataIndex: 'currentData',
-    minWidth: 300,
-    customRender: ({ record }: any) => record,
+    minWidth: 320,
   },
   {
     title: '鏈�杩戦噰闆�',
     dataIndex: 'lastCollectTime',
-    width: 165,
+    width: 160,
   },
   {
     title: '鎶ヨ',
     dataIndex: 'activeAlarmCount',
     width: 80,
     align: 'center' as const,
-    customRender: ({ record }: any) => record,
   },
   {
     title: '鎿嶄綔',
@@ -251,7 +265,6 @@
     width: 90,
     align: 'center' as const,
     fixed: 'right' as const,
-    customRender: ({ record }: any) => record,
   },
 ];
 
@@ -414,18 +427,38 @@
         :cell-style="{ padding: '12px 16px' }"
       >
         <template #bodyCell="{ column, record }">
-          <!-- 璁惧鍚嶇О -->
+          <!-- 璁惧鍚嶇О锛氬彧鏀惧悕绉帮紝缂栫爜鍗曠嫭鎴愬垪 -->
           <template v-if="column.dataIndex === 'machineryName'">
-            <a class="flex flex-col" @click="handleDetail(record)">
-              <span class="font-medium text-blue-600 hover:text-blue-700">
-                {{ record.machineryName }}
-              </span>
-              <span class="text-muted-foreground text-xs">
-                {{ record.machineryCode }}
-              </span>
+            <a
+              class="font-medium text-blue-600 hover:text-blue-700"
+              @click="handleDetail(record)"
+            >
+              {{ record.machineryName }}
             </a>
           </template>
 
+          <!-- 璁惧缂栫爜 -->
+          <template v-else-if="column.dataIndex === 'machineryCode'">
+            <span class="font-mono text-xs">{{ record.machineryCode }}</span>
+          </template>
+
+          <!-- 鏁伴噰鏍囪瘑锛氱綉鍏充笂鎶ユ姤鏂囬灞� key锛岀綉鍏充晶鍙栫殑鏄澶囧悕绉帮紝鏁呭父涓庡悕绉扮浉鍚� -->
+          <template v-else-if="column.dataIndex === 'collectDeviceCode'">
+            <span v-if="record.collectDeviceCode" class="font-mono text-xs">
+              {{ record.collectDeviceCode }}
+            </span>
+            <span v-else class="text-gray-300">鈥�</span>
+            <Tooltip
+              v-if="isCollectCodeSameAsName(record)"
+              title="璁惧缃戝叧锛圛oTGateway锛変笂鎶ユ姤鏂囩殑棣栧眰 key 鍙栫殑鏄綉鍏抽噷鐨勮澶囧悕绉帮紝鍥犳璇ユ爣璇嗕笌璁惧鍚嶇О鐩稿悓锛涘湪缃戝叧閲屾敼璁惧鍚嶇О鍗冲彲鍙樻洿姝ゆ爣璇�"
+            >
+              <IconifyIcon
+                class="ml-1 inline cursor-help text-gray-400"
+                icon="lucide:info"
+              />
+            </Tooltip>
+          </template>
+
           <!-- 鍦ㄧ嚎鐘舵�� -->
           <template v-else-if="column.dataIndex === 'online'">
             <Badge

--
Gitblit v1.9.3