From 8f3a85044b6e4b56a8dd0b104ca023933f1f129c Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期三, 03 十二月 2025 16:58:36 +0800
Subject: [PATCH] 统一卧转立扫码、卧转立、大车、大理片笼的定时器逻辑和步骤状态;添加设备拓扑图清除数据、联机状态切换按钮,

---
 mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue |  101 ++++++++++++++++++--------------------------------
 1 files changed, 36 insertions(+), 65 deletions(-)

diff --git a/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue b/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
index 74906ce..107603c 100644
--- a/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
+++ b/mes-web/src/views/plcTest/components/MultiDeviceTest/TaskOrchestration.vue
@@ -26,55 +26,28 @@
     </div>
 
     <el-form :model="form" label-width="120px" :rules="rules" ref="formRef">
-      <el-form-item label="鐜荤拑ID鍒楄〃" prop="glassIds" required>
+      <el-form-item label="鐜荤拑ID鍒楄〃" prop="glassIds">
         <el-input
           v-model="glassIdsInput"
           type="textarea"
           :rows="4"
-          placeholder="璇疯緭鍏ョ幓鐠冩潯鐮侊紝鏀寔澶氳鎴栭�楀彿鍒嗛殧锛屾瘡琛屼竴涓垨閫楀彿鍒嗛殧"
+          placeholder="鍙�夛細杈撳叆鐜荤拑ID锛屽皢浣跨敤杈撳叆鐨処D杩涜娴嬭瘯"
           show-word-limit
           :maxlength="5000"
         />
         <div class="form-tip">
-          宸茶緭鍏� {{ glassIds.length }} 涓幓鐠僆D
+          <span v-if="glassIds.length > 0">宸茶緭鍏� {{ glassIds.length }} 涓幓鐠僆D锛堟祴璇曟ā寮忥細浣跨敤杈撳叆鐨処D锛�</span>
+          <span v-else>鏈緭鍏ョ幓鐠僆D锛堟甯告ā寮忥細灏嗕粠鏁版嵁搴撹鍙栨渶杩戞壂鐮佺殑鐜荤拑ID锛�</span>
         </div>
       </el-form-item>
-      
-      <el-divider content-position="left">鎵ц閰嶇疆</el-divider>
-      
-      <el-form-item label="鎵ц闂撮殧 (ms)">
-        <el-input-number
-          v-model="form.executionInterval"
-          :min="100"
-          :max="10000"
-          :step="100"
-          placeholder="璁惧鎿嶄綔闂撮殧鏃堕棿"
-        />
-        <div class="form-tip">姣忎釜璁惧鎿嶄綔涔嬮棿鐨勯棿闅旀椂闂达紙姣锛�</div>
-      </el-form-item>
-      
-      <el-form-item label="瓒呮椂鏃堕棿 (鍒嗛挓)">
-        <el-input-number
-          v-model="form.timeoutMinutes"
-          :min="1"
-          :max="60"
-          :step="1"
-          placeholder="浠诲姟瓒呮椂鏃堕棿"
-        />
-        <div class="form-tip">浠诲姟鎵ц鐨勬渶澶ц秴鏃舵椂闂�</div>
-      </el-form-item>
-      
-      <el-form-item label="閲嶈瘯娆℃暟">
-        <el-input-number
-          v-model="form.retryCount"
-          :min="0"
-          :max="10"
-          :step="1"
-          placeholder="澶辫触閲嶈瘯娆℃暟"
-        />
-        <div class="form-tip">璁惧鎿嶄綔澶辫触鏃剁殑鏈�澶ч噸璇曟鏁�</div>
-      </el-form-item>
     </el-form>
+
+    <!-- 璁惧缁勬嫇鎵戝浘 -->
+    <GroupTopology
+      v-if="group"
+      :group="group"
+      class="topology-section"
+    />
   </div>
 </template>
 
@@ -84,6 +57,7 @@
 import { Delete, Promotion } from '@element-plus/icons-vue'
 import { multiDeviceTaskApi } from '@/api/device/multiDeviceTask'
 import { deviceGroupApi, deviceInteractionApi } from '@/api/device/deviceManagement'
