| | |
| | | import { ElMessageBox } from 'element-plus' |
| | | import { $t } from '@/locales' |
| | | |
| | | function normalizeText(value) { |
| | | return String(value ?? '').trim() |
| | |
| | | export function normalizeTaskRow(record = {}) { |
| | | return { |
| | | ...record, |
| | | taskId: record.id ?? '--', |
| | | taskCode: record.taskCode || '-', |
| | | taskStatusLabel: record['taskStatus$'] || '-', |
| | | taskTypeLabel: record['taskType$'] || '-', |
| | |
| | | barcode: record.barcode || '-', |
| | | robotCode: record.robotCode || '-', |
| | | sort: normalizeNumber(record.sort), |
| | | exceStatusText: record['exceStatus$'] || record.exceStatus || '-', |
| | | expDesc: record.expDesc || '-', |
| | | expCode: record.expCode || '-', |
| | | startTimeText: record['startTime$'] || record.startTime || '-', |
| | | endTimeText: record['endTime$'] || record.endTime || '-', |
| | | createByText: record['createBy$'] || record.createByText || record.createBy || '-', |
| | | statusText: record['status$'] || '-', |
| | | memo: record.memo || '-', |
| | | updateTimeText: record['updateTime$'] || record.updateTime || '-', |
| | | createTimeText: record['createTime$'] || record.createTime || '-', |
| | | canComplete: record.canComplete === true |
| | | updateByText: record['updateBy$'] || record.updateByText || record.updateBy || '-', |
| | | canComplete: record.canComplete === true, |
| | | canCancel: record.canCancel === true |
| | | } |
| | | } |
| | | |
| | |
| | | ...record, |
| | | orderTypeLabel: record['orderType$'] || '-', |
| | | wkTypeLabel: record['wkType$'] || '-', |
| | | platOrderCode: record.platOrderCode || '-', |
| | | platWorkCode: record.platWorkCode || '-', |
| | | platItemId: record.platItemId || '-', |
| | | projectCode: record.projectCode || '-', |
| | | matnrCode: record.matnrCode || '-', |
| | | maktx: record.maktx || '-', |
| | | batch: record.batch || '-', |
| | | unit: record.unit || '-', |
| | | anfme: normalizeNumber(record.anfme), |
| | | updateByText: record['updateBy$'] || '-', |
| | | updateTimeText: record['updateTime$'] || record.updateTime || '-' |
| | | workQty: normalizeNumber(record.workQty), |
| | | qty: normalizeNumber(record.qty), |
| | | spec: record.spec || '-', |
| | | model: record.model || '-', |
| | | createByText: record['createBy$'] || record.createByText || record.createBy || '-', |
| | | createTimeText: record['createTime$'] || record.createTime || '-', |
| | | updateByText: record['updateBy$'] || record.updateByText || record.updateBy || '-', |
| | | updateTimeText: record['updateTime$'] || record.updateTime || '-', |
| | | statusText: record['status$'] || record.status || '-', |
| | | memo: record.memo || '-' |
| | | } |
| | | } |
| | | |
| | |
| | | return Number(row.taskStatus) === 199 && Number(row.taskType) === 103 |
| | | } |
| | | |
| | | export function canTopTask(row = {}) { |
| | | const taskStatus = Number(row.taskStatus) |
| | | const taskType = Number(row.taskType) |
| | | const allowedStatuses = [1, 101] |
| | | const allowedTypes = [1, 101, 10, 103, 11] |
| | | return allowedStatuses.includes(taskStatus) && allowedTypes.includes(taskType) |
| | | } |
| | | |
| | | export function getTaskActionList(row = {}) { |
| | | return [ |
| | | { |
| | | key: 'view', |
| | | label: '查看详情', |
| | | label: $t('pages.task.actions.view'), |
| | | icon: 'ri:eye-line' |
| | | }, |
| | | { |
| | | key: 'flowStep', |
| | | label: $t('pages.task.actions.flowStep'), |
| | | icon: 'ri:node-tree' |
| | | }, |
| | | ...(row.canComplete |
| | | ? [ |
| | | { |
| | | key: 'complete', |
| | | label: '完成任务', |
| | | label: $t('pages.task.actions.complete'), |
| | | icon: 'ri:checkbox-circle-line', |
| | | auth: 'update' |
| | | } |
| | |
| | | ? [ |
| | | { |
| | | key: 'check', |
| | | label: '盘点出库', |
| | | label: $t('pages.task.actions.check'), |
| | | icon: 'ri:file-check-line', |
| | | auth: 'update' |
| | | } |
| | |
| | | ? [ |
| | | { |
| | | key: 'pick', |
| | | label: '拣料出库', |
| | | label: $t('pages.task.actions.pick'), |
| | | icon: 'ri:paint-line', |
| | | auth: 'update' |
| | | } |
| | | ] |
| | | : []), |
| | | { |
| | | key: 'top', |
| | | label: '任务置顶', |
| | | icon: 'ri:pushpin-line', |
| | | auth: 'update' |
| | | }, |
| | | { |
| | | key: 'remove', |
| | | label: '取消任务', |
| | | icon: 'ri:close-circle-line', |
| | | color: '#f56c6c', |
| | | auth: 'delete' |
| | | } |
| | | ...(canTopTask(row) |
| | | ? [ |
| | | { |
| | | key: 'top', |
| | | label: $t('pages.task.actions.top'), |
| | | icon: 'ri:pushpin-line', |
| | | auth: 'update' |
| | | } |
| | | ] |
| | | : []), |
| | | ...(row.canCancel |
| | | ? [ |
| | | { |
| | | key: 'remove', |
| | | label: $t('pages.task.actions.remove'), |
| | | icon: 'ri:close-circle-line', |
| | | color: '#f56c6c', |
| | | auth: 'delete' |
| | | } |
| | | ] |
| | | : []) |
| | | ] |
| | | } |
| | | |
| | | export async function confirmTaskAction(message) { |
| | | await ElMessageBox.confirm(message, '提示', { |
| | | await ElMessageBox.confirm(message, $t('crud.confirm.deleteTitle'), { |
| | | type: 'warning', |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消' |
| | | confirmButtonText: $t('common.confirm'), |
| | | cancelButtonText: $t('common.cancel') |
| | | }) |
| | | } |