From 42d333112ed74032fbf8f2cd60d3cc8f3b4a0a08 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期四, 03 四月 2025 08:48:00 +0800
Subject: [PATCH] 更新看板

---
 UI-Project/src/views/MechanicalArm/mechanicalArm.vue |  215 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 173 insertions(+), 42 deletions(-)

diff --git a/UI-Project/src/views/MechanicalArm/mechanicalArm.vue b/UI-Project/src/views/MechanicalArm/mechanicalArm.vue
index 7515a9a..b3dd11f 100644
--- a/UI-Project/src/views/MechanicalArm/mechanicalArm.vue
+++ b/UI-Project/src/views/MechanicalArm/mechanicalArm.vue
@@ -2,7 +2,7 @@
 <script setup>
 import request from "@/utils/request";
 import { ElMessage, ElMessageBox } from "element-plus";
-import { computed,reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue'
+import { computed, reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue'
 import { useI18n } from 'vue-i18n'
 import { WebSocketHost, host } from '@/utils/constants'
 import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
@@ -13,6 +13,8 @@
   password: '',
 });
 const blind = ref(false)
+const blindMode = ref(false)
+const blindModeNumberLocal = ref('')
 const errorInfo = ref(true)
 const loadData = ref([]);
 const findMachine = ref([]);
@@ -21,7 +23,12 @@
 const findPrimitiveTask = ref([]);
 const scanCodeOld = ref([]);
 const searchs = ref();
-const machineId = 2;//褰撳墠椤甸潰鐨勮澶嘔D
+
+const userInfo=JSON.parse(window.localStorage.getItem('userInfo'));
+const pageParams=userInfo.user.menus[0].pages[0].params;
+const pageParamsJson=JSON.parse(pageParams);
+const machineId = pageParamsJson.machineId;//褰撳墠椤甸潰鐨勮澶嘔D
+console.log(machineId);
 var errorScanId;
 //浣跨敤WebSocket鏂瑰紡灞曠ず鏁版嵁
 let socket = null;
@@ -29,12 +36,33 @@
 const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/loadTask`;
 const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`;
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
+
+
+
 const handleMessage = (data) => {
   // 鏇存柊 tableData 鐨勬暟鎹�
-  loadData.value = data.findPrimitiveTasking[0];
-  findPrimitiveTask.value = data.findPrimitiveTask[0];
-  findMachine.value = data.machine[0];
-  sendRecords.value = data.sendRecords[0].reverse();
+  let dataJson = data[""+machineId][0];
+
+  loadData.value = dataJson.findPrimitiveTasking[0];
+  findPrimitiveTask.value = dataJson.findPrimitiveTask[0];
+  findMachine.value = dataJson.machine[0];
+  if(findMachine.value.mode=="1"){
+    modevalue.value = {
+    value: '1',
+    label: '鏍囧噯',
+  };
+  }else if(findMachine.value.mode=="2"){
+    modevalue.value = {
+      value: '2',
+      label: '瀹氬埗',
+    };
+  }else if(findMachine.value.mode=="3"){
+    modevalue.value = {
+      value: '3',
+      label: '鎵嬪姩',
+    };
+  }
+  //sendRecords.value = data.sendRecords[0].reverse();
 };
 // 瀹氫箟娑堟伅澶勭悊鍑芥暟锛屾洿鏂� receivedData 鍙橀噺
 const handleMessage2 = (data) => {
@@ -62,7 +90,7 @@
 });
 //鎶ヨ鎻愮ず
 const errorInfoFuntion = async (info) => {
-  let infoScancode='鎵爜ID锛�'+info.scanId+'  '+info.scanCode;
+  let infoScancode = '鎵爜ID锛�' + info.scanId + '  ' + info.scanCode;
   ElMessageBox.confirm(
     infoScancode,
     t('delivery.prompt'),
@@ -262,10 +290,10 @@
     })
 }
 const topLineShow = async () => {
-  blind.value = true; 
+  blind.value = true;
 }
 //棰嗗彇浠诲姟/缁撴潫浠诲姟
-const startOrStopTask = async (row,line,isWorking) => {
+const startOrStopTask = async (row, line, isWorking) => {
   ElMessageBox.confirm(
     t('functionState.tips'),
     t('delivery.prompt'),
@@ -285,7 +313,8 @@
         }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
           if (res.code === 200) {
             ElMessage.success(res.message);
-          } else {n
+          } else {
+            n
             ElMessage.warning(res.message)
           }
         })
