From bd21c609d3e0f325f10f20bb1f59ae24a4b35dc2 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 03 三月 2025 10:29:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 UI-Project/src/views/GlassStorage/MaterialRackManagement.vue |   75 +++++--------------------------------
 1 files changed, 11 insertions(+), 64 deletions(-)

diff --git a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
index 6ca0948..9edb226 100644
--- a/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
+++ b/UI-Project/src/views/GlassStorage/MaterialRackManagement.vue
@@ -4,7 +4,7 @@
       <div
         slot="header"
         class="clearfix"
-        style="display: flex; align-items: center"
+        style="display: flex; align-items: center;margin-top: -20px;"
       >
         <!-- 宸︿晶鎸夐挳缁� -->
         <div>
@@ -16,13 +16,11 @@
           >
           <el-button type="success" size="mini">鍚婅浣嶅叆搴�</el-button>
         </div>
-
         <!-- 鍙充晶閫夋嫨妗� -->
-        <el-form-item style="margin-top: 15px; width: 150px">
+        <el-form-item style="margin-top: 15px; width: 150px;margin-left: 10px;">
           <el-select v-model="formData2.dzw" placeholder="璇烽�夋嫨鍚婅浣�">
             <el-option label="鍚婅浣�1" value="鍚婅浣�1"></el-option>
             <el-option label="鍚婅浣�2" value="鍚婅浣�2"></el-option>
-            <!-- 鏍规嵁瀹為檯鎯呭喌娣诲姞鏇村閫夐」 -->
           </el-select>
         </el-form-item>
       </div>
@@ -63,7 +61,6 @@
               </el-tag>
             </template>
           </el-table-column>
-
           <!-- 鎿嶄綔鍒� -->
           <el-table-column label="鎿嶄綔" width="250">
             <template #default="{ row }">
@@ -134,7 +131,6 @@
             </el-tag>
           </template>
         </el-table-column>
-
         <!-- 鎿嶄綔鍒� -->
         <el-table-column label="鎿嶄綔" width="350">
           <template #default="{ row }">
@@ -151,7 +147,6 @@
         </el-table-column>
       </el-table>
     </el-card>
-
     <div class="img-ypcc">
       <div
         class="img-car1"
@@ -168,7 +163,6 @@
         ></div>
       </div>
     </div>
-
     <!-- 鍏ュ簱瀵硅瘽妗� -->
     <el-dialog
       title="鍏ュ簱"
@@ -330,7 +324,7 @@
 
 
 <script setup>
-import { ref, onMounted, onBeforeUnmount } from "vue"; // 瀵煎叆 Vue 3 鐨勬ā鍧�
+import { ref, onMounted, onBeforeUnmount,onUnmounted } from "vue"; // 瀵煎叆 Vue 3 鐨勬ā鍧�
 //import * as echarts from 'echarts';
 import { ElMessage, ElMessageBox } from "element-plus";
 // import {tableData} from '@/stores/tableData.js';
@@ -355,7 +349,6 @@
 const handleCurrentChange = (val) => {
   currentPage.value = val;
 };
-
 const formatTaskType = (row, column) => {
   if (row.taskType === "浠庝粨浣嶅埌鍚婅浣�") {
     return `浠庝粨浣�${row.shelfRack}鍒板悐瑁呬綅${row.loadRack}`;
@@ -367,7 +360,6 @@
     return `浠庡悐瑁呬綅${row.loadRack}鍒颁粨浣�${row.shelfRack}`;
   }
 };
-
 const getTagType2 = (status) => {
   switch (status) {
     case "completed":
@@ -382,70 +374,56 @@
       return "";
   }
 };
-
 const getTagType = (status) => {
   return status === 1 ? "success" : "danger";
   // 鏍规嵁鐘舵�佸�煎喅瀹氭爣绛剧被鍨嬶紝杩欓噷鍋囪鐘舵�佷负1鏃朵负鎴愬姛锛堢豢鑹诧級锛屽惁鍒欎负澶辫触锛堢孩鑹诧級
 };
-
 const toggleStatus = (row) => {
   // 鍒囨崲鏂欐灦鐘舵�佺殑閫昏緫
   row.enableState = 1 - row.enableState; // Toggle between 0 and 1
   // 姝ゅ鍙互娣诲姞淇濆瓨鐘舵�佺殑閫昏緫锛屾瘮濡傝皟鐢� API 鏇存柊鏁版嵁
 };
