From 9b2e6042369b61ef267c1e42ae1f3c6b324c27d0 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 19 六月 2024 08:12:31 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes

---
 UI-Project/src/views/Returns/returns.vue |   86 ++++++++++++++++++++++++++++++------------
 1 files changed, 61 insertions(+), 25 deletions(-)

diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue
index 7f8942c..f1b1f89 100644
--- a/UI-Project/src/views/Returns/returns.vue
+++ b/UI-Project/src/views/Returns/returns.vue
@@ -13,7 +13,7 @@
 const adda = ref(false)
 const flake = ref(false)
 const flakea = ref(false)
-import { WebSocketHost } from '@/utils/constants'
+import { WebSocketHost ,host} from '@/utils/constants'
 import request from "@/utils/request"
 const ida = ref(null); 
 import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
@@ -25,9 +25,9 @@
 const selectedValuea = ref('');  
 const selectedValueb = ref('');
 const selectedValuec = ref(''); 
-const upstatus = ref(''); // 鍋囪杩欎釜鐢ㄤ簬鏄剧ず鑷姩/鎵嬪姩鐘舵��  
+const upstatus = ref('涓婄墖鏈烘墜鍔ㄧ姸鎬侊細'); // 鍋囪杩欎釜鐢ㄤ簬鏄剧ず鑷姩/鎵嬪姩鐘舵��  
 const cuttingMachine = ref(''); // 鍋囪杩欎釜鐢ㄤ簬瀛樺偍鍚庣杩斿洖鐨勭姸鎬佸�硷紙0鎴�1锛�  
-const cuttingMachineStatusColor = ref(''); // 鐢ㄤ簬鍔ㄦ�佽缃甶鏍囩鐨勮儗鏅壊 
+const cuttingMachineStatusColor = ref('#911005'); // 鐢ㄤ簬鍔ㄦ�佽缃甶鏍囩鐨勮儗鏅壊 
 const inKageWord = ref(0); // 鐢ㄤ簬瀛樺偍瑕佷紶閫掔粰鎺ュ彛鐨刬nKageWord鍊� 
 const options = ref<any[]>([]); // 涓嬫媺閫夐」鍒楄〃  
 const selectOptions = ref<Array<any>>([]); // 涓嬫媺閫夐�夐」鏁扮粍  
@@ -68,7 +68,7 @@
       label: thickness,  
     })); 
     } else {
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
     }
   } catch (error) {
     // 澶勭悊璇锋眰澶辫触鐨勬儏鍐�
@@ -91,7 +91,7 @@
       flakea.value = true
     }
           } else {
-          ElMessage.warning(res.msg)
+          ElMessage.warning(res.message)
           // router.push("/login")
           }
           });
@@ -102,7 +102,7 @@
 const titleSelectJsona = ref({
   processTypea: [],
 })
