This commit is contained in:
yin 2026-06-24 18:14:36 +08:00
parent 2c0d0225f1
commit 32459a98ed
31 changed files with 2774 additions and 1447 deletions

View File

@ -74,9 +74,33 @@ export type EntryDetailBinding = {
[key: string]: unknown
}
export type EntryDetailItemBarcode = {
id?: number
barcode?: string
sku_property?: string
[key: string]: unknown
}
export type EntryDetailItem = {
id?: number
stock_id?: number
external_item_code?: string
external_item_id?: number
warehouse_item_code?: string
warehouse_item_name?: string
warehouse_item_spec?: string
count?: number
received_quantity?: number
confirm_quantity?: number
warehouse_quantity?: number
warehouse_locked_quantity?: number
warehouse_is_batch_mgmt?: string
warehouse_is_shelf_life_mgmt?: string
warehouse_image_url?: string
warehouse_is_images?: number
barcodes?: EntryDetailItemBarcode[]
direct_inbound_quantity?: number
remaining_quantity?: number
/** 当前 pending 绑定的总预分配数量 */
pending_total?: number
/** 计划入库数量(= count) */
@ -163,7 +187,23 @@ export function cancelEntry(data: CancelEntryParams): Promise<CancelEntryRespons
})
}
export function completeEntry(data:any): Promise<any> {
export type CompleteEntryParams = {
/** 入库单ID */
entry_order_id: number
}
export type CompleteEntryResponse = {
code?: number
message?: string
entry_order_id?: number
order_status?: string
data?: {
entry_order_id?: number
order_status?: string
}
}
export function completeEntry(data: CompleteEntryParams): Promise<CompleteEntryResponse> {
return request({
url: '/system',
method: 'post',
@ -194,23 +234,39 @@ export function detailChange(data:any): Promise<any> {
}
export type BindReceivingDetailsBinding = {
entry_item_id: number
receiving_detail_id: number
allocated_quantity: number
}
export type BindReceivingDetailsParams = {
entry_item_id: number
/** 入库单ID */
entry_order_id: number
bindings: BindReceivingDetailsBinding[]
}
export type BindReceivingDetailsResultItem = {
entry_item_id?: number
receiving_detail_id?: number
allocated_quantity?: number
error_code?: string
message?: string
detail?: string
[key: string]: unknown
}
export type BindReceivingDetailsResponse = {
code?: number
message?: string
entry_item_id?: number
binding_count?: number
success?: BindReceivingDetailsResultItem[]
failed?: BindReceivingDetailsResultItem[]
success_count?: number
failed_count?: number
data?: {
entry_item_id?: number
binding_count?: number
success?: BindReceivingDetailsResultItem[]
failed?: BindReceivingDetailsResultItem[]
success_count?: number
failed_count?: number
}
}
@ -512,3 +568,120 @@ export function removeDirectInboundItem(
data
})
}
export type QuickInboundParams = {
/** 入库单ID */
id: number
}
export type QuickInboundResponse = {
code?: number
message?: string
id?: number
entry_order_code?: string
order_status?: string
sync_status?: string
items_count?: number
total_quantity?: number
data?: Partial<QuickInboundResponse>
}
/** 快速入库(一键完成入库单) */
export function quickInbound(data: QuickInboundParams): Promise<QuickInboundResponse> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.entry.quickInbound',
v,
timestamp: new Date().getTime()
},
data
})
}
export type ReceivingCompareMatchStatus = 'matched' | 'entry_only' | string
/** 逐行对照项(comparison 数组元素) */
export type ReceivingCompareRow = {
stock_id?: number
item_code?: string
warehouse_item_code?: string
product_code?: string
item_name?: string
product_name?: string
warehouse_item_name?: string
barcode?: string
entry_plan_qty?: number
entry_received_qty?: number
plan_qty?: number
count?: number
received_quantity?: number
receiving_qty?: number
receiving_quantity?: number
actual_quantity?: number
box_quantity?: number
match_status?: ReceivingCompareMatchStatus
[key: string]: unknown
}
/** 汇总统计(summary 对象) */
export type ReceivingCompareSummary = {
total_rows?: number
total_entry_items?: number
total_receiving_items?: number
matched_items?: number
entry_only_items?: number
receiving_only_items?: number
unmatched_items?: number
matched_count?: number
entry_only_count?: number
receiving_only_count?: number
unmatched_count?: number
total_entry_qty?: number
total_receiving_qty?: number
matched_qty?: number
entry_only_qty?: number
receiving_only_qty?: number
match_rate?: number
is_fully_matched?: boolean
fully_matched?: boolean
comparison_rows?: number
[key: string]: unknown
}
export type ReceivingCompareParams = {
/** 入库单ID */
entry_order_id: number
/** 收货单ID */
receiving_id: number
}
export type ReceivingCompareResponse = {
code?: number
message?: string
entry_order_id?: number
entry_order_code?: string
receiving_id?: number
receiving_number?: string
comparison?: ReceivingCompareRow[]
receiving_only?: ReceivingCompareRow[]
summary?: ReceivingCompareSummary
data?: Partial<Omit<ReceivingCompareResponse, 'data'>>
}
/** 入库单与收货单商品对照 */
export function receivingCompare(
data: ReceivingCompareParams
): Promise<ReceivingCompareResponse> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.entry.receivingCompare',
v,
timestamp: new Date().getTime()
},
data
})
}

View File

@ -1308,7 +1308,7 @@ defineExpose({ getConditions, reset, clear, getFieldDraft, setFieldCondition, su
.scan-tabs {
flex-shrink: 0;
border-bottom: 1px solid #e8e8e8;
border-bottom: 1px solid #ebeef5;
background: #fafafa;
}
@ -1317,13 +1317,34 @@ defineExpose({ getConditions, reset, clear, getFieldDraft, setFieldCondition, su
}
.scan-tabs :deep(.el-tabs__nav-wrap::after) {
height: 1px;
display: none;
}
.scan-tabs :deep(.el-tabs__active-bar) {
display: none;
}
.scan-tabs :deep(.el-tabs__item) {
height: 40px;
line-height: 40px;
font-size: 13px;
padding: 0 12px;
color: #606266;
border: 1px solid transparent;
border-bottom: none;
border-radius: 4px 4px 0 0;
transition: color 0.2s;
}
.scan-tabs :deep(.el-tabs__item:hover) {
color: var(--el-color-primary);
}
.scan-tabs :deep(.el-tabs__item.is-active) {
color: var(--el-color-primary);
background-color: #fff;
border-color: #ebeef5;
border-bottom-color: #fff;
}
.tab-label {

View File

@ -11,6 +11,7 @@
<div class="select-product-meta">
<span v-if="storeId">货主 ID:{{ storeId }}</span>
<span v-else>全部货主</span>
<span v-if="searchMode === 'combo'" class="select-product-meta-hint">组合搜索已展开为子商品</span>
<span>已选 {{ localSelectedItems.length }} 个</span>
</div>
@ -46,17 +47,16 @@
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="46" :reserve-selection="true" />
<template v-if="searchMode === 'combo'">
<el-table-column prop="combo_code" label="组合编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="combo_name" label="组合名称" min-width="130" show-overflow-tooltip />
<el-table-column prop="custom_code" label="自定义编码" min-width="100" show-overflow-tooltip />
<el-table-column prop="simpleNotation" label="子商品简记" min-width="120" show-overflow-tooltip />
</template>
<template v-else>
<el-table-column prop="item_code" label="商品编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="item_name" label="商品名称" min-width="130" show-overflow-tooltip />
<el-table-column prop="barcode" label="条码" min-width="100" show-overflow-tooltip />
</template>
<el-table-column prop="item_code" label="商品编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="item_name" label="商品名称" min-width="130" show-overflow-tooltip />
<el-table-column prop="barcode" label="条码" min-width="100" show-overflow-tooltip />
<el-table-column
v-if="searchMode === 'combo'"
prop="source_combo_code"
label="来源组合"
min-width="120"
show-overflow-tooltip
/>
</el-table>
<div class="select-product-pagination">
@ -74,12 +74,6 @@
<div class="selected-items-panel">
<div class="selected-items-title">已选商品</div>
<el-table :data="localSelectedItems" border size="small" max-height="160" empty-text="未选择商品">
<el-table-column label="类型" width="64">
<template #default="{ row: item }">
<el-tag v-if="item.is_combo" type="warning" size="small">组合</el-tag>
<span v-else>单品</span>
</template>
</el-table-column>
<el-table-column prop="item_code" label="编码" min-width="100" show-overflow-tooltip />
<el-table-column prop="item_name" label="名称" min-width="110" show-overflow-tooltip />
<el-table-column label="计划数量" width="100">
@ -107,11 +101,12 @@ import { nextTick, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import {
applyStockMatchToSelectedItem,
expandComboSearchResults,
findStockRowForSelectedItem,
getStockItemId,
indexStockRowsByLookupKeys,
isStockApiSuccess,
mapWarehousePickerItem,
mapStockPickerItem,
queryStockProducts,
toOrderSelectedProductItem,
type OrderSelectedProductItem,
@ -143,12 +138,13 @@ function currentWarehouseMode(): WarehouseSearchMode | undefined {
}
function tableRowKey(row: any) {
if (searchMode.value === 'combo') {
return row?.combo_id ?? row?.id ?? row?.item_id
}
return row?.item_id
}
function getPickerRowItemId(row: any): number | undefined {
return getStockItemId(row)
}
function normalizeKeyword() {
const raw = keyword.value
if (!raw) return
@ -162,6 +158,11 @@ function normalizeKeyword() {
keyword.value = normalized
}
}
function buildSelectedItemFromStock(row: any, planQty: string): SelectProductItem | null {
return toOrderSelectedProductItem(row, { planQty })
}
const defaultPlanQty = ref('1')
const allRows = ref<any[]>([])
const list = ref<any[]>([])
@ -224,10 +225,6 @@ function hasValidItemId(item: SelectProductItem) {
return Number.isInteger(itemId) && itemId > 0
}
function buildSelectedItemFromStock(row: any, planQty: string): SelectProductItem | null {
return toOrderSelectedProductItem(row, { planQty, mode: currentWarehouseMode() })
}
function enrichLocalSelectedItemsFromRows(rows: any[], mode?: WarehouseSearchMode) {
if (!localSelectedItems.value.length || !rows.length) return
@ -246,36 +243,42 @@ function needsStockMatchEnrichment(item: SelectProductItem) {
}
async function enrichLocalSelectedItems() {
enrichLocalSelectedItemsFromRows(allRows.value, currentWarehouseMode())
enrichLocalSelectedItemsFromRows(allRows.value)
const pendingItems = localSelectedItems.value.filter((item) => needsStockMatchEnrichment(item))
if (!pendingItems.length) return
const stockCodes = Array.from(new Set(
pendingItems.filter((item) => !item.is_combo).map((item) => String(item.item_code).trim()).filter(Boolean)
const codes = Array.from(new Set(
pendingItems.map((item) => String(item.item_code).trim()).filter(Boolean)
))
const comboCodes = Array.from(new Set(
pendingItems.filter((item) => item.is_combo).map((item) => String(item.item_code).trim()).filter(Boolean)
))
if (!stockCodes.length && !comboCodes.length) return
if (!codes.length) return
try {
const fetchTasks: Promise<any>[] = []
if (stockCodes.length) {
fetchTasks.push(queryStockProducts({ keyword: stockCodes.join(','), storeId: props.storeId }))
}
if (comboCodes.length) {
fetchTasks.push(queryStockProducts({ keyword: comboCodes.join(','), storeId: props.storeId, mode: 'combo' }))
}
const results = await Promise.all(fetchTasks)
for (const { res, list: rawList } of results) {
if (!isStockApiSuccess(res)) continue
const mode = rawList.some((row: any) => row?.combo_code || row?.combo_sku_id) ? 'combo' as const : undefined
const matchedRows = rawList
.map((row: any) => mapWarehousePickerItem(row, mode))
.filter((item: any) => item.item_id)
enrichLocalSelectedItemsFromRows(matchedRows, mode)
const { res, list: stockList } = await queryStockProducts({
keyword: codes.join(','),
storeId: props.storeId
})
if (isStockApiSuccess(res)) {
const matchedRows = stockList
.map((row) => mapStockPickerItem(row))
.filter((item) => getPickerRowItemId(item))
enrichLocalSelectedItemsFromRows(matchedRows)
}
const stillPending = localSelectedItems.value.filter((item) => needsStockMatchEnrichment(item))
const comboCodes = Array.from(new Set(
stillPending.map((item) => String(item.item_code).trim()).filter(Boolean)
))
if (!comboCodes.length) return
const comboResult = await queryStockProducts({
keyword: comboCodes.join(','),
storeId: props.storeId,
mode: 'combo'
})
if (!isStockApiSuccess(comboResult.res)) return
const expanded = await expandComboSearchResults(comboResult.list, { storeId: props.storeId })
enrichLocalSelectedItemsFromRows(expanded.filter((item) => getPickerRowItemId(item)))
} catch (error) {
console.error('enrich selected product names failed:', error)
}
@ -295,7 +298,16 @@ async function loadList() {
ElMessage.error(res?.message || '查询商品失败')
return
}
allRows.value = rawList.map((row) => mapWarehousePickerItem(row, mode)).filter((item: any) => item.item_id)
if (mode === 'combo') {
allRows.value = await expandComboSearchResults(rawList, { storeId: props.storeId })
if (!allRows.value.length && rawList.length) {
ElMessage.warning('组合商品未包含有效子商品')
}
} else {
allRows.value = rawList
.map((row) => mapStockPickerItem(row))
.filter((item) => getPickerRowItemId(item))
}
pagination.total = allRows.value.length
const maxPage = Math.max(1, Math.ceil(pagination.total / pagination.pageSize))
if (pagination.currentPage > maxPage) {
@ -324,7 +336,7 @@ async function syncSelectionFromLocal(releaseSync = true) {
localSelectedItems.value.filter((item) => hasValidItemId(item)).map((item) => Number(item.item_id))
)
allRows.value
.filter((item) => selectedIdSet.has(Number(item.item_id)))
.filter((item) => selectedIdSet.has(Number(getPickerRowItemId(item))))
.forEach((item) => {
table.toggleRowSelection?.(item, true)
})
@ -338,10 +350,10 @@ async function syncSelectionFromLocal(releaseSync = true) {
function applySelectedItems(selections: any[]) {
const planQty = String(defaultPlanQty.value || '').trim() || '1'
const loadedItemIds = new Set(
allRows.value.map((item) => getStockItemId(item)).filter((id): id is number => Boolean(id))
allRows.value.map((item) => getPickerRowItemId(item)).filter((id): id is number => Boolean(id))
)
const selectedIdsInTable = new Set(
(selections || []).map((item) => getStockItemId(item)).filter((id): id is number => Boolean(id))
(selections || []).map((item) => getPickerRowItemId(item)).filter((id): id is number => Boolean(id))
)
const existingQtyMap = new Map(
localSelectedItems.value.filter((item) => hasValidItemId(item)).map((item) => [Number(item.item_id), item.plan_qty])
@ -357,7 +369,7 @@ function applySelectedItems(selections: any[]) {
return selectedIdsInTable.has(Number(item.item_id))
}).map((item) => {
if (!String(item.item_name || '').trim() || !hasValidItemId(item)) {
const indexes = indexStockRowsByLookupKeys(allRows.value, currentWarehouseMode())
const indexes = indexStockRowsByLookupKeys(allRows.value)
const stockRow = findStockRowForSelectedItem(item, indexes)
if (stockRow) {
return applyStockMatchToSelectedItem(item, stockRow)
@ -452,6 +464,11 @@ function handleConfirm() {
color: #606266;
}
.select-product-meta-hint {
color: #909399;
font-size: 12px;
}
.select-product-meta--warn {
color: #e6a23c;
}

View File

@ -4,6 +4,53 @@
width: 100%;
background-color: #f0f2f5;
:deep(.scan-box-container) {
flex: 0 0 250px;
flex-shrink: 0;
height: 100%;
}
:deep(.scan-box-container .scan-tabs) {
flex-shrink: 0;
border-bottom: 1px solid #ebeef5;
background: #fafafa;
}
:deep(.scan-box-container .scan-tabs .el-tabs__header) {
margin: 0;
}
:deep(.scan-box-container .scan-tabs .el-tabs__nav-wrap::after) {
display: none;
}
:deep(.scan-box-container .scan-tabs .el-tabs__active-bar) {
display: none;
}
:deep(.scan-box-container .scan-tabs .el-tabs__item) {
height: 40px;
line-height: 40px;
font-size: 13px;
padding: 0 12px;
color: #606266;
border: 1px solid transparent;
border-bottom: none;
border-radius: 4px 4px 0 0;
transition: color 0.2s;
}
:deep(.scan-box-container .scan-tabs .el-tabs__item:hover) {
color: var(--el-color-primary);
}
:deep(.scan-box-container .scan-tabs .el-tabs__item.is-active) {
color: var(--el-color-primary);
background-color: #fff;
border-color: #ebeef5;
border-bottom-color: #fff;
}
.main-content {
flex: 1;
display: flex;
@ -98,21 +145,60 @@
.detail-header {
background-color: #fafafa;
border-bottom: 1px solid #ebeef5;
padding: 0;
padding: 0 12px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-height: 40px;
height: 42px;
min-height: 42px;
box-sizing: border-box;
.detail-tab {
flex: 1;
min-width: 0;
margin-bottom: -1px;
:deep(.el-tabs__header) {
margin: 0;
border-bottom: none;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__active-bar) {
display: none;
}
:deep(.el-tabs__item) {
height: 40px;
line-height: 40px;
font-size: 13px;
padding: 0 16px;
color: #606266;
border: 1px solid transparent;
border-bottom: none;
border-radius: 4px 4px 0 0;
transition: color 0.2s;
}
:deep(.el-tabs__item:hover) {
color: var(--el-color-primary);
}
:deep(.el-tabs__item.is-active) {
color: var(--el-color-primary);
background-color: #fff;
border-color: #ebeef5;
border-bottom-color: #fff;
}
}
.detail-header-actions {
flex: 0 0 auto;
padding-right: 12px;
padding-right: 0;
}
}

View File

@ -1,4 +1,5 @@
import { warehouseSearch } from '@/api/stock/stock'
import { mapComboGoodsItemsFromRecord } from '@/views/stock/combo_stock/combo-stock-config'
export type WarehouseSearchMode = 'combo'
@ -9,7 +10,7 @@ export type OrderSelectedProductItem = {
barcode: string
plan_qty: string
store_id?: number
/** 是否为组合商品(建单 item_id 取 combo_sku_id) */
/** 是否为组合商品(建单 item_id 优先 combo_sku_id,否则取组合 id) */
is_combo?: boolean
combo_id?: number
}
@ -62,14 +63,24 @@ export function buildWarehouseSearchRequest(options: {
return requestData
}
/** stock.warehouse.search 响应:data 为数组,total 为本次返回条数(≤50) */
/** stock.warehouse.search 响应:普通商品 data 为数组;组合商品为 { list, total } */
export function parseStockWarehouseSearch(res: any): { list: any[]; total: number } {
if (!isStockApiSuccess(res)) {
return { list: [], total: 0 }
}
const list = Array.isArray(res?.data) ? res.data : []
const total = Number(res?.total ?? list.length)
return { list, total }
const payload = res?.data ?? res
let list: any[] = []
if (Array.isArray(payload?.list)) {
list = payload.list
} else if (Array.isArray(payload)) {
list = payload
} else if (Array.isArray(res?.list)) {
list = res.list
} else if (Array.isArray(res?.data)) {
list = res.data
}
const total = Number(payload?.total ?? res?.total ?? list.length)
return { list, total: Number.isFinite(total) ? total : list.length }
}
export async function queryStockProducts(options: {
@ -93,14 +104,19 @@ export function getComboSkuId(row: any): number | undefined {
}
export function isComboStockRow(row: any): boolean {
if (row?._from_combo_expanded === true) return false
if (row?.is_combo === true) return true
if (getComboSkuId(row)) return true
return Boolean(String(row?.combo_code ?? '').trim() || String(row?.combo_name ?? '').trim())
}
function resolveComboSkuId(row: any): number | undefined {
export function resolveComboSkuId(row: any): number | undefined {
const comboSkuId = getComboSkuId(row)
if (comboSkuId) return comboSkuId
const comboId = getComboId(row)
if (comboId && (String(row?.combo_code ?? '').trim() || String(row?.combo_name ?? '').trim())) {
return comboId
}
if (row?.is_combo === true) {
const itemId = Number(row?.item_id)
if (Number.isInteger(itemId) && itemId > 0) return itemId
@ -145,6 +161,95 @@ export function mapWarehousePickerItem(row: any, mode?: WarehouseSearchMode) {
return mode === 'combo' ? mapComboPickerItem(row) : mapStockPickerItem(row)
}
/** 解析 nameNotation:【1】商品A【2】商品B */
export function parseComboNameNotation(notation: string): Map<number, string> {
const map = new Map<number, string>()
const text = String(notation || '').trim()
if (!text) return map
const regex = /【(\d+)】([^【]*)/g
let match: RegExpExecArray | null
while ((match = regex.exec(text)) !== null) {
const index = Number(match[1])
const name = String(match[2] || '').trim()
if (Number.isInteger(index) && index > 0 && name) {
map.set(index, name)
}
}
return map
}
/** 将单条组合商品记录展开为子 SKU 草稿行(待库存查询补全编码/条码) */
export function expandComboRecordToDraftRows(combo: any) {
const comboCode = getComboCode(combo)
const comboName = getComboName(combo)
const nameByIndex = parseComboNameNotation(combo?.nameNotation)
const items = mapComboGoodsItemsFromRecord(combo?.items)
if (!items.length) return []
return items.map((item, index) => {
const nameIndex = index + 1
const itemName = item.item_name
|| nameByIndex.get(nameIndex)
|| nameByIndex.get(Number(item.sort_order))
|| ''
return {
item_id: item.item_goods_sku_id,
item_code: item.item_code || String(item.item_goods_sku_id),
item_name: itemName,
barcode: item.barcode || '',
source_combo_code: comboCode,
source_combo_name: comboName,
combo_item_quantity: item.item_quantity,
_from_combo_expanded: true
}
})
}
/** 组合商品搜索结果 → 展开并补全为与普通商品一致的可选行 */
export async function expandComboSearchResults(
comboList: any[],
options: { storeId?: number } = {}
) {
const draftRows: any[] = []
for (const combo of comboList) {
if (!isComboStockRow(combo)) continue
draftRows.push(...expandComboRecordToDraftRows(combo))
}
if (!draftRows.length) return []
const skuIds = Array.from(new Set(
draftRows.map((row) => Number(row.item_id)).filter((id) => Number.isInteger(id) && id > 0)
))
const enrichById = new Map<number, ReturnType<typeof mapStockPickerItem>>()
if (skuIds.length) {
const { res, list } = await queryStockProducts({
keyword: skuIds.join(','),
storeId: options.storeId
})
if (isStockApiSuccess(res)) {
for (const row of list) {
const mapped = mapStockPickerItem(row)
if (mapped.item_id) enrichById.set(mapped.item_id, mapped)
}
}
}
return draftRows.map((draft) => {
const enriched = enrichById.get(Number(draft.item_id))
const merged = enriched
? {
...enriched,
source_combo_code: draft.source_combo_code,
source_combo_name: draft.source_combo_name,
combo_item_quantity: draft.combo_item_quantity,
_from_combo_expanded: true
}
: draft
const mapped = mapStockPickerItem(merged)
return mapped.item_id ? mapped : null
}).filter((row): row is ReturnType<typeof mapStockPickerItem> => row != null)
}
export function comboRowMatchesKeyword(row: any, keyword: string) {
const normalized = String(keyword || '').trim().toLowerCase()
if (!normalized) return false
@ -394,6 +499,8 @@ export function indexStockRowsByLookupKeys(rows: any[], mode?: WarehouseSearchMo
if (itemId) byId.set(itemId, mapped)
if (itemCode) byCode.set(itemCode, mapped)
if (mode === 'combo') {
const comboId = getComboId(mapped)
if (comboId && comboId !== itemId) byId.set(comboId, mapped)
const customCode = String(mapped?.custom_code ?? '').trim()
if (customCode) byCode.set(customCode, mapped)
} else {

View File

@ -3,9 +3,9 @@
<scan-box
ref="scanBox"
:cache-key="props.scanBoxCacheKey"
:width="waveScanBoxConfig.width"
:tree-props="waveScanBoxConfig.treeProps"
:auto-submit="waveScanBoxConfig.autoSubmit"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@ -853,7 +853,6 @@ import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import {
waveScanBoxConfig,
waveUpperTableDefaults,
waveAvailableFields,
fallbackOrderAvailableFields,

View File

@ -3,9 +3,9 @@
<scan-box
ref="scanBox"
:cache-key="props.scanBoxCacheKey"
:width="waveScanBoxConfig.width"
:tree-props="waveScanBoxConfig.treeProps"
:auto-submit="waveScanBoxConfig.autoSubmit"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@ -450,7 +450,6 @@ import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import {
waveScanBoxConfig,
waveUpperTableDefaults,
waveAvailableFields,
waveBatchColumns,

View File

@ -3,11 +3,11 @@
<scan-box
ref="scanBox"
:cache-key="props.scanBoxCacheKey"
:width="waveScanBoxConfig.width"
:tree-props="waveScanBoxConfig.treeProps"
:auto-submit="waveScanBoxConfig.autoSubmit"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="pickTaskWaveAvailableFields"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
@ -266,7 +266,6 @@ import {
type WavePickTaskListItem
} from '@/api/order.wave/orderwave'
import {
waveScanBoxConfig,
pickTaskWaveAvailableFields,
pickTaskWaveListDefaults,
pickTaskWavePaginationDefaults,
@ -297,6 +296,7 @@ const list = ref<Array<Record<string, any>>>([])
const emptyText = ref(pickTaskWaveListDefaults.emptyText)
const scanBox = ref<any>(null)
const presetTree = ref<unknown[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(pickTaskWaveAvailableFields)))
const queryTime = ref(0)
const cancelingTaskId = ref<number | string | null>(null)
const batchCancelLoading = ref(false)

View File

@ -4,9 +4,11 @@
<template v-else>
<div class="section">
<div class="section-title">基础信息</div>
<el-descriptions :column="4" border size="small">
<el-descriptions :column="4" border size="small" class="detail-descriptions">
<el-descriptions-item label="波次编号">{{ getWaveCode(row) }}</el-descriptions-item>
<el-descriptions-item label="波次类型">{{ getWaveTypeText(row) }}</el-descriptions-item>
<el-descriptions-item label="波次类型">
<el-tag size="small" type="info">{{ getWaveTypeText(row) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag size="small" :type="getStatusTagType(row)">{{ getStatusText(row) }}</el-tag>
</el-descriptions-item>
@ -20,11 +22,27 @@
<div class="section">
<div class="section-title">分配状态</div>
<el-descriptions :column="3" border size="small">
<el-descriptions-item label="库位分配状态">{{ getStorageAssignmentStatusText(row) }}</el-descriptions-item>
<el-descriptions-item label="快递分配状态">{{ formatWaveExpressAssignmentStatusLabel(row.express_assignment_status) }}</el-descriptions-item>
<el-descriptions-item label="打印分配状态">{{ formatWavePrintAssignmentStatusLabel(row.print_assignment_status) }}</el-descriptions-item>
<el-descriptions-item label="复核状态">{{ formatWaveReviewAssignmentStatusLabel(row.review_assignment_status) }}</el-descriptions-item>
<el-descriptions :column="3" border size="small" class="detail-descriptions">
<el-descriptions-item label="库位分配状态">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(getStorageAssignmentStatusText(row))">
{{ getStorageAssignmentStatusText(row) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="快递分配状态">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(row.express_assignment_status)">
{{ formatWaveExpressAssignmentStatusLabel(row.express_assignment_status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="打印分配状态">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(row.print_assignment_status)">
{{ formatWavePrintAssignmentStatusLabel(row.print_assignment_status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="复核状态">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(row.review_assignment_status)">
{{ formatWaveReviewAssignmentStatusLabel(row.review_assignment_status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="未复核订单数">{{ row.unreviewed_order_count ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="库位分配异常" :span="3">{{ getStorageAssignmentError(row) }}</el-descriptions-item>
</el-descriptions>
@ -32,7 +50,7 @@
<div class="section">
<div class="section-title">结构与订单信息</div>
<el-descriptions :column="2" border size="small">
<el-descriptions :column="2" border size="small" class="detail-descriptions">
<el-descriptions-item label="商品结构快照" :span="2">{{ getItemSnapshotText(row) }}</el-descriptions-item>
<el-descriptions-item label="订单信息" :span="2">{{ getOrderInfoSummary(row) }}</el-descriptions-item>
<el-descriptions-item label="订单列表" :span="2">{{ getOrderListPreview(row) }}</el-descriptions-item>
@ -53,7 +71,8 @@ import {
waveTypeTextMap,
formatWaveExpressAssignmentStatusLabel,
formatWavePrintAssignmentStatusLabel,
formatWaveReviewAssignmentStatusLabel
formatWaveReviewAssignmentStatusLabel,
getWaveAssignmentAggregateTagType
} from '../config/wave-config'
defineProps<{
@ -216,6 +235,17 @@ function formatDateTime(value: string | number | null | undefined) {
font-weight: 600;
}
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
.empty-tip {
height: 100%;
display: flex;

View File

@ -1,6 +1,7 @@
import {
buyerMessageHasFilterOptions,
scanBasicField,
scanWorkflowField,
type ToolbarButtonConfig
} from '@/views/order/orderManagement/config/order-common-config'
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
@ -13,7 +14,7 @@ import {
parseOrderListResponse
} from '@/views/order/orderManagement/utils/order-index-helpers'
/** ScanBox 筛选字段分组(波次模块专用) */
/** ScanBox 筛选字段分组(波次模块专用,策略/散单候选等页仍可使用) */
export const WAVE_SCAN_FIELD_GROUPS = {
wave: '波次信息',
process: '流程状态',
@ -36,6 +37,22 @@ export function waveScanField<G extends WaveScanFieldGroupKey>(
return { ...field, group: WAVE_SCAN_FIELD_GROUPS[group] }
}
/** 波次列表 ScanBox:基础信息分组(对齐待处理订单「订单基础信息」排版) */
export const WAVE_SCAN_BASIC_INFO_GROUP = '波次基础信息'
/** 拣货任务 ScanBox:基础信息分组 */
export const PICK_TASK_SCAN_BASIC_INFO_GROUP = '任务基础信息'
/** 波次列表 ScanBox 基础信息字段 */
export function waveScanBasicField(field: Record<string, any>) {
return { ...field, group: WAVE_SCAN_BASIC_INFO_GROUP }
}
/** 拣货任务 ScanBox 基础信息字段 */
export function pickTaskScanBasicField(field: Record<string, any>) {
return { ...field, group: PICK_TASK_SCAN_BASIC_INFO_GROUP }
}
/** 工具栏按钮:可限定仅在对应波次页签显示(1 团购 / 2 散单) */
export type WaveToolbarButtonConfig = ToolbarButtonConfig & {
onlyForWaveType?: 1 | 2
@ -61,10 +78,11 @@ export const waveUpperTableDefaults = {
emptyText: '暂无波次数据'
}
/** 左侧筛选可用字段 */
/** 左侧筛选可用字段(基础信息在前,流程状态在后;流程字段以 label 独立分组,对齐待处理订单 ScanBox) */
export const waveAvailableFields = [
waveScanField('wave', { label: '波次号', value: 'wave_no', type: 'text' }),
waveScanField('wave', {
// 波次基础信息
waveScanBasicField({ label: '波次号', value: 'wave_no', type: 'text' }),
waveScanBasicField({
label: '波次类型',
value: 'wave_type',
type: 'select',
@ -73,7 +91,7 @@ export const waveAvailableFields = [
{ label: '散单', value: 2 }
]
}),
waveScanField('wave', {
waveScanBasicField({
label: '波次状态',
value: 'wave_status',
type: 'select',
@ -82,7 +100,7 @@ export const waveAvailableFields = [
{ label: '已就绪', value: 1 }
]
}),
waveScanField('wave', {
waveScanBasicField({
label: '区分快递',
value: 'distinguish_express',
type: 'select',
@ -91,7 +109,14 @@ export const waveAvailableFields = [
{ label: '否', value: 0 }
]
}),
waveScanField('process', {
waveScanBasicField({ label: '快递', value: 'logistics_name', type: 'text' }),
waveScanBasicField({ label: '创建人', value: 'creator', type: 'text' }),
waveScanBasicField({ label: '最小订单数', value: 'total_orders_min', type: 'number' }),
waveScanBasicField({ label: '最大订单数', value: 'total_orders_max', type: 'number' }),
waveScanBasicField({ label: '最小已处理订单', value: 'processed_orders_min', type: 'number' }),
waveScanBasicField({ label: '最大已处理订单', value: 'processed_orders_max', type: 'number' }),
// 流程状态(按作业顺序,每项独立分组)
scanWorkflowField({
label: '库位分配',
value: 'storage_assignment_status',
type: 'select',
@ -100,7 +125,7 @@ export const waveAvailableFields = [
{ label: '已分配', value: '已分配' },
]
}),
waveScanField('process', {
scanWorkflowField({
label: '快递分配',
value: 'express_assignment_status',
type: 'select',
@ -109,7 +134,7 @@ export const waveAvailableFields = [
{ label: '已分配', value: 'assigned' },
]
}),
waveScanField('process', {
scanWorkflowField({
label: '打印状态',
value: 'print_assignment_status',
type: 'select',
@ -118,7 +143,7 @@ export const waveAvailableFields = [
{ label: '已打印', value: 'printed' },
]
}),
waveScanField('process', {
scanWorkflowField({
label: '复核状态',
value: 'review_assignment_status',
type: 'select',
@ -127,12 +152,6 @@ export const waveAvailableFields = [
{ label: '已复核', value: 'reviewed' },
]
}),
waveScanField('logistics', { label: '快递', value: 'logistics_name', type: 'text' }),
waveScanField('person', { label: '创建人', value: 'creator', type: 'text' }),
waveScanField('stats', { label: '最小订单数', value: 'total_orders_min', type: 'number' }),
waveScanField('stats', { label: '最大订单数', value: 'total_orders_max', type: 'number' }),
waveScanField('stats', { label: '最小已处理订单', value: 'processed_orders_min', type: 'number' }),
waveScanField('stats', { label: '最大已处理订单', value: 'processed_orders_max', type: 'number' }),
]
/** 抓取散单候选:左侧筛选可用字段 */
@ -783,7 +802,7 @@ export const waveBooleanOptions = [
]
// ---------------------------------------------------------------------------
// 拣货中任务页(pickTaskWave):与散单页共用 waveScanBoxConfig;筛选字段见 pickTaskWaveAvailableFields
// 拣货中任务页(pickTaskWave):ScanBox 排版对齐待处理订单;筛选字段见 pickTaskWaveAvailableFields
// ---------------------------------------------------------------------------
/** 列表与工具栏文案 */
@ -867,16 +886,19 @@ export const pickTaskStatusFilterOptions = [
{ label: '已取消', value: 9 }
] as const
/** 左侧筛选字段(与 order.wave.wavePickTaskList 入参对应) */
/** 左侧筛选字段(与 order.wave.wavePickTaskList 入参对应;基础信息在前,流程状态在后) */
export const pickTaskWaveAvailableFields = [
waveScanField('task', { label: '任务编号', value: 'task_no', type: 'text' }),
waveScanField('status', {
// 任务基础信息
pickTaskScanBasicField({ label: '任务编号', value: 'task_no', type: 'text' }),
pickTaskScanBasicField({ label: '开始时间', value: 'start_time_range', type: 'daterange' }),
// 流程状态(每项独立分组)
scanWorkflowField({
label: '任务状态',
value: 'status',
type: 'multiple',
options: [...pickTaskStatusFilterOptions]
}),
waveScanField('status', {
scanWorkflowField({
label: '复核状态',
value: 'review_status',
type: 'select',
@ -888,7 +910,7 @@ export const pickTaskWaveAvailableFields = [
{ label: '复核异常', value: 4 }
]
}),
waveScanField('status', {
scanWorkflowField({
label: '拣货模式',
value: 'pick_mode',
type: 'select',
@ -900,7 +922,7 @@ export const pickTaskWaveAvailableFields = [
{ label: '大团购', value: 5 }
]
}),
waveScanField('status', {
scanWorkflowField({
label: '来源',
value: 'source',
type: 'select',
@ -910,7 +932,6 @@ export const pickTaskWaveAvailableFields = [
{ label: '后台', value: 2 }
]
}),
waveScanField('time', { label: '开始时间', value: 'start_time_range', type: 'daterange' }),
]
export function formatPickTaskStatus(value: unknown): string {

View File

@ -95,7 +95,7 @@ export const comboGoodsScanFields = [
type: 'text',
placeholder: '模糊匹配',
operators: ['contains', 'like'],
defaultOperator: 'contains'
defaultOperator: 'like'
},
{
value: 'status',

View File

@ -1,7 +1,8 @@
<template>
<div class="combo-stock-container" :style="{ height: containerHeight }">
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
cache-key="stock-combo-goods"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
@ -247,55 +248,12 @@ onMounted(() => {
</script>
<style lang="scss" scoped>
.combo-stock-container {
display: flex;
width: 100%;
background-color: #f0f2f5;
@use "../../order/orderManagement/styles/order-sub.scss";
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
min-width: 0;
}
.toolbar {
padding: 5px 8px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
flex-wrap: wrap;
background-color: #fff;
flex-shrink: 0;
}
.toolbar-left,
.toolbar-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.upper-wrapper {
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
}
.empty-tip {
text-align: center;
font-size: 13px;
color: #909399;
padding: 16px;
}
.empty-tip {
text-align: center;
font-size: 13px;
color: #909399;
padding: 16px;
}
</style>

View File

@ -1,11 +1,11 @@
<template>
<div class="stock-index-container">
<!-- 筛选区域 -->
<div class="order-sub-container">
<scan-box
ref="scanBox"
:width="stockScanBoxConfig.width"
:tree-props="stockScanBoxConfig.treeProps"
:auto-submit="stockScanBoxConfig.autoSubmit"
cache-key="stock-management-warehouse"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFields"
@condition-change="handleConditionChange"
@ -120,9 +120,9 @@
/>
<!-- 下层详情区域 -->
<div class="lower-level" v-if="currentStockId" :class="tableSize" :style="lowerPaneStyle">
<div v-if="currentStockId" class="lower-level" :class="tableSize" :style="lowerPaneStyle">
<div class="detail-header">
<el-tabs v-model="activeTab" @tab-change="handleTabChange" class="detail-tab">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="商品明细" name="info" />
<el-tab-pane label="图片" name="images" />
<el-tab-pane label="条码" name="barcode" />
@ -133,8 +133,8 @@
</div>
<div class="detail-container">
<keep-alive>
<div class="detail-component-wrapper">
<KeepAlive>
<div class="detail-page order-detail-wrapper">
<component
:is="activeComponent"
:id="currentStockId"
@ -142,13 +142,12 @@
@refresh="handleRefresh"
/>
</div>
</keep-alive>
</KeepAlive>
</div>
</div>
<div class="no-selection" v-else :style="lowerPaneStyle">
<div v-else class="no-selection" :style="lowerPaneStyle">
<div class="empty-tip">
<el-icon><InfoFilled /></el-icon>
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
@ -219,7 +218,7 @@
import { ref, reactive, computed, onMounted, shallowRef, markRaw } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
DeleteFilled, ArrowDown, User, InfoFilled
DeleteFilled, ArrowDown, User
} from '@element-plus/icons-vue'
// Components
@ -238,7 +237,7 @@ import Recycle from './component/recycle.vue'
import ImportDialog from './component/ImportDialog.vue'
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
import { stockColumns, availableFields as stockAvailableFields, stockBatchConfig, stockToolbarButtons, stockScanBoxConfig } from './stock-config'
import { stockColumns, availableFields as stockAvailableFields, stockBatchConfig, stockToolbarButtons } from './stock-config'
// API
import * as stockApi from '@/api/stock/stock'
@ -259,7 +258,6 @@ const hasPermission = (perm: string) => {
}
// Refs
const scanBoxRef = ref()
const accountTableRef = ref()
// 批量修改对话框状态
const showBatchDialog = ref(false)
@ -360,7 +358,7 @@ async function handleExportItem() {
const tableSize = ref('small')
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
defaultLowerPercent: 40
defaultLowerPercent: 38
})
const upperPaneFullStyle = computed(() => ({
flex: '1 1 auto',
@ -719,10 +717,6 @@ const handleImportSuccess = () => {
loadData()
}
const handleTabChange = () => {
//
}
const openImportDialog = () => { importDialogVisible.value = true }
onMounted(async () => {
@ -780,135 +774,37 @@ const loadStockUnits = async () => {
</script>
<style scoped lang="scss">
.stock-index-container {
display: flex;
height: calc(100vh - 130px);
width: 100%;
background-color: #f0f2f5;
@use "../../order/orderManagement/styles/order-sub.scss";
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
.order-sub-container .main-content .lower-level .detail-container {
padding: 10px;
overflow: auto;
}
.toolbar {
margin-bottom: 3px;
padding: 6px 10px;
border: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
min-width: 0;
overflow: hidden;
.empty-tip {
text-align: center;
font-size: 13px;
line-height: 1.5;
}
.toolbar-left {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 10px;
overflow: hidden;
}
.detail-page {
height: 100%;
overflow-x: hidden;
overflow-y: auto;
}
.toolbar-right {
flex: 0 0 auto;
margin-left: 10px;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
}
}
.order-detail-wrapper {
height: 100%;
}
.upper-wrapper {
/* 高度占比由 :style(upperPaneStyle / upperPaneFullStyle)控制 */
overflow: hidden;
}
.custom-empty {
text-align: center;
color: #909399;
padding: 40px 0;
/* upper-table-container 已在组件内支持弹性高度,此处确保撑满 upper-wrapper */
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
}
.split-stack {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.pane-resizer {
flex: 0 0 6px;
min-height: 6px;
background: #e4e7ed;
cursor: row-resize;
flex-shrink: 0;
position: relative;
z-index: 2;
&:hover {
background: #dcdfe6;
}
}
.lower-level {
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
background-color: #fafafa;
.detail-tab {
margin-bottom: -1px;
:deep(.el-tabs__header) {
margin: 0;
}
:deep(.el-tabs__item) {
height: 32px;
line-height: 32px;
font-size: 13px;
}
:deep(.el-tabs__nav-wrap::after) {
height: 1px;
}
}
}
.detail-container {
flex: 1;
overflow: auto;
padding: 5px;
}
}
.no-selection {
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip {
text-align: center;
font-size: 14px;
.el-icon {
font-size: 48px;
margin-bottom: 10px;
}
}
}
.el-icon {
font-size: 48px;
margin-bottom: 10px;
}
}
</style>

View File

@ -1,6 +1,9 @@
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import {
scanWorkflowField,
type ToolbarButtonConfig
} from '@/views/order/orderManagement/config/order-common-config'
/** ScanBox 筛选字段分组(商品模块专用) */
/** ScanBox 筛选字段分组(商品模块专用,保留供其他场景复用) */
export const STOCK_SCAN_FIELD_GROUPS = {
owner: '货主信息',
product: '商品标识',
@ -22,6 +25,14 @@ export function stockScanField<G extends StockScanFieldGroupKey>(
return { ...field, group: STOCK_SCAN_FIELD_GROUPS[group] }
}
/** 商品列表 ScanBox:基础信息分组(对齐团购波次「波次基础信息」排版) */
export const STOCK_SCAN_BASIC_INFO_GROUP = '基础信息'
/** 商品列表 ScanBox 基础信息字段 */
export function stockScanBasicField(field: Record<string, any>) {
return { ...field, group: STOCK_SCAN_BASIC_INFO_GROUP }
}
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
export const stockScanBoxConfig = {
width: '250px',
@ -237,9 +248,10 @@ export const stockColumns = [
},
]
// ScanBox 可用筛选字段(含分组标签,与波次管理 scan-box 样式一致)
// ScanBox 可用筛选字段(基础信息在前,流程/状态字段在后;对齐团购波次 ScanBox 分组)
export const availableFields = [
stockScanField('owner', {
// 基础信息
stockScanBasicField({
value: 'store_id',
label: '货主',
type: 'select',
@ -247,7 +259,7 @@ export const availableFields = [
filterable: true,
options: [],
}),
stockScanField('owner', {
stockScanBasicField({
value: 'stock_unit',
label: '库存单位',
type: 'select',
@ -258,64 +270,64 @@ export const availableFields = [
],
required: false
}),
stockScanField('product', {
stockScanBasicField({
value: 'barcode',
label: '条码',
type: 'text',
placeholder: '请输入商品条码',
operators: ['contains'],
defaultOperator: 'contains'
operators: ['eq', 'contains'],
defaultOperator: 'eq'
}),
stockScanField('product', {
stockScanBasicField({
value: 'id',
label: 'SKU',
type: 'text',
placeholder: '请输入SKU',
operators: ['contains'],
defaultOperator: 'contains'
operators: ['eq', 'contains'],
defaultOperator: 'eq'
}),
stockScanField('product', {
stockScanBasicField({
value: 'item_code',
label: '商品编码',
type: 'text',
placeholder: '请输入商品编码',
operators: ['eq', 'ne', 'contains', 'startswith', 'endswith'],
defaultOperator: 'contains'
defaultOperator: 'eq'
}),
stockScanField('product', {
stockScanBasicField({
value: 'goods_code',
label: '货物编码',
type: 'text',
placeholder: '请输入货物编码',
operators: ['eq', 'ne', 'contains'],
defaultOperator: 'contains'
defaultOperator: 'eq'
}),
stockScanField('info', {
stockScanBasicField({
value: 'item_name',
label: '商品名称',
type: 'text',
placeholder: '请输入商品名称',
operators: ['eq', 'ne', 'contains'],
defaultOperator: 'contains',
defaultOperator: 'eq',
required: false
}),
stockScanField('info', {
stockScanBasicField({
value: 'brand_name',
label: '品牌',
type: 'text',
placeholder: '请输入品牌',
operators: ['eq', 'ne', 'contains', 'startswith', 'endswith'],
defaultOperator: 'contains'
defaultOperator: 'eq'
}),
stockScanField('info', {
stockScanBasicField({
value: 'sku_property',
label: 'SKU规格',
type: 'text',
placeholder: '请输入SKU规格',
operators: ['eq', 'ne', 'contains'],
defaultOperator: 'contains'
defaultOperator: 'eq'
}),
stockScanField('attribute', {
stockScanBasicField({
value: 'prohibited_type',
label: '违禁品类型',
type: 'select',
@ -323,18 +335,18 @@ export const availableFields = [
filterable: true,
options: [],
}),
stockScanField('attribute', {
stockScanBasicField({
value: 'is_images',
label: '是否有图片',
type: 'boolean',
}),
stockScanField('attribute', {
stockScanBasicField({
value: 'has_bound_item',
label: '外部商品绑定',
type: 'boolean',
placeholder: '请选择是否已绑定外部商品'
}),
stockScanField('attribute', {
stockScanBasicField({
value: 'level',
label: 'ABC分类',
type: 'select',
@ -345,41 +357,7 @@ export const availableFields = [
{ value: 'C', label: 'C类' }
],
}),
stockScanField('inventory', {
value: 'quantity',
label: '库存数量',
type: 'number',
placeholder: '请输入库存数量',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between'],
defaultOperator: 'ge'
}),
stockScanField('inventory', {
value: 'locked_quantity',
label: '锁定量',
type: 'number',
placeholder: '请输入锁定量',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le'],
defaultOperator: 'eq'
}),
stockScanField('management', {
value: 'is_sn_mgmt',
label: '序列号管理',
type: 'boolean',
placeholder: '请选择是否序列号管理'
}),
stockScanField('management', {
value: 'is_shelf_life_mgmt',
label: '保质期管理',
type: 'boolean',
placeholder: '请选择是否保质期管理'
}),
stockScanField('management', {
value: 'is_batch_mgmt',
label: '批次管理',
type: 'boolean',
placeholder: '请选择是否批次管理'
}),
stockScanField('price', {
stockScanBasicField({
value: 'tag_price',
label: '标价',
type: 'number',
@ -387,7 +365,7 @@ export const availableFields = [
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between'],
defaultOperator: 'between'
}),
stockScanField('price', {
stockScanBasicField({
value: 'retail_price',
label: '零售价',
type: 'number',
@ -395,7 +373,7 @@ export const availableFields = [
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between'],
defaultOperator: 'between'
}),
stockScanField('price', {
stockScanBasicField({
value: 'length',
label: '长度',
type: 'number',
@ -403,20 +381,55 @@ export const availableFields = [
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le'],
defaultOperator: 'gt'
}),
stockScanField('time', {
stockScanBasicField({
value: 'create_at',
label: '创建时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
stockScanField('time', {
stockScanBasicField({
value: 'update_at',
label: '更新时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
// 流程/状态(每项独立分组,对齐团购波次 scanWorkflowField 排版)
scanWorkflowField({
value: 'quantity',
label: '库存数量',
type: 'number',
placeholder: '请输入库存数量',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between'],
defaultOperator: 'ge'
}),
scanWorkflowField({
value: 'locked_quantity',
label: '锁定量',
type: 'number',
placeholder: '请输入锁定量',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le'],
defaultOperator: 'eq'
}),
scanWorkflowField({
value: 'is_sn_mgmt',
label: '序列号管理',
type: 'boolean',
placeholder: '请选择是否序列号管理'
}),
scanWorkflowField({
value: 'is_shelf_life_mgmt',
label: '保质期管理',
type: 'boolean',
placeholder: '请选择是否保质期管理'
}),
scanWorkflowField({
value: 'is_batch_mgmt',
label: '批次管理',
type: 'boolean',
placeholder: '请选择是否批次管理'
}),
]
// 批量操作配置

View File

@ -102,7 +102,10 @@
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { bindReceivingDetails } from '@/api/storage.entry/entry'
import {
bindReceivingDetails,
type BindReceivingDetailsBinding,
} from '@/api/storage.entry/entry'
import {
getAvailableInboundQuantity,
type AvailableInboundQuantityItem,
@ -122,6 +125,7 @@ export type EntryDetailBindRow = {
const props = defineProps<{
modelValue: boolean
entryItem: EntryDetailBindRow | null
entryOrderId?: string | number
}>()
const emit = defineEmits<{
@ -221,8 +225,8 @@ async function loadReceivingList() {
}
}
function buildBindings() {
const bindings: Array<{ receiving_detail_id: number; allocated_quantity: number }> = []
function buildBindings(entryItemId: number): BindReceivingDetailsBinding[] {
const bindings: BindReceivingDetailsBinding[] = []
for (const row of receivingList.value) {
const detailId = Number(row.detail_id)
const allocated = Number(allocationMap[detailId] || 0)
@ -234,6 +238,7 @@ function buildBindings() {
)
}
bindings.push({
entry_item_id: entryItemId,
receiving_detail_id: detailId,
allocated_quantity: Math.floor(allocated),
})
@ -247,17 +252,24 @@ function buildBindings() {
}
async function handleSubmit() {
const entryOrderId = Number(props.entryOrderId)
if (!Number.isFinite(entryOrderId) || entryOrderId <= 0) {
ElMessage.warning('入库单 ID 无效,无法绑定')
return
}
const entryItemId = Number(props.entryItem?.id)
if (!Number.isFinite(entryItemId) || entryItemId <= 0) {
ElMessage.warning('入库明细 ID 无效,无法绑定')
return
}
let bindings: Array<{ receiving_detail_id: number; allocated_quantity: number }> = []
let bindings: BindReceivingDetailsBinding[] = []
try {
bindings = buildBindings()
} catch (error: any) {
ElMessage.warning(error?.message || '分配数量填写有误')
bindings = buildBindings(entryItemId)
} catch (error: unknown) {
const message = error instanceof Error ? error.message : '分配数量填写有误'
ElMessage.warning(message)
return
}
@ -269,14 +281,14 @@ async function handleSubmit() {
submitting.value = true
try {
const res = await bindReceivingDetails({
entry_item_id: entryItemId,
entry_order_id: entryOrderId,
bindings,
})
if (!isApiSuccess(res)) {
ElMessage.error(res?.message || '绑定收货明细失败')
return
}
const bindingCount = res?.binding_count ?? res?.data?.binding_count ?? bindings.length
const bindingCount = res?.success_count ?? res?.data?.success_count ?? bindings.length
ElMessage.success(`绑定成功,共 ${bindingCount} 条`)
visible.value = false
emit('success')

View File

@ -0,0 +1,326 @@
<template>
<div class="quick-inbound-form">
<!-- <el-alert
type="warning"
:closable="false"
show-icon
class="intro-alert"
title="快捷直入(虚拟入库)"
description="将入库单所有商品按明细数量一键直入到虚拟库位(space_id=2),跳过收货/质检流程,入库单状态变为「已完成」。仅支持「已创建」状态的入库单。"
/> -->
<el-form :model="form" label-width="100px" size="small" class="info-form">
<el-row :gutter="16">
<el-col
v-for="field in quickInboundFormFields"
:key="field.prop"
:span="field.span ?? 12"
>
<el-form-item :label="field.label">
<template v-if="field.type === 'select'">
<el-select
v-model="(form as Record<string, unknown>)[field.prop]"
disabled
style="width: 100%"
>
<el-option
v-for="item in getFieldOptions(field.prop)"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<el-input
v-else
v-model="(form as Record<string, unknown>)[field.prop]"
disabled
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- <div v-if="!eligible" class="status-hint">
<el-tag type="danger" size="small">
当前状态「{{ formatEntryOrderStatus(form.order_status) }}」不可快捷直入
</el-tag>
<span class="hint-text">仅「已创建」状态允许操作</span>
</div>
<div class="preview-section">
<div class="section-title">入库明细预览(按应收数量直入)</div>
<el-table
v-loading="detailLoading"
:data="previewItems"
size="small"
border
max-height="240"
empty-text="暂无明细数据"
>
<el-table-column
v-for="col in quickInboundPreviewColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align"
/>
</el-table>
<div v-if="previewSummary.totalPlanned > 0" class="preview-summary">
共 {{ previewSummary.itemCount }} 种商品,合计 {{ previewSummary.totalPlanned }} 件将直入虚拟库位
</div>
</div>
<div v-if="lastResult" class="result-section">
<div class="section-title">执行结果</div>
<el-descriptions :column="2" size="small" border>
<el-descriptions-item label="入库单号">{{ lastResult.entry_order_code || '—' }}</el-descriptions-item>
<el-descriptions-item label="订单状态">
<el-tag size="small" type="success">{{ formatEntryOrderStatus(lastResult.order_status) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="同步状态">
<el-tag size="small" type="success">{{ translateEntryField('sync_status', lastResult.sync_status) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="入库种类">{{ lastResult.items_count ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="入库总量" :span="2">{{ lastResult.total_quantity ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<div v-if="showActions" class="form-actions">
<el-button v-if="!embedded" size="small" @click="emit('cancel')">取消</el-button>
<el-button
type="success"
size="small"
:disabled="!eligible || !entryId"
:loading="submitLoading"
@click="handleSubmit"
>
确认快捷直入
</el-button>
</div> -->
</div>
</template>
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import * as entryApi from '@/api/storage.entry/entry'
import type { QuickInboundResponse } from '@/api/storage.entry/entry'
import {
availableFields,
canQuickInbound,
formatEntryOrderStatus,
quickInboundFormFields,
quickInboundPreviewColumns,
translateEntryField,
} from '../entry-config'
const props = withDefaults(
defineProps<{
id?: string | number | null
row?: Record<string, unknown> | null
/** 嵌入详情 Tab 时不显示取消按钮 */
embedded?: boolean
/** 是否显示底部操作区 */
showActions?: boolean
}>(),
{
embedded: false,
showActions: true,
}
)
const emit = defineEmits<{
success: [result: QuickInboundResponse]
cancel: []
}>()
const form = reactive<Record<string, unknown>>({
id: '',
entry_order_code: '',
store_name: '',
order_type: '',
order_status: '',
total_order_lines: '',
source_type: '',
remark: '',
})
const previewItems = ref<Record<string, unknown>[]>([])
const detailLoading = ref(false)
const submitLoading = ref(false)
const lastResult = ref<QuickInboundResponse | null>(null)
const entryId = computed(() => {
const raw = props.id ?? form.id
if (raw === null || raw === undefined || raw === '') return null
const num = Number(raw)
return Number.isFinite(num) ? num : null
})
const eligible = computed(() => canQuickInbound(form.order_status))
const previewSummary = computed(() => {
let totalPlanned = 0
previewItems.value.forEach((item) => {
const count = Number(item.count ?? 0)
if (Number.isFinite(count)) totalPlanned += count
})
return {
itemCount: previewItems.value.length,
totalPlanned,
}
})
function getFieldOptions(prop: string) {
return availableFields.find((f) => f.value === prop)?.options || []
}
function syncFormFromRow(row: Record<string, unknown> | null | undefined) {
if (!row) return
quickInboundFormFields.forEach((field) => {
const val = row[field.prop]
form[field.prop] = val === null || val === undefined ? '' : val
})
if (props.id != null) {
form.id = props.id
}
}
async function loadPreviewItems() {
if (!entryId.value) {
previewItems.value = []
return
}
detailLoading.value = true
try {
const res = await entryApi.getEntryDetail({ id: entryId.value })
if (res?.code === 200 && res.data?.entryOrder) {
const entryOrder = res.data.entryOrder
form.order_status = entryOrder.order_status ?? form.order_status
form.entry_order_code = entryOrder.entry_order_code ?? form.entry_order_code
form.store_name = entryOrder.store_name ?? form.store_name
previewItems.value = (entryOrder.items || []).map((item) => ({ ...item }))
} else {
previewItems.value = []
}
} catch (error) {
console.error('加载入库明细失败:', error)
previewItems.value = []
} finally {
detailLoading.value = false
}
}
async function handleSubmit() {
if (!entryId.value) {
ElMessage.warning('缺少入库单 ID')
return
}
if (!eligible.value) {
ElMessage.warning('仅「已创建」状态的入库单可执行快捷直入')
return
}
const code = String(form.entry_order_code || entryId.value)
try {
await ElMessageBox.confirm(
`确定对入库单「${code}」执行快捷直入吗?\n所有商品将按明细数量直入虚拟库位,入库单状态变为「已完成」。`,
'快捷直入确认',
{ confirmButtonText: '确认直入', cancelButtonText: '取消', type: 'warning' }
)
} catch {
return
}
submitLoading.value = true
try {
const res = await entryApi.quickInbound({ id: entryId.value })
if (res?.code !== 200) {
throw new Error(res?.message || '快捷直入失败')
}
const payload = (res.data && typeof res.data === 'object' ? res.data : res) as QuickInboundResponse
lastResult.value = payload
form.order_status = payload.order_status ?? 'COMPLETED'
ElMessage.success(
`快捷直入成功:共 ${payload.items_count ?? '—'} 种商品,总量 ${payload.total_quantity ?? '—'}`
)
emit('success', payload)
} catch (error) {
console.error('快捷直入失败:', error)
ElMessage.error(error instanceof Error ? error.message : '快捷直入失败')
} finally {
submitLoading.value = false
}
}
watch(
() => [props.id, props.row] as const,
([newId, newRow]) => {
lastResult.value = null
syncFormFromRow(newRow)
if (newId != null) {
form.id = newId
}
void loadPreviewItems()
},
{ immediate: true, deep: true }
)
</script>
<style scoped lang="scss">
.quick-inbound-form {
display: flex;
flex-direction: column;
gap: 12px;
.intro-alert {
:deep(.el-alert__description) {
line-height: 1.5;
}
}
.info-form {
padding: 4px 0;
}
.status-hint {
display: flex;
align-items: center;
gap: 8px;
.hint-text {
font-size: 12px;
color: #909399;
}
}
.preview-section,
.result-section {
.section-title {
font-size: 13px;
font-weight: 600;
color: #303133;
margin-bottom: 8px;
}
}
.preview-summary {
margin-top: 8px;
font-size: 12px;
color: #606266;
}
.form-actions {
display: flex;
justify-content: flex-end;
gap: 8px;
padding-top: 8px;
border-top: 1px solid #ebeef5;
}
}
</style>

View File

@ -0,0 +1,961 @@
<template>
<div class="receiving-compare-form">
<el-card shadow="never" class="query-card">
<el-descriptions :column="3" size="small" border class="entry-brief">
<el-descriptions-item label="入库单号">{{ entryOrderCode }}</el-descriptions-item>
<el-descriptions-item label="货主">{{ storeName }}</el-descriptions-item>
<el-descriptions-item label="订单状态">
<el-tag v-if="entryOrderStatus" size="small" :type="entryOrderStatusTag">
{{ entryOrderStatusLabel }}
</el-tag>
<span v-else>—</span>
</el-descriptions-item>
</el-descriptions>
<el-form :model="queryForm" label-width="72px" size="small" class="query-form">
<el-row :gutter="16" align="middle">
<el-col :span="14">
<el-form-item label="收货单" required class="receiving-select-item">
<el-select
v-model="queryForm.receiving_id"
placeholder="请选择或搜索收货单号"
filterable
clearable
:loading="receivingListLoading"
style="width: 100%"
@change="handleReceivingChange"
>
<el-option
v-for="item in receivingOptions"
:key="item.id"
:label="formatReceivingOptionLabel(item)"
:value="item.id"
>
<div class="receiving-option">
<span class="receiving-option__number">{{ item.receiving_number || `#${item.id}` }}</span>
<span v-if="getReceivingStatusText(item)" class="receiving-option__status">
{{ getReceivingStatusText(item) }}
</span>
</div>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<div class="query-actions">
<el-button
type="primary"
size="small"
:loading="compareLoading"
:disabled="!canCompare"
@click="loadCompareResult"
>
对照预览
</el-button>
<el-button size="small" :loading="receivingListLoading" @click="loadReceivingList">
刷新列表
</el-button>
</div>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card v-if="compareResult" shadow="never" class="result-card" v-loading="compareLoading">
<template #header>
<div class="result-header">
<div class="result-meta">
<el-tag v-if="summaryTag" size="small" :type="summaryTag.type">
{{ summaryTag.text }}
</el-tag>
<span class="result-count">{{ diffRows.length }} 行对照</span>
</div>
<div class="diff-legend">
<span class="legend-item legend-item--matched">一致</span>
<span class="legend-item legend-item--changed">数量差异</span>
<span class="legend-item legend-item--entry-only">仅入库</span>
<span class="legend-item legend-item--receiving-only">仅收货</span>
</div>
</div>
</template>
<div v-if="summaryItems.length" class="summary-grid">
<div
v-for="item in summaryItems"
:key="item.key"
class="summary-card"
:class="`summary-card--${item.cardType}`"
>
<div class="summary-value">{{ item.value }}</div>
<div class="summary-label">{{ item.label }}</div>
</div>
</div>
<div class="diff-view">
<div class="diff-columns-header">
<div class="diff-side-header diff-side-header--entry">
<span class="side-label">入库单</span>
<span class="side-code">{{ compareResult.entry_order_code || entryOrderCode }}</span>
</div>
<div class="diff-gutter-header">行</div>
<div class="diff-side-header diff-side-header--receiving">
<span class="side-label">收货单</span>
<span class="side-code">{{ compareResult.receiving_number || selectedReceivingNumber }}</span>
</div>
</div>
<div class="diff-body">
<div
v-for="row in diffRows"
:key="row.rowKey"
class="diff-row"
:class="getDiffRowClass(row)"
>
<div class="diff-side diff-side--entry" :class="getDiffSideClass(row, 'entry')">
<template v-if="row.entry">
<div
v-for="col in receivingCompareEntrySideColumns"
:key="col.prop"
class="diff-field"
:class="{ 'diff-field--changed': isEntryCellChanged(row, col.prop) }"
>
<span class="diff-field__label">{{ col.label }}:</span>
<span class="diff-field__value" :title="formatCellTitle(row.entry, col.prop)">
{{ formatSideCell(row.entry, col.prop) }}
</span>
</div>
</template>
<span v-else class="diff-empty">∅</span>
</div>
<div class="diff-gutter">
<span class="line-no">{{ row.lineNo }}</span>
<el-tag
v-if="row.matchStatus"
size="small"
:type="getReceivingCompareStatusTagType(row.matchStatus)"
class="status-tag"
>
{{ formatReceivingCompareStatusShort(row.matchStatus) }}
</el-tag>
</div>
<div class="diff-side diff-side--receiving" :class="getDiffSideClass(row, 'receiving')">
<template v-if="row.receiving">
<div
v-for="col in receivingCompareReceivingSideColumns"
:key="col.prop"
class="diff-field"
:class="{ 'diff-field--changed': isReceivingCellChanged(row, col.prop) }"
>
<span class="diff-field__label">{{ col.label }}:</span>
<span class="diff-field__value" :title="formatCellTitle(row.receiving, col.prop)">
{{ formatSideCell(row.receiving, col.prop) }}
</span>
</div>
</template>
<span v-else class="diff-empty">∅</span>
</div>
</div>
</div>
</div>
</el-card>
<el-empty
v-else-if="!compareLoading && queryForm.receiving_id"
class="compare-empty"
description="已选择收货单,点击「对照预览」查看匹配结果"
:image-size="80"
/>
<el-empty
v-else-if="!compareLoading && !receivingListLoading && receivingOptions.length === 0 && storeId"
class="compare-empty"
description="当前货主下暂无可用收货单"
:image-size="80"
/>
</div>
</template>
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { receivingCompare } from '@/api/storage.entry/entry'
import type { ReceivingCompareResponse, ReceivingCompareRow } from '@/api/storage.entry/entry'
import { getReceivingList } from '@/api/storage_receiving/receiving'
import {
buildReceivingCompareSummaryItems,
formatEntryOrderStatus,
formatReceivingCompareStatus,
formatReceivingOrderStatusLabel,
getEntryOrderStatusTagType,
getReceivingCompareStatusTagType,
receivingCompareEntrySideColumns,
receivingCompareReceivingSideColumns,
} from '../entry-config'
type ReceivingOption = {
id: number
receiving_number?: string
status?: string
storage_status?: string
receiving_status?: string
store_id?: number
[key: string]: unknown
}
type DiffSideCell = {
stock_id: string
item_code: string
item_name: string
plan_qty: string | number
received_qty: string | number
receiving_qty: string | number
box_quantity: string | number
barcode: string
}
type DiffRow = {
rowKey: string
lineNo: number
matchStatus: string
qtyChanged: boolean
entry: DiffSideCell | null
receiving: DiffSideCell | null
}
const props = defineProps<{
id?: string | number | null
row?: Record<string, unknown> | null
}>()
const queryForm = reactive<{ receiving_id: number | '' }>({
receiving_id: '',
})
const receivingOptions = ref<ReceivingOption[]>([])
const receivingListLoading = ref(false)
const compareLoading = ref(false)
const compareResult = ref<ReceivingCompareResponse | null>(null)
const entryOrderId = computed(() => {
const raw = props.id ?? props.row?.id
if (raw === null || raw === undefined || raw === '') return null
const num = Number(raw)
return Number.isFinite(num) && num > 0 ? num : null
})
const entryOrderCode = computed(() =>
String(props.row?.entry_order_code ?? compareResult.value?.entry_order_code ?? '—')
)
const storeName = computed(() => String(props.row?.store_name ?? '—'))
const entryOrderStatus = computed(() => props.row?.order_status)
const entryOrderStatusLabel = computed(() => formatEntryOrderStatus(entryOrderStatus.value))
const entryOrderStatusTag = computed(() => getEntryOrderStatusTagType(entryOrderStatus.value) || 'info')
const storeId = computed(() => {
const raw = props.row?.store_id
if (raw === null || raw === undefined || raw === '') return null
const num = Number(raw)
return Number.isFinite(num) && num > 0 ? num : null
})
const canCompare = computed(
() => entryOrderId.value != null && queryForm.receiving_id !== '' && !compareLoading.value
)
const selectedReceiving = computed(() => {
const id = Number(queryForm.receiving_id)
return receivingOptions.value.find((item) => item.id === id) ?? null
})
const selectedReceivingNumber = computed(
() => selectedReceiving.value?.receiving_number || (queryForm.receiving_id ? `#${queryForm.receiving_id}` : '—')
)
function getReceivingStatusText(item: ReceivingOption): string {
return (
formatReceivingOrderStatusLabel(item.storage_status) ||
formatReceivingOrderStatusLabel(item.receiving_status) ||
formatReceivingOrderStatusLabel(item.status)
)
}
function formatReceivingOptionLabel(item: ReceivingOption): string {
const number = item.receiving_number || `#${item.id}`
const status = getReceivingStatusText(item)
return status ? `${number} · ${status}` : number
}
function formatReceivingCompareStatusShort(status: unknown): string {
const key = String(status ?? '').trim().toLowerCase()
const map: Record<string, string> = {
matched: '一致',
entry_only: '入库',
receiving_only: '收货',
}
return map[key] || formatReceivingCompareStatus(status).slice(0, 2)
}
function isApiSuccess(res: { code?: number; flag?: string } | null | undefined): boolean {
return !!(res && (res.code === 200 || res.code === 1 || res.flag === 'success'))
}
function unwrapComparePayload(res: ReceivingCompareResponse): ReceivingCompareResponse {
if (res.data && typeof res.data === 'object') {
return { ...res, ...res.data }
}
return res
}
function pickText(row: Record<string, unknown>, keys: string[], fallback = ''): string {
for (const key of keys) {
const val = row[key]
if (val !== null && val !== undefined && val !== '') return String(val)
}
return fallback
}
function pickQty(row: Record<string, unknown>, keys: string[]): string | number {
for (const key of keys) {
const val = row[key]
if (val !== null && val !== undefined && val !== '') return val as string | number
}
return '—'
}
function hasEntryData(record: Record<string, unknown>): boolean {
return !!(
pickText(record, ['item_code', 'warehouse_item_code', 'product_code']) ||
pickText(record, ['item_name', 'warehouse_item_name', 'product_name']) ||
pickQty(record, ['entry_plan_qty', 'plan_qty', 'count']) !== '—'
)
}
function hasReceivingData(record: Record<string, unknown>): boolean {
return !!(
pickText(record, ['item_code', 'warehouse_item_code', 'product_code']) ||
pickText(record, ['item_name', 'warehouse_item_name', 'product_name']) ||
pickQty(record, ['receiving_qty', 'receiving_quantity', 'actual_quantity']) !== '—'
)
}
function buildEntrySide(record: Record<string, unknown>): DiffSideCell {
return {
stock_id: pickText(record, ['stock_id', 'system_product_id'], '—'),
item_code: pickText(record, ['item_code', 'warehouse_item_code', 'product_code'], '—'),
item_name: pickText(record, ['item_name', 'warehouse_item_name', 'product_name'], '—'),
plan_qty: pickQty(record, ['entry_plan_qty', 'plan_qty', 'count']),
received_qty: pickQty(record, ['entry_received_qty', 'received_quantity', 'confirm_quantity']),
receiving_qty: '—',
box_quantity: '—',
barcode: pickText(record, ['barcode'], '—'),
}
}
function buildReceivingSide(record: Record<string, unknown>): DiffSideCell {
return {
stock_id: pickText(record, ['stock_id', 'system_product_id'], '—'),
item_code: pickText(record, ['item_code', 'warehouse_item_code', 'product_code'], '—'),
item_name: pickText(record, ['item_name', 'warehouse_item_name', 'product_name'], '—'),
plan_qty: '—',
received_qty: '—',
receiving_qty: pickQty(record, ['receiving_qty', 'receiving_quantity', 'actual_quantity']),
box_quantity: pickQty(record, ['box_quantity', 'receiving_boxes']),
barcode: pickText(record, ['barcode'], '—'),
}
}
function isQtyChanged(entry: DiffSideCell | null, receiving: DiffSideCell | null): boolean {
if (!entry || !receiving) return false
const entryQty = Number(entry.plan_qty)
const recvQty = Number(receiving.receiving_qty)
if (!Number.isFinite(entryQty) || !Number.isFinite(recvQty)) return false
return entryQty !== recvQty
}
function resolveMatchStatus(
rawStatus: unknown,
entry: DiffSideCell | null,
receiving: DiffSideCell | null
): string {
const status = String(rawStatus ?? '').trim().toLowerCase()
if (status) return status
if (entry && receiving) return 'matched'
if (entry) return 'entry_only'
if (receiving) return 'receiving_only'
return ''
}
function buildDiffRow(
record: ReceivingCompareRow,
index: number,
prefix: string,
forceReceivingOnly = false
): DiffRow {
const raw = record as Record<string, unknown>
const entry = hasEntryData(raw) && !forceReceivingOnly ? buildEntrySide(raw) : null
const receiving = hasReceivingData(raw) || forceReceivingOnly ? buildReceivingSide(raw) : null
const matchStatus = resolveMatchStatus(record.match_status, entry, receiving)
const stockId = pickText(raw, ['stock_id', 'system_product_id'], String(index))
return {
rowKey: `${prefix}_${stockId}_${index}`,
lineNo: index + 1,
matchStatus,
qtyChanged: isQtyChanged(entry, receiving),
entry,
receiving,
}
}
const diffRows = computed<DiffRow[]>(() => {
if (!compareResult.value) return []
const rows: DiffRow[] = []
const comparison = compareResult.value.comparison ?? []
comparison.forEach((row, index) => {
rows.push(buildDiffRow(row, index, 'cmp'))
})
const receivingOnly = compareResult.value.receiving_only ?? []
receivingOnly.forEach((row, index) => {
rows.push(buildDiffRow(row, comparison.length + index, 'recv', true))
})
return rows.map((row, index) => ({ ...row, lineNo: index + 1 }))
})
const summaryItems = computed(() =>
buildReceivingCompareSummaryItems(compareResult.value?.summary as Record<string, unknown> | undefined)
)
const summaryTag = computed(() => {
const summary = compareResult.value?.summary
if (!summary) return null
if (summary.is_fully_matched === true || summary.fully_matched === true) {
return { text: '全部匹配', type: 'success' as const }
}
if (summary.is_fully_matched === false || summary.fully_matched === false) {
const matched = Number(summary.matched_items ?? summary.matched_count ?? 0)
if (matched <= 0) return { text: '无匹配商品', type: 'danger' as const }
return { text: '部分匹配', type: 'warning' as const }
}
const matched = Number(summary.matched_items ?? summary.matched_count ?? 0)
const entryOnly = Number(summary.entry_only_items ?? summary.entry_only_count ?? 0)
const receivingOnly = Number(
summary.receiving_only_items ??
summary.receiving_only_count ??
(compareResult.value?.receiving_only?.length ?? 0)
)
if (!diffRows.value.length) {
return { text: '无对照数据', type: 'info' as const }
}
if (entryOnly === 0 && receivingOnly === 0 && matched > 0) {
return { text: '全部匹配', type: 'success' as const }
}
if (matched === 0) {
return { text: '无匹配商品', type: 'danger' as const }
}
return { text: '部分匹配', type: 'warning' as const }
})
function formatSideCell(side: DiffSideCell, prop: string): string {
const val = side[prop as keyof DiffSideCell]
if (val === null || val === undefined || val === '') return '—'
return String(val)
}
function formatCellTitle(side: DiffSideCell, prop: string): string {
const text = formatSideCell(side, prop)
return text === '—' ? '' : text
}
function getDiffRowClass(row: DiffRow): string {
const status = row.matchStatus.toLowerCase()
if (status === 'entry_only') return 'diff-row--entry-only'
if (status === 'receiving_only') return 'diff-row--receiving-only'
if (row.qtyChanged) return 'diff-row--changed'
if (status === 'matched') return 'diff-row--matched'
return ''
}
function getDiffSideClass(row: DiffRow, side: 'entry' | 'receiving'): string {
const status = row.matchStatus.toLowerCase()
if (side === 'entry') {
if (status === 'entry_only') return 'diff-side--removed'
if (status === 'receiving_only') return 'diff-side--empty'
if (row.qtyChanged) return 'diff-side--changed'
return 'diff-side--unchanged'
}
if (status === 'receiving_only') return 'diff-side--added'
if (status === 'entry_only') return 'diff-side--empty'
if (row.qtyChanged) return 'diff-side--changed'
return 'diff-side--unchanged'
}
function isEntryCellChanged(row: DiffRow, prop: string): boolean {
return row.qtyChanged && (prop === 'plan_qty' || prop === 'received_qty')
}
function isReceivingCellChanged(row: DiffRow, prop: string): boolean {
return row.qtyChanged && (prop === 'receiving_qty' || prop === 'box_quantity')
}
async function loadReceivingList() {
if (!storeId.value) {
receivingOptions.value = []
ElMessage.warning('当前入库单缺少货主信息,无法加载收货单')
return
}
receivingListLoading.value = true
try {
const res = await getReceivingList({
pagination: { page: 1, pageSize: 200 },
where: {
store_id: { operator: 'eq', value: storeId.value, type: 'number' },
},
})
if (!isApiSuccess(res)) {
receivingOptions.value = []
ElMessage.error(res?.message || '加载收货单列表失败')
return
}
const payload = res.data && typeof res.data === 'object' ? res.data : res
const list = (payload.list ?? payload.receivings ?? []) as ReceivingOption[]
receivingOptions.value = list
.map((item) => ({
...item,
id: Number(item.id),
}))
.filter((item) => Number.isFinite(item.id) && item.id > 0)
} catch (error) {
console.error('加载收货单列表失败:', error)
receivingOptions.value = []
ElMessage.error('加载收货单列表失败')
} finally {
receivingListLoading.value = false
}
}
async function loadCompareResult() {
if (!entryOrderId.value) {
ElMessage.warning('缺少入库单 ID')
return
}
const receivingId = Number(queryForm.receiving_id)
if (!Number.isFinite(receivingId) || receivingId <= 0) {
ElMessage.warning('请选择收货单')
return
}
compareLoading.value = true
compareResult.value = null
try {
const res = await receivingCompare({
entry_order_id: entryOrderId.value,
receiving_id: receivingId,
})
if (!isApiSuccess(res)) {
ElMessage.error(res?.message || '商品对照预览失败')
return
}
compareResult.value = unwrapComparePayload(res)
} catch (error) {
console.error('商品对照预览失败:', error)
ElMessage.error('商品对照预览失败')
} finally {
compareLoading.value = false
}
}
function handleReceivingChange() {
compareResult.value = null
}
function resetForm() {
queryForm.receiving_id = ''
compareResult.value = null
receivingOptions.value = []
}
watch(
() => [props.id, props.row?.store_id] as const,
() => {
resetForm()
if (entryOrderId.value && storeId.value) {
void loadReceivingList()
}
},
{ immediate: true }
)
</script>
<style scoped lang="scss">
.receiving-compare-form {
display: flex;
flex-direction: column;
gap: 12px;
.query-card,
.result-card {
border: 1px solid #ebeef5;
:deep(.el-card__header) {
padding: 10px 14px;
background: #fafafa;
}
:deep(.el-card__body) {
padding: 12px 14px;
}
}
.entry-brief {
margin-bottom: 12px;
}
.query-form {
margin-top: 4px;
}
.receiving-select-item {
margin-bottom: 0;
}
.query-actions {
display: flex;
justify-content: flex-end;
gap: 8px;
padding-top: 2px;
}
.receiving-option {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
width: 100%;
&__number {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&__status {
flex-shrink: 0;
font-size: 12px;
color: #909399;
}
}
.result-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.result-meta {
display: flex;
align-items: center;
gap: 10px;
}
.result-count {
font-size: 12px;
color: #909399;
}
.diff-legend {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.legend-item {
display: inline-flex;
align-items: center;
font-size: 11px;
color: #606266;
padding: 2px 8px;
border-radius: 3px;
border: 1px solid transparent;
&--matched {
background: #f6f8fa;
border-color: #e4e7ed;
}
&--changed {
background: #fff8e6;
border-color: #faecd8;
color: #e6a23c;
}
&--entry-only {
background: #ffeef0;
border-color: #ffdce0;
color: #cf222e;
}
&--receiving-only {
background: #e6ffed;
border-color: #c6f6d5;
color: #1a7f37;
}
}
.summary-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
gap: 8px;
margin-bottom: 12px;
}
.summary-card {
padding: 8px 6px;
border-radius: 6px;
text-align: center;
border: 1px solid transparent;
&--primary {
background: #ecf5ff;
border-color: #d9ecff;
.summary-value { color: #409eff; }
}
&--success {
background: #f0f9eb;
border-color: #e1f3d8;
.summary-value { color: #67c23a; }
}
&--warning {
background: #fdf6ec;
border-color: #faecd8;
.summary-value { color: #e6a23c; }
}
&--danger {
background: #fef0f0;
border-color: #fde2e2;
.summary-value { color: #f56c6c; }
}
&--info {
background: #f4f4f5;
border-color: #e9e9eb;
.summary-value { color: #606266; }
}
.summary-value {
font-size: 18px;
font-weight: 600;
line-height: 1.2;
}
.summary-label {
margin-top: 4px;
font-size: 11px;
color: #606266;
}
}
/* Git diff 双栏对照(字段竖向排列) */
.diff-view {
border: 1px solid #d0d7de;
border-radius: 6px;
overflow: hidden;
font-size: 12px;
}
.diff-columns-header {
display: grid;
grid-template-columns: 1fr 52px 1fr;
background: #f6f8fa;
border-bottom: 1px solid #d0d7de;
}
.diff-side-header {
display: flex;
flex-direction: column;
gap: 2px;
padding: 8px 12px;
min-width: 0;
&--entry {
border-right: 1px solid #d0d7de;
}
&--receiving {
border-left: 1px solid #d0d7de;
}
.side-label {
font-weight: 600;
color: #24292f;
font-size: 13px;
}
.side-code {
font-size: 11px;
color: #57606a;
word-break: break-all;
}
}
.diff-gutter-header {
display: flex;
align-items: center;
justify-content: center;
font-size: 11px;
color: #57606a;
background: #f6f8fa;
border-left: 1px solid #d0d7de;
border-right: 1px solid #d0d7de;
}
.diff-body {
max-height: 480px;
overflow: auto;
}
.diff-row {
display: grid;
grid-template-columns: 1fr 52px 1fr;
align-items: stretch;
border-bottom: 1px solid #d8dee4;
&:last-child {
border-bottom: none;
}
}
.diff-side {
display: flex;
flex-direction: column;
gap: 0;
padding: 8px 10px;
min-width: 0;
&--entry {
border-right: 1px solid #d0d7de;
}
&--receiving {
border-left: 1px solid #d0d7de;
}
&--removed {
background: #ffeef0;
}
&--added {
background: #e6ffed;
}
&--changed {
background: #fff8e6;
}
&--unchanged {
background: #fff;
}
&--empty {
background: #f6f8fa;
justify-content: center;
align-items: center;
min-height: 120px;
}
}
.diff-field {
display: flex;
flex-direction: row;
align-items: baseline;
gap: 4px;
padding: 4px 0;
border-bottom: 1px dashed #ebeef5;
line-height: 1.5;
&:last-child {
border-bottom: none;
padding-bottom: 0;
}
&:first-child {
padding-top: 0;
}
&__label {
flex-shrink: 0;
font-size: 12px;
color: #909399;
white-space: nowrap;
}
&__value {
flex: 1;
min-width: 0;
font-size: 12px;
color: #303133;
word-break: break-all;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
&--changed .diff-field__value {
font-weight: 700;
color: #9a6700;
}
}
.diff-empty {
color: #afb8c1;
font-size: 14px;
user-select: none;
}
.diff-gutter {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
padding: 8px 4px;
background: #f6f8fa;
border-left: 1px solid #d0d7de;
border-right: 1px solid #d0d7de;
user-select: none;
align-self: stretch;
.line-no {
font-size: 11px;
color: #57606a;
line-height: 1;
font-family: ui-monospace, Menlo, Consolas, monospace;
}
.status-tag {
transform: scale(0.85);
transform-origin: center;
}
}
.compare-empty {
padding: 24px 0;
background: #fff;
border: 1px dashed #e4e7ed;
border-radius: 6px;
}
}
</style>

View File

@ -218,9 +218,15 @@ async function unbindBindings(selected: EntryDetailBinding[]) {
const releasedQuantity = res?.released_quantity ?? res?.data?.released_quantity ?? unbindQty
ElMessage.success(`解绑成功,已释放 ${releasedQuantity} 件`)
} else {
const entryOrderId = Number(props.entryOrderId)
if (!Number.isFinite(entryOrderId) || entryOrderId <= 0) {
ElMessage.warning('入库单 ID 无效,无法解绑')
return false
}
const res = await bindReceivingDetails({
entry_item_id: entryItemId,
entry_order_id: entryOrderId,
bindings: remaining.map((item) => ({
entry_item_id: entryItemId,
receiving_detail_id: Number(item.receiving_detail_id),
allocated_quantity: Math.floor(Number(item.allocated_quantity) || 0),
})),

View File

@ -100,6 +100,7 @@
<BindReceivingDetailsDialog
v-model="bindDialogVisible"
:entry-item="bindTargetItem"
:entry-order-id="props.id"
@success="handleBindSuccess"
/>

View File

@ -1,124 +1,19 @@
<template>
<div class="entry-operate-container">
<el-form :model="form" label-width="120px" class="details-form">
<el-row :gutter="30">
<!-- 第一列:基本信息 -->
<el-col :span="12">
<el-form-item
v-for="field in detailpanel"
:key="field.prop"
:label="field.label"
:prop="field.prop"
>
<template v-if="field.type === 'select'">
<el-select
v-model="(form as any)[field.prop]"
:placeholder="'请选择' + field.label"
style="width: 100%"
>
<el-option
v-for="item in availableFields.find(f => f.value === field.prop)?.options || []"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template v-else>
<el-input
v-model="(form as any)[field.prop]"
:disabled="field.disabled"
:placeholder="'请输入' + field.label"
/>
</template>
</el-form-item>
</el-col>
<!-- 第二列:附加展示区 -->
<el-col :span="12">
<div class="image-placeholder">
<div class="placeholder-content">
<el-icon :size="48" color="#909399"><Picture /></el-icon>
<p>相关单据图片/附件展示区</p>
</div>
</div>
</el-col>
</el-row>
</el-form>
<!-- 底部操作按钮 -->
<div class="bottom">
<el-button-group class="toolbar-btn-group">
<el-button type="primary" icon="Check" disabled :loading="saveLoading" >
保存
</el-button>
<el-button type="danger" icon="Refresh" disabled>
重置
</el-button>
</el-button-group>
</div>
<ReceivingCompareForm
:id="props.id"
:row="props.row"
/>
</div>
</template>
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { availableFields, detailpanel } from '../entry-config'
import { ElMessage } from 'element-plus'
import { Picture, Check, Refresh } from '@element-plus/icons-vue'
import ReceivingCompareForm from './ReceivingCompareForm.vue'
const props = defineProps<{
id: string | number,
row?: any
const props = defineProps<{
id: string | number
row?: Record<string, unknown> | null
}>()
const form = ref<any>({
entry_order_code: '',
store_name: '',
order_status: '',
order_type: '',
purchase_order_code: '',
sync_status: '',
supplier_code: '',
supplier_name: '',
express_code: '',
logistics_name: '',
remark: ''
})
const saveLoading = ref(false)
// 监听行数据变化同步表单
watch(() => props.row, (newRow) => {
if (newRow) {
form.value = { ...newRow }
}
}, { immediate: true })
const handleReset = () => {
if (props.row) {
form.value = { ...props.row }
}
ElMessage.info('表单已重置')
}
const handleSave = async () => {
try {
saveLoading.value = true
// 模拟接口调用
await new Promise(resolve => setTimeout(resolve, 500))
ElMessage.success('保存成功')
} catch (error) {
ElMessage.error('保存失败')
} finally {
saveLoading.value = false
}
}
onMounted(() => {
if (props.row) {
form.value = { ...props.row }
}
})
</script>
<style scoped lang="scss">
@ -128,50 +23,7 @@ onMounted(() => {
flex-direction: column;
box-sizing: border-box;
background-color: #fff;
}
.details-form {
flex: 1;
padding: 12px;
overflow-y: auto;
padding: 20px;
width: 100%;
box-sizing: border-box;
/* 隐藏滚动条 */
&::-webkit-scrollbar {
display: none;
}
-ms-overflow-style: none;
scrollbar-width: none;
}
.image-placeholder {
width: 100%;
height: 400px;
background-color: #f5f7fa;
border: 1px dashed #dcdfe6;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
.placeholder-content {
text-align: center;
color: #909399;
p {
margin-top: 10px;
font-size: 14px;
}
}
}
.bottom {
flex-shrink: 0;
text-align: right;
padding: 10px 20px;
border-top: 1px solid #ebeef5;
background-color: #fff;
z-index: 10;
}
</style>

View File

@ -1,19 +1,19 @@
/** ScanBox 筛选字段分组(入库模块专用) */
export const ENTRY_SCAN_FIELD_GROUPS = {
owner: '货主信息',
status: '单据状态',
source: '来源配置',
detail: '单据详情',
time: '时间范围',
} as const
import { scanWorkflowField } from '@/views/order/orderManagement/config/order-common-config'
type EntryScanFieldGroupKey = keyof typeof ENTRY_SCAN_FIELD_GROUPS
/** ScanBox 基础信息分组(对齐收货/待处理订单排版) */
export const ENTRY_SCAN_BASIC_INFO_GROUP = '基础信息'
export function entryScanField<G extends EntryScanFieldGroupKey>(
group: G,
field: Record<string, any>
): Record<string, any> & { group: (typeof ENTRY_SCAN_FIELD_GROUPS)[G] } {
return { ...field, group: ENTRY_SCAN_FIELD_GROUPS[group] }
/** 为入库 ScanBox 基础信息字段附加分组标签 */
export type EntryScanFieldConfig = Record<string, any> & {
group: string
value: string
label: string
type?: string
options?: Array<{ label: string; value: unknown }>
}
export function entryScanBasicField(field: Record<string, any>): EntryScanFieldConfig {
return { ...field, group: ENTRY_SCAN_BASIC_INFO_GROUP } as EntryScanFieldConfig
}
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
@ -80,21 +80,15 @@ export function translateEntryField(fieldValue: string, value: unknown): string
return option ? option.label : normalized
}
export const availableFields = [
entryScanField('owner', {
export const availableFields: EntryScanFieldConfig[] = [
entryScanBasicField({
label: '货主',
value: 'store_id',
type: 'select',
multiple: true,
options: []
}),
entryScanField('status', {
label: '状态',
value: 'order_status',
type: 'select',
options: [...entryOrderStatusOptions]
}),
entryScanField('status', {
entryScanBasicField({
label: '入库单类型',
value: 'order_type',
type: 'select',
@ -111,18 +105,7 @@ export const availableFields = [
{ label: '虚拟入库', value: 'XNRK' },
]
}),
entryScanField('status', {
label: '入库状态',
value: 'sync_status',
type: 'select',
options: [
{ label: '待推送', value: 'PENDING' },
{ label: '推送中', value: 'SYNCING' },
{ label: '成功', value: 'SUCCESS' },
{ label: '失败', value: 'FAIL' },
]
}),
entryScanField('source', {
entryScanBasicField({
label: '数据来源',
value: 'source_type',
type: 'select',
@ -132,7 +115,7 @@ export const availableFields = [
{ label: '系统', value: 'WMS' },
]
}),
entryScanField('source', {
entryScanBasicField({
label: '费用是否记录',
value: 'expense_record',
type: 'select',
@ -141,36 +124,54 @@ export const availableFields = [
{ label: '否', value: false },
]
}),
entryScanField('detail', {
entryScanBasicField({
label: '批次',
value: 'batch',
type: 'text'
}),
entryScanField('detail', {
entryScanBasicField({
label: '编号',
value: 'number',
type: 'text'
}),
entryScanField('detail', {
entryScanBasicField({
label: '备注',
value: 'remark',
type: 'text'
}),
entryScanField('detail', {
entryScanBasicField({
label: 'ERP备注',
value: 'erp_remark',
type: 'text'
}),
entryScanField('detail', {
entryScanBasicField({
label: '操作员ID',
value: 'operator_id',
type: 'text'
}),
entryScanField('time', {
entryScanBasicField({
label: '创建时间',
value: 'order_create_time',
type: 'datetimerange'
}),
// 流程/状态(每项独立分组,对齐收货/待处理订单 scanWorkflowField 排版)
scanWorkflowField({
label: '状态',
value: 'order_status',
type: 'select',
options: [...entryOrderStatusOptions]
}) as EntryScanFieldConfig,
scanWorkflowField({
label: '入库状态',
value: 'sync_status',
type: 'select',
options: [
{ label: '待推送', value: 'PENDING' },
{ label: '推送中', value: 'SYNCING' },
{ label: '成功', value: 'SUCCESS' },
{ label: '失败', value: 'FAIL' },
]
}) as EntryScanFieldConfig,
]
export const entryColums = [
@ -225,6 +226,35 @@ export function isPendingEntryOrderStatus(status: unknown): boolean {
return upper === 'PENDING' || upper === 'CREATED' || normalized === '待入库' || normalized === '已创建'
}
/** 是否允许快捷直入(storage.entry.quickInbound,仅 CREATED) */
export function canQuickInbound(status: unknown): boolean {
if (status === null || status === undefined || status === '') return false
const normalized = String(status).trim()
const upper = normalized.toUpperCase()
return upper === 'CREATED' || normalized === '已创建'
}
/** 快捷直入表单只读字段(对应接口入参 id 及展示用单据信息) */
export const quickInboundFormFields = [
{ label: '入库单ID', prop: 'id', disabled: true },
{ label: '入库单号', prop: 'entry_order_code', disabled: true },
{ label: '货主', prop: 'store_name', disabled: true },
{ label: '入库类型', prop: 'order_type', type: 'select' as const, disabled: true },
{ label: '订单状态', prop: 'order_status', type: 'select' as const, disabled: true },
{ label: '商品种类', prop: 'total_order_lines', disabled: true },
{ label: '数据来源', prop: 'source_type', type: 'select' as const, disabled: true },
{ label: '备注', prop: 'remark', disabled: true, span: 24 },
]
/** 快捷直入明细预览列(按明细数量一键直入虚拟库位) */
export const quickInboundPreviewColumns = [
{ prop: 'order_line_no', label: '行号', width: '70', align: 'center' },
{ prop: 'warehouse_item_code', label: '商品编码', width: '140' },
{ prop: 'warehouse_item_name', label: '商品名称', minWidth: '160' },
{ prop: 'stock_id', label: 'SKU', width: '90' },
{ prop: 'count', label: '直入数量', width: '100', align: 'right' },
]
export const entrydetail = [
{ prop: 'entry_order_code', label: '入库单号', width: '180', fixed: 'left' },
{ prop: 'purchase_order_code', label: '单据编号', width: '160' },
@ -346,6 +376,228 @@ export const directInboundLogActionColumn = {
align: 'center',
} as const
/** 收货对照 match_status 标签样式 */
export function getReceivingCompareStatusTagType(status: unknown): string {
const key = String(status ?? '').trim().toLowerCase()
if (key === 'matched') return 'success'
if (key === 'entry_only') return 'warning'
return 'info'
}
export function formatReceivingCompareStatus(status: unknown): string {
const key = String(status ?? '').trim().toLowerCase()
const map: Record<string, string> = {
matched: '已匹配',
entry_only: '仅入库单',
receiving_only: '仅收货单',
}
return map[key] || (status ? String(status) : '--')
}
/** 收货对照 - Git Diff 左侧(入库单)列 */
export const receivingCompareEntrySideColumns = [
{ prop: 'stock_id', label: 'SKU', width: '72' },
{ prop: 'item_code', label: '编码', minWidth: '110' },
{ prop: 'item_name', label: '名称', minWidth: '130' },
{ prop: 'plan_qty', label: '应收', width: '64', align: 'right' },
{ prop: 'received_qty', label: '实收', width: '64', align: 'right' },
] as const
/** 收货对照 - Git Diff 右侧(收货单)列 */
export const receivingCompareReceivingSideColumns = [
{ prop: 'stock_id', label: 'SKU', width: '72' },
{ prop: 'item_code', label: '编码', minWidth: '110' },
{ prop: 'item_name', label: '名称', minWidth: '130' },
{ prop: 'receiving_qty', label: '收货量', width: '64', align: 'right' },
{ prop: 'box_quantity', label: '箱数', width: '56', align: 'right' },
] as const
/** 收货对照 - 逐行对照列(合并表,保留兼容) */
export const receivingCompareColumns = [
{ prop: 'match_status', label: '匹配状态', width: '90', align: 'center' },
{ prop: 'stock_id', label: 'SKU', width: '90' },
{ prop: 'item_code', label: '商品编码', width: '140' },
{ prop: 'item_name', label: '商品名称', minWidth: '160' },
{ prop: 'barcode', label: '条码', width: '130' },
{ prop: 'entry_plan_qty', label: '入库应收', width: '90', align: 'right' },
{ prop: 'entry_received_qty', label: '入库实收', width: '90', align: 'right' },
{ prop: 'receiving_qty', label: '收货数量', width: '90', align: 'right' },
{ prop: 'box_quantity', label: '收货箱数', width: '80', align: 'right' },
]
/** 收货对照 - 仅收货单商品列 */
export const receivingOnlyColumns = [
{ prop: 'stock_id', label: 'SKU', width: '90' },
{ prop: 'item_code', label: '商品编码', width: '140' },
{ prop: 'item_name', label: '商品名称', minWidth: '160' },
{ prop: 'barcode', label: '条码', width: '130' },
{ prop: 'receiving_qty', label: '收货数量', width: '90', align: 'right' },
{ prop: 'box_quantity', label: '收货箱数', width: '80', align: 'right' },
]
/** summary 字段中文标签(含 API 返回的 snake_case 键名) */
export const receivingCompareSummaryLabels: Record<string, string> = {
total_entry_items: '入库商品数',
total_receiving_items: '收货商品数',
matched_items: '已匹配商品',
entry_only_items: '仅入库单商品',
receiving_only_items: '仅收货单商品',
total_rows: '对照行数',
matched_count: '已匹配行数',
entry_only_count: '仅入库单行数',
receiving_only_count: '仅收货单行数',
total_entry_qty: '入库数量合计',
total_receiving_qty: '收货数量合计',
matched_qty: '匹配数量合计',
entry_only_qty: '仅入库数量',
receiving_only_qty: '仅收货数量',
unmatched_items: '未匹配商品',
unmatched_count: '未匹配行数',
match_rate: '匹配率',
is_fully_matched: '是否完全匹配',
fully_matched: '是否完全匹配',
comparison_rows: '对照行数',
}
/** summary 展示顺序(优先展示核心指标) */
export const receivingCompareSummaryOrder: string[] = [
'total_entry_items',
'total_receiving_items',
'matched_items',
'entry_only_items',
'receiving_only_items',
'unmatched_items',
'total_entry_qty',
'total_receiving_qty',
'matched_qty',
'match_rate',
'is_fully_matched',
'fully_matched',
'total_rows',
'matched_count',
'entry_only_count',
'receiving_only_count',
'entry_only_qty',
'receiving_only_qty',
'unmatched_count',
'comparison_rows',
]
const receivingCompareSummaryWordLabels: Record<string, string> = {
total: '合计',
entry: '入库',
receiving: '收货',
matched: '已匹配',
unmatched: '未匹配',
only: '仅',
items: '商品数',
item: '商品',
qty: '数量',
quantity: '数量',
count: '数量',
rows: '行数',
rate: '比率',
fully: '完全',
comparison: '对照',
}
export function formatReceivingCompareSummaryLabel(key: string): string {
const normalized = String(key ?? '').trim()
if (!normalized) return '—'
if (receivingCompareSummaryLabels[normalized]) {
return receivingCompareSummaryLabels[normalized]
}
return normalized
.split('_')
.filter(Boolean)
.map((part) => receivingCompareSummaryWordLabels[part.toLowerCase()] || part)
.join('')
}
export function formatReceivingCompareSummaryValue(key: string, value: unknown): string {
if (value === null || value === undefined || value === '') return '—'
const normalizedKey = String(key ?? '').trim().toLowerCase()
if (normalizedKey === 'is_fully_matched' || normalizedKey === 'fully_matched') {
const text = String(value).toLowerCase()
if (value === true || value === 1 || text === '1' || text === 'true' || text === 'yes') {
return '是'
}
if (value === false || value === 0 || text === '0' || text === 'false' || text === 'no') {
return '否'
}
}
if (normalizedKey.includes('rate') || normalizedKey.includes('ratio')) {
const num = Number(value)
if (Number.isFinite(num)) {
if (num > 0 && num <= 1) return `${(num * 100).toFixed(1)}%`
return `${num}%`
}
}
return String(value)
}
export function getReceivingCompareSummaryCardType(
key: string
): 'success' | 'warning' | 'danger' | 'info' | 'primary' {
const normalized = String(key ?? '').trim().toLowerCase()
if (normalized.includes('receiving_only') || normalized.includes('unmatched')) return 'danger'
if (normalized.includes('entry_only')) return 'warning'
if (normalized.includes('matched') && !normalized.includes('unmatched')) return 'success'
if (normalized.includes('total') || normalized.includes('rate')) return 'primary'
return 'info'
}
/** 收货单状态下拉展示文案 */
export function formatReceivingOrderStatusLabel(status: unknown): string {
if (status === null || status === undefined || status === '') return ''
const key = String(status).trim().toLowerCase()
const map: Record<string, string> = {
receiving: '收货中',
completed: '已完成',
cancelled: '已作废',
canceled: '已作废',
pending: '待收货',
partial: '部分入库',
all: '全部入库',
none: '未入库',
}
return map[key] || String(status)
}
export function buildReceivingCompareSummaryItems(
summary: Record<string, unknown> | null | undefined
): Array<{ key: string; label: string; value: string; cardType: ReturnType<typeof getReceivingCompareSummaryCardType> }> {
if (!summary || typeof summary !== 'object') return []
const used = new Set<string>()
const items: Array<{
key: string
label: string
value: string
cardType: ReturnType<typeof getReceivingCompareSummaryCardType>
}> = []
const pushItem = (key: string) => {
if (used.has(key)) return
const value = summary[key]
if (value === null || value === undefined || value === '') return
used.add(key)
items.push({
key,
label: formatReceivingCompareSummaryLabel(key),
value: formatReceivingCompareSummaryValue(key, value),
cardType: getReceivingCompareSummaryCardType(key),
})
}
receivingCompareSummaryOrder.forEach(pushItem)
Object.keys(summary)
.sort()
.forEach(pushItem)
return items
}
export const addEntryFields = [
{ label: '业务类型', prop: 'order_type', type: 'select', options: [
{ label: '生产入库', value: 'SCRK' },

View File

@ -1,10 +1,11 @@
<template>
<div class="storage-entry-container">
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
:width="entryScanBoxConfig.width"
:tree-props="entryScanBoxConfig.treeProps"
:auto-submit="entryScanBoxConfig.autoSubmit"
cache-key="storage-entry"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:initial-conditions="initialConditions"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@ -18,12 +19,27 @@
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<!-- <el-button size="small" @click="handleCreateEntry">新建入库单</el-button> -->
<el-button
size="small"
type="success"
:disabled="!canQuickInboundAction"
@click="openQuickInboundDialog"
>
快捷直入
</el-button>
<el-button size="small" @click="handleCompleteEntry">完成入库</el-button>
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
<el-button size="small" @click="handleImport">导入</el-button>
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
<!-- <el-button
size="small"
:disabled="!selectedEntryId"
@click="openReceivingCompareTab"
>
收货对照
</el-button> -->
</div>
<!-- <div class="toolbar-right">
@ -103,7 +119,7 @@
<div v-if="selectedEntryId" class="lower-level" :class="tableSize" :style="lowerPaneStyle">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="表单操作" name="operate" />
<el-tab-pane label="收货对照" name="operate" />
<el-tab-pane label="入库明细" name="details" />
<el-tab-pane label="入库记录" name="directInboundLogs" />
<el-tab-pane label="操作日志" name="logs" />
@ -133,6 +149,24 @@
</div>
</div>
<!-- 快捷直入对话框 -->
<el-dialog
v-model="quickInboundDialogVisible"
title="快捷直入"
width="720px"
align-center
destroy-on-close
@closed="handleQuickInboundDialogClosed"
>
<QuickInboundForm
v-if="quickInboundDialogVisible"
:id="quickInboundTarget?.id"
:row="quickInboundTarget"
@success="handleQuickInboundDialogSuccess"
@cancel="quickInboundDialogVisible = false"
/>
</el-dialog>
<!-- 新建入库单对话框 -->
<el-dialog
v-model="createDialogVisible"
@ -177,19 +211,27 @@ import {
availableFields,
entryColums,
addEntryFields,
entryScanBoxConfig,
formatEntryOrderStatus,
getEntryOrderStatusTagType,
isPendingEntryOrderStatus,
canQuickInbound,
translateEntryField
} from './entry-config'
import entrydetail from './component/entrydetail.vue'
import log from './component/log.vue'
import entryoperate from './component/entryoperate.vue'
import QuickInboundForm from './component/QuickInboundForm.vue'
import DirectInboundLogs from './component/DirectInboundLogs.vue'
import ExportModeDropdown from '@/components/ExportModeDropdown.vue'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
)
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
@ -215,6 +257,15 @@ function toggleDetailVisible() {
detailVisible.value = !detailVisible.value
}
function openReceivingCompareTab() {
if (!selectedEntryId.value) {
ElMessage.warning('请先在列表中选择一个入库单')
return
}
detailVisible.value = true
activeTab.value = 'operate'
}
function openColumnConfigPanel() {
upperTable.value?.openColumnConfig?.()
}
@ -264,6 +315,9 @@ const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedEntryId.value) || null
})
const quickInboundDialogVisible = ref(false)
const quickInboundTarget = ref<any>(null)
function translateField(fieldValue: string, value: any) {
return translateEntryField(fieldValue, value)
}
@ -597,6 +651,11 @@ function getActionTargetRows(): any[] {
return []
}
const canQuickInboundAction = computed(() => {
const targets = getActionTargetRows()
return targets.length === 1 && canQuickInbound(targets[0]?.order_status)
})
async function handleRowClick(row: any) {
selectedEntryId.value = row?.id || null
}
@ -632,6 +691,32 @@ function handleCreateEntry() {
ElMessage.warning('接口已下线:入库单不再支持手工新建,请使用快捷入库/匹配入库流程')
}
function openQuickInboundDialog() {
const targets = getActionTargetRows()
if (targets.length !== 1) {
ElMessage.warning('请选择一个入库单进行快捷直入')
return
}
const row = targets[0]
if (!canQuickInbound(row.order_status)) {
ElMessage.warning('仅「已创建」状态的入库单可执行快捷直入')
return
}
quickInboundTarget.value = row
quickInboundDialogVisible.value = true
}
function handleQuickInboundDialogClosed() {
quickInboundTarget.value = null
}
async function handleQuickInboundDialogSuccess() {
quickInboundDialogVisible.value = false
quickInboundTarget.value = null
await loadData()
entryDetailRefreshTick.value += 1
}
async function handleCompleteEntry() {
const targets = getActionTargetRows()
if (!targets.length) {
@ -651,7 +736,7 @@ async function handleCompleteEntry() {
loading.value = true
let successCount = 0
for (const row of targets) {
const res = await entryApi.completeEntry({ id: row.id })
const res = await entryApi.completeEntry({ entry_order_id: Number(row.id) })
if (res && res.code === 200) {
successCount++
} else {
@ -807,140 +892,15 @@ function handleImport() {
</script>
<style scoped lang="scss">
.storage-entry-container {
display: flex;
height: calc(100vh - 130px);
width: 100%;
background-color: #f0f2f5;
@use "../../order/orderManagement/styles/order-sub.scss";
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
min-height: 0;
.order-sub-container .main-content .lower-level .detail-container {
padding: 10px;
overflow: auto;
}
.toolbar {
padding: 5px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
.toolbar-right {
display: flex;
flex-direction: row;
gap: 15px;
height: 30px;
align-items: center;
}
.split-stack {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.pane-resizer {
flex: 0 0 6px;
min-height: 6px;
background: #e4e7ed;
cursor: row-resize;
flex-shrink: 0;
position: relative;
z-index: 2;
&:hover {
background: #dcdfe6;
}
}
.upper-wrapper {
overflow: hidden;
}
/* 在 entry 页面内覆盖 UpperTable,使表格容器填满可用高度,表体滚动,表头与分页固定 */
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
display: flex;
flex-direction: column;
}
.upper-wrapper :deep(.upper-table-container) :deep(.table-container) {
/* 取消 UpperTable 的固定像素高度,改为弹性填充 */
height: auto !important;
flex: 1 1 auto;
min-height: 0;
overflow: hidden; /* 交由 el-table__body-wrapper 控制滚动 */
}
/* 表头粘性,始终可见 */
.upper-wrapper :deep(.el-table__header-wrapper) {
position: sticky;
top: 0;
z-index: 3;
background: #fff;
}
/* 表格 body 使用自身滚动条 */
.upper-wrapper :deep(.el-table__body-wrapper) {
overflow: auto;
min-height: 0;
}
.lower-level {
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
background-color: #fafafa;
.detail-tab {
margin-bottom: -1px;
:deep(.el-tabs__header) {
margin: 0;
}
:deep(.el-tabs__item) {
height: 32px;
line-height: 32px;
font-size: 13px;
}
:deep(.el-tabs__nav-wrap::after) {
height: 1px;
}
}
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
}
}
.no-selection {
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip {
text-align: center;
font-size: 14px;
}
}
}
.empty-tip {
text-align: center;
font-size: 14px;
}
</style>

View File

@ -1,10 +1,11 @@
<template>
<div class="storage-entry-container">
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
:width="inventoryScanBoxConfig.width"
:tree-props="inventoryScanBoxConfig.treeProps"
:auto-submit="inventoryScanBoxConfig.autoSubmit"
cache-key="storage-inventory"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@ -200,7 +201,6 @@ import {
formatInventoryTypeLabel,
inventoryExportColumns,
isInventoryFlagEnabled,
inventoryScanBoxConfig,
productstockColums,
} from './inventory-config'
import { exportUpperTableRows } from '@/views/order/orderManagement/utils/export'
@ -211,6 +211,13 @@ import InventoryStockPickerDialog from './component/InventoryStockPickerDialog.v
import type { InventoryStockPickerItem } from './component/InventoryStockPickerDialog.vue'
import ExportModeDropdown from '@/components/ExportModeDropdown.vue'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
)
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
@ -689,146 +696,38 @@ function orderStatusTagType(val: string): any {
</script>
<style scoped lang="scss">
.storage-entry-container {
display: flex;
height: calc(100vh - 130px);
width: 100%;
background-color: #f0f2f5;
@use "../../order/orderManagement/styles/order-sub.scss";
.main-content {
flex: 1;
.order-sub-container .main-content {
.toolbar-right {
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
min-height: 0;
flex-direction: row;
gap: 8px;
align-items: center;
.toolbar {
padding: 5px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
.toolbar-right {
display: flex;
flex-direction: row;
gap: 8px;
height: 30px;
align-items: center;
.toolbar-label {
font-size: 12px;
color: #606266;
}
}
.expiry-date-expired {
color: #f56c6c;
font-weight: 600;
}
.inventory-warning-level {
font-weight: 600;
}
.split-stack {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.pane-resizer {
flex: 0 0 6px;
min-height: 6px;
background: #e4e7ed;
cursor: row-resize;
flex-shrink: 0;
position: relative;
z-index: 2;
&:hover {
background: #dcdfe6;
}
}
.upper-wrapper {
overflow: hidden;
}
/* 在 inventory 页面内覆盖 UpperTable,使表格容器填满可用高度,表体滚动,表头与分页固定 */
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
display: flex;
flex-direction: column;
}
.upper-wrapper :deep(.upper-table-container) :deep(.table-container) {
/* 取消 UpperTable 的固定像素高度,改为弹性填充 */
height: auto !important;
flex: 1 1 auto;
min-height: 0;
overflow: hidden; /* 交由 el-table__body-wrapper 控制滚动 */
}
/* 表头粘性,始终可见 */
.upper-wrapper :deep(.el-table__header-wrapper) {
position: sticky;
top: 0;
z-index: 3;
background: #fff;
}
/* 表格 body 使用自身滚动条 */
.upper-wrapper :deep(.el-table__body-wrapper) {
overflow: auto;
min-height: 0;
}
.lower-level {
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
background-color: #fafafa;
.detail-tab {
margin-bottom: -1px;
:deep(.el-tabs__header) { margin: 0; }
:deep(.el-tabs__item) {
height: 32px;
line-height: 32px;
font-size: 13px;
}
:deep(.el-tabs__nav-wrap::after) { height: 1px; }
}
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
}
}
.no-selection {
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip { text-align: center; font-size: 14px; }
.toolbar-label {
font-size: 12px;
color: #606266;
}
}
.expiry-date-expired {
color: #f56c6c;
font-weight: 600;
}
.inventory-warning-level {
font-weight: 600;
}
}
.order-sub-container .main-content .lower-level .detail-container {
padding: 10px;
overflow: auto;
}
.empty-tip {
text-align: center;
font-size: 14px;
}
</style>

View File

@ -1,19 +1,19 @@
/** ScanBox 筛选字段分组(库存模块专用) */
export const INVENTORY_SCAN_FIELD_GROUPS = {
product: '商品信息',
location: '库位信息',
owner: '货主信息',
inventory: '库存属性',
time: '时间范围',
} as const
import { scanWorkflowField } from '@/views/order/orderManagement/config/order-common-config'
type InventoryScanFieldGroupKey = keyof typeof INVENTORY_SCAN_FIELD_GROUPS
/** ScanBox 基础信息分组(对齐收货单排版) */
export const INVENTORY_SCAN_BASIC_INFO_GROUP = '基础信息'
export function inventoryScanField<G extends InventoryScanFieldGroupKey>(
group: G,
field: Record<string, any>
) {
return { ...field, group: INVENTORY_SCAN_FIELD_GROUPS[group] }
/** 为库存 ScanBox 基础信息字段附加分组标签 */
export type InventoryScanFieldConfig = Record<string, any> & {
group: string
value: string
label: string
type?: string
options?: Array<{ label: string; value: unknown }>
}
export function inventoryScanBasicField(field: Record<string, any>): InventoryScanFieldConfig {
return { ...field, group: INVENTORY_SCAN_BASIC_INFO_GROUP } as InventoryScanFieldConfig
}
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
@ -23,33 +23,34 @@ export const inventoryScanBoxConfig = {
autoSubmit: false
}
export const availableFields = [
inventoryScanField('product', {
label: '商品ID',
value: 'stock_id',
type: 'text',
placeholder: '请输入商品ID',
extraAction: { label: '编码筛选' }
}),
inventoryScanField('location', { label: '库位', value: 'space_id', type: 'text' }),
inventoryScanField('owner', { label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] }),
inventoryScanField('inventory', {
label: '库存类型',
value: 'inventory_type',
type: 'select',
options: [
{ label: '正品', value: 'ZP' },
{ label: '次品', value: 'CC' },
{ label: '机损', value: 'JS' },
{ label: '箱损', value: 'XS' },
{ label: '在途', value: 'ZT' },
{ label: '冻结', value: 'DJ' },
{ label: '分配', value: 'FP' }
]
}),
inventoryScanField('inventory', { label: '批次号', value: 'batch_no', type: 'text' }),
inventoryScanField('inventory', { label: '入库单号', value: 'inbound_order_no', type: 'text' }),
inventoryScanField('time', { label: '创建日期', value: 'created_at', type: 'daterange' })
export const availableFields: InventoryScanFieldConfig[] = [
inventoryScanBasicField({
label: '商品ID',
value: 'stock_id',
type: 'text',
placeholder: '请输入商品ID',
extraAction: { label: '编码筛选' }
}),
inventoryScanBasicField({ label: '库位', value: 'space_id', type: 'text' }),
inventoryScanBasicField({ label: '货主', value: 'store_id', type: 'select', multiple: true, options: [] }),
inventoryScanBasicField({ label: '批次号', value: 'batch_no', type: 'text' }),
inventoryScanBasicField({ label: '入库单号', value: 'inbound_order_no', type: 'text' }),
inventoryScanBasicField({ label: '创建日期', value: 'created_at', type: 'daterange' }),
// 流程/状态(每项独立分组,对齐收货单 scanWorkflowField 排版)
scanWorkflowField({
label: '库存类型',
value: 'inventory_type',
type: 'select',
options: [
{ label: '正品', value: 'ZP' },
{ label: '次品', value: 'CC' },
{ label: '机损', value: 'JS' },
{ label: '箱损', value: 'XS' },
{ label: '在途', value: 'ZT' },
{ label: '冻结', value: 'DJ' },
{ label: '分配', value: 'FP' }
]
}) as InventoryScanFieldConfig,
]
/** 库位展示名:优先 custom_name,其次 space_code */
export function formatInventorySpaceLabel(space?: Record<string, any> | null, fallback = ''): string {

View File

@ -1,7 +1,8 @@
<template>
<div class="transaction-log-container" :style="{ height: containerHeight }">
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
cache-key="storage-log"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
@ -446,149 +447,43 @@ function handleExportAction(action: string) {
</script>
<style lang="scss" scoped>
.transaction-log-container {
display: flex;
width: 100%;
background-color: #f0f2f5;
@use "../../order/orderManagement/styles/order-sub.scss";
.main-content {
flex: 1;
.order-sub-container .main-content .lower-level .detail-container {
padding: 10px;
overflow: auto;
:deep(.el-descriptions) {
background: #fff;
}
:deep(.el-descriptions__body) {
background: #fff;
}
:deep(.el-descriptions-item__cell) {
padding: 8px 12px;
}
}
.order-sub-container .main-content .lower-level .detail-header {
padding: 10px;
.detail-info {
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
min-height: 0;
align-items: center;
gap: 10px;
.toolbar {
padding: 5px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
.toolbar-left {
display: flex;
gap: 8px;
align-items: center;
}
.toolbar-right {
display: flex;
flex-direction: row;
gap: 15px;
height: 30px;
align-items: center;
}
}
.split-stack {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.pane-resizer {
flex: 0 0 6px;
min-height: 6px;
background: #e4e7ed;
cursor: row-resize;
flex-shrink: 0;
position: relative;
z-index: 2;
&:hover {
background: #dcdfe6;
}
}
.upper-wrapper {
overflow: hidden;
}
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
display: flex;
flex-direction: column;
}
.upper-wrapper :deep(.upper-table-container) :deep(.table-container) {
height: auto !important;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.el-table__header-wrapper) {
position: sticky;
top: 0;
z-index: 3;
background: #fff;
}
.upper-wrapper :deep(.el-table__body-wrapper) {
overflow: auto;
min-height: 0;
}
.lower-level {
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 10px;
border-bottom: 1px solid #ebeef5;
background-color: #fafafa;
.detail-info {
display: flex;
align-items: center;
gap: 10px;
.detail-title {
font-size: 14px;
font-weight: 500;
color: #303133;
}
}
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
:deep(.el-descriptions) {
background: #fff;
}
:deep(.el-descriptions__body) {
background: #fff;
}
:deep(.el-descriptions-item__cell) {
padding: 8px 12px;
}
}
}
.no-selection {
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip {
text-align: center;
font-size: 14px;
}
.detail-title {
font-size: 14px;
font-weight: 500;
color: #303133;
}
}
}
.empty-tip {
text-align: center;
font-size: 14px;
}
</style>

View File

@ -1,3 +1,28 @@
import { scanWorkflowField } from '@/views/order/orderManagement/config/order-common-config'
/** ScanBox 基础信息分组(对齐收货单排版) */
export const LOG_SCAN_BASIC_INFO_GROUP = '基础信息'
/** 为出入库日志 ScanBox 基础信息字段附加分组标签 */
export type LogScanFieldConfig = Record<string, any> & {
group: string
value: string
label: string
type?: string
options?: Array<{ label: string; value: unknown }>
}
export function logScanBasicField(field: Record<string, any>): LogScanFieldConfig {
return { ...field, group: LOG_SCAN_BASIC_INFO_GROUP } as LogScanFieldConfig
}
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
export const logScanBoxConfig = {
width: '250px',
treeProps: { children: 'children', label: 'label' } as const,
autoSubmit: false
}
// 时间格式化函数
export function formatDateTime(dateStr: string): string {
if (!dateStr) return '--'
@ -55,51 +80,74 @@ export const transactionColumns = [
{ prop: 'operator_name', label: '操作人', width: '100', align: 'center' }
]
// scan-box 可用字段
export const availableFields = [
{ value: 'transaction_type', label: '交易类型', type: 'select', options: Object.entries(transactionTypeConfig).map(([v, c]) => ({ value: v, label: c.text })) },
{ value: 'inventory_type', label: '库存类型', type: 'select', options: Object.entries(inventoryTypeConfig).map(([v, c]) => ({ value: v, label: c.text })) },
{ value: 'order_type', label: '订单类型', type: 'select', options: Object.entries(orderTypeConfig).map(([v, c]) => ({ value: v, label: c.text })) },
{
// scan-box 可用字段(基础信息在前,流程状态在后;对齐收货单 ScanBox 分组)
export const availableFields: LogScanFieldConfig[] = [
logScanBasicField({
value: 'stock_id',
label: '商品ID',
type: 'number',
placeholder: '请输入商品ID',
operators: ['eq', 'contains'],
defaultOperator: 'eq'
},
{
}),
logScanBasicField({
value: 'order_no',
label: '订单号',
type: 'text',
placeholder: '请输入订单号',
operators: ['contains', 'eq'],
defaultOperator: 'contains'
},
{
defaultOperator: 'eq'
}),
logScanBasicField({
value: 'operator_name',
label: '操作人',
type: 'text',
placeholder: '请输入操作人名称',
operators: ['contains'],
defaultOperator: 'contains'
},
{
operators: ['eq','contains'],
defaultOperator: 'eq'
}),
logScanBasicField({
value: 'space_id',
label: '库位ID',
type: 'number',
placeholder: '请输入库位ID',
operators: ['eq'],
defaultOperator: 'eq'
},
{ value: 'store_id', label: '货主', type: 'select', multiple: true, filterable: true, options: [] },
{
}),
logScanBasicField({
value: 'store_id',
label: '货主',
type: 'select',
multiple: true,
filterable: true,
options: []
}),
logScanBasicField({
value: 'created_at',
label: '创建时间',
type: 'date',
operators: ['between', 'eq', 'gt', 'lt'],
defaultOperator: 'between'
}
}),
// 流程/状态(每项独立分组,对齐收货单 scanWorkflowField 排版)
scanWorkflowField({
value: 'transaction_type',
label: '交易类型',
type: 'select',
options: Object.entries(transactionTypeConfig).map(([v, c]) => ({ value: v, label: c.text }))
}) as LogScanFieldConfig,
scanWorkflowField({
value: 'inventory_type',
label: '库存类型',
type: 'select',
options: Object.entries(inventoryTypeConfig).map(([v, c]) => ({ value: v, label: c.text }))
}) as LogScanFieldConfig,
scanWorkflowField({
value: 'order_type',
label: '订单类型',
type: 'select',
options: Object.entries(orderTypeConfig).map(([v, c]) => ({ value: v, label: c.text }))
}) as LogScanFieldConfig,
]
// 格式化行数据

View File

@ -1,12 +1,19 @@
<template>
<div class="storage-receiving-container" :style="{ height: containerHeight }">
<scan-box ref="scanBox"
:width="receivingScanBoxConfig.width"
:tree-props="receivingScanBoxConfig.treeProps"
:auto-submit="receivingScanBoxConfig.autoSubmit"
:initial-conditions="initialConditions" :preset-tree="presetTree" :available-fields="availableFieldsRef"
@condition-change="handleConditionChange" @reset="handleConditionReset" @condition-clear="handleConditionClear"
@submit="handleSubmit" />
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
cache-key="storage-receiving"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:initial-conditions="initialConditions"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
@submit="handleSubmit"
/>
<div class="main-content">
<div class="toolbar">
@ -326,7 +333,6 @@ import {
loadingMethodConfig,
addReceivingFields,
receivingToolbarButtons,
receivingScanBoxConfig
} from './receiving-config'
import * as XLSX from 'xlsx'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
@ -1569,158 +1575,36 @@ async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
</script>
<style scoped lang="scss">
.storage-receiving-container {
display: flex;
// height: calc(100vh - 100px); // 移除固定高度,由模板中的 :style 控制
width: 100%;
background-color: #f0f2f5;
@use "../../order/orderManagement/styles/order-sub.scss";
.main-content {
.order-sub-container .main-content .lower-level .detail-container {
padding: 6px 10px;
display: flex;
flex-direction: column;
box-sizing: border-box;
:deep(.receiving-detail-pane) {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
.toolbar {
margin-bottom: 3px;
padding: 6px 10px;
border: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
min-width: 0;
overflow: hidden;
.toolbar-left {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 10px;
overflow: hidden;
}
.toolbar-right {
flex: 0 0 auto;
margin-left: 10px;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
}
}
.split-stack {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.pane-resizer {
flex: 0 0 6px;
min-height: 6px;
background: #e4e7ed;
cursor: row-resize;
flex-shrink: 0;
position: relative;
z-index: 2;
&:hover {
background: #dcdfe6;
}
}
.upper-wrapper {
/* 高度占比由 :style(upperPaneStyle / upperPaneFullStyle)控制 */
overflow: hidden;
}
/* upper-table-container 已在组件内支持弹性高度,此处确保撑满 upper-wrapper */
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
}
.lower-level {
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
flex-shrink: 0;
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
background-color: #fafafa;
.detail-tab {
margin-bottom: -1px;
:deep(.el-tabs__header) {
margin: 0;
}
:deep(.el-tabs__item) {
height: 28px;
line-height: 28px;
font-size: 12px;
padding: 0 10px;
}
:deep(.el-tabs__nav-wrap::after) {
height: 1px;
}
}
}
.detail-container {
flex: 1;
min-height: 0;
overflow: hidden;
padding: 6px 10px;
display: flex;
flex-direction: column;
box-sizing: border-box;
:deep(.receiving-detail-pane) {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
}
}
}
.no-selection {
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
padding: 10px;
.empty-tip {
text-align: center;
font-size: 13px;
line-height: 1.5;
max-width: 360px;
.el-icon {
font-size: 36px;
margin-bottom: 8px;
}
}
}
}
}
.empty-tip {
text-align: center;
font-size: 13px;
line-height: 1.5;
max-width: 360px;
.el-icon {
font-size: 36px;
margin-bottom: 8px;
}
}
.match-putaway-dialog {
display: flex;

View File

@ -1,24 +1,22 @@
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import {
scanWorkflowField,
type ToolbarButtonConfig
} from '@/views/order/orderManagement/config/order-common-config'
/** ScanBox 筛选字段分组(收货模块专用) */
export const RECEIVING_SCAN_FIELD_GROUPS = {
order: '单据信息',
status: '状态筛选',
owner: '货主信息',
logistics: '物流信息',
stats: '数量统计',
time: '时间范围',
person: '人员信息',
other: '其他',
} as const
/** ScanBox 基础信息分组(对齐待处理订单排版) */
export const RECEIVING_SCAN_BASIC_INFO_GROUP = '基础信息'
type ReceivingScanFieldGroupKey = keyof typeof RECEIVING_SCAN_FIELD_GROUPS
/** 为收货 ScanBox 基础信息字段附加分组标签 */
export type ReceivingScanFieldConfig = Record<string, any> & {
group: string
value: string
label: string
type?: string
options?: Array<{ label: string; value: unknown }>
}
export function receivingScanField<G extends ReceivingScanFieldGroupKey>(
group: G,
field: Record<string, any>
): Record<string, any> & { group: (typeof RECEIVING_SCAN_FIELD_GROUPS)[G] } {
return { ...field, group: RECEIVING_SCAN_FIELD_GROUPS[group] }
export function receivingScanBasicField(field: Record<string, any>): ReceivingScanFieldConfig {
return { ...field, group: RECEIVING_SCAN_BASIC_INFO_GROUP } as ReceivingScanFieldConfig
}
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
@ -153,49 +151,17 @@ export const receivingColumns = [
]
// receiving配置
export const availableFields = [
receivingScanField('order', {
// receiving配置(基础信息在前,流程状态在后;对齐待处理订单 ScanBox 分组)
export const availableFields: ReceivingScanFieldConfig[] = [
receivingScanBasicField({
value: 'receiving_number',
label: '收货单号',
type: 'text',
placeholder: '请输入收货单号',
operators: ['eq', 'ne', 'contains', 'starts_with', 'like'],
defaultOperator: 'contains'
defaultOperator: 'eq'
}),
receivingScanField('status', {
value: 'status',
label: '收货状态',
type: 'select',
options: Object.entries(statusConfig).map(([v, c]) => ({ value: v, label: c.text }))
}),
receivingScanField('status', {
value: 'detail_status',
label: '匹配状态',
type: 'select',
options: Object.entries(detailStatusConfig).map(([v, c]) => ({ value: v, label: c.text }))
}),
receivingScanField('status', {
value: 'storage_status',
label: '入库状态',
type: 'select',
options: [
{ value: 'none', label: '待入库' },
{ value: 'partial', label: '部分入库' },
{ value: 'all', label: '已入库' }
]
}),
receivingScanField('status', {
value: 'is_review',
label: '审核状态',
type: 'select',
placeholder: '请选择审核状态',
options: [
{ value: 0, label: '未审核' },
{ value: 1, label: '已审核' }
]
}),
receivingScanField('owner', {
receivingScanBasicField({
value: 'store_id',
label: '货主',
type: 'select',
@ -203,13 +169,13 @@ export const availableFields = [
filterable: true,
options: []
}),
receivingScanField('logistics', {
receivingScanBasicField({
value: 'delivery_method',
label: '来货方式',
type: 'select',
options: Object.entries(deliveryMethodConfig).map(([v, c]: [string, any]) => ({ value: v, label: c.text }))
}),
receivingScanField('logistics', {
receivingScanBasicField({
value: 'loading_method',
label: '装卸方式',
type: 'select',
@ -219,23 +185,23 @@ export const availableFields = [
label: (config as any).text
}))
}),
receivingScanField('logistics', {
receivingScanBasicField({
value: 'license_plate',
label: '车牌号',
type: 'text',
placeholder: '请输入车牌号',
operators: ['contains'],
defaultOperator: 'contains'
operators: ['eq', 'contains'],
defaultOperator: 'eq'
}),
receivingScanField('logistics', {
receivingScanBasicField({
value: 'tracking_number',
label: '物流单号',
type: 'text',
placeholder: '请输入物流单号',
operators: ['contains'],
defaultOperator: 'contains'
operators: ['eq', 'contains'],
defaultOperator: 'eq'
}),
receivingScanField('stats', {
receivingScanBasicField({
value: 'total_items',
label: '商品种类',
type: 'number',
@ -243,7 +209,7 @@ export const availableFields = [
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
}),
receivingScanField('stats', {
receivingScanBasicField({
value: 'total_quantity',
label: '总数量',
type: 'number',
@ -251,7 +217,7 @@ export const availableFields = [
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
}),
receivingScanField('stats', {
receivingScanBasicField({
value: 'total_boxes',
label: '总箱数',
type: 'number',
@ -259,7 +225,7 @@ export const availableFields = [
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
}),
receivingScanField('stats', {
receivingScanBasicField({
value: 'total_pallets',
label: '总托盘数',
type: 'number',
@ -267,35 +233,35 @@ export const availableFields = [
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
}),
receivingScanField('time', {
receivingScanBasicField({
value: 'created_at',
label: '创建时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
receivingScanField('time', {
receivingScanBasicField({
value: 'updated_at',
label: '更新时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
receivingScanField('time', {
receivingScanBasicField({
value: 'receiving_start_time',
label: '收货开始时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
receivingScanField('time', {
receivingScanBasicField({
value: 'receiving_end_time',
label: '收货结束时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
receivingScanField('person', {
receivingScanBasicField({
value: 'creator_id',
label: '创建人',
type: 'select',
@ -303,22 +269,55 @@ export const availableFields = [
filterable: true,
options: []
}),
receivingScanField('other', {
receivingScanBasicField({
value: 'remark',
label: '备注',
type: 'text',
placeholder: '请输入备注关键词',
operators: ['contains'],
defaultOperator: 'contains'
operators: ['eq', 'contains'],
defaultOperator: 'eq'
}),
receivingScanField('other', {
receivingScanBasicField({
value: 'video_device_id',
label: '录像设备ID',
type: 'text',
placeholder: '请输入录像设备ID',
operators: ['eq', 'contains'],
defaultOperator: 'contains'
})
defaultOperator: 'eq'
}),
// 流程/状态(每项独立分组,对齐待处理订单 scanWorkflowField 排版)
scanWorkflowField({
value: 'status',
label: '收货状态',
type: 'select',
options: Object.entries(statusConfig).map(([v, c]) => ({ value: v, label: c.text }))
}) as ReceivingScanFieldConfig,
scanWorkflowField({
value: 'detail_status',
label: '匹配状态',
type: 'select',
options: Object.entries(detailStatusConfig).map(([v, c]) => ({ value: v, label: c.text }))
}) as ReceivingScanFieldConfig,
scanWorkflowField({
value: 'storage_status',
label: '入库状态',
type: 'select',
options: [
{ value: 'none', label: '待入库' },
{ value: 'partial', label: '部分入库' },
{ value: 'all', label: '已入库' }
]
}) as ReceivingScanFieldConfig,
scanWorkflowField({
value: 'is_review',
label: '审核状态',
type: 'select',
placeholder: '请选择审核状态',
options: [
{ value: 0, label: '未审核' },
{ value: 1, label: '已审核' }
]
}) as ReceivingScanFieldConfig,
]
export const addReceving = [

View File

@ -62,10 +62,10 @@
@mousedown="beginSplitDrag"
/>
<div v-if="selectedRow" class="lower-level" :class="tableSize" :style="lowerPaneStyle">
<div class="detail-header">
<!-- <div class="detail-header">
<span class="detail-title">行明细</span>
<span class="detail-sub">字段与接口 <code>data.list[]</code> 单条对象一致</span>
</div>
</div> -->
<div class="detail-container">
<el-descriptions :column="2" border size="small">
<el-descriptions-item

View File

@ -1,10 +1,11 @@
<template>
<div class="storage-stockout-container">
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
:width="stockoutScanBoxConfig.width"
:tree-props="stockoutScanBoxConfig.treeProps"
:auto-submit="stockoutScanBoxConfig.autoSubmit"
cache-key="storage-stockout"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:initial-conditions="initialConditions"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@ -125,7 +126,6 @@ import {
statusConfig,
syncStatusConfig,
formatStockoutData,
stockoutScanBoxConfig
} from './stockout-config'
import stockoutdetail from './component/stockoutdetail.vue'
@ -134,6 +134,13 @@ import log from './component/log.vue'
import ExportModeDropdown from '@/components/ExportModeDropdown.vue'
import * as XLSX from 'xlsx'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
)
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
@ -509,111 +516,15 @@ function handleImport() {
</script>
<style scoped lang="scss">
.storage-stockout-container {
display: flex;
height: calc(100vh - 130px);
width: 100%;
background-color: #f0f2f5;
@use "../../order/orderManagement/styles/order-sub.scss";
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
min-height: 0;
.order-sub-container .main-content .lower-level .detail-container {
padding: 10px;
overflow: auto;
}
.toolbar {
padding: 5px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
.toolbar-right {
display: flex;
flex-direction: row;
gap:15px;
height: 30px;
align-items: center;
}
.split-stack {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.pane-resizer {
flex: 0 0 6px;
min-height: 6px;
background: #e4e7ed;
cursor: row-resize;
flex-shrink: 0;
position: relative;
z-index: 2;
&:hover {
background: #dcdfe6;
}
}
.upper-wrapper {
overflow: hidden;
}
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
}
.lower-level {
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
background-color: #fafafa;
.detail-tab {
margin-bottom: -1px;
:deep(.el-tabs__header) {
margin: 0;
}
:deep(.el-tabs__item) {
height: 32px;
line-height: 32px;
font-size: 13px;
}
:deep(.el-tabs__nav-wrap::after) {
height: 1px;
}
}
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
}
}
.no-selection {
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip { text-align: center; font-size: 14px; }
}
}
.empty-tip {
text-align: center;
font-size: 14px;
}
</style>

View File

@ -1,20 +1,19 @@
// status 实际值(接口存在拼写:pedding)
export const STOCKOUT_SCAN_FIELD_GROUPS = {
order: '单据信息',
status: '单据状态',
owner: '货主信息',
receiver: '收货信息',
logistics: '物流信息',
time: '时间范围',
} as const
import { scanWorkflowField } from '@/views/order/orderManagement/config/order-common-config'
type StockoutScanFieldGroupKey = keyof typeof STOCKOUT_SCAN_FIELD_GROUPS
/** ScanBox 基础信息分组(对齐收货单排版) */
export const STOCKOUT_SCAN_BASIC_INFO_GROUP = '基础信息'
export function stockoutScanField<G extends StockoutScanFieldGroupKey>(
group: G,
field: Record<string, any>
): Record<string, any> & { group: (typeof STOCKOUT_SCAN_FIELD_GROUPS)[G] } {
return { ...field, group: STOCKOUT_SCAN_FIELD_GROUPS[group] }
/** 为出库 ScanBox 基础信息字段附加分组标签 */
export type StockoutScanFieldConfig = Record<string, any> & {
group: string
value: string
label: string
type?: string
options?: Array<{ label: string; value: unknown }>
}
export function stockoutScanBasicField(field: Record<string, any>): StockoutScanFieldConfig {
return { ...field, group: STOCKOUT_SCAN_BASIC_INFO_GROUP } as StockoutScanFieldConfig
}
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
@ -75,9 +74,9 @@ export const entryColums = [
{ prop: 'updated_at', label: '更新时间', width: '160', sortable: true, formatter: (row: any) => formatDateTime(row.updated_at) }
]
export const availableFields = [
stockoutScanField('order', { value: 'delivery_order_code', label: '出库单号', type: 'text' }),
stockoutScanField('order', {
export const availableFields: StockoutScanFieldConfig[] = [
stockoutScanBasicField({ value: 'delivery_order_code', label: '出库单号', type: 'text' }),
stockoutScanBasicField({
value: 'order_type',
label: '单据类型',
type: 'select',
@ -88,7 +87,27 @@ export const availableFields = [
{ label: '其他出库', value: 'OTHER' }
]
}),
stockoutScanField('status', {
stockoutScanBasicField({
value: 'store_id',
label: '货主',
type: 'select',
multiple: true,
filterable: true,
options: []
}),
stockoutScanBasicField({ value: 'buyer_nick', label: '买家', type: 'text' }),
stockoutScanBasicField({ value: 'mobile', label: '联系电话', type: 'text' }),
stockoutScanBasicField({ value: 'logistics_code', label: '物流公司', type: 'text' }),
stockoutScanBasicField({ value: 'express_code', label: '运单号', type: 'text' }),
stockoutScanBasicField({
value: 'place_order_time',
label: '下单时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
}),
// 流程/状态(每项独立分组,对齐收货单 scanWorkflowField 排版)
scanWorkflowField({
value: 'status',
label: '出库状态',
type: 'select',
@ -98,8 +117,8 @@ export const availableFields = [
{ value: 'completed', label: '已完成' },
{ value: 'cancelled', label: '已作废' }
]
}),
stockoutScanField('status', {
}) as StockoutScanFieldConfig,
scanWorkflowField({
value: 'sync_status',
label: '同步状态',
type: 'select',
@ -108,26 +127,7 @@ export const availableFields = [
{ value: 'success', label: '同步成功' },
{ value: 'failed', label: '同步失败' }
]
}),
stockoutScanField('owner', {
value: 'store_id',
label: '货主',
type: 'select',
multiple: true,
filterable: true,
options: []
}),
stockoutScanField('receiver', { value: 'buyer_nick', label: '买家', type: 'text' }),
stockoutScanField('receiver', { value: 'mobile', label: '联系电话', type: 'text' }),
stockoutScanField('logistics', { value: 'logistics_code', label: '物流公司', type: 'text' }),
stockoutScanField('logistics', { value: 'express_code', label: '运单号', type: 'text' }),
stockoutScanField('time', {
value: 'place_order_time',
label: '下单时间',
type: 'daterange',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间'
})
}) as StockoutScanFieldConfig,
]
// 详情面板表单配置