diff --git a/application/admin/view/granary/index.html b/application/admin/view/granary/index.html index 75397b6..0023aba 100644 --- a/application/admin/view/granary/index.html +++ b/application/admin/view/granary/index.html @@ -151,6 +151,8 @@ 添加 删除 + 中心库大屏 + 习水库大屏 diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 329d881..ee03396 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -40,7 +40,11 @@ class Index extends Api if ($site === 'xishui') { $query->where('storage', 'like', '%习水%'); } else { - $query->where('storage', 'like', '%中心库%'); + $query->where(function ($q) { + $q->where('storage', 'like', '%中心库%') + ->whereOr('storage', 'not like', '%习水%') + ->whereOr('storage', null); + }); } $list = $query->select(); @@ -339,50 +343,66 @@ class Index extends Api { if ($site === 'xishui') { return [ - 'xishui_1' => ['top' => 45.2, 'left' => 19.8, 'x' => 19.8, 'y' => 45.2], - 'xishui_2' => ['top' => 48.0, 'left' => 26.5, 'x' => 26.5, 'y' => 48.0], - 'xishui_3' => ['top' => 51.5, 'left' => 33.2, 'x' => 33.2, 'y' => 51.5], - 'xishui_4' => ['top' => 54.8, 'left' => 40.0, 'x' => 40.0, 'y' => 54.8], - 'xishui_5' => ['top' => 43.5, 'left' => 47.8, 'x' => 47.8, 'y' => 43.5], - 'xishui_6' => ['top' => 46.5, 'left' => 54.5, 'x' => 54.5, 'y' => 46.5], - 'xishui_7' => ['top' => 49.5, 'left' => 61.2, 'x' => 61.2, 'y' => 49.5], - 'xishui_8' => ['top' => 52.8, 'left' => 68.0, 'x' => 68.0, 'y' => 52.8], - 'xishui_9' => ['top' => 34.0, 'left' => 36.5, 'x' => 36.5, 'y' => 34.0], - 'xishui_10' => ['top' => 33.0, 'left' => 50.0, 'x' => 50.0, 'y' => 33.0], - 'xishui_11' => ['top' => 32.0, 'left' => 63.5, 'x' => 63.5, 'y' => 32.0], + 101 => ['top' => 47.5, 'left' => 26.4, 'x' => 26.4, 'y' => 47.5], + 102 => ['top' => 48.0, 'left' => 39.6, 'x' => 39.6, 'y' => 48.0], + 103 => ['top' => 48.0, 'left' => 60.4, 'x' => 60.4, 'y' => 48.0], + 104 => ['top' => 47.5, 'left' => 73.7, 'x' => 73.7, 'y' => 47.5], + 105 => ['top' => 33.5, 'left' => 27.0, 'x' => 27.0, 'y' => 33.5], + 106 => ['top' => 34.0, 'left' => 39.0, 'x' => 39.0, 'y' => 34.0], + 107 => ['top' => 34.0, 'left' => 60.2, 'x' => 60.2, 'y' => 34.0], + 108 => ['top' => 33.5, 'left' => 73.2, 'x' => 73.2, 'y' => 33.5], + 109 => ['top' => 22.5, 'left' => 55.0, 'x' => 55.0, 'y' => 22.5], + 110 => ['top' => 29.0, 'left' => 84.5, 'x' => 84.5, 'y' => 29.0], + 111 => ['top' => 47.0, 'left' => 85.5, 'x' => 85.5, 'y' => 47.0], + 'xishui_1' => ['top' => 47.5, 'left' => 26.4, 'x' => 26.4, 'y' => 47.5], + 'xishui_2' => ['top' => 48.0, 'left' => 39.6, 'x' => 39.6, 'y' => 48.0], + 'xishui_3' => ['top' => 48.0, 'left' => 60.4, 'x' => 60.4, 'y' => 48.0], + 'xishui_4' => ['top' => 47.5, 'left' => 73.7, 'x' => 73.7, 'y' => 47.5], + 'xishui_5' => ['top' => 33.5, 'left' => 27.0, 'x' => 27.0, 'y' => 33.5], + 'xishui_6' => ['top' => 34.0, 'left' => 39.0, 'x' => 39.0, 'y' => 34.0], + 'xishui_7' => ['top' => 34.0, 'left' => 60.2, 'x' => 60.2, 'y' => 34.0], + 'xishui_8' => ['top' => 33.5, 'left' => 73.2, 'x' => 73.2, 'y' => 33.5], + 'xishui_9' => ['top' => 22.5, 'left' => 55.0, 'x' => 55.0, 'y' => 22.5], + 'xishui_10' => ['top' => 29.0, 'left' => 84.5, 'x' => 84.5, 'y' => 29.0], + 'xishui_11' => ['top' => 47.0, 'left' => 85.5, 'x' => 85.5, 'y' => 47.0], ]; } $rawCenter = [ - 30 => ['top' => 60.5, 'left' => 12.5], - 31 => ['top' => 58.2, 'left' => 18.0], - 32 => ['top' => 56.0, 'left' => 23.5], - 33 => ['top' => 53.8, 'left' => 29.0], - 35 => ['top' => 51.5, 'left' => 34.5], - 36 => ['top' => 49.2, 'left' => 40.0], - 37 => ['top' => 47.0, 'left' => 45.5], - 38 => ['top' => 44.8, 'left' => 51.0], - 39 => ['top' => 42.5, 'left' => 56.5], - 40 => ['top' => 40.2, 'left' => 62.0], - 41 => ['top' => 38.0, 'left' => 67.5], - 42 => ['top' => 35.8, 'left' => 73.0], - 43 => ['top' => 33.5, 'left' => 78.5], - 44 => ['top' => 31.2, 'left' => 84.0], - 10 => ['top' => 75.0, 'left' => 28.0], - 12 => ['top' => 73.0, 'left' => 35.0], - 14 => ['top' => 71.0, 'left' => 42.0], - 15 => ['top' => 69.0, 'left' => 49.0], - 16 => ['top' => 67.0, 'left' => 56.0], - 17 => ['top' => 65.0, 'left' => 63.0], - 18 => ['top' => 63.0, 'left' => 70.0], + // 7 座立式储油罐 (含高位激光引线 stemY 错层防遮挡) + 14 => ['top' => 12.8, 'left' => 4.8, 'stemX' => 2.8, 'stemY' => 20.3], + 18 => ['top' => 18.5, 'left' => 6.5, 'stemY' => 21.0], + 17 => ['top' => 9.2, 'left' => 9.6, 'stemY' => 18.4], + 12 => ['top' => 15.8, 'left' => 10.5, 'stemY' => 22.0], + 16 => ['top' => 12.2, 'left' => 13.7, 'stemY' => 22.4], + 10 => ['top' => 16.0, 'left' => 16.9, 'stemY' => 23.1], + 15 => ['top' => 13.0, 'left' => 19.8, 'stemY' => 19.8], + // 14 栋粮食平房仓 + 44 => ['top' => 18.7, 'left' => 45.1], + 43 => ['top' => 33.5, 'left' => 44.0], + 35 => ['top' => 23.8, 'left' => 38.5], + 42 => ['top' => 29.9, 'left' => 52.1], + 36 => ['top' => 28.0, 'left' => 33.8], + 41 => ['top' => 35.0, 'left' => 65.9], + 33 => ['top' => 34.5, 'left' => 29.7], + 37 => ['top' => 41.0, 'left' => 40.0], + 38 => ['top' => 42.0, 'left' => 59.0], + 40 => ['top' => 41.0, 'left' => 80.6], + 39 => ['top' => 49.5, 'left' => 75.8], + 32 => ['top' => 51.3, 'left' => 56.3], + 31 => ['top' => 60.2, 'left' => 73.2], + 30 => ['top' => 61.8, 'left' => 50.5], ]; $result = []; foreach ($rawCenter as $k => $c) { - $result[$k] = [ + $row = [ 'top' => $c['top'], 'left' => $c['left'], 'x' => $c['left'], 'y' => $c['top'] ]; + if (isset($c['stemX'])) $row['stemX'] = $c['stemX']; + if (isset($c['stemY'])) $row['stemY'] = $c['stemY']; + $result[$k] = $row; } return $result; } diff --git a/public/assets/js/backend/granary.js b/public/assets/js/backend/granary.js index 7b5ccec..0c4309a 100644 --- a/public/assets/js/backend/granary.js +++ b/public/assets/js/backend/granary.js @@ -263,6 +263,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin this.loadData(this.search.keyword, this.currentPage, this.pageSize, this.search.sort); }, methods: { + // 直达中心库大屏 + openCenterScreen() { + window.open('/screen/index.html', '_blank'); + }, + // 直达习水库大屏 + openXishuiScreen() { + window.open('/screen/xishui.html', '_blank'); + }, // 刷新页面 refreshPage() { this.search = { diff --git a/public/screen/js/app.js b/public/screen/js/app.js index 9b5a0f2..fad5887 100644 --- a/public/screen/js/app.js +++ b/public/screen/js/app.js @@ -216,8 +216,15 @@ function renderHotspots() { container.innerHTML = ''; STATE.list.forEach(item => { - const coord = hotspotCoords[item.id]; - if (!coord) return; + const rawCoord = hotspotCoords[item.id] || hotspotCoords[item.num] || hotspotCoords[item.name]; + if (!rawCoord) return; + + const coord = { + x: rawCoord.x !== undefined ? rawCoord.x : (rawCoord.left !== undefined ? rawCoord.left : 50), + y: rawCoord.y !== undefined ? rawCoord.y : (rawCoord.top !== undefined ? rawCoord.top : 50), + stemX: rawCoord.stemX, + stemY: rawCoord.stemY + }; const isOil = item.isOilTank; const isVisible = STATE.filterType === 'all' || diff --git a/public/screen/js/grain_monitor_core.js b/public/screen/js/grain_monitor_core.js index 9adaeaa..4865d65 100644 --- a/public/screen/js/grain_monitor_core.js +++ b/public/screen/js/grain_monitor_core.js @@ -34,6 +34,12 @@ export const DESIGN_THEME = { if (str.includes('稻') || str.includes('paddy') || str.includes('rice')) { return { color: '#10b981', label: '稻谷', type: 'paddy' }; } + if (str.includes('玉米') || str.includes('corn')) { + return { color: '#eab308', label: '玉米', type: 'corn' }; + } + if (str.includes('大豆') || str.includes('soybean') || str.includes('bean')) { + return { color: '#ca8a04', label: '大豆', type: 'soybean' }; + } return { color: '#38bdf8', label: '小麦', type: 'wheat' }; } }; @@ -948,7 +954,7 @@ export function mapVarietyToForecastType(varietyName) { if (!varietyName) return null; const str = String(varietyName).toLowerCase(); if (str.includes('油') || str.includes('oil') || str.includes('rapeseed')) return null; - if (str.includes('麦') || str.includes('wheat')) return 'wheat'; + if (str.includes('麦') || str.includes('wheat') || str.includes('玉米') || str.includes('corn') || str.includes('高粱')) return 'wheat'; if (str.includes('稻') || str.includes('rice') || str.includes('paddy')) return 'rice'; return null; } diff --git a/public/screen/js/xishui_app.js b/public/screen/js/xishui_app.js index 31ad8e5..8e8e912 100644 --- a/public/screen/js/xishui_app.js +++ b/public/screen/js/xishui_app.js @@ -204,8 +204,13 @@ function renderHotspots() { container.innerHTML = ''; STATE.list.forEach(item => { - const coord = hotspotCoords[item.id]; - if (!coord) return; + const rawCoord = hotspotCoords[item.id] || hotspotCoords[item.num] || hotspotCoords[item.name]; + if (!rawCoord) return; + + const coord = { + x: rawCoord.x !== undefined ? rawCoord.x : (rawCoord.left !== undefined ? rawCoord.left : 50), + y: rawCoord.y !== undefined ? rawCoord.y : (rawCoord.top !== undefined ? rawCoord.top : 50) + }; const isSilo = item.grainTypeCategory === 'silo'; const isVisible = STATE.filterType === 'all' ||