zhoushihao
2025-03-03 bd21c609d3e0f325f10f20bb1f59ae24a4b35dc2
UI-Project/src/views/Caching/cachingun.vue
@@ -2,6 +2,7 @@
import {onBeforeUnmount, onMounted, onUnmounted, ref, reactive} from "vue";
import {useRouter} from "vue-router"
import {host, WebSocketHost} from '@/utils/constants'
import dayjs from 'dayjs';
import request from "@/utils/request"
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
import {ElMessage, ElMessageBox} from 'element-plus'
@@ -36,9 +37,12 @@
  //     id: rect.id * 10,
  //   })); 
};
// 初始化 WebSocket,并传递消息处理函数
onMounted(() => {
  socket = initializeWebSocket(socketUrl, handleMessage);
  const endTime = dayjs().startOf('minute'); // 当前时间,精确到分钟
  const startTime = endTime.subtract(1, 'day').startOf('minute'); // 当前时间的前一天,精确到分钟
  // 设置时间范围为 [开始时间, 结束时间]
  timeRange.value = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')];
});
// 历史任务
const handlehistorical = (row) => {
@@ -65,8 +69,8 @@
  try { 
    const params = {
      deviceId: 2,
      startTime: timeRange.value[0] || '',
      endTime: timeRange.value[1] || '',
      startTime: (timeRange.value && timeRange.value[0]) || '',
      endTime: (timeRange.value && timeRange.value[1]) || '',
      glassId: glassId.value || '',
      taskState: taskState.value,
      taskType: taskType.value || ''
@@ -182,9 +186,7 @@
      } 
    ); 
    if (confirmResult === 'confirm') {
      const response = await request.post("/cacheGlass/edgStorageCageDetails/removeEdgDetails",{
        glassId: row.glassId
      })
      const response = await request.post("/cacheGlass/edgStorageCageDetails/removeEdgDetails?glassId="+encodeURIComponent(row.glassId))
    if (response.code === 200) {
     ElMessage.success(response.message);
      } else {
@@ -279,8 +281,7 @@
  const hours = String(date.getHours()).padStart(2, '0'); // 补零(如果需要显示时间)
  const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零(如果需要显示时间)
  const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零(如果需要显示时间)
  // 只显示年月日,如果需要显示时间,则拼接 hours + ':' + minutes + ':' + seconds
  return `${year}-${month}-${day}`;
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
  onUnmounted(() => {
    if (socket) {
@@ -311,7 +312,6 @@
      ref="table"
      style="margin-top: 20px; height: 360px;"
      :data="tableDataa"
      :row-class-name="rowClassName"
      :header-cell-style="{ background: '#F2F3F5', color: '#1D2129' }"
      row-key="id"
  >
@@ -334,7 +334,7 @@
    <template #default="props">
      <el-table 
      :header-cell-style="{ background: '#F2F3F5', color: '#1D2129' }"
      :data="props.row.details" style="width: 100%;height: 100px;">
      :data="props.row.details" style="width: 100%;height: 70px;">
        <el-table-column prop="engineerId" align="center" min-width="80" />
          <el-table-column prop="flowCardId" align="center" min-width="80" />
          <el-table-column prop="glassId" align="center" min-width="80" />