From cde142f113c59bedd8a0522116258c8ff2236283 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Mon, 29 Jun 2026 03:40:57 +0800 Subject: [PATCH] 1 --- .../storage/entry/component/entrydetail.vue | 17 ++- src/views/storage/entry/entry-config.ts | 2 + src/views/storage/entry/index.vue | 133 ++++++++++++------ .../management/replenishmentDemand/index.vue | 51 ------- 4 files changed, 102 insertions(+), 101 deletions(-) diff --git a/src/views/storage/entry/component/entrydetail.vue b/src/views/storage/entry/component/entrydetail.vue index 6697eacb..f8d2e701 100644 --- a/src/views/storage/entry/component/entrydetail.vue +++ b/src/views/storage/entry/component/entrydetail.vue @@ -21,7 +21,7 @@
- 可导入/PDA 入库 + 可导入/PDA 入库 已导入 {{ directSummary.total_direct_inbound ?? 0 }} / 计划 {{ directSummary.total_planned ?? '—' }} @@ -93,7 +93,6 @@ import DirectInboundImportDialog, { import { canDirectInboundOperate, entrydetail, - isPendingEntryOrderStatus, } from '../entry-config' const props = defineProps<{ @@ -121,7 +120,8 @@ const pagination = reactive({ const canBatchImport = computed(() => { const status = props.row?.order_status ?? entryOrderStatus.value - return isPendingEntryOrderStatus(status) + if (status === null || status === undefined || status === '') return false + return String(status).trim().toUpperCase() === 'CREATED' }) const canDirectInbound = computed(() => { @@ -137,7 +137,7 @@ const detailColumns = computed(() => { { prop: 'direct_inbound_quantity', label: '已导入', width: '90', align: 'right' }, { prop: 'remaining_quantity', label: '剩余可入', width: '90', align: 'right' }, ) - if (canDirectInbound.value) { + if (canBatchImport.value) { columns.push({ prop: 'operation', label: '操作', @@ -277,9 +277,12 @@ async function reloadAll() { } function canImportRow(row: DirectInboundImportRow) { + const status = props.row?.order_status ?? entryOrderStatus.value + if (status === null || status === undefined || status === '') return false + if (String(status).trim().toUpperCase() !== 'CREATED') return false if (!canDirectInbound.value || !row.stock_id) return false - const remaining = Number(row.remaining_quantity ?? 0) - return Number.isFinite(remaining) && remaining > 0 + const available = Number(row.remaining_quantity ?? row.count ?? 0) + return Number.isFinite(available) && available > 0 } function openImportDialog(row: DirectInboundImportRow) { @@ -294,7 +297,7 @@ function openImportDialog(row: DirectInboundImportRow) { function openBatchImportDialog() { if (!canBatchImport.value) { - ElMessage.warning('仅「待入库」状态可使用批量导入') + ElMessage.warning('仅「已创建」状态可使用批量导入') return } importTargetItem.value = null diff --git a/src/views/storage/entry/entry-config.ts b/src/views/storage/entry/entry-config.ts index ecf11f55..00ebf5db 100644 --- a/src/views/storage/entry/entry-config.ts +++ b/src/views/storage/entry/entry-config.ts @@ -170,6 +170,7 @@ export const availableFields: EntryScanFieldConfig[] = [ { label: '推送中', value: 'SYNCING' }, { label: '成功', value: 'SUCCESS' }, { label: '失败', value: 'FAIL' }, + { label: '失败', value: 'FAILED' }, ] }) as EntryScanFieldConfig, scanWorkflowField({ @@ -195,6 +196,7 @@ export const entryColums = [ { prop: 'hasReceiving', label: '收货绑定', width: '100' }, { prop: 'receivingBindings', label: '绑定收货单', minWidth: '180' }, { prop: 'sync_status',label:'入库状态',width:'160' }, + { prop: 'sync_message', label: '同步信息', minWidth: '220' }, { prop: 'supplier_code',label:'供应商编码',width:'160' }, { prop: 'supplier_name',label:'供应商名称',width:'160' }, // { prop: '',label:'',width:'160' }, diff --git a/src/views/storage/entry/index.vue b/src/views/storage/entry/index.vue index 03744079..30649185 100644 --- a/src/views/storage/entry/index.vue +++ b/src/views/storage/entry/index.vue @@ -19,7 +19,6 @@
刷新 - 完成入库 批量作废 导入 @@ -91,6 +90,26 @@ + + @@ -536,11 +555,65 @@ function getSyncStatusType(status: string) { 'PENDING': 'info', 'SYNCING': 'primary', 'SUCCESS': 'success', - 'FAIL': 'danger' + 'FAIL': 'danger', + 'FAILED': 'danger', } return map[status] || undefined } +function syncMessageCellClass(row: any): string { + const status = row?.sync_status + if (!status) return '' + const upper = String(status).trim().toUpperCase() + if (upper === 'FAIL' || upper === 'FAILED') return 'sync-message--fail' + if (upper === 'SUCCESS') return 'sync-message--success' + return '' +} + +function syncMessageFullText(row: any): string { + const v = row?.sync_message + if (v == null) return '' + return String(v).trim() +} + +/** 列表格内省略展示,完整内容见 tooltip,点击复制全文 */ +function syncMessageCellText(row: any): string { + const t = syncMessageFullText(row) + if (!t) return '—' + const max = 48 + return t.length > max ? `${t.slice(0, max)}…` : t +} + +async function copySyncMessage(row: any) { + const text = syncMessageFullText(row) + if (!text) { + ElMessage.warning('当前行无同步信息可复制') + return + } + try { + if (navigator.clipboard?.writeText) { + await navigator.clipboard.writeText(text) + } else { + throw new Error('no clipboard api') + } + ElMessage.success('同步信息已复制到剪贴板') + } catch { + try { + const ta = document.createElement('textarea') + ta.value = text + ta.style.position = 'fixed' + ta.style.opacity = '0' + document.body.appendChild(ta) + ta.select() + document.execCommand('copy') + document.body.removeChild(ta) + ElMessage.success('同步信息已复制到剪贴板') + } catch { + ElMessage.error('复制失败,请手动选择文本复制') + } + } +} + onMounted(() => { // 先加载筛选相关数据(例如 store options、presetTree),保证 ScanBox options 可用 loadFilterData() @@ -942,47 +1015,6 @@ async function handleReviewConfirm() { reviewSubmitting.value = false } } - -async function handleCompleteEntry() { - const targets = getActionTargetRows() - if (!targets.length) { - ElMessage.warning('请先选择一个入库单') - return - } - const confirmLabel = targets.length === 1 - ? (targets[0].entry_order_code || targets[0].id) - : `${targets.length} 个入库单` - try { - await ElMessageBox.confirm(`确定要完成入库单 ${confirmLabel} 吗?`, '确认', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'success' - }) - - loading.value = true - let successCount = 0 - for (const row of targets) { - const res = await entryApi.completeEntry({ entry_order_id: Number(row.id) }) - if (res && res.code === 200) { - successCount++ - } else { - ElMessage.error(res?.message || `入库单 ${row.entry_order_code || row.id} 操作失败`) - } - } - if (successCount > 0) { - ElMessage.success(successCount === targets.length ? '入库单操作完成' : `已完成 ${successCount}/${targets.length} 个入库单`) - loadData() - } - } catch (e) { - if (e !== 'cancel') { - console.error('完成入库单出错:', e) - ElMessage.error('操作异常') - } - } finally { - loading.value = false - } -} - function handleCreateDialogClosed() { Object.keys(createForm).forEach(key => createForm[key] = '') } @@ -1129,4 +1161,19 @@ function handleImport() { text-align: center; font-size: 14px; } + +.sync-message-cell { + cursor: pointer; + color: var(--el-color-primary); + text-decoration: none; +} +.sync-message-cell:hover { + text-decoration: underline; +} +.sync-message--fail { + color: var(--el-color-danger); +} +.sync-message--success { + color: var(--el-color-success); +} diff --git a/src/views/storage/management/replenishmentDemand/index.vue b/src/views/storage/management/replenishmentDemand/index.vue index baebea9c..cdb45961 100644 --- a/src/views/storage/management/replenishmentDemand/index.vue +++ b/src/views/storage/management/replenishmentDemand/index.vue @@ -7,57 +7,6 @@
- - - - - - - - - - - - - - - - - - - - - 查询 - 重置 - - - -
SKU总数