| | |
| | | |
| | | <!--表格--> |
| | | <div class="plan-panel-wrapper"> |
| | | <a-table :loading="tableLoading" class="plan-table" :columns="columns" :data-source="plansData.data" |
| | | <a-table :loading="tableLoading" class="plan-table" :columns="columns" :data-source="plansData.data" @expand="expand" :indentSize="200" |
| | | row-key="job_id" |
| | | :pagination="paginationProp" :scroll="{ x: '100%', y: 600 }" @change="refreshData"> |
| | | <!-- 执行时间 --> |
| | |
| | | getWaylineJobs, |
| | | Task, |
| | | uploadMediaFileNow, |
| | | TaskQueryParam |
| | | TaskQueryParam, getWaylineChildrenJobs |
| | | } from '/@/api/wayline' |
| | | import { useMyStore } from '/@/store' |
| | | import { ELocalStorageKey } from '/@/types/enums' |
| | |
| | | import { getErrorMessage } from '/@/utils/error-code/index' |
| | | import { commonColor } from '/@/utils/color' |
| | | import { ExclamationCircleOutlined, UploadOutlined } from '@ant-design/icons-vue' |
| | | import { timestampToTime } from '/@/utils/time' |
| | | |
| | | const store = useMyStore() |
| | | const workspaceId = localStorage.getItem(ELocalStorageKey.WorkspaceId)! |
| | |
| | | const searchQuery = reactive<TaskQueryParam>({ |
| | | taskType: '' |
| | | }) |
| | | |
| | | function getSearchTime (n:number) { |
| | | const nowStamp = new Date().getTime() |
| | | const timestamp = nowStamp + (n * 60 * 60 * 1000 * 24) |
| | | const time = timestampToTime(timestamp) |
| | | return time |
| | | } |
| | | |
| | | const statusArr = reactive([]) |
| | | const timeRangeArr = reactive({ |
| | | data: [] as string[] |
| | | data: [getSearchTime(-3), getSearchTime(3)] as string[] |
| | | }) |
| | | |
| | | const body: IPage = { |
| | |
| | | { |
| | | title: '计划|实际时间', |
| | | dataIndex: 'duration', |
| | | width: 200, |
| | | width: 240, |
| | | slots: { customRender: 'duration' }, |
| | | }, |
| | | { |
| | | title: '执行状态', |
| | | key: 'status', |
| | | width: 150, |
| | | width: 80, |
| | | slots: { customRender: 'status' } |
| | | }, |
| | | { |
| | | title: '计划名称', |
| | | dataIndex: 'job_name', |
| | | width: 100, |
| | | ellipsis: true, |
| | | width: 170, |
| | | }, |
| | | { |
| | | title: '设备名称', |
| | |
| | | getPlans() |
| | | }) |
| | | |
| | | function expand (expand:any, record:any) { |
| | | if (!expand) { |
| | | return |
| | | } |
| | | tableLoading.value = true |
| | | const params = { |
| | | parentId: record.job_id |
| | | } |
| | | |
| | | getWaylineChildrenJobs(workspaceId, params).then(res => { |
| | | const data = res.data |
| | | plansData.data.forEach(item => { |
| | | if (item.job_id === record.job_id) { |
| | | item.children = data |
| | | } |
| | | }) |
| | | |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | function dateChange (value: any) { |
| | | searchQuery.startTime = value[0] |
| | | searchQuery.endTime = value[1] |
| | |
| | | } |
| | | |
| | | function getPlans () { |
| | | searchQuery.startTime = timeRangeArr.data[0] |
| | | searchQuery.endTime = timeRangeArr.data[1] |
| | | |
| | | console.log('计划查询请求参数', searchQuery) |
| | | tableLoading.value = true |
| | | getWaylineJobs(workspaceId, body, searchQuery).then(res => { |
| | | if (res.code !== 0) { |
| | | return |
| | | } |
| | | |
| | | res.data.list.forEach(e => { |
| | | if (e.has_children === '1') { |
| | | e.children = [] |
| | | } |
| | | }) |
| | | |
| | | plansData.data = res.data.list |
| | | paginationProp.total = res.data.pagination.total |
| | | paginationProp.current = res.data.pagination.page |
| | |
| | | job_id: jobId |
| | | }) |
| | | if (code === 0) { |
| | | message.success('Deleted successfully') |
| | | message.success('删除成功') |
| | | getPlans() |
| | | } |
| | | } |
| | |
| | | status: UpdateTaskStatus.Suspend |
| | | }) |
| | | if (code === 0) { |
| | | message.success('Suspended successfully') |
| | | message.success('暂停成功') |
| | | getPlans() |
| | | } |
| | | } |
| | |
| | | status: UpdateTaskStatus.Resume |
| | | }) |
| | | if (code === 0) { |
| | | message.success('Resumed successfully') |
| | | message.success('恢复成功') |
| | | getPlans() |
| | | } |
| | | } |
| | |
| | | async function onUploadMediaFileNow (jobId: string) { |
| | | const { code } = await uploadMediaFileNow(workspaceId, jobId) |
| | | if (code === 0) { |
| | | message.success('Upload Media File successfully') |
| | | message.success('上传媒体文件成功') |
| | | getPlans() |
| | | } |
| | | } |
| | |
| | | .plan-table { |
| | | background: #fff; |
| | | margin-top: 10px; |
| | | |
| | | :deep(.ant-table-tbody) { |
| | | |
| | | tr.ant-table-row-level-0 { |
| | | td:first-child { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | } |
| | | |
| | | tr.ant-table-row-level-1 { |
| | | td:first-child { |
| | | padding-left: 60px; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | .action-area { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | </style> |