From 94ad631d316da04c46266ddb1fc6e63e6f8f2fae Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 17 三月 2026 17:34:15 +0800
Subject: [PATCH] feat: 同步协议处理、前端交互与业务联调改动
---
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