From 1460aa1d5f2b5722d43ed31724594c006213bea7 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期五, 18 四月 2025 16:40:43 +0800
Subject: [PATCH] 看板2更新

---
 UI-Project/src/views/Marking/marking.vue |  152 ++++++++++++++++++++++++--------------------------
 1 files changed, 73 insertions(+), 79 deletions(-)

diff --git a/UI-Project/src/views/Marking/marking.vue b/UI-Project/src/views/Marking/marking.vue
index 264514c..bba4efb 100644
--- a/UI-Project/src/views/Marking/marking.vue
+++ b/UI-Project/src/views/Marking/marking.vue
@@ -6,6 +6,8 @@
 import { useI18n } from 'vue-i18n'
 import { WebSocketHost ,host} from '@/utils/constants'
 import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
+import {gridDateFormatter} from '@/stores/tool';
+
 let language = ref(localStorage.getItem('lang') || 'zh')
 const { t } = useI18n()
 const requestData = reactive({
@@ -14,14 +16,25 @@
 });
 const loadData = ref([]);
 const findMachine = ref([]);
+const sendRecords = ref([]);
+
+const userInfo=JSON.parse(window.localStorage.getItem('userInfo'));
+const pageParams=userInfo.user.menus[0].pages[3].params;
+const pageParamsJson=JSON.parse(pageParams);
+const machineId = pageParamsJson.machineId;//褰撳墠椤甸潰鐨勮澶嘔D
+console.log(machineId);
+//const machineId=12;//褰撳墠椤甸潰鐨勮澶嘔D
 //浣跨敤WebSocket鏂瑰紡灞曠ず鏁版嵁
 let socket = null;
 const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/marking`;
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
 const handleMessage = (data) => {
   // 鏇存柊 tableData 鐨勬暟鎹�
-  loadData.value = data.taskingList[0];
-  findMachine.value = data.machine[0];
+  let dataJson = data[""+machineId][0];
+
+  loadData.value = dataJson.taskingList[0];
+  findMachine.value = dataJson.machine[0];
+  sendRecords.value = dataJson.sendRecords[0];
 };
 onUnmounted(() => {
   if (socket) {
@@ -36,46 +49,11 @@
 onMounted(async () => {
   //浣跨敤WebSocket鏂瑰紡灞曠ず鏁版嵁
   socket = initializeWebSocket(socketUrl, handleMessage);// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
-
-  //浣跨敤鎺ュ彛鏂瑰紡灞曠ず鏁版嵁
-  //load();
 });
-
-// //鑾峰彇鏁版嵁
-// const load = async() => {
-//   //鑾峰彇璁惧浠诲姟鏁版嵁
-//   try {
-//     const response = await request.post('/deviceInteraction/tasking/findMachineTask',
-//     {
-//       "id": 11
-//     }); // 鏇挎崲涓轰綘鐨凙PI绔偣  
-//     if (response.code === 200) {
-//       loadData.value.findTaskingData= response.data;
-//     } else {
-//       ElMessage.warning(res.msg)
-//     }
-//   } catch (error) {
-//     // console.error('Error fetching rects :', error);  
-//   }
-//   //鑾峰彇璁惧鐘舵��
-//   try {
-//     const response = await request.post('/deviceInteraction/machine/findMachine',
-//     {
-//       "id": 11
-//     }); // 鏇挎崲涓轰綘鐨凙PI绔偣  
-//     if (response.code === 200) {
-//       findMachine.value= response.data;
-//     } else {
-//       ElMessage.warning(res.msg)
-//     }
-//   } catch (error) {
-//     // console.error('Error fetching rects :', error);  
-//   }
-// }
 //淇敼宸ヤ綔鐘舵�� 銆愬け璐�/姝e湪宸ヤ綔/瀹屽伐銆�
 const workStatus = async(row,state) => {
   let url;
-  if(state=="澶辫触"){
+  if(state=="閲嶅彂"){
     url="/deviceInteraction/tasking/loseMachineTask";
   }else if(state=="姝e湪宸ヤ綔"){
     url="/deviceInteraction/tasking/startMachineTask";
@@ -85,11 +63,11 @@
     return;
   }
   ElMessageBox.confirm(
-        t('marking.tips'),
+        t('functionState.tips'),
         t('delivery.prompt'),  
         {
-          confirmButtonText: t('marking.sure'),
-          cancelButtonText: t('marking.cancel'),
+          confirmButtonText: t('functionState.sure'),
+          cancelButtonText: t('functionState.cancel'),
           type: 'warning',
         }
       )
@@ -97,7 +75,7 @@
           //寮�濮嬩慨鏀�
           request.post(url,
             {
-              "id": 11
+              "id": machineId
             }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
               if (res.code === 200) {
                 ElMessage.success(res.message);
@@ -109,7 +87,7 @@
         .catch(() => {
           ElMessage({
             type: 'info',
-            message: t('marking.cancel'),
+            message: t('functionState.cancel'),
           })
         })
 
@@ -118,11 +96,11 @@
 //寮�宸�/鏆傚仠
 const machineStatus = async(state) => {
   ElMessageBox.confirm(
-        t('marking.tips'),
+        t('functionState.tips'),
         t('delivery.prompt'),  
         {
-          confirmButtonText: t('marking.sure'),
-          cancelButtonText: t('marking.cancel'),
+          confirmButtonText: t('functionState.sure'),
+          cancelButtonText: t('functionState.cancel'),
           type: 'warning',
         }
       )
@@ -130,7 +108,7 @@
           //涓嬬嚎鎺ュ彛
           request.post("/deviceInteraction/machine/updateMachineState",
             {
-              "id": 11,
+              "id": machineId,
               "state": state
             }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
               if (res.code === 200) {
@@ -143,18 +121,18 @@
         .catch(() => {
           ElMessage({
             type: 'info',
-            message: t('marking.cancel'),
+            message: t('functionState.cancel'),
           })
         })
 }
 //鐮存崯
 const damagedTask = async(row) => {
   ElMessageBox.confirm(
-        t('marking.tips'),
+        t('functionState.tips'),
         t('delivery.prompt'),  
         {
-          confirmButtonText: t('marking.sure'),
-          cancelButtonText: t('marking.cancel'),
+          confirmButtonText: t('functionState.sure'),
+          cancelButtonText: t('functionState.cancel'),
           type: 'warning',
         }
       )
@@ -174,18 +152,18 @@
         .catch(() => {
           ElMessage({
             type: 'info',
-            message: t('marking.cancel'),
+            message: t('functionState.cancel'),
           })
         })
 }
 //涓嬬嚎(鎷胯蛋)
 const glassDownLine = async(row) => {
   ElMessageBox.confirm(
-        t('marking.tips'),
+        t('functionState.tips'),
         t('delivery.prompt'),  
         {
-          confirmButtonText: t('marking.sure'),
-          cancelButtonText: t('marking.cancel'),
+          confirmButtonText: t('functionState.sure'),
+          cancelButtonText: t('functionState.cancel'),
           type: 'warning',
         }
       )
@@ -205,7 +183,7 @@
         .catch(() => {
           ElMessage({
             type: 'info',
-            message: t('marking.cancel'),
+            message: t('functionState.cancel'),
           })
         })
 }
@@ -216,50 +194,66 @@
 
 </script>
 <template>
-  <div ref="content">
+  <div ref="content" style="padding:0 20px;">
     <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
-      鑷姩鎵撴爣鏈�
+      {{$t('machine.marking')}}
     </div>
     <hr />
     <br>
-    <div id="search" style="padding-left: 20px;">
+    <div id="search" >
       <!-- 鍔熻兘 -->
-      <el-button type="primary" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='鏆傚仠'?'寮�宸�':'鏆傚仠'))">{{findMachine['state']=='寮�宸�'?'寮�宸�':'鏆傚仠'}}</el-button>
-      <el-button type="primary" id="ButtonTopLine" @click="topLine">涓婄嚎</el-button>
+      <el-button :type="(findMachine['state']=='鏆傚仠'?'danger':'success')" id="ButtonMachineStatus" 
+      @click="machineStatus((findMachine['state']=='鏆傚仠'?'寮�宸�':'鏆傚仠'))">
+      {{findMachine['state']=='寮�宸�'?$t('functionState.start'):$t('functionState.stop')}}</el-button>
+      <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button>
       <!-- <el-button type="primary" id="searchButton" @click="downLine('涓嬬嚎')">涓嬬嚎</el-button>
       <el-button type="primary" id="searchButton" @click="workStatus('鐮存崯')">鐮存崯</el-button>
       <el-button type="primary" id="searchButton" @click="workStatus('瀹屽伐')">瀹屽伐</el-button> -->
     </div>
-    <div id="main-body" style="min-height:240px;">
+    <div id="main-body">
       <!-- 琛ㄦ牸鍐呭 -->
-      <el-table :data="loadData" stripe
+      <el-table :data="loadData" stripe style="height:260px"
         :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
         :cell-style="{ textAlign: 'center' }">
         <!-- <el-table-column type="selection" min-width="30" /> -->
-        <el-table-column type="index" label="搴忓彿" min-width="30" />
-        <el-table-column prop="batchNumber" label="鎵规鍙�" />
-        <el-table-column prop="taskType" label="浠诲姟绫诲瀷" />
-        <el-table-column prop="glassId" label="鐜荤拑缂栧彿" />
-        <el-table-column prop="length" label="闀�" />
-        <el-table-column prop="width" label="瀹�" />
-        <el-table-column prop="thickness" label="鍘�" />
-        <el-table-column prop="workState" label="鐘舵��" />
+        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
+        <el-table-column prop="isMarking" :label="$t('glassInfo.isMarking')"/>
+        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
+        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
+        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
+        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" />
+        <el-table-column prop="length" :label="$t('glassInfo.length')"/>
+        <el-table-column prop="width" :label="$t('glassInfo.width')"/>
+        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
+        <el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
+        <el-table-column prop="operationRecordTime" :formatter="gridDateFormatter" :label="$t('glassInfo.operationRecordTime')" width="180"/>
         <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
           <template #default="scope">
-            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '澶辫触')">閲嶅彂</el-button>
-            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '瀹屽伐')">瀹屽伐</el-button>
-            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">鐮存崯</el-button>
-            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">涓嬬嚎</el-button>
+            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '閲嶅彂')" >{{$t('functionState.anew')}}</el-button>
+            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '瀹屽伐')">{{$t('functionState.finish')}}</el-button>
+            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button>
+            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button>
           </template>
         </el-table-column>
       </el-table>
     </div>
 
-    <div id="main-body"
-      style="width: 100%; height: 460px;background-image: url(../../src/assets/鑷姩鎵撴爣鏈�.png) ;background-size: 100% 100%;">
-      <!-- 鐢诲浘鍐呭 -->
-      <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
+    <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
+      <img style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../assets/鑷姩鎵撴爣鏈�.png">
+      <!-- <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/鑷姩鎵撴爣鏈�.png"></el-image> -->
+      <!-- <div style="width: 70%;min-width: 900px; height: 460px;background-image: url('../../src/assets/鑷姩鎵撴爣鏈�.png') ;background-size: 100% 100%;float: left;">
+
+      </div> -->
+      <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;">
+          <!-- <div style="text-align: center;height: 30px;line-height: 30px;font-size: 20px;padding: 20px;">鏁版嵁浜や簰璁板綍</div> -->
+          <el-table :data="sendRecords" stripe :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center',height:'30px'}" :cell-style="{ textAlign: 'center' }">
+        <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')"/>
+      </el-table>
       </div>
+      <div style="clear锛歜oth"></div>
+      <!-- 鐢诲浘鍐呭 
+      <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
+      </div>-->
     </div>
   </div>
 </template>

--
Gitblit v1.8.0