+let socket = null;
 const socketUrl = `ws://${WebSocketHost}:${host}/api/glassStorage/api/talk/storageTask`;
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
 const handleMessage = (data) => {
   // 鏇存柊 tableData 鐨勬暟鎹�
-
   tableData.value = data.rack[0]; // 鍋囪 tableData 鏄搷搴斿紡瀵硅薄鎴栧彉閲�
-
   tableData.value.forEach((item) => {
     // 鑾峰彇 createTime 鐨勬椂闂存埑
     const createTimeTimestamp = item.createTime;
-
     // 鍒涘缓鏃ユ湡瀵硅薄
     const date = new Date(createTimeTimestamp);
-
     // 鏍煎紡鍖栨棩鏈熸椂闂翠负鏈湴鏍煎紡
     const formattedDateTime = date.toLocaleString();
-
     // 鏇挎崲鍘熸潵鐨� createTime 瀛楁涓烘牸寮忓寲鍚庣殑鏃ユ湡鏃堕棿瀛楃涓�
     item.createTime = formattedDateTime;
   });
-
   tasktableData.value = data.tasks[0]; // 鍋囪 tasktableData 鏄搷搴斿紡瀵硅薄鎴栧彉閲�
-
   tasktableData.value.forEach((item) => {
     // 鑾峰彇 createTime 鐨勬椂闂存埑
     const createTimeTimestamp = item.startTime;
-
     // 鍒涘缓鏃ユ湡瀵硅薄
     const date = new Date(createTimeTimestamp);
-
     // 鏍煎紡鍖栨棩鏈熸椂闂翠负鏈湴鏍煎紡
     const formattedDateTime = date.toLocaleString();
-
     // 鏇挎崲鍘熸潵鐨� createTime 瀛楁涓烘牸寮忓寲鍚庣殑鏃ユ湡鏃堕棿瀛楃涓�
     item.startTime = formattedDateTime;
   });
-
-
-
-
-
 };
-
 onMounted(() => {
-  initializeWebSocket(socketUrl, handleMessage);
+  socket = initializeWebSocket(socketUrl, handleMessage);
 });
+  onUnmounted(() => {
+    if (socket) {
+    closeWebSocket(socket);
+    }
+    });
 onBeforeUnmount(() => {
   console.log("鍏抽棴浜�");
   closeWebSocket();
 });
-
 const tasktableData = ref([]);
-
 const dialogVisible = ref(false);
 const formData = ref({
   number: "",
@@ -456,11 +434,9 @@
   pieces: "",
   loadRack: 1,
 });
-
 const formData2 = ref({
   dzw: "",
 });
-
 const handleDelete = (row) => {
   // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
   ElMessageBox.confirm("纭畾瑕佹墽琛屽垹闄ゆ搷浣滃悧锛�", "纭鍒犻櫎", {
@@ -470,12 +446,10 @@
   })
     .then(() => {
       // 鐐瑰嚮纭鎸夐挳鐨勫洖璋冿紝鎵ц鍑哄簱鎿嶄綔
-
       const intNumber = {
         id: parseInt(row.number),
       };
       deleteRawUsage(intNumber);
-
       console.log("鎵ц鍒犻櫎鎿嶄綔");
     })
     .catch(() => {
@@ -483,7 +457,6 @@
       console.log("鍙栨秷鍒犻櫎鎿嶄綔");
     });
 };
-
 const handleCheckout = (row) => {
   // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
   ElMessageBox.confirm("纭畾瑕佹墽琛屽嚭搴撴搷浣滃悧锛�", "纭鍑哄簱", {
@@ -505,17 +478,14 @@
       console.log("鍙栨秷鍑哄簱鎿嶄綔");
     });
 };
-
 const handleInbound = () => {
   // 鎵撳紑鍏ュ簱瀵硅瘽妗�
   dialogVisible.value = true;
 };
-
 const storage = () => {
   // 鎵撳紑鍏ュ簱瀵硅瘽妗�
   Hidden.value = true;
 };
-
 const handleCloseDialog = () => {
   // 鍏抽棴瀵硅瘽妗嗘椂閲嶇疆琛ㄥ崟鏁版嵁
   formData.value = {
@@ -528,7 +498,6 @@
   };
   dialogVisible.value = false;
 };
-
 const handleConfirmInbound = () => {
   inStorage(formData.value);
   // 澶勭悊纭鍏ュ簱閫昏緫锛屽彲浠ュ湪杩欓噷鎻愪氦琛ㄥ崟鎴栬�呮墽琛屽叾浠栨搷浣�
@@ -536,7 +505,6 @@
   // 鍏抽棴瀵硅瘽妗�
   dialogVisible.value = false;
 };
-
 const dialogVisible3 = ref(false);
 const colors = ref([
   { "0_glass_id": "Red" },
@@ -544,7 +512,6 @@
   { "0_glass_id": "Blue" },
   // Add more colors as needed
 ]);
-
 const formData3 = ref({
   selectedColor: "",
   wid: "",
@@ -552,7 +519,6 @@
   thinkness: "",
   num: "",
 });
-
 const addglass = () => {
   // 鎵撳紑鍏ュ簱瀵硅瘽妗�
   dialogVisible3.value = true;
@@ -560,17 +526,14 @@
 const handleCommand = (command) => {
   formData.value.selectedColor = command;
 };
-
 const clearInput = (field) => {
   formData.value[field] = "";
 };
-
 const submitForm = () => {
   console.log("鎻愪氦鏁版嵁:", formData.value);
   dialogVisible3.value = false;
   // Add your submit logic here
 };
-
 const editdialogVisible = ref(false);
 const editForm = ref({
   id: "",
@@ -582,7 +545,6 @@
 });
 const editFormRef = ref(null);
 let currentRow = ref(null);
-
 // 澶勭悊琛岀偣鍑讳簨浠�
 const edithandleRowClick = (row) => {
   currentRow.value = row;
@@ -596,11 +558,9 @@
   editdialogVisible.value = true;
   console.log(editForm.value);
 };
-
 // 娣诲姞淇濆瓨缂栬緫鍐呭
 const editsaveEdit = () => {
   if (!currentRow.value) return;
-
   // 鏇存柊褰撳墠琛屾暟鎹�
   currentRow.value.pieces = editForm.value.pieces;
   currentRow.value.batchId = editForm.value.batchId;
@@ -609,11 +569,9 @@
   currentRow.value.rawThickness = editForm.value.rawThickness;
   // 璋冪敤鏇存柊鍑芥暟锛屽苟澶勭悊鍏惰繑鍥炵殑 Promise
   updateRawUsage(editForm.value);
-
   // 鍏抽棴瀵硅瘽妗�
   editdialogVisible.value = false;
 };
-
 // 瀵硅瘽妗嗗叧闂椂閲嶇疆缂栬緫琛ㄥ崟鍜屽綋鍓嶈鏁版嵁
 const edithandleDialogClose = () => {
   editForm.value.pieces = "";
@@ -621,10 +579,8 @@
   editForm.value.rawWidth = "";
   editForm.value.rawHeight = "";
   editForm.value.rawThickness = "";
-
   currentRow.value = null;
 };
-
 const handleRestart = (row) => {
   // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
   ElMessageBox.confirm("纭畾瑕佹墽琛岄噸鏂板紑濮嬫搷浣滃悧锛�", "纭閲嶆柊寮�濮�", {
@@ -638,8 +594,6 @@
         Type:"閲嶆柊寮�濮�"
       }
       taskUpdate(taskdata);
-      
-
       console.log("鎵ц閲嶆柊寮�濮嬫搷浣�", row);
     })
     .catch(() => {
@@ -647,7 +601,6 @@
       console.log("鍙栨秷閲嶆柊寮�濮嬫搷浣�");
     });
 };
-
 const handleDeletetask = (row) => {
   // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
   ElMessageBox.confirm("纭畾瑕佹墽琛屽垹闄や换鍔℃搷浣滃悧锛�", "纭鍒犻櫎浠诲姟", {
@@ -669,7 +622,6 @@
       console.log("鍙栨秷鍒犻櫎浠诲姟鎿嶄綔");
     });
 };
-
 const handleComplete = (row) => {
   // 浣跨敤 Element UI 鐨� MessageBox.confirm 鏂规硶杩涜浜屾纭
   ElMessageBox.confirm("纭畾瑕佹墽琛屼换鍔″畬鎴愭搷浣滃悧锛�", "纭浠诲姟瀹屾垚", {
@@ -678,7 +630,6 @@
     type: "warning",
   })
     .then(() => {
-
       const taskdata={
         id:row.id,
         Type:"瀹屾垚"
@@ -693,7 +644,6 @@
     });
 };
 </script>
-
 <style scoped>
 #dt {
   display: block;
@@ -711,7 +661,6 @@
   text-align: center;
   margin-top: -15px;
 }
-
 .img-ypcc {
   margin-left: 80px;
   background-image: url("../../assets/ypcc.png");
@@ -725,7 +674,6 @@
   position: relative;
   margin-top: 0px;
 }
-
 .img-car1 {
   background-image: url("../../assets/ypccche.png");
   position: absolute;
@@ -738,9 +686,8 @@
   overflow: hidden;
   position: relative;
 }
-
 .custom-dialog {
   max-height: 90vh; /* 鏈�澶ч珮搴︿负瑙嗗彛楂樺害鐨�90% */
   overflow-y: auto; /* 瀵硅瘽妗嗗唴閮ㄥ嚭鐜板瀭鐩存粴鍔ㄦ潯 */
 }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.8.0