| | |
| | | <div class="task-intermediate-content"> |
| | | <SearchBox @search="searchClick" @addTask="handleAddTask"></SearchBox> |
| | | <div class="task-table"> |
| | | <el-table border :data="jobListData" class="custom-header"> |
| | | <el-table border :data="jobListData" class="custom-header" @cell-click="handleCellClick"> |
| | | <el-table-column label="序号" type="index" width="60"> |
| | | <template #default="{ $index }"> |
| | | {{ ($index + 1 + (jobListParams.current - 1) * jobListParams.size).toString().padStart(2, |
| | |
| | | <el-table-column prop="creator_name" label="创建人" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="操作" width="200" align="center"> |
| | | <template #default="scope"> |
| | | <div |
| | | v-if="scope.row.status === 2" |
| | | class="btnItem" |
| | | link |
| | | type="primary" |
| | | @click="turnBack(scope.row)" |
| | | > |
| | | <!-- <el-button type="text" @click="rejectDetail(row.id)">驳回原因</el-button> --> |
| | | <el-button icon="el-icon-back" v-if="scope.row.status === 2" type="text" |
| | | @click="turnBack(scope.row)"> |
| | | 返航 |
| | | </div> |
| | | <div |
| | | v-if="scope.row.status === 1" |
| | | class="btnItem" |
| | | link |
| | | type="primary" |
| | | @click="cancelTask(scope.row)" |
| | | > |
| | | </el-button> |
| | | <el-button icon="el-icon-close" v-if="scope.row.status === 1" type="text" |
| | | @click="cancelTask(scope.row)"> |
| | | 取消任务 |
| | | </div> |
| | | <div class="btnItem" link type="primary" @click="handleDetail(scope.row)">查看</div> |
| | | </el-button> |
| | | <el-button icon="el-icon-view" type="text" @click="handleDetail(scope.row)">查看</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <div class="pagination"> |
| | | <el-pagination |
| | | class="ztzf-pagination" |
| | | popper-class="custom-pagination-dropdown" |
| | | background |
| | | :page-sizes="[10, 20, 30, 40,50,100]" |
| | | :size="size" |
| | | v-model:current-page="jobListParams.current" |
| | | v-model:page-size="jobListParams.size" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | <el-pagination class="ztzf-pagination" popper-class="custom-pagination-dropdown" background |
| | | :page-sizes="[10, 20, 30, 40, 50, 100]" :size="size" v-model:current-page="jobListParams.current" |
| | | v-model:page-size="jobListParams.size" layout="total, sizes, prev, pager, next, jumper" :total="total" |
| | | @size-change="handleSizeChange" @current-change="handleCurrentChange" /> |
| | | </div> |
| | | </div> |
| | | <!-- 添加任务 --> |
| | |
| | | import SearchBox from '../SearchBox.vue' |
| | | import AddTask from './AddTask.vue' |
| | | // import CurrentTaskDetails from '@/components/CurrentTaskDetails/CurrentTaskDetails.vue' |
| | | import { jobList, cancelJobs, taskReturnLines, returnHomeCluster } from '@/api/job/task' |
| | | import { jobList, cancelJobs, taskReturnLines, returnHomeCluster, statusChangedApi } from '@/api/job/task'; |
| | | import { ElMessage } from 'element-plus' |
| | | import DeviceJobDetails from '../DeviceJobDetails.vue' |
| | | import CancelTaskDialog from '../CancelTaskDialog.vue' |
| | | import { useStore } from 'vuex' |
| | | import { cloneDeep } from 'lodash'; |
| | | import { cloneDeep } from 'lodash' |
| | | import { inject, onBeforeUnmount } from 'vue'; |
| | | const store = useStore() |
| | | const singleUavHome = computed(() => store.state.home.singleUavHome) |
| | | const jobListParams = reactive({ |
| | |
| | | |
| | | // 获取任务列表 |
| | | const getJobList = () => { |
| | | const apiParams = { |
| | | ...cloneDeep(jobListParams), |
| | | searchParams: { |
| | | ...cloneDeep(jobListParams.searchParams), |
| | | status_list: jobListParams.searchParams.status || undefined, |
| | | status: undefined, |
| | | }, |
| | | } |
| | | const apiParams = { |
| | | ...cloneDeep(jobListParams), |
| | | searchParams: { |
| | | ...cloneDeep(jobListParams.searchParams), |
| | | status_list: jobListParams.searchParams.status || undefined, |
| | | status: undefined, |
| | | }, |
| | | } |
| | | jobList(apiParams).then(res => { |
| | | if (res.data.code !== 0) return |
| | | jobListData.value = res.data.data.records |
| | |
| | | }) |
| | | } |
| | | |
| | | function handleCellClick(row, column) { |
| | | if (column.no === 1) { |
| | | navigator.clipboard.writeText(row.job_info_num).then(() => { |
| | | ElMessage.success('复制任务编号成功') |
| | | }) |
| | | } else if (column.no === 2) { |
| | | navigator.clipboard.writeText(row.name).then(() => { |
| | | ElMessage.success('复制任务名称成功') |
| | | }) |
| | | } |
| | | } |
| | | |
| | | |
| | | const changeKey = inject('changeKey') |
| | | // 轮询查询是否刷新 |
| | | const polling = setInterval(async () => { |
| | | const res = await statusChangedApi() |
| | | if (res.data.data.DEVICE_REFRESH || res.data.data.JOB_REFRESH) { |
| | | getJobList() |
| | | changeKey.value++ |
| | | } |
| | | }, 4000) |
| | | |
| | | onBeforeUnmount(() => { |
| | | clearInterval(polling) |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | // getJobList() |
| | | }) |