From 2ef99428f9be29ec299029782edb97baef88e126 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 18 三月 2026 14:19:20 +0800
Subject: [PATCH] feat: 完成WCS/WMS任务链路与设备调度改造

---
 Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Web/src/views/HomeView.vue |   50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Web/src/views/HomeView.vue b/Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Web/src/views/HomeView.vue
index 7c9c152..e16d086 100644
--- a/Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Web/src/views/HomeView.vue
+++ b/Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Web/src/views/HomeView.vue
@@ -1,12 +1,15 @@
-<template>
-  <div>
+锘�<template>
+  <div
+    v-loading.fullscreen.lock="startActionLoading"
+    element-loading-text="姝e湪鍚姩瀹炰緥锛岃绋嶅��..."
+  >
     <div class="page-header">
       <div class="header-left">
         <h2>
           <el-icon :size="24"><Cpu /></el-icon>
-          S7 PLC 浠跨湡鍣ㄥ疄渚�
+          S7 PLC 妯℃嫙鍣ㄥ疄渚�
         </h2>
-        <p class="text-muted">绠$悊鍜岀洃鎺� S7 PLC 浠跨湡鍣ㄥ疄渚�</p>
+        <p class="text-muted">绠$悊鍜岀洃鎺� S7 PLC 妯℃嫙鍣ㄥ疄渚�</p>
       </div>
       <div class="header-right">
         <div class="stats">
@@ -107,7 +110,7 @@
 </template>
 
 <script setup lang="ts">
-import { onMounted, onUnmounted } from 'vue'
+import { onMounted, onUnmounted, ref } from 'vue'
 import { storeToRefs } from 'pinia'
 import { useInstancesStore } from '../stores/instances'
 import { ElMessage, ElMessageBox } from 'element-plus'
@@ -125,6 +128,7 @@
 
 const store = useInstancesStore()
 const { instances, loading, runningCount, stoppedCount, errorCount } = storeToRefs(store)
+const startActionLoading = ref(false)
 
 onMounted(() => {
   store.loadInstances()
@@ -135,22 +139,28 @@
   store.stopAutoRefresh()
 })
 
-function handleStart(id: string) {
-  ElMessageBox.confirm(`纭畾瑕佸惎鍔ㄥ疄渚� "${id}" 鍚�?`, '纭', {
-    confirmButtonText: '纭畾',
-    cancelButtonText: '鍙栨秷',
-    type: 'info'
-  }).then(() => {
-    store.startInstance(id).then(() => {
-      ElMessage.success('鍚姩鍛戒护宸插彂閫�')
-    }).catch(() => {
-      ElMessage.error('鍚姩澶辫触锛岃鏌ョ湅鎺у埗鍙�')
+async function handleStart(id: string) {
+  try {
+    await ElMessageBox.confirm(`纭畾瑕佸惎鍔ㄥ疄渚� "${id}" 鍚楋紵`, '纭', {
+      confirmButtonText: '纭畾',
+      cancelButtonText: '鍙栨秷',
+      type: 'info'
     })
-  })
+
+    startActionLoading.value = true
+    await store.startInstance(id)
+    ElMessage.success('鍚姩鍛戒护宸插彂閫�')
+  } catch (err) {
+    if (err !== 'cancel') {
+      ElMessage.error('鍚姩澶辫触锛岃鏌ョ湅鎺у埗鍙�')
+    }
+  } finally {
+    startActionLoading.value = false
+  }
 }
 
 function handleStop(id: string) {
-  ElMessageBox.confirm(`纭畾瑕佸仠姝㈠疄渚� "${id}" 鍚�?`, '纭', {
+  ElMessageBox.confirm(`纭畾瑕佸仠姝㈠疄渚� "${id}" 鍚楋紵`, '纭', {
     confirmButtonText: '纭畾',
     cancelButtonText: '鍙栨秷',
     type: 'warning'
@@ -164,7 +174,7 @@
 }
 
 function handleDelete(id: string) {
-  ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ疄渚� "${id}" 鍚�?姝ゆ搷浣滀笉鍙挙閿�!`, '璀﹀憡', {
+  ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ疄渚� "${id}" 鍚楋紵姝ゆ搷浣滀笉鍙挙閿�锛乣, '璀﹀憡', {
     confirmButtonText: '纭畾',
     cancelButtonText: '鍙栨秷',
     type: 'error'
@@ -188,7 +198,7 @@
   return map[status] || ''
 }
 
-function getStatusTagType(status: string): 'success' | 'info' | 'warning' | 'danger' | 'info' {
+function getStatusTagType(status: string): 'success' | 'info' | 'warning' | 'danger' {
   const map: Record<string, 'success' | 'info' | 'warning' | 'danger'> = {
     'Stopped': 'info',
     'Starting': 'info',
@@ -337,3 +347,5 @@
   margin-top: 8px;
 }
 </style>
+
+

--
Gitblit v1.9.3