| | |
| | |
|
| | |
|
| | | <script setup>
|
| | | import { ref, onMounted, onBeforeUnmount } from "vue"; // 导入 Vue 3 的模块
|
| | | import { ref, onMounted, onBeforeUnmount,onUnmounted } from "vue"; // 导入 Vue 3 的模块
|
| | | //import * as echarts from 'echarts';
|
| | | import { ElMessage, ElMessageBox } from "element-plus";
|
| | | // import {tableData} from '@/stores/tableData.js';
|
| | |
| | | row.enableState = 1 - row.enableState; // Toggle between 0 and 1
|
| | | // 此处可以添加保存状态的逻辑,比如调用 API 更新数据
|
| | | };
|
| | | let socket = null;
|
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/glassStorage/api/talk/storageTask`;
|
| | | // 定义消息处理函数,更新 receivedData 变量
|
| | | const handleMessage = (data) => {
|
| | |
| | | // 替换原来的 createTime 字段为格式化后的日期时间字符串
|
| | | item.startTime = formattedDateTime;
|
| | | });
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | };
|
| | |
|
| | | onMounted(() => {
|
| | | initializeWebSocket(socketUrl, handleMessage);
|
| | | socket = initializeWebSocket(socketUrl, handleMessage);
|
| | | });
|
| | | onUnmounted(() => {
|
| | | if (socket) {
|
| | | closeWebSocket(socket);
|
| | | }
|
| | | });
|
| | | onBeforeUnmount(() => {
|
| | | console.log("关闭了");
|