From 21078521d79f0eb5535cc34be7917a3fd1123b8f Mon Sep 17 00:00:00 2001
From: HuBingJie <3146306518@qq.com>
Date: 星期三, 29 十月 2025 15:35:29 +0800
Subject: [PATCH] RGV监控
---
代码管理/WCS/WCS/WIDESEAWCS_Client/src/views/Home.vue | 1568 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 1,423 insertions(+), 145 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Client/src/views/Home.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Client/src/views/Home.vue"
index 8b40ac0..61f98f8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Client/src/views/Home.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Client/src/views/Home.vue"
@@ -1,181 +1,1459 @@
<template>
- <div class="title">璁惧鍒濆鍖�</div>
- <div>
- <div class="container">
- <label>AGV璁惧鍚嶇О</label>
- <el-select placeholder="璇烽�夋嫨鐗╂枡鐘舵��" v-model="DeviceName">
- <el-option label="(鍑哄簱)姣嶈溅锛歊GV110" value="RGV110" />
- <el-option label="(鍑哄簱)姣嶈溅锛歊GV112" value="RGV112" />
- <el-option label="(鍑哄簱)瀛愯溅锛歊GV111" value="RGV111" />
- <el-option label="(鍑哄簱)瀛愯溅锛歊GV116" value="RGV116" />
- <el-option label="(鍑哄簱)姣嶈溅锛歊GV114" value="RGV114" />
- <el-option label="(鍑哄簱)姣嶈溅锛歊GV115" value="RGV115" />
- <el-option label="姣嶈溅锛歊GV109" value="RGV109" />
- <el-option label="姣嶈溅锛歊GV108" value="RGV108" />
- <el-option label="姣嶈溅锛歊GV105" value="RGV105" />
- <el-option label="姣嶈溅锛歊GV103" value="RGV103" />
-
- <el-option label="瀛愯溅锛歊GV104" value="RGV104" />
- <el-option label="瀛愯溅锛歊GV107" value="RGV107" />
- </el-select>
+ <div class="rgv-monitor">
+ <div class="monitor-header">
+ <div class="title">璁惧鐘舵�佺洃鎺�</div>
+ <div class="control-panel">
+ <!-- 鐩戞帶绫诲瀷鍒囨崲 -->
+ <div class="monitor-type-switch">
+ <el-button-group>
+ <el-button
+ :type="currentMonitorType === 'inbound' ? 'primary' : ''"
+ @click="switchMonitorType('inbound')"
+ >
+ 鍏ュ簱鐩戞帶
+ </el-button>
+ <el-button
+ :type="currentMonitorType === 'outbound' ? 'primary' : ''"
+ @click="switchMonitorType('outbound')"
+ >
+ 鍑哄簱鐩戞帶
+ </el-button>
+ <el-button
+ :type="currentMonitorType === 'safetydoor' ? 'primary' : ''"
+ @click="switchMonitorType('safetydoor')"
+ >
+ 瀹夊叏闂ㄧ洃鎺�
+ </el-button>
+ </el-button-group>
+ </div>
+
+ <!-- 涓�閿搷浣滄寜閽紙瀹夊叏闂ㄧ洃鎺ф椂涓嶆樉绀猴級 -->
+ <div class="one-click-operations" v-if="currentMonitorType !== 'safetydoor'">
+ <el-button-group>
+ <el-button
+ type="primary"
+ @click="handleOneClickOperation('init')"
+ :loading="oneClickLoading.init"
+ >
+ 涓�閿垵濮嬪寲
+ </el-button>
+ <el-button
+ type="warning"
+ @click="handleOneClickOperation('reset')"
+ :loading="oneClickLoading.reset"
+ >
+ 涓�閿浣�
+ </el-button>
+ <el-button
+ type="success"
+ @click="handleOneClickOperation('start')"
+ :loading="oneClickLoading.start"
+ >
+ 涓�閿惎鍔�
+ </el-button>
+ <el-button
+ type="danger"
+ @click="handleOneClickOperation('stop')"
+ :loading="oneClickLoading.stop"
+ >
+ 涓�閿殏鍋�
+ </el-button>
+ </el-button-group>
+ </div>
+
+ <el-button
+ :type="isMonitoring ? 'danger' : 'primary'"
+ @click="toggleMonitoring"
+ >
+ {{ isMonitoring ? '鍋滄鐩戞帶' : '鍚姩鐩戞帶' }}
+ </el-button>
+ <el-button type="warning" @click="refreshData">鍒锋柊鏁版嵁</el-button>
+ </div>
</div>
- <div class="container">
- <label>鍐欏叆鐨勭被鍨�</label>
- <el-select placeholder="璇烽�夋嫨鐗╂枡鐘舵��" v-model="DBType">
- <el-option label="宸ヤ綔妯″紡锛�0鎵嬪姩銆�1鑷姩锛�" value="1" />
- <el-option label="澶嶄綅鎿嶄綔锛�0涓嶅浣嶃��1澶嶄綅锛�" value="2" />
- <el-option label="浠诲姟纭瀹屾垚锛�0涓嶇‘瀹氾紝1纭畾锛�" value="3" />
- <el-option label="浠诲姟绫诲瀷(4娓呴櫎)" value="4" />
- </el-select>
- </div>
- <div class="container">
- <label>鍐欏叆鍙傛暟</label>
- <el-input type="text" v-model="WriteRGVvalue"></el-input>
+ <!-- 鐩戞帶鐘舵�佹樉绀� -->
+ <div class="monitor-status">
+ <el-alert
+ :title="getMonitorStatusTitle()"
+ :type="isMonitoring ? 'success' : 'info'"
+ :closable="false"
+ show-icon
+ />
</div>
- <el-button type="danger" v-on:click="submit" plain style="margin-left: 50px">鍐欏叆</el-button>
+ <div class="devices-container">
+ <!-- 鍔ㄦ�佹覆鏌撹澶� -->
+ <div
+ class="device-card"
+ v-for="(deviceData, deviceKey) in currentDeviceData"
+ :key="deviceKey"
+ >
+ <div class="device-header">
+ <h3>{{ getDeviceDisplayName(deviceKey) }}</h3>
+ <div class="status-indicator" :class="getStatusClass(deviceData)"></div>
+ </div>
+ <div class="device-content">
+ <template v-if="deviceData && Object.keys(deviceData).length > 0">
+ <!-- RGV璁惧鏄剧ず -->
+ <template v-if="currentMonitorType !== 'safetydoor'">
+ <!-- 鍒濆鍖栫姸鎬佹樉绀� -->
+ <div
+ class="data-row"
+ v-if="deviceData['鍒濆鍖栨湭瀹屾垚鏍囧織浣�'] !== undefined"
+ >
+ <span class="label">鍒濆鍖栫姸鎬�:</span>
+ <span class="value" :class="deviceData['鍒濆鍖栨湭瀹屾垚鏍囧織浣�'] === 1 ? 'fault-text' : ''">
+ {{ deviceData['鍒濆鍖栨湭瀹屾垚鏍囧織浣�'] === 0 ? '宸插畬鎴�' : '鏈畬鎴�' }}
+ </span>
+ </div>
+
+ <div
+ class="data-row"
+ v-for="(value, key) in deviceData"
+ :key="key"
+ v-if="key !== '鍒濆鍖栨湭瀹屾垚鏍囧織浣�'"
+ >
+ <span class="label">{{ getFieldDisplayName(key) }}:</span>
+ <span class="value" :class="getValueClass(key, value, deviceKey)">
+ {{ getFormattedValue(key, value, deviceKey) }}
+ <!-- 涓轰笂鍗囦俊鍙峰拰涓嬮檷淇″彿娣诲姞鎸囩ず鐏� -->
+ <span v-if="key === '涓婂崌淇″彿鍒颁綅'" class="signal-indicator" :class="getSignalClass(value)"></span>
+ <span v-if="key === '涓嬮檷淇″彿鍒颁綅'" class="signal-indicator" :class="getSignalClass(value)"></span>
+ </span>
+ </div>
+ </template>
+
+ <!-- 瀹夊叏闂ㄨ澶囨樉绀� -->
+ <template v-else>
+ <div
+ class="data-row"
+ v-for="(value, key) in deviceData"
+ :key="key"
+ >
+ <span class="label">{{ getFieldDisplayName(key) }}:</span>
+ <span class="value" :class="getSafetyDoorValueClass(key, value)">
+ {{ getSafetyDoorFormattedValue(key, value) }}
+ <!-- 瀹夊叏闂ㄧ姸鎬佹寚绀虹伅 -->
+ <span v-if="key === '瀹夊叏闂ㄦ寚绀虹伅鐘舵��'" class="safety-light" :class="getSafetyLightClass(value)"></span>
+ <span v-if="key === '瀹夊叏闂ㄦ�ュ仠鐘舵��'" class="emergency-stop" :class="getEmergencyStopClass(value)"></span>
+ </span>
+ </div>
+ </template>
+ </template>
+ <div v-else class="no-data">
+ 璁惧鏈繛鎺ユ垨鏆傛棤鏁版嵁
+ </div>
+
+ <!-- 鎿嶄綔鎸夐挳鍖哄煙锛堝畨鍏ㄩ棬鐩戞帶鏃朵笉鏄剧ず锛� -->
+ <div class="operation-buttons" v-if="currentMonitorType !== 'safetydoor'">
+ <!-- 瀛愯溅鎿嶄綔鎸夐挳 -->
+ <template v-if="getDeviceType(deviceKey) === 'child'">
+ <el-button
+ type="primary"
+ size="small"
+ @click="handleOperation(deviceKey, 'cs')"
+ :loading="loadingStates[deviceKey]?.cs"
+ :disabled="deviceData && deviceData['鍒濆鍖栨湭瀹屾垚鏍囧織浣�'] === 0"
+ >
+ {{ getInitializationButtonText(deviceData) }}
+ </el-button>
+ <el-button
+ :type="getModeButtonType(deviceData)"
+ size="small"
+ @click="handleModeToggle(deviceKey)"
+ :loading="loadingStates[deviceKey]?.modeToggle"
+ >
+ {{ getCurrentModeText(deviceData) }}
+ </el-button>
+ <el-button
+ type="warning"
+ size="small"
+ @click="handleOperation(deviceKey, 'fw')"
+ :loading="loadingStates[deviceKey]?.fw"
+ >
+ 澶嶄綅
+ </el-button>
+ </template>
+
+ <!-- 姣嶈溅鎿嶄綔鎸夐挳 -->
+ <template v-else-if="getDeviceType(deviceKey) === 'mother'">
+ <el-button
+ type="primary"
+ size="small"
+ @click="handleOperation(deviceKey, 'cs')"
+ :loading="loadingStates[deviceKey]?.cs"
+ :disabled="deviceData && deviceData['鍒濆鍖栨湭瀹屾垚鏍囧織浣�'] === 0"
+ >
+ {{ getInitializationButtonText(deviceData) }}
+ </el-button>
+ <el-button
+ :type="getModeButtonType(deviceData)"
+ size="small"
+ @click="handleModeToggle(deviceKey)"
+ :loading="loadingStates[deviceKey]?.modeToggle"
+ >
+ {{ getCurrentModeText(deviceData) }}
+ </el-button>
+ <el-button
+ type="warning"
+ size="small"
+ @click="handleOperation(deviceKey, 'fw')"
+ :loading="loadingStates[deviceKey]?.fw"
+ >
+ 澶嶄綅
+ </el-button>
+ </template>
+
+ <!-- 鍘熸枡杞︽搷浣滄寜閽� -->
+ <template v-else-if="getDeviceType(deviceKey) === 'material'">
+ <el-button
+ type="primary"
+ size="small"
+ @click="handleOperation(deviceKey, 'cs')"
+ :loading="loadingStates[deviceKey]?.cs"
+ :disabled="deviceData && deviceData['鍒濆鍖栨湭瀹屾垚鏍囧織浣�'] === 0"
+ >
+ {{ getInitializationButtonText(deviceData) }}
+ </el-button>
+ <el-button
+ :type="getModeButtonType(deviceData)"
+ size="small"
+ @click="handleModeToggle(deviceKey)"
+ :loading="loadingStates[deviceKey]?.modeToggle"
+ >
+ {{ getCurrentModeText(deviceData) }}
+ </el-button>
+ <el-button
+ type="warning"
+ size="small"
+ @click="handleOperation(deviceKey, 'fw')"
+ :loading="loadingStates[deviceKey]?.fw"
+ >
+ 澶嶄綅
+ </el-button>
+ <!-- 闆疯揪寮�鍏虫寜閽� -->
+ <el-button
+ :type="getRadarButtonType(deviceData)"
+ size="small"
+ @click="handleRadarToggle(deviceKey)"
+ :loading="loadingStates[deviceKey]?.radarToggle"
+ :disabled="!isManualMode(deviceData)"
+ >
+ {{ getRadarButtonText(deviceData) }}
+ </el-button>
+
+ <!-- 鍏ュ簱缁х画浠诲姟鎸夐挳锛堜粎瀵筊GV101鏄剧ず锛� -->
+ <el-button
+ v-if="deviceKey === 'rgV101'"
+ type="success"
+ size="small"
+ @click="handleInNormal(deviceKey)"
+ :loading="loadingStates[deviceKey]?.inNormal"
+ >
+ 鍏ュ簱缁х画浠诲姟
+ </el-button>
+
+ <!-- 鍏ュ簱寮傚父鎺掗櫎鎸夐挳锛堜粎瀵筊GV101鏄剧ず锛� -->
+ <el-button
+ v-if="deviceKey === 'rgV101'"
+ type="danger"
+ size="small"
+ @click="handleInAbnormal(deviceKey)"
+ :loading="loadingStates[deviceKey]?.inAbnormal"
+ >
+ 鍏ュ簱寮傚父鎺掗櫎
+ </el-button>
+ </template>
+ </div>
+
+ <!-- 鍦板潃鎿嶄綔鍖哄煙锛堝畨鍏ㄩ棬鐩戞帶鏃朵笉鏄剧ず锛� -->
+ <div class="address-operation" v-if="currentMonitorType !== 'safetydoor'">
+ <div class="address-title">鍦板潃鎿嶄綔</div>
+ <div class="address-input-group">
+ <el-select
+ v-model="addressValues[deviceKey]"
+ placeholder="閫夋嫨鐩爣鍦板潃"
+ size="small"
+ style="width: 200px; margin-right: 10px;"
+ >
+ <el-option
+ v-for="address in getDeviceAddresses(deviceKey)"
+ :key="address.value"
+ :label="address.label"
+ :value="address.value"
+ />
+ </el-select>
+ <el-button
+ type="info"
+ size="small"
+ @click="handleAddressOperation(deviceKey)"
+ :loading="loadingStates[deviceKey]?.dz"
+ :disabled="!addressValues[deviceKey]"
+ >
+ 鍓嶅線鍦板潃
+ </el-button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鍏ㄥ眬鎿嶄綔闈㈡澘锛堝畨鍏ㄩ棬鐩戞帶鏃朵笉鏄剧ず锛� -->
+ <div class="operation-panel" v-if="currentMonitorType !== 'safetydoor'">
+ <!-- <el-button type="primary" @click="showOperationDialog = true">楂樼骇鎿嶄綔</el-button> -->
+ </div>
+
+ <!-- 鎿嶄綔瀵硅瘽妗� -->
+ <el-dialog v-model="showOperationDialog" title="璁惧楂樼骇鎿嶄綔" width="600px">
+ <div>璁惧鍒濆鍖栥�佸啓鍏ュ弬鏁扮瓑楂樼骇鎿嶄綔鐣岄潰</div>
+ </el-dialog>
</div>
-
- <div style="margin-top: 30px;">
- <el-button type="danger" v-on:click="InReset" plain style="margin-left: 50px">涓�閿浣嶏紙鍏ュ簱绔級</el-button>
- <el-button type="danger" v-on:click="OutReset" plain style="margin-left: 50px">涓�閿浣嶏紙鍑哄簱绔級</el-button>
- </div>
-
- <div style="margin-top: 30px;">
- <label style="height: 30PX;">鎵嬪姩鐢熸垚RGV鍘荤殑鐩爣鍦板潃</label>
- <div class="container">
- <label>AGV璁惧鍚嶇О</label>
- <el-select placeholder="璇烽�夋嫨鐗╂枡鐘舵��" v-model="DeviceName2">
- <el-option label="姣嶈溅锛歊GV110" value="RGV110" />
- <el-option label="姣嶈溅锛歊GV112" value="RGV112" />
- <el-option label="瀛愯溅锛歊GV111" value="RGV111" />
- <el-option label="瀛愯溅锛歊GV116" value="RGV116" />
- <el-option label="姣嶈溅锛歊GV114" value="RGV114" />
- <el-option label="姣嶈溅锛歊GV115" value="RGV115" />
- <el-option label="姣嶈溅锛歊GV109" value="RGV109" />
- <el-option label="姣嶈溅锛歊GV108" value="RGV108" />
- <el-option label="姣嶈溅锛歊GV105" value="RGV105" />
- <el-option label="姣嶈溅锛歊GV103" value="RGV103" />
-
- <el-option label="瀛愯溅锛歊GV104" value="RGV104" />
- <el-option label="瀛愯溅锛歊GV107" value="RGV107" />
- </el-select>
- </div>
- <div class="container">
- <label>鐩爣鍦板潃</label>
- <el-input type="text" v-model="WritergvAddres"></el-input>
- </div>
-
- <el-button type="danger" v-on:click="submit2" plain style="margin-left: 50px">纭涓嬪彂绉诲姩浠诲姟</el-button>
-
- </div>
-
</template>
<script>
-import VolBox from "@/components/basic/VolBox.vue";
export default {
- components: {
- "vol-box": VolBox,
- },
+ name: 'RgvMonitor',
data() {
return {
- //鍒濆鍖朢GV
- DeviceName:"",
- DBType:"",
- WriteRGVvalue:"",
-
- //鎵嬪姩涓嬪彂rgv鐩爣鍦板潃锛岃繘琛岀Щ鍔╮gv
- DeviceName2:"",
- WritergvAddres:""
-
- };
+ currentMonitorType: 'inbound', // 'inbound' 鎴� 'outbound' 鎴� 'safetydoor'
+ isMonitoring: false,
+ showOperationDialog: false,
+ pollingTimer: null,
+ loadingStates: {},
+ addressValues: {},
+
+ // 涓�閿搷浣滃姞杞界姸鎬�
+ oneClickLoading: {
+ init: false,
+ reset: false,
+ start: false,
+ stop: false
+ },
+
+ // 璁惧鏁版嵁
+ inboundDeviceData: {
+ rgV101: null,
+ rgV103: null,
+ rgV104: null,
+ rgV105: null,
+ rgV107: null,
+ rgV108: null,
+ rgV109: null,
+ // rgV202: null
+ },
+ outboundDeviceData: {
+ rgV116: null,
+ rgV115: null,
+ rgV111: null,
+ rgV112: null,
+ rgV110: null,
+ rgV114: null,
+ rgV118: null
+ },
+ safetyDoorDeviceData: {
+ aqm001: null,
+ aqm002: null,
+ aqm003: null
+ },
+
+ // 瀛楁鏄剧ず鍚嶇О鏄犲皠
+ fieldDisplayNames: {
+ '宸ヤ綔妯″紡': '宸ヤ綔妯″紡',
+ '褰撳墠浣嶇疆': '褰撳墠浣嶇疆',
+ '鏈夎揣鐘舵��': '鏈夎揣鐘舵��',
+ '鐩爣鍦板潃': '鐩爣鍦板潃',
+ '浠诲姟鐘舵��': '浠诲姟鐘舵��',
+ 'rgV浠诲姟缂栧彿': '浠诲姟缂栧彿',
+ '鏁呴殰浠g爜': '鏁呴殰浠g爜',
+ '涓婂崌淇″彿鍒颁綅': '涓婂崌淇″彿',
+ '涓嬮檷淇″彿鍒颁綅': '涓嬮檷淇″彿',
+ '鍒濆鍖栨湭瀹屾垚鏍囧織浣�': '鍒濆鍖栫姸鎬�',
+ '闆疯揪鐘舵��': '闆疯揪鐘舵��',
+ '璐у弶鐘舵��': '璐у弶鐘舵��',
+ // 瀹夊叏闂ㄥ瓧娈�
+ '瀹夊叏闂ㄦ寚绀虹伅鐘舵��': '鎸囩ず鐏姸鎬�',
+ '瀹夊叏闂ㄨ姹傚紑闂�': '璇锋眰寮�闂�',
+ '瀹夊叏闂ㄦ柇鐢电姸鎬�': '鏂數鐘舵��',
+ '瀹夊叏闂ㄦ�ュ仠鐘舵��': '鎬ュ仠鐘舵��',
+ '瀹夊叏闂ㄩ攣鐘舵��': '闂ㄩ攣鐘舵��',
+ '瀹夊叏闂ㄥ浣嶇姸鎬�': '澶嶄綅鐘舵��',
+ '鎶ヨ淇℃伅': '鎶ヨ淇℃伅',
+ '寮�闂ㄤ俊鎭�': '寮�闂ㄤ俊鎭�'
+ },
+
+ // 璁惧鏄剧ず鍚嶇О鏄犲皠
+ deviceDisplayNames: {
+ // 鍏ュ簱璁惧
+ 'rgV101': 'RGV101 - 鍘熸枡鍏ュ簱杞�',
+ 'rgV103': 'RGV103 - 姣嶈溅',
+ 'rgV104': 'RGV104 - 瀛愯溅',
+ 'rgV105': 'RGV105 - 姣嶈溅',
+ 'rgV107': 'RGV107 - 瀛愯溅',
+ 'rgV108': 'RGV108 - 姣嶈溅',
+ 'rgV109': 'RGV109 - 姣嶈溅',
+ // 鍑哄簱璁惧
+ 'rgV110': 'RGV110 - 姣嶈溅',
+ 'rgV111': 'RGV111 - 瀛愯溅',
+ 'rgV112': 'RGV112 - 姣嶈溅',
+ 'rgV114': 'RGV114 - 姣嶈溅',
+ 'rgV115': 'RGV115 - 姣嶈溅',
+ 'rgV116': 'RGV116 - 瀛愯溅',
+ 'rgV118': 'RGV118 - 鍘熸枡鍑哄簱杞�',
+ // 瀹夊叏闂ㄨ澶�
+ 'aqm001': 'AQM001 - 1#瀹夊叏闂�',
+ 'aqm002': 'AQM002 - 2#瀹夊叏闂�',
+ 'aqm003': 'AQM003 - 3#瀹夊叏闂�'
+ },
+
+ // 鎿嶄綔绫诲瀷鏄犲皠
+ operationTypes: {
+ 'cs': '鍒濆鍖�',
+ 'sd': '鍒囨崲鍒版墜鍔ㄦā寮�',
+ 'zd': '鍒囨崲鍒拌嚜鍔ㄦā寮�',
+ 'dz': '鍓嶅線鍦板潃',
+ 'kld': '寮�闆疯揪',
+ 'gld': '鍏抽浄杈�',
+ 'fw': '澶嶄綅',
+ },
+
+ // 鎶ヨ浠g爜鏄犲皠
+ motherCarAlarmCodes: {
+ 0: '鏃犳姤璀�',
+ 1: 'RGV灏忚溅鎬ュ仠琚寜涓�',
+ 2: '鍓嶈繘闄愪綅鎶ヨ',
+ 3: '鍚庨��闄愪綅鎶ヨ',
+ 4: 'PLC妯″潡鏁呴殰',
+ 5: 'PLC鎵╁睍妯″潡鏁呴殰',
+ 6: 'RGV闀挎椂闂寸┖杞晠闅�',
+ 7: '鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰',
+ 8: '涓庢�绘帶閫氳鏁呴殰',
+ 9: '琛岃蛋鍙橀鍣ㄦ晠闅�',
+ 10: '鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ',
+ 11: '鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ',
+ 12: '鍋滄鏃朵綅缃繃鍐叉姤璀�'
+ },
+
+ childCarAlarmCodes: {
+ 0: '鏃犳姤璀�',
+ 1: 'RGV灏忚溅鎬ュ仠琚寜涓�',
+ 2: '鍓嶈繘闄愪綅鎶ヨ',
+ 3: '鍚庨��闄愪綅鎶ヨ',
+ 4: 'PLC妯″潡鏁呴殰',
+ 5: 'PLC鎵╁睍妯″潡鏁呴殰',
+ 6: '鎵爜瀹氫綅鏁呴殰',
+ 7: 'RGV闀挎椂闂寸┖杞晠闅�',
+ 8: '鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰',
+ 9: '涓庢�绘帶閫氳鏁呴殰',
+ 10: '琛岃蛋鍙橀鍣ㄦ晠闅�',
+ 11: '娑插帇鍗曞厓杩囪浇淇濇姢鏁呴殰',
+ 12: '娑插帇涓婂崌瓒呮椂鎶ヨ',
+ 13: '娑插帇涓嬮檷瓒呮椂鎶ヨ',
+ 14: '鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ',
+ 15: '鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ',
+ 16: '鍙栬揣妫�娴嬩笉鍒拌揣鐗╂姤璀�'
+ },
+
+ materialCarAlarmCodes: {
+ 0: '鏃犳姤璀�',
+ 1: 'RGV灏忚溅鎬ュ仠琚寜涓�',
+ 2: '姝h浆闆疯揪鎶ヨ',
+ 3: '鍙嶈浆闆疯揪鎶ヨ',
+ 4: '鍓嶈繘闄愪綅鎶ヨ',
+ 5: '鍚庨��闄愪綅鎶ヨ',
+ 6: '棰勭暀',
+ 7: 'PLC妯″潡鏁呴殰',
+ 8: 'PLC鎵╁睍妯″潡鏁呴殰',
+ 9: '绉伴噸妯″潡鏁呴殰',
+ 10: '鎵爜瀹氫綅鏁呴殰',
+ 11: 'RGV闀挎椂闂寸┖杞晠闅�',
+ 12: '鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰',
+ 13: '涓庢�绘帶閫氳鏁呴殰',
+ 14: '鍓嶉浄杈惧睆钄借鍛�',
+ 15: '鍚庨浄杈惧睆钄借鍛�',
+ 16: '琛岃蛋鍙橀鍣ㄦ晠闅�',
+ 17: '浼哥缉鍙夊彉棰戝櫒鏁呴殰',
+ 18: '娑插帇鍗曞厓杩囪浇淇濇姢鏁呴殰',
+ 19: '娑插帇涓婂崌瓒呮椂鎶ヨ',
+ 20: '娑插帇涓嬮檷瓒呮椂鎶ヨ',
+ 21: '浼哥缉鍙変几鍑鸿秴鏃舵姤璀�',
+ 22: '浼哥缉鍙夌缉鍥炶秴鏃舵姤璀�',
+ 23: '澶栧舰妫�娴嬫姤璀�',
+ 24: '绉伴噸瓒呴噸鎶ヨ',
+ 25: '璐у弶浼稿嚭鏋侀檺闄愪綅鎶ヨ',
+ 26: '璐у弶缂╁洖鏋侀檺闄愪綅鎶ヨ',
+ 27: '鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ',
+ 28: '鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ',
+ 29: '璐у弶鏈洖鍒板垵濮嬩綅鎶ヨ',
+ 30: '瑙﹀彂浠呯Щ鍔ㄥ懡浠ゆ椂璐у弶涓嶅湪鍒濆浣嶆姤璀�',
+ 31: '璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ'
+ },
+
+ // 瀹夊叏闂ㄦ寚绀虹伅鐘舵�佹槧灏�
+ safetyDoorLightCodes: {
+ 0: '鏃犺緭鍑�',
+ 1: '绾㈢伅甯镐寒+铚傞福',
+ 2: '缁跨伅甯镐寒',
+ 3: '榛勭伅闂儊(2HZ)',
+ 4: '榛勭伅甯镐寒'
+ },
+
+ // 璁惧绫诲瀷鍒嗙被
+ deviceTypes: {
+ // 鍏ュ簱璁惧
+ motherCars: ['rgV103', 'rgV105', 'rgV108', 'rgV109'],
+ childCars: ['rgV104', 'rgV107'],
+ materialCars: ['rgV101'],
+ // 鍑哄簱璁惧
+ outboundMotherCars: ['rgV110', 'rgV112', 'rgV114', 'rgV115'],
+ outboundChildCars: ['rgV111', 'rgV116'],
+ outboundMaterialCars: ['rgV118'],
+ // 瀹夊叏闂ㄨ澶�
+ safetyDoors: ['aqm001', 'aqm002', 'aqm003']
+ },
+
+ // 璁惧鍦板潃鏄犲皠
+ deviceAddresses: {
+ // 鍏ュ簱璁惧鍦板潃
+ 'rgV101': [
+ { value: '1001', label: '1001 - 鍘熸枡鍏ュ簱浣�' },
+ { value: '1002', label: '1002 - 鍘熸枡鍑哄簱浣�' },
+ { value: '1021', label: '1021 - 涓浆浣�' }
+ ],
+ 'rgV103': [
+ { value: '1031', label: '1031 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1032', label: '1032 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ 'rgV104': [
+ { value: '3', label: '鍋滈潬鐐�1' },
+ { value: '5', label: '鍋滈潬鐐�2' },
+ ],
+ 'rgV105': [
+ { value: '1051', label: '1051 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1052', label: '1052 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ 'rgV107': [
+ { value: '3', label: '鍋滈潬鐐�1' },
+ { value: '5', label: '鍋滈潬鐐�2' },
+ ],
+ 'rgV108': [
+ { value: '1081', label: '1081 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1082', label: '1082 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ 'rgV109': [
+ { value: '1091', label: '1091 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1092', label: '1092 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ // 'rgV202': [
+ // { value: '2001', label: '2001 - 宸ヤ綅1' },
+ // { value: '2002', label: '2002 - 宸ヤ綅2' },
+ // { value: '2003', label: '2003 - 宸ヤ綅3' },
+ // { value: '2004', label: '2004 - 宸ヤ綅4' },
+ // { value: '2005', label: '2005 - 宸ヤ綅5' },
+ // { value: '2006', label: '2006 - 宸ヤ綅6' },
+ // { value: '2007', label: '2007 - 宸ヤ綅7' },
+ // { value: '2008', label: '2008 - 宸ヤ綅8' },
+ // { value: '2009', label: '2009 - 宸ヤ綅9' }
+ // ],
+ // 鍑哄簱璁惧鍦板潃
+ 'rgV110': [
+ { value: '1101', label: '1101 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1102', label: '1102 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ 'rgV111': [
+ { value: '3', label: '鍋滈潬鐐�1' },
+ { value: '5', label: '鍋滈潬鐐�2' },
+ ],
+ 'rgV112': [
+ { value: '1121', label: '1121 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1122', label: '1122 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ 'rgV114': [
+ { value: '1141', label: '1141 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1142', label: '1142 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ 'rgV115': [
+ { value: '1151', label: '1151 - 姣嶈溅鍋滆溅浣�1' },
+ { value: '1152', label: '1152 - 姣嶈溅鍋滆溅浣�2' }
+ ],
+ 'rgV116': [
+ { value: '3', label: '鍋滈潬鐐�1' },
+ { value: '5', label: '鍋滈潬鐐�2' },
+ ],
+ 'rgV118': [
+ { value: '2016', label: '2016 - 鍘熸枡澶勭悊浣�1' },
+ { value: '2017', label: '2017 - 鍘熸枡澶勭悊浣�2' },
+ { value: '2018', label: '2018 - 鍘熸枡澶勭悊浣�3' },
+ { value: '2019', label: '2019 - 鍘熸枡澶勭悊浣�4' }
+ ]
+ },
+
+ // 鐗规畩瀛楁鐨勫�兼牸寮忓寲
+ valueFormatters: {
+ '宸ヤ綔妯″紡': (value) => {
+ const modes = { 0: '鎵嬪姩妯″紡', 1: '鑷姩妯″紡' }
+ return modes[value] || `鏈煡妯″紡(${value})`
+ },
+ '鏈夎揣鐘舵��': (value) => value === 0 ? '鏃犺揣' : '鏈夎揣',
+ '浠诲姟鐘舵��': (value) => {
+ const statusMap = { 0: '绌洪棽', 1: '鎵ц涓�', 2: '瀹屾垚' }
+ return statusMap[value] || `鏈煡鐘舵��(${value})`
+ },
+ '鏁呴殰浠g爜': (value, deviceKey) => {
+ return this.getAlarmText(value, deviceKey)
+ },
+ '涓婂崌淇″彿鍒颁綅': (value) => value === 0 ? '鏈埌浣�' : '宸插埌浣�',
+ '涓嬮檷淇″彿鍒颁綅': (value) => value === 0 ? '鏈埌浣�' : '宸插埌浣�',
+ '鍒濆鍖栨湭瀹屾垚鏍囧織浣�': (value) => value === 0 ? '宸插畬鎴�' : '鏈畬鎴�',
+ '闆疯揪鐘舵��': (value) => value === 0 ? '鍏抽棴' : '寮�鍚�',
+ '璐у弶鐘舵��': (value) => value === 0 ? '缂╁洖' : '浼稿嚭'
+ },
+
+ // 瀹夊叏闂ㄥ瓧娈靛�兼牸寮忓寲
+ safetyDoorValueFormatters: {
+ '瀹夊叏闂ㄦ寚绀虹伅鐘舵��': (value) => {
+ return this.safetyDoorLightCodes[value] || `鏈煡鐘舵��(${value})`
+ },
+ '瀹夊叏闂ㄨ姹傚紑闂�': (value) => value === 0 ? '姝e父' : '璇锋眰寮�闂�',
+ '瀹夊叏闂ㄦ柇鐢电姸鎬�': (value) => value === 0 ? '鏂數' : '涓婄數',
+ '瀹夊叏闂ㄦ�ュ仠鐘舵��': (value) => value === 0 ? '鎬ュ仠' : '姝e父',
+ '瀹夊叏闂ㄩ攣鐘舵��': (value) => value === 0 ? '寮�闂�' : '鍏抽棬',
+ '瀹夊叏闂ㄥ浣嶇姸鎬�': (value) => value === 0 ? '姝e父' : '澶嶄綅涓�',
+ '鎶ヨ淇℃伅': (value) => value === 0 ? '姝e父' : '鎶ヨ',
+ '寮�闂ㄤ俊鎭�': (value) => value === 0 ? '鍏抽棬' : '寮�闂�'
+ }
+ }
+ },
+ computed: {
+ // 褰撳墠鏄剧ず鐨勮澶囨暟鎹�
+ currentDeviceData() {
+ switch (this.currentMonitorType) {
+ case 'inbound':
+ return this.inboundDeviceData
+ case 'outbound':
+ return this.outboundDeviceData
+ case 'safetydoor':
+ return this.safetyDoorDeviceData
+ default:
+ return this.inboundDeviceData
+ }
+ }
},
methods: {
- submit() {
- var param = {
- DelKeys: [this.DeviceName,this.DBType,this.WriteRGVvalue],
- Extra: true
+ // 鍏ュ簱缁х画浠诲姟
+ async handleInNormal(deviceKey) {
+ this.setLoadingState(deviceKey, 'inNormal', true);
+
+ try {
+ const response = await this.http.post("api/RgvOperation/WriteInNormal", {}, "鏁版嵁澶勭悊涓�...");
+
+ if (response.status) {
+ this.$message.success('鍏ュ簱缁х画浠诲姟鎴愬姛');
+ this.refreshData();
+ } else {
+ this.$message.error(response.message || '鍏ュ簱缁х画浠诲姟澶辫触');
}
- this.http
- .post("api/RgvOperation/WriteInitialization", param, "鏁版嵁澶勭悊涓�...")
- .then((x) => {
- if (x.status) {
- this.$Message.success('鎴愬姛.');
- this.$parent.refresh();
- } else {
- return this.$Message.error(x.message);
- }
- });
+ } catch (error) {
+ this.$message.error('鍏ュ簱缁х画浠诲姟璇锋眰澶辫触: ' + error.message);
+ } finally {
+ this.setLoadingState(deviceKey, 'inNormal', false);
+ }
},
- submit2() {
- var param = {
- DelKeys: [this.DeviceName2,this.WritergvAddres],
- Extra: true
+ // 鍏ュ簱寮傚父鎺掗櫎
+ async handleInAbnormal(deviceKey) {
+ this.setLoadingState(deviceKey, 'inAbnormal', true);
+
+ try {
+ const response = await this.http.post("api/RgvOperation/WriteInAbnormal", {}, "鏁版嵁澶勭悊涓�...");
+
+ if (response.status) {
+ this.$message.success('鍏ュ簱寮傚父鎺掗櫎鎴愬姛');
+ this.refreshData();
+ } else {
+ this.$message.error(response.message || '鍏ュ簱寮傚父鎺掗櫎澶辫触');
}
- this.http
- .post("api/RgvOperation/ManualmovementRGV", param, "鏁版嵁澶勭悊涓�...")
- .then((x) => {
- if (x.status) {
- this.$Message.success('鎴愬姛.');
- this.$parent.refresh();
- } else {
- return this.$Message.error(x.message);
- }
- });
+ } catch (error) {
+ this.$message.error('鍏ュ簱寮傚父鎺掗櫎璇锋眰澶辫触: ' + error.message);
+ } finally {
+ this.setLoadingState(deviceKey, 'inAbnormal', false);
+ }
},
- InReset(){
- var param = {
- DelKeys: [],
- Extra: true
- }
- this.http
- .post("api/RgvOperation/WriteInReset", {}, "鏁版嵁澶勭悊涓�...")
- .then((x) => {
- if (x.status) {
- this.$Message.success('鎴愬姛.');
- this.$parent.refresh();
- } else {
- return this.$Message.error(x.message);
- }
- });
+ // 鑾峰彇鐩戞帶鐘舵�佹爣棰�
+ getMonitorStatusTitle() {
+ const typeNames = {
+ 'inbound': '鍏ュ簱',
+ 'outbound': '鍑哄簱',
+ 'safetydoor': '瀹夊叏闂�'
+ }
+ const status = this.isMonitoring ? '杩愯涓�' : '宸插仠姝�'
+ return `${typeNames[this.currentMonitorType]}鐩戞帶鐘舵��: ${status}`
},
- OutReset(){
- var param = {
- DelKeys: [],
- Extra: true
+
+ // 瀹夊叏闂ㄥ瓧娈靛�兼牸寮忓寲
+ getSafetyDoorFormattedValue(fieldKey, value) {
+ const formatter = this.safetyDoorValueFormatters[fieldKey]
+ return formatter ? formatter(value) : value
+ },
+
+ // 瀹夊叏闂ㄥ瓧娈靛�兼牱寮�
+ getSafetyDoorValueClass(fieldKey, value) {
+ if (fieldKey === '瀹夊叏闂ㄦ�ュ仠鐘舵��' && value === 0) {
+ return 'fault-text'
+ }
+ if (fieldKey === '瀹夊叏闂ㄦ柇鐢电姸鎬�' && value === 0) {
+ return 'fault-text'
+ }
+ if (fieldKey === '鎶ヨ淇℃伅' && value === 1) {
+ return 'fault-text'
+ }
+ return ''
+ },
+
+ // 瀹夊叏闂ㄦ寚绀虹伅鏍峰紡
+ getSafetyLightClass(value) {
+ const classMap = {
+ 0: 'light-off',
+ 1: 'light-red',
+ 2: 'light-green',
+ 3: 'light-yellow-blink',
+ 4: 'light-yellow'
+ }
+ return classMap[value] || 'light-off'
+ },
+
+ // 鎬ュ仠鐘舵�佹牱寮�
+ getEmergencyStopClass(value) {
+ return value === 0 ? 'emergency-stop-active' : 'emergency-stop-normal'
+ },
+
+ // 涓�閿搷浣滃鐞�
+ async handleOneClickOperation(operationType) {
+ // 鏍规嵁褰撳墠鐩戞帶绫诲瀷璁剧疆鍙傛暟
+ const monitorType = this.currentMonitorType === 'inbound' ? 'Inbound' : 'Outbound'
+
+ this.oneClickLoading[operationType] = true
+
+ try {
+ const operationNames = {
+ init: '涓�閿垵濮嬪寲',
+ reset: '涓�閿浣�',
+ start: '涓�閿惎鍔�',
+ stop: '涓�閿殏鍋�'
}
- this.http
- .post("api/RgvOperation/WriteOutReset", {}, "鏁版嵁澶勭悊涓�...")
- .then((x) => {
- if (x.status) {
- this.$Message.success('鎴愬姛.');
- this.$parent.refresh();
- } else {
- return this.$Message.error(x.message);
- }
- });
+
+ const response = await this.http.post('api/Rgvoperainform/OneClickOperation', {
+ operationType: operationType,
+ monitorType: monitorType
+ }, `${operationNames[operationType]}涓�...`)
+
+ if (response.status) {
+ this.$message.success(`${operationNames[operationType]} ${monitorType}绔澶囨垚鍔焋)
+ this.refreshData()
+ } else {
+ this.$message.error(response.message || `${operationNames[operationType]}澶辫触`)
+ }
+ } catch (error) {
+ this.$message.error(`${operationNames[operationType]}璇锋眰澶辫触: ` + error.message)
+ } finally {
+ this.oneClickLoading[operationType] = false
+ }
+ },
+
+ // 鑾峰彇鍒濆鍖栨寜閽樉绀烘枃鏈�
+ getInitializationButtonText(deviceData) {
+ if (!deviceData) return '鍒濆鍖�'
+ return deviceData['鍒濆鍖栨湭瀹屾垚鏍囧織浣�'] === 0 ? '宸插垵濮嬪寲' : '鍒濆鍖�'
+ },
+
+ // 鍒囨崲鐩戞帶绫诲瀷
+ switchMonitorType(type) {
+ if (this.currentMonitorType !== type) {
+ // 鍋滄褰撳墠鐩戞帶
+ if (this.isMonitoring) {
+ this.stopMonitoring()
+ }
+ this.currentMonitorType = type
+ // 濡傛灉涔嬪墠鏄洃鎺х姸鎬侊紝鑷姩鍚姩鏂扮被鍨嬬殑鐩戞帶
+ if (this.isMonitoring) {
+ this.startMonitoring()
+ }
+ }
+ },
+
+ // 鑾峰彇淇″彿鎸囩ず鐏被鍚�
+ getSignalClass(value) {
+ return value === 1 ? 'signal-active' : 'signal-inactive'
+ },
+
+ // 鐩戞帶鎺у埗鏂规硶
+ async toggleMonitoring() {
+ if (this.isMonitoring) {
+ this.stopMonitoring()
+ } else {
+ await this.startMonitoring()
+ }
+ },
+
+ async startMonitoring() {
+ try {
+ const param = {
+ off: 1,
+ monitorType: this.currentMonitorType
+ }
+
+ const response = await this.http.post('api/Rgvoperainform/GetDeviceStatusDto', param)
+
+ if (response.status) {
+ this.isMonitoring = true
+ // 鏍规嵁鐩戞帶绫诲瀷鏇存柊瀵瑰簲鐨勮澶囨暟鎹�
+ switch (this.currentMonitorType) {
+ case 'inbound':
+ this.inboundDeviceData = response.data
+ break
+ case 'outbound':
+ this.outboundDeviceData = response.data
+ break
+ case 'safetydoor':
+ this.safetyDoorDeviceData = response.data
+ break
+ }
+ this.startPolling()
+ this.$message.success(`${this.getMonitorStatusTitle()}宸插惎鍔╜)
+ } else {
+ this.$message.error(response.message || `鍚姩${this.currentMonitorType}鐩戞帶澶辫触`)
+ }
+ } catch (error) {
+ this.$message.error('璇锋眰澶辫触: ' + error.message)
+ }
+ },
+
+ stopMonitoring() {
+ this.isMonitoring = false
+ if (this.pollingTimer) {
+ clearTimeout(this.pollingTimer)
+ this.pollingTimer = null
+ }
+
+ this.http.post('api/Rgvoperainform/GetDeviceStatusDto', {
+ off: 0,
+ monitorType: this.currentMonitorType
+ })
+
+ this.$message.info(`${this.getMonitorStatusTitle()}宸插仠姝)
+ },
+
+ startPolling() {
+ this.pollingTimer = setTimeout(() => {
+ if (this.isMonitoring) {
+ this.refreshData()
+ this.startPolling()
+ }
+ }, 2000)
+ },
+
+ async refreshData() {
+ if (!this.isMonitoring) return
+
+ try {
+ const response = await this.http.post('api/Rgvoperainform/GetDeviceStatusDto', {
+ off: 1,
+ monitorType: this.currentMonitorType
+ })
+ if (response.status) {
+ // 鏍规嵁鐩戞帶绫诲瀷鏇存柊瀵瑰簲鐨勮澶囨暟鎹�
+ switch (this.currentMonitorType) {
+ case 'inbound':
+ this.inboundDeviceData = response.data
+ break
+ case 'outbound':
+ this.outboundDeviceData = response.data
+ break
+ case 'safetydoor':
+ this.safetyDoorDeviceData = response.data
+ break
+ }
+ }
+ } catch (error) {
+ console.error('鍒锋柊鏁版嵁澶辫触:', error)
+ }
+ },
+
+ // 鍏朵粬鍘熸湁鏂规硶淇濇寔涓嶅彉
+ getStatusClass(device) {
+ if (!device || Object.keys(device).length === 0) return 'offline'
+
+ // 瀹夊叏闂ㄧ姸鎬佸垽鏂�
+ if (this.currentMonitorType === 'safetydoor') {
+ if (device['瀹夊叏闂ㄦ�ュ仠鐘舵��'] === 0) return 'fault'
+ if (device['瀹夊叏闂ㄦ柇鐢电姸鎬�'] === 0) return 'offline'
+ if (device['鎶ヨ淇℃伅'] === 1) return 'fault'
+ return 'normal'
+ }
+
+ // RGV璁惧鐘舵�佸垽鏂�
+ if (device['鏁呴殰浠g爜'] !== 0) return 'fault'
+ if (device['浠诲姟鐘舵��'] === 1) return 'running'
+ if (device['宸ヤ綔妯″紡'] === 0) return 'manual'
+ return 'normal'
+ },
+
+ getDeviceDisplayName(deviceKey) {
+ return this.deviceDisplayNames[deviceKey] || deviceKey.toUpperCase()
+ },
+
+ getFieldDisplayName(fieldKey) {
+ return this.fieldDisplayNames[fieldKey] || fieldKey
+ },
+
+ getFormattedValue(fieldKey, value, deviceKey) {
+ const formatter = this.valueFormatters[fieldKey]
+ return formatter ? formatter(value, deviceKey) : value
+ },
+
+ getValueClass(fieldKey, value, deviceKey) {
+ if (fieldKey === '鏁呴殰浠g爜' && value !== 0) {
+ return 'fault-text'
+ }
+ return ''
+ },
+
+ // 鑾峰彇璁惧绫诲瀷
+ getDeviceType(deviceKey) {
+ if (this.deviceTypes.motherCars.includes(deviceKey) ||
+ this.deviceTypes.outboundMotherCars.includes(deviceKey)) {
+ return 'mother'
+ } else if (this.deviceTypes.childCars.includes(deviceKey) ||
+ this.deviceTypes.outboundChildCars.includes(deviceKey)) {
+ return 'child'
+ } else if (this.deviceTypes.materialCars.includes(deviceKey) ||
+ this.deviceTypes.outboundMaterialCars.includes(deviceKey)) {
+ return 'material'
+ } else if (this.deviceTypes.safetyDoors.includes(deviceKey)) {
+ return 'safetydoor'
+ }
+ return 'unknown'
+ },
+
+ // 鑾峰彇璁惧鍙敤鐨勭洰鏍囧湴鍧�
+ getDeviceAddresses(deviceKey) {
+ return this.deviceAddresses[deviceKey] || []
+ },
+
+ // 鑾峰彇鎶ヨ鏂囨湰
+ getAlarmText(alarmCode, deviceKey) {
+ if (alarmCode === 0) return '鏃犳姤璀�'
+
+ const deviceType = this.getDeviceType(deviceKey)
+ let alarmMap = {}
+
+ switch (deviceType) {
+ case 'mother':
+ alarmMap = this.motherCarAlarmCodes
+ break
+ case 'child':
+ alarmMap = this.childCarAlarmCodes
+ break
+ case 'material':
+ alarmMap = this.materialCarAlarmCodes
+ break
+ default:
+ alarmMap = this.motherCarAlarmCodes
+ }
+
+ return alarmMap[alarmCode] || `鏈繛鎺�(${alarmCode})`
+ },
+
+ // 鑾峰彇褰撳墠妯″紡鏄剧ず鏂囨湰
+ getCurrentModeText(deviceData) {
+ if (!deviceData || !deviceData['宸ヤ綔妯″紡']) return '鐐瑰嚮鍒囨崲鑷姩'
+ return deviceData['宸ヤ綔妯″紡'] === 1 ? '鐐瑰嚮鍒囨崲鎵嬪姩' : '鐐瑰嚮鍒囨崲鑷姩'
+ },
+
+ // 鑾峰彇妯″紡鎸夐挳绫诲瀷锛堥鑹诧級
+ getModeButtonType(deviceData) {
+ if (!deviceData || !deviceData['宸ヤ綔妯″紡']) return 'success'
+ return deviceData['宸ヤ綔妯″紡'] === 1 ? 'warning' : 'success'
+ },
+
+ // 鍒ゆ柇鏄惁涓烘墜鍔ㄦā寮�
+ isManualMode(deviceData) {
+ return deviceData && deviceData['宸ヤ綔妯″紡'] === 0
+ },
+
+ // 鑾峰彇闆疯揪鎸夐挳鏂囨湰
+ getRadarButtonText(deviceData) {
+ if (!deviceData) return '寮�鍚浄杈�'
+ return deviceData['闆疯揪鐘舵��'] === 1 ? '鍏抽棴闆疯揪' : '寮�鍚浄杈�'
+ },
+
+ // 鑾峰彇闆疯揪鎸夐挳绫诲瀷
+ getRadarButtonType(deviceData) {
+ if (!deviceData) return 'info'
+ return deviceData['闆疯揪鐘舵��'] === 1 ? 'warning' : 'info'
+ },
+
+ // 璁剧疆鍔犺浇鐘舵��
+ setLoadingState(deviceKey, operationType, loading) {
+ if (!this.loadingStates[deviceKey]) {
+ this.loadingStates[deviceKey] = {}
+ }
+ this.loadingStates[deviceKey][operationType] = loading
+ this.loadingStates = { ...this.loadingStates }
+ },
+
+ // 鎵嬪姩/鑷姩妯″紡鍒囨崲
+ async handleModeToggle(deviceKey) {
+ this.setLoadingState(deviceKey, 'modeToggle', true)
+
+ try {
+ const deviceData = this.currentDeviceData[deviceKey]
+ const currentMode = deviceData?.['宸ヤ綔妯″紡'] || 0
+
+ const operationType = currentMode === 0 ? 'zd' : 'sd'
+
+ const response = await this.http.post('api/Rgvoperainform/DeviceOperation', {
+ DelKeys: [deviceKey, operationType],
+ Extra: true
+ }, `${this.operationTypes[operationType]}涓�...`)
+
+ if (response.status) {
+ this.$message.success(`${this.getDeviceDisplayName(deviceKey)} ${this.operationTypes[operationType]}鎴愬姛`)
+ this.refreshData()
+ } else {
+ this.$message.error(response.message || `${this.operationTypes[operationType]}澶辫触`)
+ }
+ } catch (error) {
+ this.$message.error(`妯″紡鍒囨崲璇锋眰澶辫触: ` + error.message)
+ } finally {
+ this.setLoadingState(deviceKey, 'modeToggle', false)
+ }
+ },
+
+ // 闆疯揪寮�鍏冲垏鎹�
+ async handleRadarToggle(deviceKey) {
+ this.setLoadingState(deviceKey, 'radarToggle', true)
+
+ try {
+ const deviceData = this.currentDeviceData[deviceKey]
+ const currentRadarState = deviceData?.['闆疯揪鐘舵��'] || 0
+
+ const operationType = currentRadarState === 0 ? 'kld' : 'gld'
+
+ const response = await this.http.post('api/Rgvoperainform/DeviceOperation', {
+ DelKeys: [deviceKey, operationType],
+ Extra: true
+ }, `${this.operationTypes[operationType]}涓�...`)
+
+ if (response.status) {
+ this.$message.success(`${this.getDeviceDisplayName(deviceKey)} ${this.operationTypes[operationType]}鎴愬姛`)
+ this.refreshData()
+ } else {
+ this.$message.error(response.message || `${this.operationTypes[operationType]}澶辫触`)
+ }
+ } catch (error) {
+ this.$message.error(`闆疯揪鎿嶄綔璇锋眰澶辫触: ` + error.message)
+ } finally {
+ this.setLoadingState(deviceKey, 'radarToggle', false)
+ }
+ },
+
+ // 鍦板潃鎿嶄綔
+ async handleAddressOperation(deviceKey) {
+ const address = this.addressValues[deviceKey]
+ if (!address) {
+ this.$message.warning('璇烽�夋嫨鐩爣鍦板潃')
+ return
+ }
+
+ this.setLoadingState(deviceKey, 'dz', true)
+
+ try {
+ const response = await this.http.post('api/Rgvoperainform/DeviceOperation', {
+ DelKeys: [deviceKey, 'dz', address],
+ Extra: true
+ }, '鍓嶅線鍦板潃涓�...')
+
+ if (response.status) {
+ this.$message.success(`${this.getDeviceDisplayName(deviceKey)} 鍓嶅線鍦板潃 ${address} 鎴愬姛`)
+ this.refreshData()
+ } else {
+ this.$message.error(response.message || '鍓嶅線鍦板潃澶辫触')
+ }
+ } catch (error) {
+ this.$message.error('鍓嶅線鍦板潃璇锋眰澶辫触: ' + error.message)
+ } finally {
+ this.setLoadingState(deviceKey, 'dz', false)
+ }
+ },
+
+ // 缁熶竴鎿嶄綔澶勭悊鍑芥暟
+ async handleOperation(deviceKey, operationType) {
+ this.setLoadingState(deviceKey, operationType, true)
+
+ try {
+ const response = await this.http.post('api/Rgvoperainform/DeviceOperation', {
+ DelKeys: [deviceKey, operationType],
+ Extra: true
+ }, `${this.operationTypes[operationType]}涓�...`)
+
+ if (response.status) {
+ const operationName = this.operationTypes[operationType]
+ this.$message.success(`${this.getDeviceDisplayName(deviceKey)} ${operationName}鎿嶄綔鎴愬姛`)
+
+ // 濡傛灉鏄垵濮嬪寲鎿嶄綔锛屾坊鍔犻澶栨彁绀�
+ if (operationType === 'cs') {
+ this.$notify({
+ title: '鍒濆鍖栨垚鍔�',
+ message: `${this.getDeviceDisplayName(deviceKey)} 璁惧鍒濆鍖栧畬鎴恅,
+ type: 'success',
+ duration: 3000
+ })
+ }
+
+ this.refreshData()
+ } else {
+ this.$message.error(response.message || `${this.operationTypes[operationType]}鎿嶄綔澶辫触`)
+ }
+ } catch (error) {
+ this.$message.error(`${this.operationTypes[operationType]}璇锋眰澶辫触: ` + error.message)
+ } finally {
+ this.setLoadingState(deviceKey, operationType, false)
+ }
}
},
-};
+ beforeUnmount() {
+ this.stopMonitoring()
+ }
+}
</script>
<style scoped>
-.container {
+/* 鍘熸湁鐨勬牱寮忎繚鎸佷笉鍙橈紝娣诲姞瀹夊叏闂ㄧ浉鍏虫牱寮� */
+
+/* 瀹夊叏闂ㄦ寚绀虹伅鏍峰紡 */
+.safety-light {
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+ display: inline-block;
+ margin-left: 8px;
+ border: 1px solid #ccc;
+}
+
+.safety-light.light-off {
+ background-color: #909399;
+}
+
+.safety-light.light-red {
+ background-color: #F56C6C;
+ box-shadow: 0 0 6px #F56C6C;
+ animation: blink 1s infinite;
+}
+
+.safety-light.light-green {
+ background-color: #67C23A;
+ box-shadow: 0 0 6px #67C23A;
+}
+
+.safety-light.light-yellow {
+ background-color: #E6A23C;
+ box-shadow: 0 0 6px #E6A23C;
+}
+
+.safety-light.light-yellow-blink {
+ background-color: #E6A23C;
+ box-shadow: 0 0 6px #E6A23C;
+ animation: blink 0.5s infinite;
+}
+
+/* 鎬ュ仠鐘舵�佹寚绀� */
+.emergency-stop {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ display: inline-block;
+ margin-left: 8px;
+}
+
+.emergency-stop.emergency-stop-normal {
+ background-color: #67C23A;
+ box-shadow: 0 0 4px #67C23A;
+}
+
+.emergency-stop.emergency-stop-active {
+ background-color: #F56C6C;
+ box-shadow: 0 0 4px #F56C6C;
+ animation: blink 0.8s infinite;
+}
+
+/* 鐩戞帶绫诲瀷鍒囨崲鏍峰紡 */
+.monitor-type-switch {
+ margin-right: 20px;
+}
+
+.one-click-operations {
+ margin-right: 20px;
+}
+
+.control-panel {
+ display: flex;
+ gap: 10px;
+ align-items: center;
+}
+
+/* 淇″彿鎸囩ず鐏牱寮� */
+.signal-indicator {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ display: inline-block;
+ margin-left: 8px;
+}
+
+.signal-indicator.signal-active {
+ background-color: #67C23A;
+ box-shadow: 0 0 4px #67C23A;
+}
+
+.signal-indicator.signal-inactive {
+ background-color: #DCDFE6;
+ border: 1px solid #C0C4CC;
+}
+
+/* 淇敼value鏍峰紡浠ュ绾虫寚绀虹伅 */
+.value {
+ color: #303133;
+ font-weight: 500;
display: flex;
align-items: center;
+ gap: 8px;
+}
+
+/* 鍏朵粬鍘熸湁鏍峰紡淇濇寔涓嶅彉 */
+.rgv-monitor {
+ padding: 20px;
+ background-color: #f5f7fa;
+ min-height: 100vh;
+}
+
+.monitor-header {
+ display: flex;
justify-content: space-between;
- width: 20%;
- margin-top: 10px;
- margin-left: 10px;
+ align-items: center;
+ margin-bottom: 20px;
+ padding: 0 10px;
}
.title {
- font-size: 28px;
- color: orange;
+ font-size: 24px;
+ font-weight: bold;
+ color: #409EFF;
+}
+
+.monitor-status {
+ margin-bottom: 20px;
+}
+
+.devices-container {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
+ gap: 20px;
+ margin-bottom: 20px;
+}
+
+.device-card {
+ background: white;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ overflow: hidden;
+ transition: all 0.3s ease;
+}
+
+.device-card:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
+}
+
+.device-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 15px 20px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+}
+
+.device-header h3 {
+ margin: 0;
+ font-size: 16px;
+}
+
+.status-indicator {
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+}
+
+.status-indicator.normal {
+ background-color: #67C23A;
+ box-shadow: 0 0 8px #67C23A;
+}
+
+.status-indicator.running {
+ background-color: #409EFF;
+ box-shadow: 0 0 8px #409EFF;
+ animation: pulse 1.5s infinite;
+}
+
+.status-indicator.fault {
+ background-color: #F56C6C;
+ box-shadow: 0 0 8px #F56C6C;
+ animation: blink 1s infinite;
+}
+
+.status-indicator.manual {
+ background-color: #E6A23C;
+ box-shadow: 0 0 8px #E6A23C;
+ animation: pulse 1.5s infinite;
+}
+
+.status-indicator.offline {
+ background-color: #909399;
+}
+
+.device-content {
+ padding: 20px;
+}
+
+.data-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 8px 0;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.data-row:last-child {
+ border-bottom: none;
+}
+
+.label {
+ font-weight: 500;
+ color: #606266;
+}
+
+.fault-text {
+ color: #F56C6C;
+ font-weight: bold;
+}
+
+.no-data {
+ text-align: center;
+ color: #909399;
+ padding: 40px 0;
+ font-style: italic;
+}
+
+.operation-buttons {
+ margin-top: 15px;
+ padding-top: 15px;
+ border-top: 1px dashed #ebeef5;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ justify-content: center;
+}
+
+.address-operation {
+ margin-top: 15px;
+ padding-top: 15px;
+ border-top: 1px dashed #ebeef5;
+}
+
+.address-title {
+ font-weight: 500;
+ color: #606266;
+ margin-bottom: 10px;
+ text-align: center;
+}
+
+.address-input-group {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: 10px;
+}
+
+.operation-panel {
+ text-align: center;
+ padding: 20px;
+}
+
+@keyframes pulse {
+ 0% { opacity: 1; }
+ 50% { opacity: 0.5; }
+ 100% { opacity: 1; }
+}
+
+@keyframes blink {
+ 0%, 50% { opacity: 1; }
+ 51%, 100% { opacity: 0.3; }
+}
+
+/* 鍝嶅簲寮忚璁� */
+@media (max-width: 768px) {
+ .devices-container {
+ grid-template-columns: 1fr;
+ }
+
+ .monitor-header {
+ flex-direction: column;
+ gap: 15px;
+ align-items: flex-start;
+ }
+
+ .control-panel {
+ flex-direction: column;
+ align-items: flex-start;
+ width: 100%;
+ }
+
+ .monitor-type-switch,
+ .one-click-operations {
+ margin-right: 0;
+ margin-bottom: 10px;
+ width: 100%;
+ }
+
+ .monitor-type-switch .el-button-group,
+ .one-click-operations .el-button-group {
+ width: 100%;
+ }
+
+ .monitor-type-switch .el-button,
+ .one-click-operations .el-button {
+ flex: 1;
+ }
+
+ .operation-buttons {
+ flex-direction: column;
+ align-items: stretch;
+ }
+
+ .operation-buttons .el-button {
+ width: 100%;
+ }
+
+ .address-input-group {
+ flex-direction: column;
+ align-items: stretch;
+ }
+
+ .address-input-group .el-select,
+ .address-input-group .el-button {
+ width: 100%;
+ }
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3