From eea9f3f7b76d4e6bb8e79e8d0e07ffe9d4b66b5c Mon Sep 17 00:00:00 2001
From: wang <3597712270@qq.com>
Date: 星期二, 21 五月 2024 14:24:57 +0800
Subject: [PATCH] 调整上片机刷新方式,新增磨边(冷加工)界面

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

diff --git a/UI-Project/src/views/Returns/returns.vue b/UI-Project/src/views/Returns/returns.vue
index c917ca0..1bf0404 100644
--- a/UI-Project/src/views/Returns/returns.vue
+++ b/UI-Project/src/views/Returns/returns.vue
@@ -14,6 +14,7 @@
 const adda = ref(false)
 const flake = ref(false)
 const flakea = ref(false)
+const state = reactive({updateKey: 0})
 // const value = ref('')
 import request from "@/utils/request"
 const ida = ref(null); 
@@ -244,8 +245,9 @@
     if (response.code == 200) {
       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
       ElMessage.success(response.message);
-      window.location.reload() 
+      // window.location.reload() 
       add.value = false;
+     tableDataa.value = response.data;
       window.localStorage.setItem('workstationId', response.data.workstationId)
       let workstationId = window.localStorage.getItem('workstationId')
       if (workstationId == '1') {
@@ -277,8 +279,9 @@
     if (response.code == 200) {
       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
       ElMessage.success(response.message);
-      window.location.reload() 
+      // window.location.reload() 
       add.value = false;
+     tableDataa.value = response.data;
       window.localStorage.setItem('workstationId', response.data.workstationId)
       let workstationId = window.localStorage.getItem('workstationId')
       if (workstationId == '1') {
@@ -320,6 +323,7 @@
       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
       ElMessage.success(response.message);
       adda.value = false;
+     tableDataa.value = response.data;
       window.localStorage.setItem('workstationId', response.data.workstationId)
       let workstationId = window.localStorage.getItem('workstationId')
       if (workstationId == '1') {
@@ -345,7 +349,7 @@
     if (response.code == 200) {
       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
       ElMessage.success(response.message);
-      window.location.reload() 
+      // window.location.reload() 
       dialogFormVisible.value = false;
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
@@ -367,8 +371,10 @@
     if (response.code == 200) {
       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
       ElMessage.success(response.message);
-      window.location.reload() 
+      // window.location.reload() 
       blind.value = false;
+      tableData.splice(0, tableData.length, ...response.data);
+      
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
       ElMessage.error(response.msg);
@@ -379,36 +385,6 @@
     console.error(error);
   }
 }
-// const handle = async () => {
-//   try  {
-//   let engineeringId = window.localStorage.getItem('engineeringId')
-// console.log(engineeringId);
-// if (engineeringId !== '') {
-//   const response = await request.post('/loadGlass/engineering/engineering/changeTask', {
-//       engineeringId: engineerId.va,
-//       state: 1,
-//     })
-//     if (response.code == 200) {
-//       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
-//       ElMessage.success(response.message);
-//       blind.value = false;
-//     } else {
-//       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
-//       ElMessage.error(response.msg);
-//     }
-//   }
-//     else  {
-//       ElMessage({
-//         type: 'info',
-//         message: '宸ョ▼鍙蜂笉鑳戒负绌猴紒',
-//       })
-//     }
-// }
-// catch (error) {
-//     // 澶勭悊閿欒
-//     console.error(error);
-//   }
-// }
 // 鏆傚仠
 const handlea = async () => {
   try  {
@@ -422,8 +398,11 @@
     if (response.code == 200) {
       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
       ElMessage.success(response.message);
-      window.location.reload() 
+      // window.location.reload() 
       blinda.value = false;
+      // tableData.value = response.data
+      // tableData.value = [];
+      state.updateKey ++
     } else {
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
       ElMessage.error(response.msg);
@@ -454,9 +433,10 @@
     if (response.code == 200) {
       // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
       ElMessage.success(response.message);
-      window.location.reload() 
+      // window.location.reload() 
       blindb.value = false;
-    } else {
+      state.updateKey ++
+
       // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
       ElMessage.error(response.msg);
     }
@@ -474,11 +454,12 @@
   }
 }
 onMounted(fetchTableData);
-function getStatusText(state: number) {  
-  switch (state) {  
+function getStatusText(state: number) {
+  switch (state) {
     case 0:  
       return '绛夊緟涓�';  
     case 1:  
+      return '涓婄墖涓�';  
     case 2:  
       return '涓婄墖涓�';  
     case 100:  
@@ -596,7 +577,7 @@
     <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;">
+      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;" :key="state.updateKey">
     <el-table
     height="150"
      ref="table" 

--
Gitblit v1.8.0