From 9594a89ebd00d2fc7f258de41359b66aa82b8cd2 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Sat, 19 Apr 2025 15:39:06 +0800
Subject: [PATCH] feat: 完成率改成完结率

---
 src/views/SignMachineNest/MachineRight/InspectionRaskList.vue |   89 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
index def807b..0f3114e 100644
--- a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
+++ b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
@@ -22,7 +22,7 @@
         :infinite-scroll-disabled="busy"
         infinite-scroll-immediate="true">>
         <div class="item" v-for="(item,index) in tableList">
-          <div class="left">
+          <div class="left" @click="taskClick(item)">
             <div class="left-t">
               <span>{{ index+1 }}.</span>{{ item.name }}
               <span class="status" :class="item.status===2?'active':''">
@@ -34,8 +34,13 @@
               <img src="../../../assets/images/signMachineNest/machineRight/name.png" alt="" />{{ item.creator_name || '' }}
             </div>
           </div>
-          <div class="right">
-            <img src="../../../assets/images/signMachineNest/machineRight/return.png" alt="">
+          <div class="right" v-if="tabIndex===1" @click="reExecute(item.dock_sn)">
+            <span>立即返航</span>
+            <img src="../../../assets/images/signMachineNest/machineRight/return-fly.png" alt="">
+          </div>
+          <div class="right" v-else @click="returnImmediately(item.job_id)">
+            <span>再次执行</span>
+            <img src="../../../assets/images/signMachineNest/machineRight/return-fly.png" alt="">
           </div>
         </div>
       </div>
@@ -46,12 +51,36 @@
       </el-empty>
     </div>
   </div>
+  <!-- 当前任务详情 -->
+  <CurrentTaskDetails
+		v-if="isShowCurrentTaskDetails"
+		v-model:show="isShowCurrentTaskDetails"
+		:id="currentInfoId"/>
+	<!-- 历史任务详情 -->
+  <DeviceJobDetails
+		v-if="isShowDeviceJobDetails"
+		v-model:show="isShowDeviceJobDetails"
+		:wayLineJodInfoId="wayLineJodInfoId"/>
 </template>
 
 <script setup>
 import { Search } from '@element-plus/icons-vue';
+import { ElMessage } from 'element-plus';
 import CommonTitle from '@/components/CommonTitle.vue';
-import { getBeforeJob, getTodayJob } from '@/api/home'
+import CurrentTaskDetails from '@/components/CurrentTaskDetails/CurrentTaskDetails.vue';
+import DeviceJobDetails from '@/components/DeviceJobDetails/DeviceJobDetails.vue'
+import { getBeforeJob, getTodayJob, flyByJobId, returnHome } from '@/api/home';
+import { useStore } from 'vuex';
+
+const store = useStore();
+// 设备任务详情
+let currentInfoId = ref('');
+let isShowCurrentTaskDetails = ref(false);
+let wayLineJodInfoId = ref('');
+let isShowDeviceJobDetails = ref(false);
+
+// 单个机巢信息
+const singleUavHome = computed(() => store.state.home.singleUavHome);
 
 const isMore = ref(true);
 // 控制加载状态
@@ -96,7 +125,7 @@
 const getJobList = async () => {
   const params = {
     area_code: '',
-    device_sn: '',
+    device_sn: singleUavHome.value.device_sn,
     job_name: searchText.value,
     current: pageParams.value.current,
     size: pageParams.value.size,
@@ -132,6 +161,41 @@
 // 搜索数据
 const searchNickName = () => {
   clearData();
+};
+
+// 立即返航
+const returnImmediately = (id) => {
+  flyByJobId(id).then(result => {
+    if (result.data.code === 0) {
+      ElMessage.success('执行成功');
+    } else {
+      ElMessage.error(result.data.message);
+    }
+  });
+};
+// 重新执行
+const reExecute = (dock_sn) => {
+  returnHome(dock_sn).then(result => {
+    if (result.data.code === 0) {
+      ElMessage.success('返航成功');
+    } else {
+      ElMessage.error(result.data.message);
+    }
+  });
+};
+
+// 点击当前任务显示当前任务详情
+const taskClick = (item) => {
+  if (tabIndex.value === 1) {
+    // 展示当前任务详情
+    currentInfoId.value = item.wayline_job_info_id;
+    isShowCurrentTaskDetails.value = true;
+  } else {
+    // 展示历史任务详情
+    wayLineJodInfoId.value = item.wayline_job_info_id;
+    isShowDeviceJobDetails.value = true;
+  }
+  
 };
 
 onMounted(() => {
@@ -220,7 +284,9 @@
         color: #fff;
         display: flex;
         justify-content: space-between;
+        background: linear-gradient( 90deg, rgba(71,157,255,0) 0%, rgba(71, 157, 255, 0.12) 50%, rgba(71,157,255,0) 100%);
         .left {
+          cursor: pointer;
           .left-t {
             height: 24px;
             font-size: 16px;
@@ -256,6 +322,19 @@
           }
         }
         .right {
+          cursor: pointer;
+          position: relative;
+          span {
+            position: absolute;
+            display: inline-block;
+            top: 12px;
+            left: 12px;
+            width: 26px;
+            line-height: 12px;
+            font-size: 12px;
+            font-family: YouSheBiaoTiHei, YouSheBiaoTiHei, serif;
+            color: rgb(4,18,44)
+          }
           img {
             width: 46px;
             height: 46px

--
Gitblit v1.9.3