-const socketUrl = `ws://${WebSocketHost}:88/api/loadGlass/api/talk/loadGlass`;
+const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`;
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
 const handleMessage = (data) => {
   // 鏇存柊 tableData 鐨勬暟鎹�
@@ -210,7 +210,7 @@
     }
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
     }
   } catch (error) {  
       // 澶勭悊璇锋眰閿欒  
@@ -249,7 +249,7 @@
     }
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
     }
   } catch (error) {  
       // 澶勭悊璇锋眰閿欒  
@@ -291,7 +291,7 @@
     }
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
     }
   } catch (error) {
     // 澶勭悊閿欒
@@ -337,7 +337,8 @@
     })); 
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
+      // ElMessage.error(response.msg);
     }
 }
 catch (error) {
@@ -362,10 +363,10 @@
       ElMessage.success(response.message);
       // window.location.reload() 
       blind.value = false;
-      selectedProjectNoa.value = ''
+      selectedProjectNoa.value = '';
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
     }
 }
 catch (error) {
@@ -390,10 +391,10 @@
     if (response.code == 200) {
       ElMessage.success(response.message);
       blinda.value = false;
-      tableData.splice([]);
+      // tableData.splice([]);
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
     }
   }
     else  {
@@ -426,7 +427,7 @@
       tableData.splice([]);
 
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-      ElMessage.error(response.msg);
+      ElMessage.error(response.message);
     }
   }
     else  {
@@ -494,10 +495,31 @@
 const confirmCuttingMachine = () => {  
   cuttingMachineStatus.value = 'green';  
 }; 
+const toggleEnableState = async (row: any) => {  
+  // 妫�鏌� id 鏄惁涓虹┖  
+  if (!row.id) {  
+    ElMessage.error('璇ュ伐绋嬫湭淇濆瓨鍒颁笂鐗囪〃锛�');  
+    return; // 濡傛灉 id 涓虹┖锛屽垯涓嶆墽琛屽悗缁搷浣�  
+  }  
+  
+  const newState = row.state === 100 ? 0 : 100;  
+  
+  try {  
+    // 鍙戦�佽姹傚埌鍚庣鏇存柊鐘舵��  
+    const response = await request.post('/loadGlass/up-patten-usage/updateGlassState', { id: row.id, state: newState });  
+    if (response.code === 200) {  
+      ElMessage.success(response.message);  
+    } else {  
+      ElMessage.error(response.message);  
+    }  
+  } catch (error) {  
+    // 澶勭悊璇锋眰閿欒  
+    console.error('鏇存柊鐜荤拑鐘舵�佽姹傚け璐�:', error);  
+    ElMessage.error('鏇存柊鐜荤拑鐘舵�佹椂鍙戠敓閿欒');  
+  }  
+};  
 
-
-
-const wsUrl = `ws://${WebSocketHost}:88/api/loadGlass/api/talk/loadGlass`;
+const wsUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`;
 const ws = new WebSocket(wsUrl);  
 ws.onopen = () => {  
   console.log('WebSocket杩炴帴宸叉墦寮�');  
@@ -526,7 +548,7 @@
       const status = data.InkageStatus[0]; 
       cuttingMachine.value = status; 
       upstatus.value = status === '1' ? '涓婄墖鏈鸿仈鏈虹姸鎬侊細' : '涓婄墖鏈烘墜鍔ㄧ姸鎬侊細';
-      cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';  
+      cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005';  
       inKageWord.value = status === '1' ? 0 : 1;  
     } else {  
       // 澶勭悊閿欒鎯呭喌鎴栨棤鏁堟暟鎹�  
@@ -544,7 +566,7 @@
     if (response.code == 200) {  
       const status = response.data.status; 
       upstatus.value = status === '1' ? '涓婄墖鏈鸿仈鏈虹姸鎬侊細' : '涓婄墖鏈烘墜鍔ㄧ姸鎬侊細';  
-      cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';  
+      cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005';  
       // 鏄剧ず鎴愬姛娑堟伅  
       ElMessage.success(response.message);  
     } else {  
@@ -569,13 +591,13 @@
     <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >纭</el-button>
     <div style="margin-left: 70px;">{{ upstatus  }} </div>
     <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatusColor, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i>  
-    <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >纭</el-button>
+    <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >鍒囨崲</el-button>
    
   </div>
     <el-button style="margin-top: 5px;margin-left: 15px;"   id="searchButton" type="primary" @click="dialogFormVisible = true">閫夋嫨宸ョ▼</el-button>
     <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">寮�濮嬩笂鐗�</el-button>
     <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="warning" @click="handleBinda">鏆傚仠</el-button>
-    <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="danger" @click="handleBindb">鍋滄浠诲姟</el-button>
+    <!-- <el-button style="margin-top: 5px;margin-left: 20px;"  id="searchButton" type="danger" @click="handleBindb">鍋滄浠诲姟</el-button> -->
     
     <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
       <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
@@ -591,7 +613,7 @@
       <el-table-column prop="filmsId" label="鑶滅郴" align="center"/>
       <el-table-column prop="layoutSequence" label="鏁伴噺" align="center"/>
       <el-table-column prop="thickness" label="鍘氬害" align="center"/>
-      <el-table-column
+      <!-- <el-table-column
             align="center"
             label="鐘舵��"
             min-width="80"
@@ -601,7 +623,21 @@
         <el-tag :type="getStatusType(scope.row.state)">  
           {{ getStatusText(scope.row.state) }}  
         </el-tag>  
-      </template> 
+      </template>  -->
+      <el-table-column
+          align="center"
+            label="鍚敤鐘舵��"
+            min-width="80"
+            prop="state"
+          >
+          <template #default="scope">  
+          <el-tag  
+            :type="scope.row.state === 100 ? 'success' : 'warning'"  
+            @click="toggleEnableState(scope.row)"  
+          >  
+            {{ scope.row.state === 100 ? '閫氳繃' : '绛夊緟涓�' }}  
+          </el-tag>  
+        </template> 
           </el-table-column>
     </el-table>
       </div>
@@ -759,7 +795,7 @@
               <div id="dt" style="font-size: 15px;">
         <div>
               <el-form-item label="鏁伴噺锛�" :required="true" style="width: 14vw;">
-                <el-input  v-model="number" autocomplete="off" />
+                <el-input placeholder="璇疯緭鍏ユ暟閲�" v-model="number" autocomplete="off" />
               </el-form-item></div></div>
           </el-col>
         </el-row>

--
Gitblit v1.8.0