wangfei
2024-07-29 157ddaf4e6f1f57edbd1d6ade4d93ea14d8da6e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
  <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" value-format="YYYY-MM-DD"
      :start-placeholder="$t('reportmanage.starttime')" :end-placeholder="$t('reportmanage.endtime')" :default-time="defaultTime" />
    <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>
      <el-option :label="$t('reportmanage.broke')" value="2"></el-option>
      <el-option :label="$t('reportmanage.takeout')" value="3"></el-option>
    </el-select>
    <el-select v-model="report.status" :placeholder="$t('reportmanage.cstate')" style="margin-left: 10px;" >
      <el-option :label="$t('reportmanage.all')" value="0"></el-option>
      <el-option :label="$t('reportmanage.dreportwork')" value="1"></el-option>
      <el-option :label="$t('reportmanage.pendingwork')" value="2"></el-option>
      <el-option :label="$t('reportmanage.reportwork')" value="3"></el-option>
    </el-select>
    <el-select v-model="report.workingProcedure" :placeholder="$t('reportmanage.cprocess')" style="margin-left: 10px;" >
      <el-option :label="$t('reportmanage.all')" value="0"></el-option>
      <el-option :label="$t('reportmanage.incise')" value="1"></el-option>
      <el-option :label="$t('reportmanage.edging')" value="2"></el-option>
      <el-option :label="$t('reportmanage.steel')" value="3"></el-option>
    </el-select>
    <el-button type="primary" style="margin-left: 10px;" @click="selectReportData()">{{ $t('reportmanage.inquire') }}</el-button>
    <el-button type="success" style="margin-left: 10px;" >{{ $t('reportmanage.signingwork') }}</el-button>
  </div>
    <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
    <el-table height="540" ref="table" :data="reportData"
      :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
      <el-table-column prop="teamsGroupsName" align="center" :label="$t('reportmanage.reporteam')" min-width="120" />
      <el-table-column prop="deviceName" align="center" :label="$t('reportmanage.reportingequipment')" min-width="120" />
      <el-table-column prop="line" align="center" :label="$t('reportmanage.line')" min-width="120" />
      <el-table-column prop="workingProcedure" align="center" :label="$t('reportmanage.process')" min-width="120" />
      <el-table-column prop="glassId" align="center" :label="$t('reportmanage.glassID')" min-width="120" />
      <el-table-column prop="engineerId" align="center" :label="$t('reportmanage.projectnumber')" min-width="120" />
      <el-table-column prop="temperingLayoutId" align="center" :label="$t('reportmanage.layoutID')" min-width="120" />
      <el-table-column prop="damageTime" align="center" :label="$t('reportmanage.productiontime')" min-width="120" />
      <el-table-column prop="type" align="center" :label="$t('reportmanage.type')" min-width="120" />
      <el-table-column prop="status" align="center" :label="$t('reportmanage.state')" min-width="120" />
      <el-table-column prop="processId" align="center" :label="$t('reportmanage.processcards')" min-width="120" />
      <el-table-column prop="orderNumber" align="center" :label="$t('reportmanage.number')" min-width="120" />
      <el-table-column prop="technologyNumber" align="center" :label="$t('reportmanage.layer')" min-width="120" />
      <el-table-column prop="breakageType" align="center" :label="$t('reportmanage.typebreakage')" min-width="120" />
      <el-table-column prop="breakageReason" align="center" :label="$t('reportmanage.causebreakage')" min-width="120" />
      <el-table-column prop="responsibleProcess" align="center" :label="$t('reportmanage.responsibleprocess')" min-width="120" />
      <el-table-column prop="responsiblePersonnel" align="center" :label="$t('reportmanage.responsiblepersonnel')" min-width="120" />
      <el-table-column prop="responsibleTeam" align="center" :label="$t('reportmanage.responsibleteam')" min-width="120" />
      <el-table-column prop="responsibleEquipment" align="center" :label="$t('reportmanage.responsibleequipment')" min-width="120" />
      <el-table-column prop="remark" align="center" :label="$t('reportmanage.remark')" min-width="120" />
    </el-table>
    </div>
    </el-card>
  </div>
</template>
<script setup>
import { Delete, Upload } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, onMounted, onBeforeUnmount, reactive, computed, shallowRef, onUnmounted, watchEffect } from "vue";
import request from "@/utils/request"
import { WebSocketHost, host } from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const report = ref({
  type: '0',
  status: '0',
  workingProcedure: '0',
});
const reportData = ref([])
const timeRange = ref(["2022-01-01", "2022-01-01"])
 
 
// 查询数据
const selectReportData = async () => {
  const response = await request.post("/cacheVerticalGlass/damage/selectDamage", {
    startTime: timeRange.value[0],
    endTime: timeRange.value[1],
    type: report.value.type,
    status: report.value.status,
    workingProcedure: report.value.workingProcedure
  })
  if (response.code === 200) {
    reportData.value = response.data;
    ElMessage.success(response.message);
  } else {
    ElMessage.error(response.message);
  }
 
  const responses = await request.post("/cacheVerticalGlass/damage/insertDamage", {
    glassId:"P24060403|3|6",
    line:"2001",
    workingProcedure:"冷加工",
    remark:"",
    status:"2"
  })
};
 
const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/screen`;
const handleMessage = (data) => {
  // adjustedRects.value = data.device[0].map(rect => ({  
  //       ...rect, 
  //       completed: rect.completedQuantity,
  //       breakage: rect.breakageQuantity,
  //       thisProcess: rect.thisProcess,
  //     })); 
};
let socket;
onMounted(() => {
  socket = new WebSocket(socketUrl);
  socket.onmessage = (event) => {
    const data = JSON.parse(event.data);
 
    // updateCharts();
  };
  // };  
});
 
 
 
 
onUnmounted(() => {
  socket.close();
});
 
onMounted(() => {
  // fetchFlowCardId();
  // fetchTableData(); // 获取数据
  initializeWebSocket(socketUrl, handleMessage);
});
onBeforeUnmount(() => {
  console.log("关闭了")
  closeWebSocket();
});
</script>
 
<style scoped></style>