From 11b40328f7aa7599f89189d0ebcbbdf8773f9e1b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 21 四月 2026 10:41:41 +0800
Subject: [PATCH] 新疆马铃薯 1.巡检记录添加巡检状态和巡检结果展示字段

---
 src/views/inventoryManagement/environmentalMonitoring/index.vue |   62 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/src/views/inventoryManagement/environmentalMonitoring/index.vue b/src/views/inventoryManagement/environmentalMonitoring/index.vue
index 8e692a3..7db5696 100644
--- a/src/views/inventoryManagement/environmentalMonitoring/index.vue
+++ b/src/views/inventoryManagement/environmentalMonitoring/index.vue
@@ -20,6 +20,8 @@
         <div class="sensor-table__head">
           <span>璁惧缂栧彿</span>
           <span>璁惧鍚嶇О</span>
+          <span>鐘舵��</span>
+          <span>鐢甸噺</span>
           <span>娓╁害</span>
           <span>婀垮害</span>
           <span>浜屾哀鍖栫⒊</span>
@@ -29,6 +31,18 @@
         <div v-for="item in deviceRows" :key="item.guid" class="sensor-table__row">
           <span>{{ item.guid }}</span>
           <span>{{ item.name }}</span>
+          <span>
+            <el-tag
+              v-if="item.statusLabel !== '-'"
+              :type="item.statusTagType"
+              effect="light"
+              size="small"
+            >
+              {{ item.statusLabel }}
+            </el-tag>
+            <span v-else>{{ item.statusLabel }}</span>
+          </span>
+          <span>{{ item.battery }}</span>
           <span>{{ item.temperature }}</span>
           <span>{{ item.humidity }}</span>
           <span>{{ item.co2 }}</span>
@@ -168,8 +182,11 @@
   const hour = endOfDay ? 23 : 0;
   const minute = endOfDay ? 59 : 0;
   const second = endOfDay ? 59 : 0;
+  const shanghaiOffsetHours = 8;
 
-  return Math.floor(Date.UTC(year, month - 1, day, hour, minute, second) / 1000);
+  return Math.floor(
+    Date.UTC(year, month - 1, day, hour - shanghaiOffsetHours, minute, second) / 1000
+  );
 }
 
 function extractNumericValue(rawValue) {
@@ -204,6 +221,8 @@
   const normalized = {
     guid: source.guid || source.deviceGuid || source.deviceNo || `GUID-${index + 1}`,
     name: source.deviceName || source.name || `璁惧${index + 1}`,
+    status: source.status || source.deviceStatus || "",
+    battery: source.battery ?? source.deviceBattery ?? "",
     temperature: 0,
     humidity: 0,
     co2: 0,
@@ -218,6 +237,42 @@
   });
 
   return normalized;
+}
+
+function formatStatusValue(value) {
+  if (value === "offline") {
+    return "绂荤嚎";
+  }
+  if (value === "error") {
+    return "寮傚父";
+  }
+  return value || "-";
+}
+
+function resolveStatusTagType(value) {
+  if (value === "offline") {
+    return "info";
+  }
+  if (value === "error") {
+    return "danger";
+  }
+  if (value) {
+    return "success";
+  }
+  return "";
+}
+
+function formatBatteryValue(value) {
+  if (value === "" || value === null || value === undefined) {
+    return "-";
+  }
+
+  const numericValue = Number(value);
+  if (Number.isFinite(numericValue)) {
+    return `${numericValue}%`;
+  }
+
+  return String(value);
 }
 
 function resolveHistoryTimeLabel(source, index) {
@@ -299,6 +354,9 @@
   latestDevices.value.map((item) => ({
     guid: item.guid,
     name: item.name,
+    statusLabel: formatStatusValue(item.status),
+    statusTagType: resolveStatusTagType(item.status),
+    battery: formatBatteryValue(item.battery),
     temperature: formatMetricValue(item.temperature, "鈩�"),
     humidity: formatMetricValue(item.humidity, "%RH"),
     co2: formatMetricValue(item.co2, "ppm"),
@@ -415,7 +473,7 @@
 .sensor-table__head,
 .sensor-table__row {
   display: grid;
-  grid-template-columns: 1.2fr 1fr 0.9fr 0.9fr 1fr 0.9fr 0.9fr;
+  grid-template-columns: 1.2fr 1fr 0.8fr 0.8fr 0.9fr 0.9fr 1fr 0.9fr 0.9fr;
   gap: 12px;
   align-items: center;
 }

--
Gitblit v1.9.3