时间获取新增websockect推送,提供全局使用,所有模块更改时间选择器获取方式,中空理片笼表格,钢化理片笼表格
10个文件已修改
208 ■■■■■ 已修改文件
UI-Project/src/lang/en.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/lang/py.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/lang/zh.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/layout/MainErpView.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Caching/cachingbefore.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Caching/cachingun.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/GlassStorage/rawfilmstorage.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/ReportWork/reportWork.vue 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Slicecage/slicecage.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/hollow/hollowslicecage.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/lang/en.js
@@ -139,7 +139,6 @@
          cagesnumber:'笼内数量',
          slotnumber:'占有格子数',
          progress:'进度',
          temperingpriority:'钢化优先级',
          whethersame:'是否相同',
          same:'相同',
          notsame:'不相同',
UI-Project/src/lang/py.js
@@ -138,7 +138,6 @@
        cagesnumber:'笼内数量',
        slotnumber:'占有格子数',
        progress:'进度',
        temperingpriority:'钢化优先级',
        whethersame:'是否相同',
        same:'相同',
        notsame:'不相同',
UI-Project/src/lang/zh.js
@@ -138,7 +138,6 @@
          cagesnumber:'笼内数量',
          slotnumber:'占有格子数',
          progress:'进度',
          temperingpriority:'钢化优先级',
          whethersame:'是否相同',
          same:'相同',
          notsame:'不相同',
