From fd051f92d31331a85fdec3bc7819bafb34ec8a06 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Thu, 17 Apr 2025 09:44:43 +0800
Subject: [PATCH] feat: 历史任务详情改造,移入到公共组件,传入id即可使用
---
src/components/DeviceJobDetails/DeviceJobDetails.vue | 17 ++++++++++-------
src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJob.vue | 11 +++++++----
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue b/src/components/DeviceJobDetails/DeviceJobDetails.vue
similarity index 95%
rename from src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue
rename to src/components/DeviceJobDetails/DeviceJobDetails.vue
index d4cc8c7..007edb7 100644
--- a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJobDetails/DeviceJobDetails.vue
+++ b/src/components/DeviceJobDetails/DeviceJobDetails.vue
@@ -27,7 +27,7 @@
<div class="itemValue">{{ flystatus ? flystatus :'' }}</div>
</div>
</div>
- <JobRelatedEvents v-if="isShow" />
+ <JobRelatedEvents v-if="props.wayLineJodInfoId" />
<div class="devicetitle" v-if="isShow">
<p>
任务成果
@@ -101,7 +101,12 @@
const mediaType = ref('')
const total = ref(0)
const achievementList = ref([])
-const wayLineJodInfoId = inject('wayLineJodInfoId')
+
+const props = defineProps(['wayLineJodInfoId'])
+const wayLineJodInfoId = computed(()=> props.wayLineJodInfoId)
+provide('wayLineJodInfoId',wayLineJodInfoId)
+
+
const getAchievement = () => {
getJobInfoFiles({ jobInfoId: wayLineJodInfoId.value }).then(res => {
for (let i = 0; i < res.data.data.length; i++) {
@@ -132,11 +137,9 @@
})
}
-watch(isShow, (newValue, oldValue) => {
- if (newValue) {
- getDetails()
- getAchievement()
- }
+onMounted(() => {
+ getDetails()
+ getAchievement()
})
</script>
diff --git a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJob.vue b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJob.vue
index 4d904db..1a7fa6b 100644
--- a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJob.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJob.vue
@@ -36,7 +36,7 @@
<el-pagination
class="ztzf-pagination"
background
-
+
v-model:current-page="sizeParams.current"
v-model:page-size="sizeParams.size"
layout=" prev, pager, next, jumper"
@@ -45,11 +45,15 @@
/>
</div>
- <DeviceJobDetails v-model:show="deviceJobDetailsShow" />
+ <DeviceJobDetails
+ v-if="deviceJobDetailsShow"
+ v-model:show="deviceJobDetailsShow"
+ :wayLineJodInfoId="wayLineJodInfoId"
+ />
</template>
<script setup>
import { useStore } from 'vuex'
-import DeviceJobDetails from './DeviceJobDetails/DeviceJobDetails.vue'
+import DeviceJobDetails from '@/components/DeviceJobDetails/DeviceJobDetails.vue'
import { getDeviceJobList } from '@/api/home/task'
const list = ref([])
@@ -65,7 +69,6 @@
const total = ref(0)
const deviceJobDetailsShow = ref(false)
const wayLineJodInfoId = ref(null)
-provide('wayLineJodInfoId', wayLineJodInfoId)
const viewJob = row => {
wayLineJodInfoId.value = row.id
deviceJobDetailsShow.value = true
--
Gitblit v1.9.3