From dd1af3b519ef3ea616c0424a331927fc21e9587e Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 07 Apr 2025 11:42:31 +0800
Subject: [PATCH] feat: 历史任务详情40%

---
 src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJob.vue                         |    2 
 src/api/home/task.js                                                                                       |   27 +++++++++
 src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue |   85 +++++++++++++++++++++------
 src/api/home/machineNest.js                                                                                |   12 +---
 src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/JobRelatedEvents.vue |   25 ++++++--
 5 files changed, 115 insertions(+), 36 deletions(-)

diff --git a/src/api/home/machineNest.js b/src/api/home/machineNest.js
index 6abf443..de87e64 100644
--- a/src/api/home/machineNest.js
+++ b/src/api/home/machineNest.js
@@ -47,15 +47,7 @@
 	})
 }
 
-// 设备-任务列表
-export const getDeviceJobList = (data,params) => {
-	return request({
-		url: `/drone-device-core/wayline/waylineJobInfo/jobList`,
-		method: 'post',
-		data,
-		params
-	})
-}
+
 
 // 设备-事件列表
 export const getDeviceEventList = (data,params) => {
@@ -66,3 +58,5 @@
 		params
 	})
 }
+
+
diff --git a/src/api/home/task.js b/src/api/home/task.js
index b539391..171409c 100644
--- a/src/api/home/task.js
+++ b/src/api/home/task.js
@@ -48,5 +48,32 @@
 		data: data.searchParams,
 	})
 }
+// 任务详情
+export const getJobDetails = params => {
+	return request({
+		url: '/drone-device-core/wayline/waylineJobInfo/jobDetails',
+		method: 'get',
+		params
+	})
+}
+
+// 设备-任务列表
+export const getDeviceJobList = (data,params) => {
+	return request({
+		url: `/drone-device-core/wayline/waylineJobInfo/jobList`,
+		method: 'post',
+		data,
+		params
+	})
+}
+
+// 根据任务id查成果
+export const getJobInfoFiles = (params) => {
+	return request({
+		url: `/blade-resource/media/api/v1/workspaces/files/getJobInfoFiles`,
+		method: 'get',
+		params
+	})
+}
 
 
diff --git a/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJob.vue b/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJob.vue
index f8fce46..29e661e 100644
--- a/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJob.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJob.vue
@@ -32,8 +32,8 @@
 </template>
 <script setup>
 import { useStore } from 'vuex'
-import { getDeviceJobList } from '@/api/home/machineNest'
 import DeviceJobDetails from './DeviceJobDetails/DeviceJobDetails.vue';