UI-Project/src/layout/MainErpView.vue
@@ -3,10 +3,14 @@
import userInfo from '@/stores/userInfo'
import request from '@/utils/request'
import {ElMessage} from 'element-plus'
import {ref, watch, onMounted } from 'vue'
import {ref, watch, onMounted, onUnmounted } from 'vue'
import deepClone from '@/utils/deepClone'
import { useRouter } from 'vue-router';  
import { useI18n } from 'vue-i18n'
import { provide } from 'vue';
import {host, WebSocketHost} from '@/utils/constants'
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
const globalDate = ref('');
const { t } = useI18n()
let language = ref(localStorage.getItem('lang') || 'zh')
const store = userInfo()
@@ -28,6 +32,17 @@
              })
  router.push('/login')  
}
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/mainMes`;
const handleMessage = (data) => {
  if(data.globalDate!=null){
    window.localStorage.setItem('getglobalDate', data.globalDate[0])
  }else{
    globalDate.value = ''
      }
    }
  let getglobalDate = window.localStorage.getItem('getglobalDate')
  provide('globalDate', getglobalDate);
  function replaceChineseWithEnglish(menuData) {  
      // 定义中俄文对照关系对象
       const translation  = {  
@@ -145,6 +160,14 @@
function toggleCollapse() {  
  isCollapse.value = !isCollapse.value;  
onMounted(() => {
  socket = initializeWebSocket(socketUrl, handleMessage);
});
  onUnmounted(() => {
    if (socket) {
    closeWebSocket(socket);
    }
    });
</script>
<template>
  <div id="all">
UI-Project/src/views/Caching/cachingbefore.vue
@@ -7,6 +7,8 @@
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
import {ElMessage, ElMessageBox} from 'element-plus'
import {useI18n} from 'vue-i18n'
import { inject } from 'vue';
const globalDate = inject('globalDate');
const {t} = useI18n()
let language = ref(localStorage.getItem('lang') || 'zh')
const tableDataa = ref([])
@@ -38,12 +40,19 @@
  //     id: rect.id * 10,
  //   })); 
};
onMounted(() => {
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
  const backendTime = new Date(globalDate);
  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  console.log(formatTimestamp(oneWeekAgo));
  console.log(oneWeekAgo);
  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
  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')];
  parseAndSetTime();
});
// 历史任务
const handlehistorical = (row) => {
@@ -53,7 +62,8 @@
// 历史任务
const historical = async () => {
  try { 
  var url="/cacheGlass/edgStorageDeviceTaskHistory?deviceId="+1 + "&startTime=" + '' + "&endTime=" + '' + "&glassId=" + '' + "&taskState=" + '' + "&taskType=" + '';
  let startTime = window.localStorage.getItem('startTime')
  var url="/cacheGlass/edgStorageDeviceTaskHistory?deviceId="+1 + "&startTime=" + startTime + "&endTime=" + globalDate + "&glassId=" + '' + "&taskState=" + '' + "&taskType=" + '';
      const response = await request.get(url) 
      if (response.code == 200) {
        ElMessage.success(response.message);
UI-Project/src/views/Caching/cachingun.vue
@@ -7,6 +7,8 @@
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
import {ElMessage, ElMessageBox} from 'element-plus'
import {useI18n} from 'vue-i18n'
import { inject } from 'vue';
const globalDate = inject('globalDate');
const {t} = useI18n()
let language = ref(localStorage.getItem('lang') || 'zh')
const tableDataa = ref([])
@@ -37,12 +39,19 @@
  //     id: rect.id * 10,
  //   })); 
};
onMounted(() => {
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
  const backendTime = new Date(globalDate);
  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  console.log(formatTimestamp(oneWeekAgo));
  console.log(oneWeekAgo);
  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
  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')];
  parseAndSetTime();
});
// 历史任务
const handlehistorical = (row) => {
@@ -52,7 +61,8 @@
// 历史任务
const historical = async () => {
  try { 
  var url="/cacheGlass/edgStorageDeviceTaskHistory?deviceId="+2 + "&startTime=" + '' + "&endTime=" + '' + "&glassId=" + '' + "&taskState=" + '' + "&taskType=" + '';
  let startTime = window.localStorage.getItem('startTime')
  var url="/cacheGlass/edgStorageDeviceTaskHistory?deviceId="+2 + "&startTime=" + startTime + "&endTime=" + globalDate + "&glassId=" + '' + "&taskState=" + '' + "&taskType=" + '';
      const response = await request.get(url) 
      if (response.code == 200) {
        ElMessage.success(response.message);
UI-Project/src/views/GlassStorage/rawfilmstorage.vue
@@ -7,6 +7,7 @@
import dayjs from 'dayjs';
import request from "@/utils/request"
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
import { inject } from 'vue';
const router = useRouter()
const tableDataa = ref([])
const tableDatab = ref([])
@@ -28,6 +29,7 @@
const leftingStation = ref('');
const loadingline = ref('');
let webSocket: WebSocket | null = null;  
const globalDate = inject('globalDate');
const value = ref('')
const options = [
  {
@@ -44,27 +46,28 @@
  taskState: '',
});
  let startTime = window.localStorage.getItem('startTime')
  let endTime = window.localStorage.getItem('endTime')
  request.post("/glassStorage/rawGlassStorageTask/setRawGlassTaskRequest",{
  beginDate: startTime,
  endDate: endTime,
  endDate: globalDate,
}).then((response) => {
          if (response.code == 200) {
            tableDataa.value = response.data
            console.log(tableDataa.value);
          } else {
          ElMessage.warning(response.msg)
          }
          });
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
  const backendTime = new Date(globalDate);
  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  console.log(formatTimestamp(oneWeekAgo));
  console.log(oneWeekAgo);
  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
  onMounted(() => {
  socket = initializeWebSocket(socketUrl, handleMessage);
  const endTime = dayjs().startOf('minute'); // 当前时间,精确到分钟
  const startTime = endTime.subtract(7, 'day').startOf('minute'); // 当前时间的前一天,精确到分钟
  // 设置时间范围为 [开始时间, 结束时间]
  timeRange.value = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')];
  window.localStorage.setItem('startTime', startTime.format('YYYY-MM-DD HH:mm:ss'))
  window.localStorage.setItem('endTime', endTime.format('YYYY-MM-DD HH:mm:ss'))
  parseAndSetTime();
});
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/glassStorage/api/talk/rawGlass`;
@@ -292,14 +295,14 @@
  }
};
// 格式化时间戳为年月日时间字符串的函数
function formatTimestamp(timestamp) {
function formatTimestamp(timestamp: number | Date): string {
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并补零
  const day = String(date.getDate()).padStart(2, '0'); // 补零
  const hours = String(date.getHours()).padStart(2, '0'); // 补零(如果需要显示时间)
  const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零(如果需要显示时间)
  const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零(如果需要显示时间)
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');
  const hours = String(date.getHours()).padStart(2, '0');
  const minutes = String(date.getMinutes()).padStart(2, '0');
  const seconds = String(date.getSeconds()).padStart(2, '0');
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
function getStatusType1(taskType) {  
UI-Project/src/views/ReportWork/reportWork.vue
@@ -2,9 +2,13 @@
  <div style="height: 600px;">
    <div style="display: flex; flex-direction: row; align-items: center; margin-top: 20px;">
      <span style="margin-left: 10px;" class="demonstration">{{ $t('reportmanage.productiontime') }}</span>
      <el-date-picker style="margin-left: 10px;" v-model="timeRange" type="daterange" format="YYYY/MM/DD"
      <!-- <el-date-picker style="margin-left: 10px;" v-model="timeRange" type="daterange" format="YYYY/MM/DD"
        value-format="YYYY-MM-DD" :start-placeholder="$t('reportmanage.starttime')"
        :end-placeholder="$t('reportmanage.endtime')" :default-time="defaultTime" />
        :end-placeholder="$t('reportmanage.endtime')" :default-time="defaultTime" /> -->
        <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" :start-placeholder="$t('reportmanage.starttime')"
             style="margin-left: 15px;" value-format = "YYYY-MM-DD hh:mm:ss"
              :end-placeholder="$t('reportmanage.endtime')">
            </el-date-picker>
      <el-select v-model="report.type" :placeholder="$t('reportmanage.ctype')" style="margin-left: 10px;">
        <!-- <el-option :label="$t('reportmanage.all')" value="0"></el-option> -->
        <!-- <el-option :label="$t('reportmanage.completed')" value="1"></el-option> -->
@@ -127,6 +131,9 @@
import { WebSocketHost, host } from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
import { useI18n } from 'vue-i18n'
import { inject } from 'vue';
const globalDate = inject('globalDate');
const timeRange = ref([])
const { t } = useI18n()
const report = ref({
  type: '8',
@@ -134,18 +141,27 @@
  workingProcedure: '0',
});
const reportData = ref([])
const endDate = new Date();
const startDate = new Date();
startDate.setDate(endDate.getDate() - 7);  // 获取一个星期前的时间
// 格式化为 "YYYY-MM-DD" 格式
const formatDate = (date) => {
function formatTimestamp(timestamp) {
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');
  return `${year}-${month}-${day}`;
};
const timeRange = ref([formatDate(startDate), formatDate(endDate)]);
  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并补零
  const day = String(date.getDate()).padStart(2, '0'); // 补零
  const hours = String(date.getHours()).padStart(2, '0'); // 补零(如果需要显示时间)
  const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零(如果需要显示时间)
  const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零(如果需要显示时间)
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
  const backendTime = new Date(globalDate);
  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  console.log(formatTimestamp(oneWeekAgo));
  console.log(oneWeekAgo);
  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
// const timeRange = ref([formatTimestamp(startDate), formatTimestamp(globalDate)]);
const selectOptionsa = ref([]);
const selectOptionsb = ref([]);
const selectOptionsc = ref([]);
@@ -165,8 +181,8 @@
// 查询数据
const selectReportData = async () => {
  const response = await request.post("/cacheVerticalGlass/damage/selectDamage", {
    startTime: timeRange.value[0],
    endTime: timeRange.value[1]+" 23:59:59",
    startTime: (timeRange.value && timeRange.value[0]) || '',
    endTime: (timeRange.value && timeRange.value[1]) || '',
    type: report.value.type,
    status: report.value.status,
    workingProcedure: report.value.workingProcedure
@@ -260,20 +276,12 @@
//     })); 
// };
// let socket;
onMounted(() => {
  // socket = new WebSocket(socketUrl);
  // socket.onmessage = (event) => {
  //   const data = JSON.parse(event.data);
  //   // updateCharts();
  // };
  // };
});
onUnmounted(() => {
  socket.close();
});
onMounted(() => {
  fetchTableData();
  parseAndSetTime();
  // socket = initializeWebSocket(socketUrl, handleMessage);
});
onUnmounted(() => {
UI-Project/src/views/Slicecage/slicecage.vue
@@ -35,6 +35,7 @@
const tableDatae = ref([])
const tableDatax = ref([])
const tableDatas = ref([])
const tableDatass = ref([])
const tableDatalack = ref([])
const tableDataspecify = ref([])
const tableDatacagedetails = ref([])
@@ -779,6 +780,11 @@
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheVerticalGlass/api/talk/slicecage`;
const handleMessage = (data) => {
  if(data.bigStorageSummary!=null){
    tableDatass.value = data.bigStorageSummary[0]
  }else{
    tableDatass.value = ''
      }
  if (data.inkageEntity != null) {
    inkageEntity.value = data.inkageEntity[0] == true ? 'green' : '#911005';
  }
@@ -1238,15 +1244,14 @@
<el-card style="flex: 1;margin-left: 1220px;margin-top: -510px;" v-loading="loading">
      <div style="width: 100%; height: calc(100% - 35px); overflow-y: auto;max-height: 420px;">
       <el-table height="420px" ref="table" border 
       :data="tableDatac" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
         <el-table-column prop="glassId" align="center" :label="$t('Mounting.project')" min-width="140" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.totalfurnaces')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.cagesnumber')" min-width="120" />
         <el-table-column prop="targetSlot" align="center" :label="$t('large.are')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.fullfurnaces')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.slotnumber')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.progress')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.temperingpriority')" min-width="120" />
       :data="tableDatass" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
         <el-table-column prop="engineerId" align="center" :label="$t('Mounting.project')" min-width="140" />
         <el-table-column prop="countTemp" align="center" :label="$t('searchOrder.totalfurnaces')" min-width="120" />
         <el-table-column prop="countGlass" align="center" :label="$t('searchOrder.cagesnumber')" min-width="120" />
         <el-table-column prop="area" align="center" :label="$t('large.are')" min-width="120" />
         <el-table-column prop="fullTemp" align="center" :label="$t('searchOrder.fullfurnaces')" min-width="120" />
         <el-table-column prop="countSlot" align="center" :label="$t('searchOrder.slotnumber')" min-width="120" />
         <el-table-column prop="percent" align="center" :label="$t('searchOrder.progress')" min-width="120" />
       </el-table>
       </div>
    </el-card>
UI-Project/src/views/hollow/hollowslicecage.vue
@@ -27,6 +27,7 @@
const tableDataf = ref([])
const tableDatae = ref([])
const carPosition = ref([])
const tableDatass = ref([])
const ganghua = ref('')
const diaodu = ref('')
const flowCardId = ref('')
@@ -298,6 +299,11 @@
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/hollowGlass/api/talk/hollowGlassMessage`;
const handleMessage = (data) => {
  if(data.bigStorageSummary!=null){
    tableDatass.value = data.bigStorageSummary[0]
  }else{
    tableDatass.value = ''
      }
  if (data.inkageEntity != null) {
    inkageEntity.value = data.inkageEntity[0] == true ? 'green' : '#911005';
  }
@@ -772,13 +778,13 @@
<el-card style="flex: 1;margin-left: 1020px;margin-top: -670px;" v-loading="loading">
      <div style="width: 100%; height: calc(100% - 35px); overflow-y: auto;max-height: 550px;">
       <el-table height="550px" ref="table" border 
       :data="tableDatac" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
         <el-table-column prop="glassId" align="center" :label="$t('searchOrder.cardnumber')" min-width="140" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.totallogarithms')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.numberpairs')" min-width="120" />
         <el-table-column prop="targetSlot" align="center" :label="$t('hellow.totalnumber')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('hellow.realpieces')" min-width="120" />
         <el-table-column prop="startSlot" align="center" :label="$t('searchOrder.numberoccupied')" min-width="120" />
       :data="tableDatass" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
         <el-table-column prop="flowCardId" align="center" :label="$t('searchOrder.cardnumber')" min-width="140" />
         <el-table-column prop="sumCount" align="center" :label="$t('searchOrder.totallogarithms')" min-width="120" />
         <el-table-column prop="pairCount" align="center" :label="$t('searchOrder.numberpairs')" min-width="120" />
         <el-table-column prop="sumCountlayer" align="center" :label="$t('hellow.totalnumber')" min-width="120" />
         <el-table-column prop="realCount" align="center" :label="$t('hellow.realpieces')" min-width="120" />
         <el-table-column prop="slotCount" align="center" :label="$t('searchOrder.numberoccupied')" min-width="120" />
       </el-table>
       </div>
    </el-card>