| | |
| | | <div>{{ formatTaskTime(record.end_time) }}</div> |
| | | </div> |
| | | </template> |
| | | <!-- 任务类型 --> |
| | | <template #taskType="{ record }"> |
| | | <div>{{ formatTaskType(record) }}</div> |
| | | </template> |
| | | <!-- 失控动作 --> |
| | | <template #lostAction="{ record }"> |
| | | <div>{{ formatLostAction(record) }}</div> |
| | | </template> |
| | | <!-- 状态 --> |
| | | <template #status="{ record }"> |
| | | <div> |
| | |
| | | </div> |
| | | <div v-if="record.status === TaskStatus.Carrying"> |
| | | <a-progress :percent="record.progress || 0" /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <!-- 任务类型 --> |
| | | <template #taskType="{ record }"> |
| | | <div>{{ formatTaskType(record) }}</div> |
| | | </template> |
| | | <!-- 失控动作 --> |
| | | <template #lostAction="{ record }"> |
| | | <div>{{ formatLostAction(record) }}</div> |
| | | </template> |
| | | <!-- 媒体上传状态 --> |
| | | <template #media_upload="{ record }"> |
| | | <div> |
| | | <div class="flex-display flex-align-center"> |
| | | <span class="circle-icon" :style="{backgroundColor: formatMediaTaskStatus(record).color}"></span> |
| | | {{ formatMediaTaskStatus(record).text }} |
| | | </div> |
| | | <div class="pl15"> |
| | | {{ formatMediaTaskStatus(record).number }} |
| | | <a-tooltip v-if="formatMediaTaskStatus(record).status === MediaStatus.ToUpload" placement="bottom" arrow-point-at-center > |
| | | <template #title> |
| | | <div>Upload now</div> |
| | | </template> |
| | | <UploadOutlined class="ml5" :style="{color: commonColor.BLUE, fontSize: '16px' }" @click="onUploadMediaFileNow(record.job_id)"/> |
| | | </a-tooltip> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import { TableState } from 'ant-design-vue/lib/table/interface' |
| | | import { onMounted } from 'vue' |
| | | import { IPage } from '/@/api/http/type' |
| | | import { deleteTask, getWaylineJobs, Task } from '/@/api/wayline' |
| | | import { deleteTask, getWaylineJobs, Task, uploadMediaFileNow } from '/@/api/wayline' |
| | | import { useMyStore } from '/@/store' |
| | | import { ELocalStorageKey } from '/@/types/enums' |
| | | import { useFormatTask } from './use-format-task' |
| | | import { TaskStatus, TaskProgressInfo, TaskProgressStatus, TaskProgressWsStatusMap } from '/@/types/task' |
| | | import { useTaskProgressEvent } from './use-task-progress-event' |
| | | import { TaskStatus, TaskProgressInfo, TaskProgressStatus, TaskProgressWsStatusMap, MediaStatus, MediaStatusProgressInfo, TaskMediaHighestPriorityProgressInfo } from '/@/types/task' |
| | | import { useTaskWsEvent } from './use-task-ws-event' |
| | | import { getErrorMessage } from '/@/utils/error-code/index' |
| | | import { commonColor } from '/@/utils/color' |
| | | import { ExclamationCircleOutlined } from '@ant-design/icons-vue' |
| | | import { ExclamationCircleOutlined, UploadOutlined } from '@ant-design/icons-vue' |
| | | |
| | | const store = useMyStore() |
| | | const workspaceId = localStorage.getItem(ELocalStorageKey.WorkspaceId)! |
| | |
| | | { |
| | | title: 'Planned/Actual Time', |
| | | dataIndex: 'duration', |
| | | width: 180, |
| | | width: 160, |
| | | slots: { customRender: 'duration' }, |
| | | }, |
| | | { |
| | | title: 'Status', |
| | | key: 'status', |
| | | width: 150, |
| | | slots: { customRender: 'status' } |
| | | }, |
| | | { |
| | | title: 'Plan Name', |
| | | dataIndex: 'job_name', |
| | | width: 150, |
| | | ellipsis: true |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: 'Type', |
| | | dataIndex: 'taskType', |
| | | width: 120, |
| | | width: 100, |
| | | slots: { customRender: 'taskType' }, |
| | | }, |
| | | { |
| | | title: 'Flight Route Name', |
| | | dataIndex: 'file_name', |
| | | width: 150, |
| | | ellipsis: true |
| | | width: 100, |
| | | }, |
| | | { |
| | | title: 'Dock Name', |
| | | dataIndex: 'dock_name', |
| | | width: 120, |
| | | width: 100, |
| | | ellipsis: true |
| | | }, |
| | | { |
| | | title: 'RTH Altitude Relative to Dock (m)', |
| | | dataIndex: 'rth_altitude', |
| | | width: 120, |
| | | ellipsis: true |
| | | }, |
| | | { |
| | | title: 'Lost Action', |
| | |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: 'Status', |
| | | key: 'status', |
| | | width: 200, |
| | | slots: { customRender: 'status' } |
| | | title: 'Media File Upload', |
| | | key: 'media_upload', |
| | | width: 160, |
| | | slots: { customRender: 'media_upload' } |
| | | }, |
| | | { |
| | | title: 'Action', |
| | |
| | | data: [] as Task[] |
| | | }) |
| | | |
| | | const { formatTaskType, formatTaskTime, formatLostAction, formatTaskStatus } = useFormatTask() |
| | | const { formatTaskType, formatTaskTime, formatLostAction, formatTaskStatus, formatMediaTaskStatus } = useFormatTask() |
| | | |
| | | // 设备任务执行进度更新 |
| | | function onTaskProgressWs (data: TaskProgressInfo) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 媒体上传进度更新 |
| | | function onTaskMediaProgressWs (data: MediaStatusProgressInfo) { |
| | | const { media_count: mediaCount, uploaded_count: uploadedCount, job_id: jobId } = data |
| | | if (isNaN(mediaCount) || isNaN(uploadedCount) || !jobId) { |
| | | return |
| | | } |
| | | const taskItem = plansData.data.find(task => task.job_id === jobId) |
| | | if (!taskItem) return |
| | | if (mediaCount === uploadedCount) { |
| | | taskItem.uploading = false |
| | | } else { |
| | | taskItem.uploading = true |
| | | } |
| | | taskItem.media_count = mediaCount |
| | | taskItem.uploaded_count = uploadedCount |
| | | } |
| | | |
| | | function onoTaskMediaHighestPriorityWS (data: TaskMediaHighestPriorityProgressInfo) { |
| | | const { pre_job_id: preJobId, job_id: jobId } = data |
| | | const preTaskItem = plansData.data.find(task => task.job_id === preJobId) |
| | | const taskItem = plansData.data.find(task => task.job_id === jobId) |
| | | if (preTaskItem) { |
| | | preTaskItem.uploading = false |
| | | } |
| | | if (taskItem) { |
| | | taskItem.uploading = true |
| | | } |
| | | } |
| | | |
| | | function getCodeMessage (code: number) { |
| | | return getErrorMessage(code) + `(code: ${code})` |
| | | } |
| | | |
| | | useTaskProgressEvent(onTaskProgressWs) |
| | | useTaskWsEvent({ |
| | | onTaskProgressWs, |
| | | onTaskMediaProgressWs, |
| | | onoTaskMediaHighestPriorityWS, |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | getPlans() |
| | |
| | | getPlans() |
| | | } |
| | | } |
| | | |
| | | // 立即上传媒体 |
| | | async function onUploadMediaFileNow (jobId: string) { |
| | | const { code } = await uploadMediaFileNow(workspaceId, jobId) |
| | | if (code === 0) { |
| | | message.success('Upload Media File successfully') |
| | | getPlans() |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |