forked from drone/command-center-dashboard

罗广辉
2025-04-03 8cdaaafadbbdcff3e55da90fc160191d34ec40c7
src/views/SignMachineNest/MachineRight/MachineTableDetails/DeviceJob/DeviceJob.vue
File was renamed from src/views/SignMachineNest/components/MachineRight/MachineTableDetails/DeviceJob.vue
@@ -1,5 +1,5 @@
<template>
   <el-divider content-position="left">相关事件 {{ total }}次</el-divider>
   <el-divider content-position="left">相关任务 {{ total }}次</el-divider>
   <el-table :data="list" style="width: 100%">
      <el-table-column prop="id" label="id" />
      <el-table-column prop="name" label="名称" />
@@ -10,8 +10,12 @@
      <el-table-column prop="area_code" label="地区代码" />
      <el-table-column prop="begin_time" label="开始时间" />
      <el-table-column prop="end_time" label="结束时间" />
      <el-table-column prop="device_names" label="设备名称" />
      <el-table-column prop="creator_name" label="创建者姓名" />
      <el-table-column prop="creator_name" label="创建者" />
      <el-table-column label="操作">
         <template #default="scope">
            <el-button type="primary" link @click="viewJob(scope.row)">查看</el-button>
         </template>
      </el-table-column>
   </el-table>
   <el-pagination
      background
@@ -22,10 +26,14 @@
      :total="total"
      @change="pageChange"
   />
  <DeviceJobDetails v-model:show="deviceJobDetailsShow"/>
</template>
<script setup>
import { useStore } from 'vuex'
import { getDeviceJobList } from '@/api/home/machineNest'
import DeviceJobDetails from './DeviceJobDetails/DeviceJobDetails.vue';
const list = ref([])
const params = ref({
@@ -33,20 +41,28 @@
})
const sizeParams = ref({
   current: 1,
   size: 1,
   size: 10,
})
const store = useStore()
const child_sn = computed(() => store.state.home.singleUavHome.child_sn)
const device_sn = computed(() => store.state.home.singleUavHome.device_sn)
const total = ref(0)
const deviceJobDetailsShow = ref(false)
const jobId = ref(null)
provide('jobId', jobId)
const viewJob = (row) => {
  jobId.value = row.id
  deviceJobDetailsShow.value = true
}
const getList = () => {
   params.value.device_sn = child_sn.value
   params.value.device_sn = device_sn.value
   getDeviceJobList(params.value, sizeParams.value).then(res => {
      const resData = res?.data?.data || {}
      list.value = resData.records
      total.value = resData.total
   })
}
const pageChange = val => {
   sizeParams.value.current = val
   getList()