@@ -297,34 +326,97 @@
       })
     })
 }
-const handleDialogClose = () => {  
-    
-}
+const handleDialogClose = () => {
 
+}
 
 const fetchData = async () => {
   //鎵爜鍥炶溅鎻愪氦
-  alert(searchs.value);
-  searchs.value="";
+  //alert(searchs.value);
+  searchs.value = "";
 }
+
 const filterTableData = computed(() =>
   loadData.value.filter(
     (data) =>
-      !searchs.value ||data.scanId.toLowerCase().includes(searchs.value.toLowerCase())
+      !searchs.value || data.scanId.toLowerCase().includes(searchs.value.toLowerCase())
   )
 )
+
+//涓嬫媺妗嗘ā寮忛�夋嫨
+const modevalue = ref('')
+
+const options = [
+  {
+    value: '1',
+    label: '鏍囧噯',
+  },
+  {
+    value: '2',
+    label: '瀹氬埗',
+  },
+  {
+    value: '3',
+    label: '鎵嬪姩',
+  }
+]
+
+const modeShow = async () => {
+  blindMode.value = true;
+  blindModeNumberLocal.value=findMachine.taskCount;
+}
+//妯″紡閫夋嫨鏃惰繘琛屽鐞�
+const modeChange = async () => {
+  let mode=modevalue.value;
+  request.post("/deviceInteraction/machine/toggleModeMachine",
+        {
+          "id": machineId,
+          "mode": mode
+        }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
+          if (res.code === 200) {
+            ElMessage.success(res.message);
+          } else {
+            ElMessage.warning(res.message)
+          }
+        })
+  if(modevalue.value=='3'){
+    //褰撴槸鎵嬪姩妯″紡鏃跺脊绐楁彁绀� 璁剧疆涓婄墖鏁伴噺
+    blindMode.value = true;
+  }
+  
+}
+
+//鎻愪氦淇敼鎵嬪姩妯″紡鐨勫惛鐗囨暟閲�
+const fetchSubmit = async () => {
+  //鎵爜鍥炶溅鎻愪氦
+  request.post("/deviceInteraction/machine/manualOperationTask",
+        {
+          "id": machineId,
+          "taskCount": blindModeNumberLocal.value,
+          "finshCount": 0
+        }).then((res) => { // 鏇挎崲涓轰綘鐨凙PI绔偣  
+          if (res.code === 200) {
+            ElMessage.success(res.message);
+          } else {
+            ElMessage.warning(res.message)
+          }
+        })
+        blindMode.value = false;
+}
 </script>
 <template>
   <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.mechanicalArm') }}
     </div>
-    <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose">
-        <!-- 鏈鍙栫殑鏍囧噯浠诲姟 -->
-         
-      <el-table :data="findPrimitiveTask" stripe style="height:260px" :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }">
+    <el-dialog v-model="blind" top="10vh" style="text-align: center;width:1400px ;" @close="handleDialogClose">
+      <!-- 鏈鍙栫殑鏍囧噯浠诲姟 -->
+
+      <el-table :data="findPrimitiveTask" stripe style="height:660px"
+        :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="$t('glassInfo.number')" min-width="30" />
         <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" />
         <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" />
@@ -337,27 +429,53 @@
         <el-table-column prop="workState" :label="$t('glassInfo.workState')" />
         <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70">
           <template #default="scope">
-            <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row,2,1)">{{
+            <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, 2, 1)">{{
               $t('functionState.getTask') }}</el-button>
           </template>
         </el-table-column>
       </el-table>
     </el-dialog>
+
+    <el-dialog v-model="blindMode" top="30vh" style="text-align: center;width: 600px;" @close="handleDialogClose">
+      <!-- 鎵嬪姩妯″紡杈撳叆鏁伴噺 -->
+      <div style="text-align: none;font-size: 20px;margin-bottom: 20px;">
+        鎵嬪姩杈撳叆妯″紡
+      </div>
+      <div>
+        鎵嬪姩杈撳叆涓婄墖鏁伴噺锛�
+        <el-input v-model="blindModeNumberLocal" style="width: 200px;" type="Number" id="blindMode" @keyup.enter="fetchSubmit"></el-input>
+        
+      </div>
+      <!-- <div>
+        <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, 2, 2)">纭</el-button>
+        <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, 2, 2)">鍙栨秷</el-button>
+      </div> -->
+    </el-dialog>
     <hr />
     <br>
     <div id="search">
       <!-- 鍔熻兘 -->
