From 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 21 Apr 2025 18:29:09 +0800
Subject: [PATCH] fix: 天气显示

---
 src/views/SignMachineNest/MachineRight/InspectionRaskList.vue |  191 ++++++++++++-----------------------------------
 1 files changed, 49 insertions(+), 142 deletions(-)

diff --git a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
index a93548d..8e3384d 100644
--- a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
+++ b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
@@ -9,7 +9,7 @@
 					<div :class="tabIndex === 2 ? 'active' : ''" @click="tabClick(2)">历史任务</div>
 				</div>
 				<div class="search-box">
-					<el-input v-model="searchText" placeholder="请输入搜索内容" class="input-with-select">
+					<el-input v-model="searchText" placeholder="请输入关键字" class="input-with-select">
 						<template #append>
 							<el-button :icon="Search" @click="searchNickName" />
 						</template>
@@ -24,15 +24,14 @@
 				:infinite-scroll-disabled="busy"
 				infinite-scroll-immediate="true"
 			>
-				>
 				<div class="item" v-for="(item, index) in tableList">
 					<div class="left" @click="taskClick(item)">
 						<div class="left-t">
-							<span>{{ index + 1 }}.</span>
-							{{ item.name }}
-							<span class="status" :class="item.status === 2 ? 'active' : ''">
+							<div>{{ index + 1 }}.</div>
+							<div class="t-name">{{item.name}}</div>
+							<div class="status" :class="item.status === 2 ? 'active' : ''">
 								{{ getStatusText(item.status) }}
-							</span>
+							</div>
 						</div>
 						<div class="left-b">
 							<img src="../../../assets/images/signMachineNest/machineRight/date.png" alt="" />
@@ -78,13 +77,11 @@
 import { useStore } from 'vuex'
 import { useTaskWayline } from '@/hooks/useTaskWayline/useTaskWayline'
 import { useTaskDetails } from '@/hooks/useTaskDetails/useTaskDetails'
-import { useTaskViewInfo } from '@/hooks/useTaskViewInfo/useTaskViewInfo'
 import { useDroneWS } from '@/hooks/useDroneWS'
 let viewer = null
 
 let { taskDetails, workspace_id, getTaskDetails } = useTaskDetails()
-let { wsInfo, removeWS } = useDroneWS(workspace_id) //ws信息,是一个ref对象
-
+const wsInfo = inject('wsInfo')
 const store = useStore()
 // 设备任务详情
 let currentInfoId = ref('')
@@ -94,6 +91,7 @@
 
 // 单个机巢信息
 const singleUavHome = computed(() => store.state.home.singleUavHome)
+const osdVisible = computed(() => store.state.home.osdVisible);
 
 const isMore = ref(true)
 // 控制加载状态
@@ -202,6 +200,12 @@
 const taskClick = item => {
 	if (tabIndex.value === 1) {
 		// 展示当前任务详情
+		if (!item?.device_sns?.length) return ElMessage.warning('没有device_sns');
+		if (item?.device_sns?.length !== 1) {
+			// todo 后续开发
+			ElMessage.success('即将跳转到集群调度');
+			return
+		}
 		currentInfoId.value = item.wayline_job_info_id
 		isShowCurrentTaskDetails.value = true
 	} else {
@@ -211,144 +215,37 @@
 	}
 }
 
