| | |
| | | import { $t } from '@/locales' |
| | | |
| | | const TRANSFER_SOURCE_META = { |
| | | 1: { text: 'ERP系统', type: 'info' }, |
| | | 2: { text: 'WMS系统生成', type: 'primary' }, |
| | | 3: { text: 'EXCEL导入', type: 'warning' }, |
| | | 4: { text: 'QMS系统', type: 'success' } |
| | | 1: { text: $t('pages.orders.transfer.status.sourceErp'), type: 'info' }, |
| | | 2: { text: $t('pages.orders.transfer.status.sourceWms'), type: 'primary' }, |
| | | 3: { text: $t('pages.orders.transfer.status.sourceExcel'), type: 'warning' }, |
| | | 4: { text: $t('pages.orders.transfer.status.sourceQms'), type: 'success' } |
| | | } |
| | | |
| | | const TRANSFER_EXCE_STATUS_META = { |
| | | 0: { text: '未执行', type: 'info' }, |
| | | 1: { text: '执行中', type: 'warning' }, |
| | | 2: { text: '执行完成', type: 'success' } |
| | | 0: { text: $t('pages.orders.transfer.status.pending'), type: 'info' }, |
| | | 1: { text: $t('pages.orders.transfer.status.running'), type: 'warning' }, |
| | | 2: { text: $t('pages.orders.transfer.status.completed'), type: 'success' } |
| | | } |
| | | |
| | | const TRANSFER_STATUS_META = { |
| | | 1: { text: '正常', type: 'success', bool: true }, |
| | | 0: { text: '冻结', type: 'danger', bool: false } |
| | | 1: { text: $t('pages.orders.transfer.status.normal'), type: 'success', bool: true }, |
| | | 0: { text: $t('pages.orders.transfer.status.frozen'), type: 'danger', bool: false } |
| | | } |
| | | |
| | | export const TRANSFER_REPORT_TITLE = '调拨单报表' |
| | | export const TRANSFER_REPORT_TITLE = $t('pages.orders.transfer.reportTitle') |
| | | export const TRANSFER_REPORT_STYLE = { |
| | | titleAlign: 'center', |
| | | titleLevel: 'strong', |
| | |
| | | |
| | | export function getTransferSourceOptions() { |
| | | return [ |
| | | { label: 'ERP系统', value: 1 }, |
| | | { label: 'WMS系统生成', value: 2 }, |
| | | { label: 'EXCEL导入', value: 3 }, |
| | | { label: 'QMS系统', value: 4 } |
| | | { label: $t('pages.orders.transfer.status.sourceErp'), value: 1 }, |
| | | { label: $t('pages.orders.transfer.status.sourceWms'), value: 2 }, |
| | | { label: $t('pages.orders.transfer.status.sourceExcel'), value: 3 }, |
| | | { label: $t('pages.orders.transfer.status.sourceQms'), value: 4 } |
| | | ] |
| | | } |
| | | |
| | | export function getTransferStatusOptions() { |
| | | return [ |
| | | { label: '正常', value: 1 }, |
| | | { label: '冻结', value: 0 } |
| | | { label: $t('pages.orders.transfer.status.normal'), value: 1 }, |
| | | { label: $t('pages.orders.transfer.status.frozen'), value: 0 } |
| | | ] |
| | | } |
| | | |
| | | export function getTransferExceStatusOptions() { |
| | | return [ |
| | | { label: '未执行', value: 0 }, |
| | | { label: '执行中', value: 1 }, |
| | | { label: '执行完成', value: 2 } |
| | | { label: $t('pages.orders.transfer.status.pending'), value: 0 }, |
| | | { label: $t('pages.orders.transfer.status.running'), value: 1 }, |
| | | { label: $t('pages.orders.transfer.status.completed'), value: 2 } |
| | | ] |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | export function normalizeTransferRow(record = {}) { |
| | | const statusMeta = metaByValue(record.statusBool ?? record.status, TRANSFER_STATUS_META, '未知') |
| | | const statusMeta = metaByValue(record.statusBool ?? record.status, TRANSFER_STATUS_META, $t('common.status.unknown')) |
| | | const exceStatusMeta = metaByValue(record.exceStatus, TRANSFER_EXCE_STATUS_META, record.exceStatusText) |
| | | const sourceMeta = metaByValue(record.source, TRANSFER_SOURCE_META, record.sourceText) |
| | | return { |
| | |
| | | } |
| | | |
| | | export function normalizeTransferOrderRow(record = {}) { |
| | | const statusMeta = metaByValue(record.statusBool ?? record.status, TRANSFER_STATUS_META, '未知') |
| | | const statusMeta = metaByValue(record.statusBool ?? record.status, TRANSFER_STATUS_META, $t('common.status.unknown')) |
| | | const exceStatusMeta = metaByValue(record.exceStatus, TRANSFER_EXCE_STATUS_META, record.exceStatusText) |
| | | return { |
| | | ...record, |
| | |
| | | export function getTransferActionList(row = {}) { |
| | | const normalizedRow = normalizeTransferRow(row) |
| | | const actions = [ |
| | | { key: 'view', label: '查看详情', icon: 'ri:eye-line' }, |
| | | { key: 'items', label: '明细', icon: 'ri:list-check-3' }, |
| | | { key: 'edit', label: '编辑', icon: 'ri:pencil-line' } |
| | | { key: 'view', label: $t('pages.orders.transfer.actions.view'), icon: 'ri:eye-line' }, |
| | | { key: 'items', label: $t('pages.orders.transfer.actions.items'), icon: 'ri:list-check-3' }, |
| | | { key: 'edit', label: $t('pages.orders.transfer.actions.edit'), icon: 'ri:pencil-line' } |
| | | ] |
| | | if (Number(normalizedRow.exceStatus) === 0) { |
| | | actions.push({ key: 'publish', label: '下发执行', icon: 'ri:send-plane-line' }) |
| | | actions.push({ key: 'delete', label: '删除', icon: 'ri:delete-bin-5-line', color: 'var(--art-error)' }) |
| | | actions.push({ key: 'publish', label: $t('pages.orders.transfer.actions.publish'), icon: 'ri:send-plane-line' }) |
| | | actions.push({ key: 'delete', label: $t('pages.orders.transfer.actions.delete'), icon: 'ri:delete-bin-5-line', color: 'var(--art-error)' }) |
| | | } |
| | | return actions |
| | | } |
| | |
| | | if (value === void 0) return null |
| | | return { |
| | | value, |
| | | label: normalizeText(item.name || item.areaName || item.code || item.warehouseId$ || item.warehouseName || `库区 ${value}`), |
| | | label: normalizeText(item.name || item.areaName || item.code || item.warehouseId$ || item.warehouseName || `${$t('menu.warehouseAreas')} ${value}`), |
| | | raw: item |
| | | } |
| | | }) |
| | |
| | | if (value === void 0) return null |
| | | return { |
| | | value, |
| | | label: normalizeText(item.label || item.name || item.dictLabel || `类型 ${value}`) |
| | | label: normalizeText(item.label || item.name || item.dictLabel || `${$t('pages.orders.transfer.dialog.type')} ${value}`) |
| | | } |
| | | }) |
| | | .filter(Boolean) |