sgj
16 小时以前 91aec47712c9a369b000ad2a67682fc2a8ab92f7
智能抓拍添加库区回显
已修改4个文件
51 ■■■■ 文件已修改
fzzy-igdss-web/src/main/java/com/fzzy/sys/controller/security/SnapRecordController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord-style.css 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/static/security/snap/snapRecord.js 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fzzy-igdss-web/src/main/resources/templates/security/snap/snapRecord/snapRecord.html 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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";
    }
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;
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 - 摄像头ID
 * @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;
}
/**
 * 格式化日期
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}]];