From 91aec47712c9a369b000ad2a67682fc2a8ab92f7 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期三, 17 十二月 2025 10:13:31 +0800
Subject: [PATCH] 智能抓拍添加库区回显

---
 fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord-style.css             |    2 +-
 fzzy-igdss-web/src/main/resources/templates/security/snap/snapRecord/snapRecord.html    |   23 ++++++++++++++++-------
 fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/security/SnapRecordController.java |    1 +
 fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord.js                    |   25 +++++++++++++++++++++----
 4 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/security/SnapRecordController.java b/fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/security/SnapRecordController.java
index 9c38404..a4666b4 100644
--- a/fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/security/SnapRecordController.java
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/security/SnapRecordController.java
@@ -47,6 +47,7 @@
         model.addAttribute("totalItems", images.getTotal());
         model.addAttribute("pageSize", images.getSize());
         model.addAttribute("cameraList", commonManager.listCameraData());
+        model.addAttribute("deptList", commonManager.listDeptData());
         return prefix + "/snapRecord";
     }
 
diff --git a/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord-style.css b/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord-style.css
index 268a484..f661cb2 100644
--- a/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord-style.css
+++ b/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord-style.css
@@ -70,7 +70,7 @@
 
 .gallery-img {
     width: 100%;
-    height: 240px;
+    height: 229px;
     object-fit: cover;
     cursor: pointer;
     transition: all 0.3s ease;
diff --git a/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord.js b/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord.js
index 51c2bdb..48c2a5f 100644
--- a/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord.js
+++ b/fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord.js
@@ -177,12 +177,11 @@
                         <span>${formatDate(record.snapTime)}</span>
                     </div>
                  </div>
-<!--                
-  <div class="meta-item">
+              
+                 <div class="meta-item">
                     <i class="layui-icon layui-icon-home"></i>
-                    <span>${record.deptId || ''}</span>
+                    <span>${getDeptName(record.deptId) || record.deptId || ''}</span>
                  </div>  
- -->
                                    
             </div>        
         </div>
@@ -213,6 +212,24 @@
     return null;
 }
 
+/**
+ * 鏍规嵁搴撳尯ID鑾峰彇搴撳尯鍚嶇О
+ * @param {string} deptId - 鎽勫儚澶碔D
+ * @returns {string|null} 鎽勫儚澶村悕绉版垨null
+ */
+function getDeptName(deptId) {
+    // 纭繚deptList瀛樺湪涓斾负鏁扮粍
+    if (typeof deptList !== 'undefined' && Array.isArray(deptList) && deptId) {
+        // 鏌ユ壘鍖归厤鐨勬憚鍍忓ご瀵硅薄
+        var dept = deptList.find(function(item) {
+            return item.id === deptId;
+        });
+        // 杩斿洖鎽勫儚澶村悕绉帮紝濡傛灉鎵句笉鍒板垯杩斿洖null
+        return dept ? dept.kqmc : null;
+    }
+    return null;
+}
+
 
 /**
  * 鏍煎紡鍖栨棩鏈�
diff --git a/fzzy-igdss-web/src/main/resources/templates/security/snap/snapRecord/snapRecord.html b/fzzy-igdss-web/src/main/resources/templates/security/snap/snapRecord/snapRecord.html
index 8550b7e..b10c88c 100644
--- a/fzzy-igdss-web/src/main/resources/templates/security/snap/snapRecord/snapRecord.html
+++ b/fzzy-igdss-web/src/main/resources/templates/security/snap/snapRecord/snapRecord.html
@@ -28,7 +28,7 @@
                         </select>
                         </li>
                         <li class="select-time">
-                            <label>鎶撴媿鏃堕棿锛� </label>
+                            <label style="width: 100px">鎶撴媿鏃堕棿锛�</label>
                             <input type="text" class="time-input" style="width: 120px;" id="start" placeholder="寮�濮嬫椂闂�" name="params[begin]"/>
                             <span>-</span>
                             <input type="text" class="time-input" style="width: 120px;" id="end" placeholder="缁撴潫鏃堕棿" name="params[end]"/>
@@ -94,16 +94,24 @@
                                 </div>
 
 
-
-
                                 <div class="meta-item" style="width: 50%">
                                     <i class="layui-icon layui-icon-date"></i>
                                     <span th:text="${snapRecord.snapTime != null ? #dates.format(snapRecord.snapTime, 'yyyy-MM-dd HH:mm') : '鏃犳椂闂�'}"></span>                                </div>
                             </div>
-                            <!--                            <div class="meta-item">-->
-                            <!--                                <i class="layui-icon layui-icon-home"></i>-->
-                            <!--                                <span th:text="${snapRecord.deptId}"></span>-->
-                            <!--                            </div>-->
+                            <div class="meta-item">
+                                <i class="layui-icon layui-icon-home"></i>
+<!--                                <span th:text="${snapRecord.deptId}"></span>-->
+                                <th:block th:with="matchedDept=${deptList.?[id == #root.snapRecord.deptId]}">
+                                    <!-- 濡傛灉鏈夊尮閰嶉」锛屾樉绀虹涓�涓尮閰嶇殑鎽勫儚澶村悕绉� -->
+                                    <th:block th:if="${!#lists.isEmpty(matchedDept)}">
+                                        <span th:text="${matchedDept[0].kqmc}"></span>
+                                    </th:block>
+                                    <!-- 濡傛灉娌℃湁鍖归厤椤癸紝鏄剧ず鍘熷ID -->
+                                    <th:block th:if="${#lists.isEmpty(matchedDept)}">
+                                        <span th:text="${snapRecord.deptId}"></span>
+                                    </th:block>
+                                </th:block>
+                            </div>
                         </div>
                     </div>
                 </div>
@@ -131,6 +139,7 @@
 <script th:src="@{/security/snap/snapRecord.js}"></script>
 <script th:inline="javascript">
     var cameraList = [[${cameraList}]];
+    var deptList = [[${deptList}]];
     var currentPage = [[${currentPage}]];
     var totalItems = [[${totalItems}]];
     var pageSize = [[${pageSize}]];

--
Gitblit v1.9.3