From 96e9d03db5fe4771ed29160047ff536c46cb7405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B1=97=E9=9D=92?= Date: Wed, 3 Jun 2026 16:39:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(lane):=20=E6=A0=B9=E6=8D=AE=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E5=8A=A8=E6=80=81=E8=AE=BE=E7=BD=AE=E5=B7=B7=E9=81=93?= =?UTF-8?q?=E7=BC=96=E5=8F=B7=E4=B8=8E=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/index.js | 65 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/js/index.js b/js/index.js index f02f53c..571d556 100644 --- a/js/index.js +++ b/js/index.js @@ -396,14 +396,10 @@ function liebiao(res) { var t = null; $(document).ready(function() { time() - // getData() - // window.setInterval("getData()", 10000); - // getData2() - // window.setInterval("getData2()", 3000); - // info() - // window.setInterval("info()", 3000); - // mockAlarmData(); + // 初始化巷道标题 + updateLaneHeaders(); + getAlarmData(); window.setInterval(getAlarmData, 1500); @@ -489,14 +485,27 @@ function getLaneData() { } function renderLaneData(data) { - var laneIds = ['1', '2', '3']; // Keys in the data object + // 根据仓库ID动态设置巷道编号 + let laneIds; + if (warehouseId === "02") { + laneIds = ['4', '5', '6']; //二联:4、5、6巷道 + } else { + laneIds = ['1', '2', '3']; //三联:1、2、3巷道 + } - laneIds.forEach(function(key) { + console.log(laneIds); + // 前端dom固定 lane1/lane2/lane3,依次渲染三个巷道 + const domIdList = ["lane1", "lane2", "lane3"]; + + // 同步更新页面顶部巷道标题 + updateLaneHeaders(); + + laneIds.forEach(function(key, idx) { var list = data[key] || []; var content = ""; content += ""; - $("#lane" + key).html(content); + // 依次填充 lane1/lane2/lane3 + $("#" + domIdList[idx]).html(content); }); } @@ -532,7 +542,7 @@ function getTaskTypeName(code) { if (!code) return ""; // 将编码转为数字(兼容字符串/数字类型入参),判断大小后返回对应名称 const numCode = Number(code); - return numCode > 20 ? "出库" : "入库"; + return numCode >= 20 ? "出库" : "入库"; } function getTaskStatusName(code) { @@ -778,6 +788,16 @@ function updatePreview() { ); } +function updateLaneHeaders() { + var laneIds = (warehouseId === "02") ? ['4', '5', '6'] : ['1', '2', '3']; + var laneHeaders = document.querySelectorAll(".lane-header"); + laneIds.forEach(function(key, idx) { + if (laneHeaders[idx]) { + laneHeaders[idx].textContent = key + "巷道"; + } + }); +} + function saveSettings() { // 更新全局变量 warehouseId = _pendingWarehouse; @@ -788,6 +808,9 @@ function saveSettings() { localStorage.setItem("warehouseId", warehouseId); localStorage.setItem("type", type); + // 立即更新巷道标题 + updateLaneHeaders(); + closeSettingModal(); // 立即刷新数据