+watch([() => tabIndex.value, () => tableList.value], async ([newTabIndex, newTableList]) => {
+	if (newTabIndex == 1 && newTableList.length > 0) {
+		const params = {
+			// 航线信息id
+			wayLineJobInfoId:newTableList[0].wayline_job_info_id,
+			// 当前航线id
+			waylineJobId:newTableList[0].id,
+		}
+		await getTaskDetails(params)
+	}
+})
+
+// 监听如果当前任务飞行完毕,当前任务即消失
+watch(() => store.state.home.deviceState, async (newValue) => {
+	const deviceInfo = newValue?.deviceInfo[osdVisible.value.sn];
+	if (!deviceInfo) return
+	// 重新刷新数据
+	if (deviceInfo?.mode_code === 14) {
+		getJobList()
+	}
+});
+
+const { init: initTaskWayline, removeEntitys } = useTaskWayline()
+
 onMounted(async () => {
 	viewer = window.$viewer
 
 	await getJobList()
 
-	// tableList.value = [
-	// 	{
-	// 		id: 11563,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 05:46:25',
-	// 		end_time: '2025/04/19 05:46:25',
-	// 		create_time: '2025-04-19T05:46:36.032+00:00',
-	// 		name: '智引即飞202504191252',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 340,
-	// 		job_id: '484a7846-60e0-4ec3-b9fb-272a055c6938',
-	// 	},
-	// 	{
-	// 		id: 11559,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 05:39:42',
-	// 		end_time: '2025/04/19 05:39:42',
-	// 		create_time: '2025-04-19T05:39:52.022+00:00',
-	// 		name: '智引即飞202504191252',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 340,
-	// 		job_id: 'b8c58bfb-4352-47c5-ba33-242eec8df188',
-	// 	},
-	// 	{
-	// 		id: 11558,
-	// 		status: 3,
-	// 		begin_time: '2025/04/19 05:39:17',
-	// 		end_time: '2025/04/19 05:39:17',
-	// 		create_time: '2025-04-19T05:39:27.407+00:00',
-	// 		name: '智引即飞202504191252',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 340,
-	// 		job_id: '839773ce-bd46-4947-a2ef-d859eaea82f6',
-	// 	},
-	// 	{
-	// 		id: 11557,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 04:52:04',
-	// 		end_time: '2025/04/19 04:52:04',
-	// 		create_time: '2025-04-19T04:52:14.503+00:00',
-	// 		name: '智引即飞202504191252',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 340,
-	// 		job_id: '58366fd4-8361-456f-8ad9-3b881f933620',
-	// 	},
-	// 	{
-	// 		id: 11556,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 03:45:06',
-	// 		end_time: '2025/04/19 03:45:06',
-	// 		create_time: '2025-04-19T03:45:16.522+00:00',
-	// 		name: '智引即飞202504191145',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 338,
-	// 		job_id: '39c60fb8-e5c4-4474-912a-c3af3f1b9054',
-	// 	},
-	// 	{
-	// 		id: 11555,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 03:27:55',
-	// 		end_time: '2025/04/19 03:27:55',
-	// 		create_time: '2025-04-19T03:28:05.196+00:00',
-	// 		name: '智引即飞202504191127',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 336,
-	// 		job_id: '78c42532-45e4-4a01-b698-69bca19286ff',
-	// 	},
-	// 	{
-	// 		id: 11554,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 02:58:53',
-	// 		end_time: '2025/04/19 02:58:53',
-	// 		create_time: '2025-04-19T02:59:03.602+00:00',
-	// 		name: '智引即飞202504191058',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 335,
-	// 		job_id: 'd3b25edc-ec23-4ad6-800a-0f659a72bff3',
-	// 	},
-	// 	{
-	// 		id: 11553,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 02:52:21',
-	// 		end_time: '2025/04/19 02:52:21',
-	// 		create_time: '2025-04-19T02:52:31.415+00:00',
-	// 		name: '智引即飞202504191052',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 334,
-	// 		job_id: 'e27090f1-e740-4ae4-8d4d-301354eb0bbc',
-	// 	},
-	// 	{
-	// 		id: 11548,
-	// 		status: 5,
-	// 		begin_time: '2025/04/19 02:23:06',
-	// 		end_time: '2025/04/19 02:23:06',
-	// 		create_time: '2025-04-19T02:23:16.151+00:00',
-	// 		name: '智引即飞202504191023',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 332,
-	// 		job_id: '9e1f7283-fe34-4cfd-b468-cd2b34a96d34',
-	// 	},
-	// 	{
-	// 		id: 11547,
-	// 		status: 3,
-	// 		begin_time: '2025/04/19 02:18:24',
-	// 		end_time: '2025/04/19 02:18:24',
-	// 		create_time: '2025-04-19T02:18:34.590+00:00',
-	// 		name: '智引即飞202504191018',
-	// 		event_number: 0,
-	// 		dock_sn: '7CTDLCR00BQBM2',
-	// 		wayline_job_info_id: 331,
-	// 		job_id: '7aa5222c-2f8b-401e-b6ba-d6a550398829',
-	// 	},
-	// ]
+	initTaskWayline(viewer, wsInfo, taskDetails)
 })
-
-watch([() => tabIndex.value, () => tableList.value], async ([newTabIndex, newTableList]) => {
-	if (newTabIndex == 1 && newTableList.length > 0) {
-		await getTaskDetails(newTableList[0].wayline_job_info_id)
-	}
-})
-
-const { removeEntitys } = useTaskWayline(viewer || window.$viewer, taskDetails)
-
-useTaskViewInfo(viewer || window.$viewer, wsInfo, removeEntitys)
 </script>
 
 <style lang="scss" scoped>
@@ -436,13 +333,19 @@
 			.left {
 				cursor: pointer;
 				.left-t {
+					display: flex;
 					height: 24px;
 					font-size: 16px;
 					margin-bottom: 4px;
+					.t-name {
+						width: 180px;
+						white-space: nowrap; // 不换行
+						overflow: hidden; // 超出隐藏
+						text-overflow: ellipsis; // 显示省略号
+					}
 					.status {
 						text-align: center;
 						font-size: 12px;
-						display: inline-block;
 						width: 48px;
 						height: 20px;
 						background: rgba(76, 166, 255, 0.08);
@@ -459,6 +362,10 @@
 				.left-b {
 					height: 21px;
 					line-height: 21px;
+					width: 260px; // 添加固定宽度
+					white-space: nowrap; // 不换行
+					overflow: hidden; // 超出隐藏
+					text-overflow: ellipsis; // 显示省略号
 					img {
 						width: 16px;
 						height: 16px;

--
Gitblit v1.9.3