+import { getDeviceJobList } from '@/api/home/task'
 
 const list = ref([])
 const params = ref({
diff --git a/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue b/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue
index 38eb225..5bac13d 100644
--- a/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue
@@ -1,7 +1,7 @@
 <!-- 任务详情 -->
 <template>
 	<el-dialog
-    append-to-body
+		append-to-body
 		modal-class="detailsOfHistoricalTasks"
 		v-model="isShow"
 		title="历史任务详情"
@@ -21,7 +21,16 @@
 				<JobRelatedEvents v-if="isShow" />
 				<el-divider content-position="left">任务成果 xxx个</el-divider>
 				<div class="imgListBox">
-					<div v-for="item in imgList" class="imgItem">xxx图片</div>
+					<el-image
+						class="imgItem"
+						v-for="(item, index) in achievementList"
+						:src="item.url"
+						:preview-src-list="achievementList.map(i => i.url)"
+						show-progress
+						preview-teleported
+						:initial-index="index"
+						fit="cover"
+					/>
 				</div>
 			</div>
 			<div class="contentRight">map</div>
@@ -32,30 +41,64 @@
 <script setup>
 import { pxToRem } from '@/utils/rem'
 import JobRelatedEvents from './JobRelatedEvents.vue'
+import { getJobDetails, getJobInfoFiles } from '@/api/home/task'
 
 const isShow = defineModel('show')
 
-
-const imgList = ref([
-	{ name: '图片1', url: 'xxx' },
-	{ name: '图片1', url: 'xxx' },
-	{ name: '图片1', url: 'xxx' },
-	{ name: '图片1', url: 'xxx' },
-])
-
 const infoList = ref([
-	{ name: '任务编号', value: 'xxx' },
-	{ name: '任务所属机巢', value: 'xxx' },
-	{ name: '关联算法', value: 'xxx' },
-	{ name: '任务名称', value: 'xxx' },
-	{ name: '所属单位', value: 'xxx' },
-	{ name: '任务类型', value: 'xxx' },
-	{ name: '任务周期', value: 'xxx' },
-	{ name: '飞行事件', value: 'xxx' },
-	{ name: '任务频次', value: 'xxx' },
-	{ name: '任务描述', value: 'xxx' },
+	{ name: '任务编号', value: '', field: 'id' },
+	{ name: '任务所属机巢', value: '', field: 'device_names' },
+	{ name: '关联算法', value: '', field: 'ai_type_str' },
+	{ name: '任务名称', value: '', field: 'name' },
+	{ name: '所属单位', value: '', field: 'dept_name' },
+	{ name: '任务类型', value: '', field: 'industry_type_str' },
+	{ name: '飞行事件', value: '', field: 'event_number' },
+	{ name: '任务周期', value: '', field: 'rep_rule_val' },
+	{ name: '任务频次', value: '', field: 'rep_fre_val' },
+	{ name: '任务描述', value: '', field: 'remark' },
 ])
 
+const detailsData = ref({
+	id: 19,
+	remark: '测试测试',
+	is_monitoring: 0,
+	industry_type_str: '综合类、公安类',
+	area_code: '360103',
+	ai_type_str: '识别火情、车牌识别',
+	begin_time: '2025/04/02 16:00',
+	end_time: '2025/04/01 15:59',
+	device_names: '赣县-夏潭机场',
+	create_time: '2025-04-01T07:35:19.000+00:00',
+	name: '夏弹机场测试',
+	event_number: 2,
+	creator_name: '管理员',
+	way_lines: [],
+})
+
+const achievementList = ref([])
+
+const wayLineJodInfoId = inject('wayLineJodInfoId')
+const getAchievement = () => {
+	getJobInfoFiles({ jobInfoId: wayLineJodInfoId.value }).then(res => {
+		achievementList.value = res.data.data
+	})
+}
+const getDetails = () => {
+	getJobDetails({ wayLineJobInfoId: wayLineJodInfoId.value }).then(res => {
+		console.log(res.data.data, 666)
+		detailsData.value = res.data.data
+		infoList.value.forEach(item => {
+			item.value = detailsData.value?.[item.field] || ''
+		})
+	})
+}
+
+watch(isShow, (newValue, oldValue) => {
+	if (newValue) {
+		getAchievement()
+		getDetails()
+	}
+})
 </script>
 
 <style lang="scss">
@@ -112,6 +155,8 @@
 
 		.imgListBox {
 			display: flex;
+			flex-wrap: wrap;
+			gap: 0 10px;
 
 			.imgItem {
 				width: 200px;
diff --git a/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/JobRelatedEvents.vue b/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/JobRelatedEvents.vue
index 5bf73aa..4455dc2 100644
--- a/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/JobRelatedEvents.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJobDetails/JobRelatedEvents.vue
@@ -1,11 +1,23 @@
 <template>
 	<el-divider content-position="left">关联事件 {{total}}个</el-divider>
 	<el-table :data="list" style="width: 100%" >
-		<el-table-column prop="event_num" label="编号" />
+		<el-table-column prop="id" label="ID" />
 		<el-table-column prop="event_name" label="名称" />
 		<el-table-column prop="media_type" label="类型" />
-		<el-table-column prop="photo_url" label="图片url" />
-		<el-table-column prop="video_url" label="视频url" />
+		<el-table-column prop="photo_url" label="图片">
+      <template #default="scope">
+        <el-image
+          :style="{width: pxToRem(50), height:  pxToRem(50)}"
+          :src="scope.row.photo_url"
+          :preview-src-list="[scope.row.photo_url]"
+          show-progress
+					preview-teleported
+          :initial-index="4"
+          fit="cover"
+        />
+      </template>
+    </el-table-column>
+		<el-table-column prop="video_url" label="视频" />
 		<el-table-column prop="remark" label="备注" />
 		<el-table-column prop="status" label="状态">
 			<template #default="scope">
@@ -17,7 +29,6 @@
 				<el-tag v-if="scope.row.status === 5" type="success">已完结</el-tag>
 			</template>
 		</el-table-column>
-		<el-table-column prop="wayline_job_id" label="	任务id" />
     <el-table-column label="操作" >
       <template #default="scope">
         <el-button type="primary" link @click="examine(scope.row)">审核</el-button>
@@ -39,6 +50,7 @@
 import { useStore } from 'vuex'
 import { getDeviceEventList } from '@/api/home/machineNest'
 import { ElMessage } from 'element-plus';
+import { pxToRem } from '@/utils/rem'
 
 
 const list = ref()
@@ -47,7 +59,7 @@
 })
 const sizeParams = ref({
 	current: 1,
-	size: 1,
+	size: 10,
 })
 const store = useStore()
 const child_sn = computed(() => store.state.home.singleUavHome.child_sn)
@@ -69,13 +81,14 @@
 		total.value = resData.total
 	})
 }
+
+
 const pageChange = val => {
 	sizeParams.value.current = val
 	getList()
 }
 
 onMounted(() => {
-  console.log(66);
 	getList()
 })
 </script>

--
Gitblit v1.9.3