wu
2024-06-24 09a010c5dc11c68a866a6075a74bd1bbefb4a9a8
UI-Project/src/views/Caching/cachingbefore.vue
@@ -4,6 +4,7 @@
import {useRouter} from "vue-router"
const router = useRouter()
const adda = ref(false)
import { WebSocketHost ,host} from '@/utils/constants'
import request from "@/utils/request"
import { ref, onMounted , onBeforeUnmount} from "vue";
@@ -15,7 +16,6 @@
const tableData = ref([])
const slot = ref('')
const adjustedRects = ref([]);
onMounted(async () => {  
  try {  
    const response = await request.post('/cacheGlass/edgStorageCage/selectEdgStorageCage'); // 替换为你的API端点  
@@ -37,7 +37,7 @@
  }  
}); 
const toggleEnableState = async (row) => {  
  const newState = row.enable_state === 1 ? 0 : 1;
  const newState = row.enable_state === 1 ? 0 : 1;
  // 发送请求到后端更新状态(这里省略了实际的请求逻辑)  
  const response = await request.post('/cacheGlass/edgStorageCage/updateEdgStorageCage', { id: row.id, enablestate: newState });  
  if (response.code === 200) {
@@ -78,7 +78,7 @@
    console.error('发生错误:', error);  
  }  
};   
const socketUrl = `ws://10.153.19.150:88/api/cacheGlass/api/talk/cacheGlass`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据