+import GroupTopology from '../DeviceGroup/GroupTopology.vue'
 
 const props = defineProps({
   group: {
@@ -93,12 +67,8 @@
 })
 
 const emit = defineEmits(['task-started'])
-
-const form = reactive({
-  executionInterval: 1000,
-  timeoutMinutes: 30,
-  retryCount: 3
-})
+//閰嶇疆榛樿鍊�
+const form = reactive({})
 
 const formRef = ref(null)
 
@@ -106,8 +76,10 @@
   glassIds: [
     {
       validator: (rule, value, callback) => {
+        // 濡傛灉杈撳叆浜嗙幓鐠僆D锛屽垯杩涜楠岃瘉锛涘鏋滄病鏈夎緭鍏ワ紝鍒欏厑璁革紙灏嗕粠鏁版嵁搴撹鍙栵級
         if (glassIds.value.length === 0) {
-          callback(new Error('璇疯嚦灏戣緭鍏ヤ竴涓幓鐠僆D'))
+          // 鍏佽涓虹┖锛屽皢浠庢暟鎹簱璇诲彇鏈�杩戞壂鐮佺殑鐜荤拑ID
+          callback()
         } else if (glassIds.value.length > 100) {
           callback(new Error('鐜荤拑ID鏁伴噺涓嶈兘瓒呰繃100涓�'))
         } else {
@@ -151,6 +123,8 @@
     .filter((item) => item.length > 0)
 })
 
+const normalizeType = (type) => (type || '').trim().toUpperCase()
+
 const fetchLoadDevice = async () => {
   loadDeviceId.value = null
   loadDeviceName.value = ''
@@ -172,9 +146,15 @@
       : Array.isArray(rawList?.data)
       ? rawList.data
       : []
-    const targetDevice =
-      deviceList.find((item) => (item.deviceType || '').toUpperCase() === 'LOAD_VEHICLE') ||
-      deviceList[0]
+    const scannerDevice = deviceList.find((item) => {
+      const type = normalizeType(item.deviceType)
+      return type.includes('SCANNER') || type.includes('鎵爜')
+    })
+    const loadVehicleDevice = deviceList.find((item) => {
+      const type = normalizeType(item.deviceType)
+      return type.includes('LOAD_VEHICLE') || type.includes('澶ц溅')
+    })
+    const targetDevice = scannerDevice || loadVehicleDevice || deviceList[0]
     if (targetDevice && targetDevice.id) {
       loadDeviceId.value = targetDevice.id
       loadDeviceName.value = targetDevice.deviceName || targetDevice.deviceCode || `ID: ${targetDevice.id}`
@@ -202,26 +182,13 @@
     return
   }
   
-  if (glassIds.value.length === 0) {
-    ElMessage.warning('璇疯嚦灏戣緭鍏ヤ竴涓幓鐠僆D')
-    return
-  }
-  
   try {
     loading.value = true
     
     // 鏋勫缓浠诲姟鍙傛暟
+    // 濡傛灉杈撳叆浜嗙幓鐠僆D锛屼娇鐢ㄨ緭鍏ョ殑锛涘鏋滄病鏈夎緭鍏ワ紝glassIds涓虹┖鏁扮粍锛屽悗绔細浠庢暟鎹簱璇诲彇
     const parameters = {
-      glassIds: glassIds.value,
-      executionInterval: form.executionInterval || 1000
-    }
-    
-    // 璁惧鐗瑰畾閰嶇疆宸茬Щ闄わ紝濡傛湁闇�瑕佸彲鍦ㄦ鎵╁睍
-    if (form.timeoutMinutes) {
-      parameters.timeoutMinutes = form.timeoutMinutes
-    }
-    if (form.retryCount !== null) {
-      parameters.retryCount = form.retryCount
+      glassIds: glassIds.value.length > 0 ? glassIds.value : []
     }
     
     // 寮傛鍚姩浠诲姟锛岀珛鍗宠繑鍥烇紝涓嶉樆濉�
@@ -261,14 +228,14 @@
     return
   }
   if (!loadDeviceId.value) {
-    ElMessage.warning('鏈壘鍒颁笂澶ц溅璁惧锛屾棤娉曟竻绌篜LC')
+    ElMessage.warning('鏈壘鍒板搴旇澶囷紝鏃犳硶娓呯┖PLC')
     return
   }
   try {
     clearLoading.value = true
     const response = await deviceInteractionApi.executeOperation({
       deviceId: loadDeviceId.value,
-      operation: 'clearGlass',
+      operation: 'clearPlc',
       params: {}
     })
     if (response?.code !== 200) {
@@ -337,5 +304,9 @@
   margin-top: 4px;
   line-height: 1.4;
 }
+
+.topology-section {
+  margin-top: 24px;
+}
 </style>
 

--
Gitblit v1.8.0