-      
+
+      <div class="flex flex-wrap gap-4 items-center">
+        涓婄墖鏈鸿繍琛屾ā寮�:
+        <el-select v-model="modevalue" @change="modeChange" placeholder="璇烽�夋嫨妯″紡" size="large" style="width: 220px">
+          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
+        </el-select>
+        
+        <span>
+          <span @click="modeShow" style="margin-left: 40px;">{{ findMachine.mode=="3"? ("涓婄墖鏁伴噺锛�"+findMachine.taskCount):"" }}</span>
+          <span style="margin-left: 40px;">{{ findMachine.mode=="3"? ("宸插畬鎴愭暟閲忥細"+findMachine.finshCount):"" }}</span>
+        </span>
+        
+        
+      </div>
+      <br>
       <el-button :type="(findMachine['state'] == '鏆傚仠' ? 'danger' : 'success')" id="ButtonMachineStatus"
         @click="machineStatus((findMachine['state'] == '鏆傚仠' ? '寮�宸�' : '鏆傚仠'))">{{ findMachine['state'] == '寮�宸�' ?
-          $t('functionState.start') : $t('functionState.stop') }}</el-button>
+        $t('functionState.start') : $t('functionState.stop') }}</el-button>
       <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.getTask') }}</el-button>
-
-      <el-button :type="(findMachine['mode'] == '瀹氬埗' ? 'danger' : 'success')" id="ButtonMachineMode"
-        @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ?
-         $t('functionState.modeD') : $t('functionState.modeB') }}</el-button>
     </div>
-    
+
     <div id="main-body" style="min-height:240px;">
       <!-- 琛ㄦ牸鍐呭 -->
       <el-table :data="filterTableData" stripe style="height:260px"
@@ -368,15 +486,26 @@
         <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
         <el-table-column prop="batchNumber" sortable :label="$t('glassInfo.batchNumber')" />
         <el-table-column prop="taskType" sortable :label="$t('glassInfo.taskType')" />
-        <el-table-column prop="scanId" sortable :label="$t('glassInfo.scanId')" >
-        <template #header>
+        <el-table-column prop="scanId" :label="$t('glassInfo.scanId')">
+          <template #header>
             <div>
-              <div>{{ $t('glassInfo.taskType') }}
-                <el-icon @click="fetchData"><CaretTop /></el-icon>
-                <el-icon @click="fetchData"><CaretBottom /></el-icon>
-                <el-icon color="#409efc"><Filter /></el-icon>
-              </div>
-              <el-input v-model="searchs" type="primary" id="ReportSubmission" @keyup.enter="fetchData"></el-input>
+              <span>{{ $t('glassInfo.scanId') }}</span>
+              <span style="margin-left:10px ;"></span>
+              <el-popover placement="bottom" title="绛涢��" :width="200" trigger="click">
+                <el-input v-model="searchs" type="primary" id="ReportSubmission" @keyup.enter="fetchData"></el-input>
+                <template #reference>
+                  <el-icon>
+                    <Filter />
+                  </el-icon>
+                </template>
+              </el-popover>
+              <el-icon>
+                <CaretTop />
+              </el-icon>
+              <el-icon>
+                <CaretBottom />
+              </el-icon>
+              <!-- <el-input v-model="searchs" type="primary" id="ReportSubmission" @keyup.enter="fetchData"></el-input> -->
               <!-- <el-input size="small" placeholder="Type to search" /> -->
             </div>
           </template>
@@ -388,7 +517,7 @@
         <el-table-column prop="isWorking" sortable :label="$t('glassInfo.isWorking')" />
         <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="startOrStopTask(scope.row,2,2)">{{
+            <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, 2, 2)">{{
               $t('functionState.stopTask') }}</el-button>
           </template>
         </el-table-column>
@@ -396,7 +525,8 @@
     </div>
 
     <div id="main-body" style="width: 100%; height: 460px;min-width: 1200px;">
-      <el-image style="width: 70%;min-width: 900px; height: 460px;float: left;" src="../../src/assets/鎵爜璇嗗埆.png"></el-image>
+      <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> -->
@@ -442,11 +572,12 @@
   border: none;
   cursor: pointer;
 }
+
 .dotClass {
-  width:10px;
-  height:10px;
+  width: 10px;
+  height: 10px;
   border-radius: 50%;
   display: block;
-  margin-left: 10px; 
+  margin-left: 10px;
 }
 </style>
\ No newline at end of file

--
Gitblit v1.8.0