From 65ce957a82e047fe8327bcc1a290234da1d3ca29 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期六, 14 九月 2024 09:53:20 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/JiuMuMES

---
 UI-Project/src/views/Marking/marking.vue |  108 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 90 insertions(+), 18 deletions(-)

diff --git a/UI-Project/src/views/Marking/marking.vue b/UI-Project/src/views/Marking/marking.vue
index b561b18..dfe1156 100644
--- a/UI-Project/src/views/Marking/marking.vue
+++ b/UI-Project/src/views/Marking/marking.vue
@@ -10,20 +10,36 @@
   account: '',
   password: '',
 });
-const findCraftTaskingData = ref([]);
+const loadData = ref([]);
+const findMachine = ref([]);
 
 onMounted(async () => {
   load();
 });
 //鑾峰彇鏁版嵁
 const load = async() => {
+  //鑾峰彇璁惧浠诲姟鏁版嵁
   try {
     const response = await request.post('/deviceInteraction/tasking/findMachineTask',
     {
       "id": 11
     }); // 鏇挎崲涓轰綘鐨凙PI绔偣  
     if (response.code === 200) {
-      findCraftTaskingData.value= response.data;
+      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)
     }
@@ -76,15 +92,7 @@
 }
 
 //寮�宸�/鏆傚仠
-const machineStatus = async(row,state) => {
-
-}
-//鐮存崯
-const damagedTask = async(row) => {
-
-}
-//涓嬬嚎(鎷胯蛋)
-const downLine = async(row,state) => {
+const machineStatus = async(state) => {
   ElMessageBox.confirm(
         t('marking.tips'),
         t('delivery.prompt'),  
@@ -96,10 +104,74 @@
       )
         .then(() => {
           //涓嬬嚎鎺ュ彛
-          request.post("/deviceInteraction/tasking/updateDownLine",
+          request.post("/deviceInteraction/machine/updateMachineState",
+            {
+              "id": 11,
+              "state": state
+            }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
+              if (res.code === 200) {
+                ElMessage.success(res.message);
+                this.load();
+              } else {
+                ElMessage.warning(res.message)
+              }
+            })
+        })
+        .catch(() => {
+          ElMessage({
+            type: 'info',
+            message: t('marking.cancel'),
+          })
+        })
+}
+//鐮存崯
+const damagedTask = async(row) => {
+  ElMessageBox.confirm(
+        t('marking.tips'),
+        t('delivery.prompt'),  
+        {
+          confirmButtonText: t('marking.sure'),
+          cancelButtonText: t('marking.cancel'),
+          type: 'warning',
+        }
+      )
+        .then(() => {
+          //涓嬬嚎鎺ュ彛
+          request.post("/deviceInteraction/tasking/damagedTask",
+            {
+              "glassId": row.glassId
+            }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
+              if (res.code === 200) {
+                ElMessage.success(res.message);
+                this.load();
+              } else {
+                ElMessage.warning(res.message)
+              }
+            })
+        })
+        .catch(() => {
+          ElMessage({
+            type: 'info',
+            message: t('marking.cancel'),
+          })
+        })
+}
+//涓嬬嚎(鎷胯蛋)
+const glassDownLine = async(row) => {
+  ElMessageBox.confirm(
+        t('marking.tips'),
+        t('delivery.prompt'),  
+        {
+          confirmButtonText: t('marking.sure'),
+          cancelButtonText: t('marking.cancel'),
+          type: 'warning',
+        }
+      )
+        .then(() => {
+          //涓嬬嚎鎺ュ彛
+          request.post("/deviceInteraction/tasking/glassDownLine",
             {
               "glassId": row.glassId,
-              "state": state
             }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
               if (res.code === 200) {
                 ElMessage.success(res.message);
@@ -131,15 +203,15 @@
     <br>
     <div id="search" style="padding-left: 20px;">
       <!-- 鍔熻兘 -->
-      <el-button type="primary" id="searchButton" @click="machineStatus">寮�宸�</el-button>
-      <el-button type="primary" id="searchButton" @click="topLine">涓婄嚎</el-button>
+      <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="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;">
       <!-- 琛ㄦ牸鍐呭 -->
-      <el-table :data="findCraftTaskingData" stripe
+      <el-table :data="loadData.findTaskingData" stripe
         :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
         :cell-style="{ textAlign: 'center' }">
         <!-- <el-table-column type="selection" min-width="30" /> -->
@@ -155,8 +227,8 @@
           <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="workStatus(scope.row, '鐮存崯')">鐮存崯</el-button>
-            <el-button size="mini" link type="primary" plain @click="downLine(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>
           </template>
         </el-table-column>
       </el-table>

--
Gitblit v1.8.0