1
This commit is contained in:
parent
1146ed6c1d
commit
cde142f113
@ -21,7 +21,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-actions">
|
<div class="right-actions">
|
||||||
<el-tag v-if="canDirectInbound" size="small" type="success">可导入/PDA 入库</el-tag>
|
<el-tag v-if="canBatchImport" size="small" type="success">可导入/PDA 入库</el-tag>
|
||||||
<span v-if="directSummary.total_direct_inbound !== undefined" class="summary-text">
|
<span v-if="directSummary.total_direct_inbound !== undefined" class="summary-text">
|
||||||
已导入 {{ directSummary.total_direct_inbound ?? 0 }} / 计划 {{ directSummary.total_planned ?? '—' }}
|
已导入 {{ directSummary.total_direct_inbound ?? 0 }} / 计划 {{ directSummary.total_planned ?? '—' }}
|
||||||
</span>
|
</span>
|
||||||
@ -93,7 +93,6 @@ import DirectInboundImportDialog, {
|
|||||||
import {
|
import {
|
||||||
canDirectInboundOperate,
|
canDirectInboundOperate,
|
||||||
entrydetail,
|
entrydetail,
|
||||||
isPendingEntryOrderStatus,
|
|
||||||
} from '../entry-config'
|
} from '../entry-config'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@ -121,7 +120,8 @@ const pagination = reactive({
|
|||||||
|
|
||||||
const canBatchImport = computed(() => {
|
const canBatchImport = computed(() => {
|
||||||
const status = props.row?.order_status ?? entryOrderStatus.value
|
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(() => {
|
const canDirectInbound = computed(() => {
|
||||||
@ -137,7 +137,7 @@ const detailColumns = computed(() => {
|
|||||||
{ prop: 'direct_inbound_quantity', label: '已导入', width: '90', align: 'right' },
|
{ prop: 'direct_inbound_quantity', label: '已导入', width: '90', align: 'right' },
|
||||||
{ prop: 'remaining_quantity', label: '剩余可入', width: '90', align: 'right' },
|
{ prop: 'remaining_quantity', label: '剩余可入', width: '90', align: 'right' },
|
||||||
)
|
)
|
||||||
if (canDirectInbound.value) {
|
if (canBatchImport.value) {
|
||||||
columns.push({
|
columns.push({
|
||||||
prop: 'operation',
|
prop: 'operation',
|
||||||
label: '操作',
|
label: '操作',
|
||||||
@ -277,9 +277,12 @@ async function reloadAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function canImportRow(row: DirectInboundImportRow) {
|
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
|
if (!canDirectInbound.value || !row.stock_id) return false
|
||||||
const remaining = Number(row.remaining_quantity ?? 0)
|
const available = Number(row.remaining_quantity ?? row.count ?? 0)
|
||||||
return Number.isFinite(remaining) && remaining > 0
|
return Number.isFinite(available) && available > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function openImportDialog(row: DirectInboundImportRow) {
|
function openImportDialog(row: DirectInboundImportRow) {
|
||||||
@ -294,7 +297,7 @@ function openImportDialog(row: DirectInboundImportRow) {
|
|||||||
|
|
||||||
function openBatchImportDialog() {
|
function openBatchImportDialog() {
|
||||||
if (!canBatchImport.value) {
|
if (!canBatchImport.value) {
|
||||||
ElMessage.warning('仅「待入库」状态可使用批量导入')
|
ElMessage.warning('仅「已创建」状态可使用批量导入')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
importTargetItem.value = null
|
importTargetItem.value = null
|
||||||
|
|||||||
@ -170,6 +170,7 @@ export const availableFields: EntryScanFieldConfig[] = [
|
|||||||
{ label: '推送中', value: 'SYNCING' },
|
{ label: '推送中', value: 'SYNCING' },
|
||||||
{ label: '成功', value: 'SUCCESS' },
|
{ label: '成功', value: 'SUCCESS' },
|
||||||
{ label: '失败', value: 'FAIL' },
|
{ label: '失败', value: 'FAIL' },
|
||||||
|
{ label: '失败', value: 'FAILED' },
|
||||||
]
|
]
|
||||||
}) as EntryScanFieldConfig,
|
}) as EntryScanFieldConfig,
|
||||||
scanWorkflowField({
|
scanWorkflowField({
|
||||||
@ -195,6 +196,7 @@ export const entryColums = [
|
|||||||
{ prop: 'hasReceiving', label: '收货绑定', width: '100' },
|
{ prop: 'hasReceiving', label: '收货绑定', width: '100' },
|
||||||
{ prop: 'receivingBindings', label: '绑定收货单', minWidth: '180' },
|
{ prop: 'receivingBindings', label: '绑定收货单', minWidth: '180' },
|
||||||
{ prop: 'sync_status',label:'入库状态',width:'160' },
|
{ prop: 'sync_status',label:'入库状态',width:'160' },
|
||||||
|
{ prop: 'sync_message', label: '同步信息', minWidth: '220' },
|
||||||
{ prop: 'supplier_code',label:'供应商编码',width:'160' },
|
{ prop: 'supplier_code',label:'供应商编码',width:'160' },
|
||||||
{ prop: 'supplier_name',label:'供应商名称',width:'160' },
|
{ prop: 'supplier_name',label:'供应商名称',width:'160' },
|
||||||
// { prop: '',label:'',width:'160' },
|
// { prop: '',label:'',width:'160' },
|
||||||
|
|||||||
@ -19,7 +19,6 @@
|
|||||||
<div class="toolbar-left">
|
<div class="toolbar-left">
|
||||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||||
<!-- <el-button size="small" @click="handleCreateEntry">新建入库单</el-button> -->
|
<!-- <el-button size="small" @click="handleCreateEntry">新建入库单</el-button> -->
|
||||||
<el-button size="small" @click="handleCompleteEntry">完成入库</el-button>
|
|
||||||
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
|
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
|
||||||
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
|
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
|
||||||
<el-button size="small" @click="handleImport">导入</el-button>
|
<el-button size="small" @click="handleImport">导入</el-button>
|
||||||
@ -91,6 +90,26 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #column-sync_message="{ row }">
|
||||||
|
<el-tooltip
|
||||||
|
:content="syncMessageFullText(row)"
|
||||||
|
placement="top"
|
||||||
|
:disabled="!syncMessageFullText(row)"
|
||||||
|
:show-after="400"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="sync-message-cell"
|
||||||
|
:class="syncMessageCellClass(row)"
|
||||||
|
role="button"
|
||||||
|
tabindex="0"
|
||||||
|
@click.stop="copySyncMessage(row)"
|
||||||
|
@keydown.enter.prevent="copySyncMessage(row)"
|
||||||
|
>
|
||||||
|
{{ syncMessageCellText(row) }}
|
||||||
|
</span>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #column-order_create_time="{ row }">
|
<template #column-order_create_time="{ row }">
|
||||||
{{ formatTime(row.order_create_time) }}
|
{{ formatTime(row.order_create_time) }}
|
||||||
</template>
|
</template>
|
||||||
@ -536,11 +555,65 @@ function getSyncStatusType(status: string) {
|
|||||||
'PENDING': 'info',
|
'PENDING': 'info',
|
||||||
'SYNCING': 'primary',
|
'SYNCING': 'primary',
|
||||||
'SUCCESS': 'success',
|
'SUCCESS': 'success',
|
||||||
'FAIL': 'danger'
|
'FAIL': 'danger',
|
||||||
|
'FAILED': 'danger',
|
||||||
}
|
}
|
||||||
return map[status] || undefined
|
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(() => {
|
onMounted(() => {
|
||||||
// 先加载筛选相关数据(例如 store options、presetTree),保证 ScanBox options 可用
|
// 先加载筛选相关数据(例如 store options、presetTree),保证 ScanBox options 可用
|
||||||
loadFilterData()
|
loadFilterData()
|
||||||
@ -942,47 +1015,6 @@ async function handleReviewConfirm() {
|
|||||||
reviewSubmitting.value = false
|
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() {
|
function handleCreateDialogClosed() {
|
||||||
Object.keys(createForm).forEach(key => createForm[key] = '')
|
Object.keys(createForm).forEach(key => createForm[key] = '')
|
||||||
}
|
}
|
||||||
@ -1129,4 +1161,19 @@ function handleImport() {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14px;
|
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);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -7,57 +7,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <el-alert
|
|
||||||
type="info"
|
|
||||||
:closable="false"
|
|
||||||
show-icon
|
|
||||||
class="api-tip"
|
|
||||||
title="storage.management.replenishmentDemand"
|
|
||||||
description="接口自动从用户上下文获取仓库,查询参数仅支持分页(page / pageSize)与排序(sortField / sortOrder)。"
|
|
||||||
/> -->
|
|
||||||
|
|
||||||
<el-card shadow="never" class="query-card">
|
|
||||||
<el-form
|
|
||||||
ref="queryFormRef"
|
|
||||||
:model="queryForm"
|
|
||||||
:inline="true"
|
|
||||||
size="small"
|
|
||||||
label-width="88px"
|
|
||||||
class="query-form"
|
|
||||||
@submit.prevent="handleQuery"
|
|
||||||
>
|
|
||||||
<el-form-item label="每页条数">
|
|
||||||
<el-select v-model="queryForm.pageSize" style="width: 120px">
|
|
||||||
<el-option v-for="size in pageSizeOptions" :key="size" :label="`${size} 条`" :value="size" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="排序字段">
|
|
||||||
<el-select v-model="queryForm.sortField" style="width: 150px">
|
|
||||||
<el-option
|
|
||||||
v-for="item in sortFieldOptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="排序方向">
|
|
||||||
<el-select v-model="queryForm.sortOrder" style="width: 110px">
|
|
||||||
<el-option
|
|
||||||
v-for="item in sortOrderOptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" :loading="loading" @click="handleQuery">查询</el-button>
|
|
||||||
<el-button :disabled="loading" @click="handleReset">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<div class="summary-bar">
|
<div class="summary-bar">
|
||||||
<div class="summary-item">
|
<div class="summary-item">
|
||||||
<span class="summary-label">SKU总数</span>
|
<span class="summary-label">SKU总数</span>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user