1
This commit is contained in:
parent
6e61f3a5be
commit
1146ed6c1d
@ -704,6 +704,28 @@ export type ReceivingCompareRow = {
|
|||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** storage.entry.queryEntryLogs 参数 */
|
||||||
|
export type QueryEntryLogsParams = {
|
||||||
|
id?: number | string
|
||||||
|
page?: number
|
||||||
|
pageSize?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询入库单操作日志 */
|
||||||
|
export function queryEntryLogs(data: QueryEntryLogsParams = {}): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'storage.entry.queryEntryLogs',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
/** 汇总统计(summary 对象) */
|
/** 汇总统计(summary 对象) */
|
||||||
export type ReceivingCompareSummary = {
|
export type ReceivingCompareSummary = {
|
||||||
total_rows?: number
|
total_rows?: number
|
||||||
@ -780,3 +802,34 @@ export function receivingCompare(
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** storage.entry.reviewEntry 参数 */
|
||||||
|
export type ReviewEntryParams = {
|
||||||
|
/** 入库单ID */
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** storage.entry.reviewEntry 响应 */
|
||||||
|
export type ReviewEntryResponse = {
|
||||||
|
flag?: string
|
||||||
|
code?: number
|
||||||
|
message?: string
|
||||||
|
data?: {
|
||||||
|
id?: number
|
||||||
|
order_status?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 审核入库单(CREATED → PENDING),仅允许已绑定收货单的入库单推进状态 */
|
||||||
|
export function reviewEntry(data: ReviewEntryParams): Promise<ReviewEntryResponse> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'storage.entry.reviewEntry',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -694,9 +694,9 @@ export const pendingOrderDetailSections: OrderDetailSectionConfig[] = [
|
|||||||
{ prop: 'delivery_order_code', label: '发货单号' },
|
{ prop: 'delivery_order_code', label: '发货单号' },
|
||||||
{ prop: 'pre_delivery_order_code', label: '前置单号' },
|
{ prop: 'pre_delivery_order_code', label: '前置单号' },
|
||||||
{ prop: 'order_type', label: '订单类型' },
|
{ prop: 'order_type', label: '订单类型' },
|
||||||
{ prop: 'create_channel', label: '创建渠道' },
|
{ prop: 'create_channel', label: '来源' },
|
||||||
{ prop: 'order_flag', label: '订单标记', span: 4 },
|
{ prop: 'order_flag', label: '订单标记', span: 4 },
|
||||||
{ prop: 'sys_platform_name', label: '来源' },
|
{ prop: 'sys_platform_name', label: '平台' },
|
||||||
{ prop: 'sys_platform_code', label: '平台编码', tag: true },
|
{ prop: 'sys_platform_code', label: '平台编码', tag: true },
|
||||||
{ prop: 'source_platform_name', label: '来源平台名' },
|
{ prop: 'source_platform_name', label: '来源平台名' },
|
||||||
{ prop: 'source_order_codes', label: '平台交易单号' },
|
{ prop: 'source_order_codes', label: '平台交易单号' },
|
||||||
@ -795,7 +795,8 @@ export const orderDetailCompactSections: OrderDetailSectionConfig[] = [
|
|||||||
fields: [
|
fields: [
|
||||||
{ prop: 'delivery_order_code', label: '发货单号' },
|
{ prop: 'delivery_order_code', label: '发货单号' },
|
||||||
{ prop: 'order_type', label: '订单类型' },
|
{ prop: 'order_type', label: '订单类型' },
|
||||||
{ prop: 'sys_platform_name', label: '来源' },
|
{ prop: 'sys_platform_name', label: '平台' },
|
||||||
|
{ prop: 'create_channel', label: '来源' },
|
||||||
{ prop: 'shop_nick', label: '店铺名称' },
|
{ prop: 'shop_nick', label: '店铺名称' },
|
||||||
{ prop: 'buyer_nick', label: '买家昵称' },
|
{ prop: 'buyer_nick', label: '买家昵称' },
|
||||||
{ prop: 'status', label: '订单状态', tag: true },
|
{ prop: 'status', label: '订单状态', tag: true },
|
||||||
@ -1098,7 +1099,7 @@ export const sourceOrderCodesScanField = scanBasicField({ label: '平台交易
|
|||||||
export const pendingOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
export const pendingOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
||||||
export const exceptionOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
export const exceptionOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
||||||
export const shopNickScanField = scanBasicField({ label: '店铺名称', value: 'shop_nick', type: 'text' })
|
export const shopNickScanField = scanBasicField({ label: '店铺名称', value: 'shop_nick', type: 'text' })
|
||||||
export const sysPlatformNameScanField = scanBasicField({ label: '来源', value: 'sys_platform_name', type: 'select', options: [] })
|
export const sysPlatformNameScanField = scanBasicField({ label: '平台', value: 'sys_platform_name', type: 'select', options: [] })
|
||||||
export const sysPlatformCodeScanField = scanBasicField({ label: '平台编码', value: 'sys_platform_code', type: 'select', options: [] })
|
export const sysPlatformCodeScanField = scanBasicField({ label: '平台编码', value: 'sys_platform_code', type: 'select', options: [] })
|
||||||
export const buyerNickScanField = scanBasicField({ label: '买家昵称', value: 'buyer_nick', type: 'text' })
|
export const buyerNickScanField = scanBasicField({ label: '买家昵称', value: 'buyer_nick', type: 'text' })
|
||||||
export const receiverNameScanField = scanBasicField({ label: '收件人', value: 'name', type: 'text' })
|
export const receiverNameScanField = scanBasicField({ label: '收件人', value: 'name', type: 'text' })
|
||||||
@ -1290,7 +1291,8 @@ export const deliveryColumns = applyOrderListCopyActions([
|
|||||||
{ prop: 'wave_no', label: '波次号', width: '150' },
|
{ prop: 'wave_no', label: '波次号', width: '150' },
|
||||||
{ prop: 'wave_id', label: '波次ID', width: '90' },
|
{ prop: 'wave_id', label: '波次ID', width: '90' },
|
||||||
{ prop: 'order_flag', label: '订单标记', minWidth: '220' },
|
{ prop: 'order_flag', label: '订单标记', minWidth: '220' },
|
||||||
{ prop: 'sys_platform_name', label: '来源', width: '110' },
|
{ prop: 'sys_platform_name', label: '平台', width: '110' },
|
||||||
|
{ prop: 'create_channel', label: '来源', width: '120' },
|
||||||
{ prop: 'sys_platform_code', label: '平台编码', width: '100' },
|
{ prop: 'sys_platform_code', label: '平台编码', width: '100' },
|
||||||
{ prop: 'order_type', label: '订单类型', width: '90', formatter: orderTypeFormatter },
|
{ prop: 'order_type', label: '订单类型', width: '90', formatter: orderTypeFormatter },
|
||||||
{ prop: 'buyer_nick', label: '买家昵称', width: '120' },
|
{ prop: 'buyer_nick', label: '买家昵称', width: '120' },
|
||||||
@ -1488,7 +1490,8 @@ export const reviewOrderDetail = [
|
|||||||
{ prop: 'pre_delivery_order_code', label: '前置单号' },
|
{ prop: 'pre_delivery_order_code', label: '前置单号' },
|
||||||
{ prop: 'order_type', label: '订单类型' },
|
{ prop: 'order_type', label: '订单类型' },
|
||||||
{ prop: 'order_flag', label: '订单标记' },
|
{ prop: 'order_flag', label: '订单标记' },
|
||||||
{ prop: 'sys_platform_name', label: '来源' },
|
{ prop: 'sys_platform_name', label: '平台' },
|
||||||
|
{ prop: 'create_channel', label: '来源' },
|
||||||
{ prop: 'sys_platform_code', label: '平台编码' },
|
{ prop: 'sys_platform_code', label: '平台编码' },
|
||||||
{ prop: 'shop_nick', label: '店铺名称' },
|
{ prop: 'shop_nick', label: '店铺名称' },
|
||||||
{ prop: 'buyer_nick', label: '买家昵称' },
|
{ prop: 'buyer_nick', label: '买家昵称' },
|
||||||
@ -1641,7 +1644,8 @@ export const pendingCloums = [
|
|||||||
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
|
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
|
||||||
{ prop: 'pay_time', label: '支付时间', width: '160', formatter: orderTimeFormatter },
|
{ prop: 'pay_time', label: '支付时间', width: '160', formatter: orderTimeFormatter },
|
||||||
{ prop: 'place_order_time', label: '时效', width: '165', formatter: orderTimeFormatter },
|
{ prop: 'place_order_time', label: '时效', width: '165', formatter: orderTimeFormatter },
|
||||||
{ prop: 'sys_platform_name', label: '来源', width: '120' },
|
{ prop: 'sys_platform_name', label: '平台', width: '120' },
|
||||||
|
{ prop: 'create_channel', label: '来源', width: '120' },
|
||||||
{ prop: 'source_order_codes', label: '平台交易单号', width: '140' },
|
{ prop: 'source_order_codes', label: '平台交易单号', width: '140' },
|
||||||
{ prop: 'logistics_name', label: '快递', width: '120' },
|
{ prop: 'logistics_name', label: '快递', width: '120' },
|
||||||
{ prop: 'remark', label: '留言', width: '160' },
|
{ prop: 'remark', label: '留言', width: '160' },
|
||||||
@ -1705,7 +1709,8 @@ export const pendingOrderDetail = [
|
|||||||
{ prop: 'pre_delivery_order_code', label: '前置单号' },
|
{ prop: 'pre_delivery_order_code', label: '前置单号' },
|
||||||
{ prop: 'order_type', label: '订单类型' },
|
{ prop: 'order_type', label: '订单类型' },
|
||||||
{ prop: 'order_flag', label: '订单标记' },
|
{ prop: 'order_flag', label: '订单标记' },
|
||||||
{ prop: 'sys_platform_name', label: '来源' },
|
{ prop: 'sys_platform_name', label: '平台' },
|
||||||
|
{ prop: 'create_channel', label: '来源' },
|
||||||
{ prop: 'sys_platform_code', label: '平台编码' },
|
{ prop: 'sys_platform_code', label: '平台编码' },
|
||||||
{ prop: 'shop_nick', label: '店铺名称' },
|
{ prop: 'shop_nick', label: '店铺名称' },
|
||||||
{ prop: 'buyer_nick', label: '买家昵称' },
|
{ prop: 'buyer_nick', label: '买家昵称' },
|
||||||
@ -1865,7 +1870,8 @@ export const workbenchColumns = applyOrderListCopyActions([
|
|||||||
{ prop: 'delivery_order_code', label: '发货单号', minWidth: 160 },
|
{ prop: 'delivery_order_code', label: '发货单号', minWidth: 160 },
|
||||||
{ prop: 'wave_no', label: '波次号', minWidth: 160 },
|
{ prop: 'wave_no', label: '波次号', minWidth: 160 },
|
||||||
{ prop: 'order_flag', label: '订单标记', minWidth: 260 },
|
{ prop: 'order_flag', label: '订单标记', minWidth: 260 },
|
||||||
{ prop: 'sys_platform_name', label: '来源', minWidth: 120 },
|
{ prop: 'sys_platform_name', label: '平台', minWidth: 120 },
|
||||||
|
{ prop: 'create_channel', label: '来源', minWidth: 120 },
|
||||||
{ prop: 'shop_nick', label: '店铺名称', minWidth: 140 },
|
{ prop: 'shop_nick', label: '店铺名称', minWidth: 140 },
|
||||||
{ prop: 'buyer_nick', label: '买家昵称', minWidth: 140 },
|
{ prop: 'buyer_nick', label: '买家昵称', minWidth: 140 },
|
||||||
{ prop: 'name', label: '收件人', minWidth: 100 },
|
{ prop: 'name', label: '收件人', minWidth: 100 },
|
||||||
@ -1936,7 +1942,8 @@ export const expectionColumns = [
|
|||||||
{ prop: 'id', label: '订单ID', width: '80' },
|
{ prop: 'id', label: '订单ID', width: '80' },
|
||||||
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
|
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
|
||||||
{ prop: 'wave_no', label: '波次号', width: '170' },
|
{ prop: 'wave_no', label: '波次号', width: '170' },
|
||||||
{ prop: 'sys_platform_name', label: '来源', width: '120' },
|
{ prop: 'sys_platform_name', label: '平台', width: '120' },
|
||||||
|
{ prop: 'create_channel', label: '来源', width: '120' },
|
||||||
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
||||||
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
|
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
|
||||||
{ prop: 'status', label: '订单状态', width: '100' },
|
{ prop: 'status', label: '订单状态', width: '100' },
|
||||||
@ -1966,7 +1973,8 @@ export const expectionOrderDetail = [
|
|||||||
{ prop: 'order_code', label: '发货单号' },
|
{ prop: 'order_code', label: '发货单号' },
|
||||||
{ prop: 'order_type', label: '订单类型' },
|
{ prop: 'order_type', label: '订单类型' },
|
||||||
{ prop: 'shop_nick', label: '店铺名称' },
|
{ prop: 'shop_nick', label: '店铺名称' },
|
||||||
{ prop: 'sys_platform_name', label: '来源' },
|
{ prop: 'sys_platform_name', label: '平台' },
|
||||||
|
{ prop: 'create_channel', label: '来源' },
|
||||||
{ prop: 'status', label: '订单状态' },
|
{ prop: 'status', label: '订单状态' },
|
||||||
{ prop: 'intercept_status', label: '拦截状态' },
|
{ prop: 'intercept_status', label: '拦截状态' },
|
||||||
|
|
||||||
@ -2044,6 +2052,7 @@ export const archiveColumns = applyOrderListCopyActions([
|
|||||||
{ prop: 'wave_no', label: '波次号', width: '160' },
|
{ prop: 'wave_no', label: '波次号', width: '160' },
|
||||||
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
|
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
|
||||||
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
|
||||||
|
{ prop: 'create_channel', label: '来源', width: '120' },
|
||||||
{ prop: 'name', label: '收件人', width: '120' },
|
{ prop: 'name', label: '收件人', width: '120' },
|
||||||
{ prop: 'mobile', label: '电话', width: '120' },
|
{ prop: 'mobile', label: '电话', width: '120' },
|
||||||
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
|
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
|
||||||
@ -2060,7 +2069,8 @@ export const archiveOrderDetail = [
|
|||||||
{ prop: 'order_code', label: '发货单号' },
|
{ prop: 'order_code', label: '发货单号' },
|
||||||
{ prop: 'order_type', label: '订单类型' },
|
{ prop: 'order_type', label: '订单类型' },
|
||||||
{ prop: 'shop_nick', label: '店铺名称' },
|
{ prop: 'shop_nick', label: '店铺名称' },
|
||||||
{ prop: 'sys_platform_name', label: '来源' },
|
{ prop: 'sys_platform_name', label: '平台' },
|
||||||
|
{ prop: 'create_channel', label: '来源' },
|
||||||
{ prop: 'status', label: '订单状态' },
|
{ prop: 'status', label: '订单状态' },
|
||||||
|
|
||||||
// 收货信息
|
// 收货信息
|
||||||
|
|||||||
@ -333,8 +333,7 @@ const canSubmitBind = computed(
|
|||||||
selectedReceivingRows.value.length > 0 &&
|
selectedReceivingRows.value.length > 0 &&
|
||||||
!bindSubmitting.value &&
|
!bindSubmitting.value &&
|
||||||
!compareLoading.value &&
|
!compareLoading.value &&
|
||||||
!receivingListLoading.value &&
|
!receivingListLoading.value
|
||||||
isEntryFullyCovered.value
|
|
||||||
)
|
)
|
||||||
|
|
||||||
function isApiSuccess(res: { code?: number; flag?: string } | null | undefined): boolean {
|
function isApiSuccess(res: { code?: number; flag?: string } | null | undefined): boolean {
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-actions">
|
<div class="right-actions">
|
||||||
<el-tag v-if="canBindReceiving" size="small" type="warning">待入库,可绑定收货明细</el-tag>
|
|
||||||
<el-tag v-if="canDirectInbound" size="small" type="success">可导入/PDA 入库</el-tag>
|
<el-tag v-if="canDirectInbound" size="small" type="success">可导入/PDA 入库</el-tag>
|
||||||
<span v-if="directSummary.total_direct_inbound !== undefined" class="summary-text">
|
<span v-if="directSummary.total_direct_inbound !== undefined" class="summary-text">
|
||||||
已导入 {{ directSummary.total_direct_inbound ?? 0 }} / 计划 {{ directSummary.total_planned ?? '—' }}
|
已导入 {{ directSummary.total_direct_inbound ?? 0 }} / 计划 {{ directSummary.total_planned ?? '—' }}
|
||||||
@ -40,28 +39,7 @@
|
|||||||
@page-size-change="handlePageSizeChange"
|
@page-size-change="handlePageSizeChange"
|
||||||
@page-change="handlePageChange"
|
@page-change="handlePageChange"
|
||||||
>
|
>
|
||||||
<template v-if="canBindReceiving" #column-operation="{ row }">
|
<template #column-operation="{ row }">
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
:disabled="!row.stock_id"
|
|
||||||
@click="openBindDialog(row)"
|
|
||||||
>
|
|
||||||
绑定
|
|
||||||
</el-button>
|
|
||||||
<!-- <el-button
|
|
||||||
v-if="canDirectInbound"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
:disabled="!canImportRow(row)"
|
|
||||||
@click="openImportDialog(row)"
|
|
||||||
>
|
|
||||||
导入
|
|
||||||
</el-button> -->
|
|
||||||
</template>
|
|
||||||
<template v-else-if="canDirectInbound" #column-operation="{ row }">
|
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -83,34 +61,11 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #column-pending_total="{ row }">
|
<template #column-pending_total="{ row }">
|
||||||
<el-button
|
<span>{{ row.pending_total ?? 0 }}</span>
|
||||||
v-if="canBindReceiving && hasPendingBindings(row)"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
@click="openUnbindDialog(row)"
|
|
||||||
>
|
|
||||||
{{ row.pending_total ?? 0 }}
|
|
||||||
</el-button>
|
|
||||||
<span v-else>{{ row.pending_total ?? 0 }}</span>
|
|
||||||
</template>
|
</template>
|
||||||
</UpperTable>
|
</UpperTable>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BindReceivingDetailsDialog
|
|
||||||
v-model="bindDialogVisible"
|
|
||||||
:entry-item="bindTargetItem"
|
|
||||||
:entry-order-id="props.id"
|
|
||||||
@success="handleBindSuccess"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<UnbindReceivingDetailsDialog
|
|
||||||
v-model="unbindDialogVisible"
|
|
||||||
:entry-item="unbindTargetItem"
|
|
||||||
:entry-order-id="props.id"
|
|
||||||
@success="handleUnbindSuccess"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DirectInboundImportDialog
|
<DirectInboundImportDialog
|
||||||
v-model="importDialogVisible"
|
v-model="importDialogVisible"
|
||||||
:entry-order-code="entryOrderCode"
|
:entry-order-code="entryOrderCode"
|
||||||
@ -132,10 +87,6 @@ import {
|
|||||||
getDirectInboundItems,
|
getDirectInboundItems,
|
||||||
type DirectInboundItem,
|
type DirectInboundItem,
|
||||||
} from '@/api/storage.directinbound/directinbound'
|
} from '@/api/storage.directinbound/directinbound'
|
||||||
import BindReceivingDetailsDialog, {
|
|
||||||
type EntryDetailBindRow,
|
|
||||||
} from './BindReceivingDetailsDialog.vue'
|
|
||||||
import UnbindReceivingDetailsDialog from './UnbindReceivingDetailsDialog.vue'
|
|
||||||
import DirectInboundImportDialog, {
|
import DirectInboundImportDialog, {
|
||||||
type DirectInboundImportRow,
|
type DirectInboundImportRow,
|
||||||
} from './DirectInboundImportDialog.vue'
|
} from './DirectInboundImportDialog.vue'
|
||||||
@ -168,13 +119,11 @@ const pagination = reactive({
|
|||||||
total: 0,
|
total: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
const canBindReceiving = computed(() => {
|
const canBatchImport = computed(() => {
|
||||||
const status = props.row?.order_status ?? entryOrderStatus.value
|
const status = props.row?.order_status ?? entryOrderStatus.value
|
||||||
return isPendingEntryOrderStatus(status)
|
return isPendingEntryOrderStatus(status)
|
||||||
})
|
})
|
||||||
|
|
||||||
const canBatchImport = computed(() => canBindReceiving.value)
|
|
||||||
|
|
||||||
const canDirectInbound = computed(() => {
|
const canDirectInbound = computed(() => {
|
||||||
const status = props.row?.order_status ?? entryOrderStatus.value
|
const status = props.row?.order_status ?? entryOrderStatus.value
|
||||||
return canDirectInboundOperate(status)
|
return canDirectInboundOperate(status)
|
||||||
@ -188,11 +137,11 @@ const detailColumns = computed(() => {
|
|||||||
{ prop: 'direct_inbound_quantity', label: '已导入', width: '90', align: 'right' },
|
{ prop: 'direct_inbound_quantity', label: '已导入', width: '90', align: 'right' },
|
||||||
{ prop: 'remaining_quantity', label: '剩余可入', width: '90', align: 'right' },
|
{ prop: 'remaining_quantity', label: '剩余可入', width: '90', align: 'right' },
|
||||||
)
|
)
|
||||||
if (canBindReceiving.value || canDirectInbound.value) {
|
if (canDirectInbound.value) {
|
||||||
columns.push({
|
columns.push({
|
||||||
prop: 'operation',
|
prop: 'operation',
|
||||||
label: '操作',
|
label: '操作',
|
||||||
width: canBindReceiving.value && canDirectInbound.value ? '120' : '90',
|
width: '90',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
} as unknown as (typeof entrydetail)[number])
|
} as unknown as (typeof entrydetail)[number])
|
||||||
@ -200,10 +149,6 @@ const detailColumns = computed(() => {
|
|||||||
return columns
|
return columns
|
||||||
})
|
})
|
||||||
|
|
||||||
const bindDialogVisible = ref(false)
|
|
||||||
const bindTargetItem = ref<EntryDetailBindRow | null>(null)
|
|
||||||
const unbindDialogVisible = ref(false)
|
|
||||||
const unbindTargetItem = ref<EntryDetailBindRow | null>(null)
|
|
||||||
const importDialogVisible = ref(false)
|
const importDialogVisible = ref(false)
|
||||||
const importTargetItem = ref<DirectInboundImportRow | null>(null)
|
const importTargetItem = ref<DirectInboundImportRow | null>(null)
|
||||||
const batchFileMode = ref(false)
|
const batchFileMode = ref(false)
|
||||||
@ -404,57 +349,6 @@ async function handleCommit() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openBindDialog(row: EntryDetailBindRow) {
|
|
||||||
if (!canBindReceiving.value) {
|
|
||||||
ElMessage.warning('仅待入库状态的入库单支持绑定收货明细')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!row?.id) {
|
|
||||||
ElMessage.warning('入库明细 ID 无效')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!row?.stock_id) {
|
|
||||||
ElMessage.warning('当前明细缺少 stock_id,无法查询收货单')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
bindTargetItem.value = row
|
|
||||||
bindDialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function openUnbindDialog(row: EntryDetailBindRow) {
|
|
||||||
if (!canBindReceiving.value) {
|
|
||||||
ElMessage.warning('仅待入库状态的入库单支持解绑收货明细')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!row?.id) {
|
|
||||||
ElMessage.warning('入库明细 ID 无效')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!hasPendingBindings(row)) {
|
|
||||||
ElMessage.warning('当前明细没有可解绑的收货绑定')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
unbindTargetItem.value = row
|
|
||||||
unbindDialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleBindSuccess() {
|
|
||||||
await reloadAll()
|
|
||||||
emit('refresh')
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleUnbindSuccess() {
|
|
||||||
await reloadAll()
|
|
||||||
emit('refresh')
|
|
||||||
}
|
|
||||||
|
|
||||||
function hasPendingBindings(row: EntryDetailBindRow): boolean {
|
|
||||||
const pendingTotal = Number(row.pending_total)
|
|
||||||
if (Number.isFinite(pendingTotal) && pendingTotal > 0) return true
|
|
||||||
const bindings = row.bindings
|
|
||||||
return Array.isArray(bindings) && bindings.length > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleSelectionChange = (val: Record<string, unknown>[]) => {
|
const handleSelectionChange = (val: Record<string, unknown>[]) => {
|
||||||
multipleSelection.value = val
|
multipleSelection.value = val
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,250 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="">
|
<div class="log-container">
|
||||||
<h1>操作日志</h1>
|
<el-button-group class="toolbar-btn-group">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
:icon="Refresh"
|
||||||
|
title="刷新"
|
||||||
|
:loading="loading"
|
||||||
|
class="toolbar-btn"
|
||||||
|
:disabled="!entryId"
|
||||||
|
@click="handleRefresh"
|
||||||
|
>
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
:data="tableData"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
style="width: 100%; height: 100%"
|
||||||
|
height="100%"
|
||||||
|
v-loading="loading"
|
||||||
|
>
|
||||||
|
<el-table-column prop="created_at" label="时间" width="175" />
|
||||||
|
<el-table-column label="操作人" width="110">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.operator_name ?? '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作类型" min-width="160" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatOperationLabel(row) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="平台" width="100" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.platform_name || row.platform_code || '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="外部日志" width="108" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.external_log_type && row.external_log_type !== 'NONE'" size="small" type="info">
|
||||||
|
{{ row.external_log_type }}
|
||||||
|
</el-tag>
|
||||||
|
<span v-else class="cell-muted">—</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.message ?? '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" width="108" align="center" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="hasExternalPayload(scope.row)"
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
@click="viewData(scope.row)"
|
||||||
|
>
|
||||||
|
查看报文
|
||||||
|
</el-button>
|
||||||
|
<span v-else class="cell-muted">—</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:total="pagination.total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
background
|
||||||
|
size="small"
|
||||||
|
@size-change="handlePageSizeChange"
|
||||||
|
@current-change="handlePageChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-drawer
|
||||||
|
v-model="showRequestData"
|
||||||
|
direction="rtl"
|
||||||
|
:with-header="false"
|
||||||
|
size="800px"
|
||||||
|
class="el-drawers"
|
||||||
|
>
|
||||||
|
<RequestData v-if="showRequestData" :id="requestId" :type="requestType" />
|
||||||
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts"></script>
|
<script setup lang="ts">
|
||||||
|
import { computed, reactive, ref, watch } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { Refresh } from '@element-plus/icons-vue'
|
||||||
|
import RequestData from '@/components/RequestData/index.vue'
|
||||||
|
import { queryEntryLogs } from '@/api/storage.entry/entry'
|
||||||
|
|
||||||
<style lang="css" scoped></style>
|
const props = defineProps<{
|
||||||
|
id?: string | number | null
|
||||||
|
row?: Record<string, any> | null
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const tableData = ref<any[]>([])
|
||||||
|
|
||||||
|
const showRequestData = ref(false)
|
||||||
|
const requestId = ref(0)
|
||||||
|
const requestType = ref('')
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const entryId = computed(() => {
|
||||||
|
const id = props.id ?? props.row?.id
|
||||||
|
if (id === undefined || id === null || id === '') return ''
|
||||||
|
return String(id)
|
||||||
|
})
|
||||||
|
|
||||||
|
function extractLogListPayload(res: any): { list: any[]; total: number } {
|
||||||
|
if (!res) return { list: [], total: 0 }
|
||||||
|
const inner = res.data && typeof res.data === 'object' && !Array.isArray(res.data) ? res.data : res
|
||||||
|
const list = Array.isArray(inner.list)
|
||||||
|
? inner.list
|
||||||
|
: Array.isArray(res.list)
|
||||||
|
? res.list
|
||||||
|
: []
|
||||||
|
const totalRaw = inner.pagination?.total ?? inner.total ?? res.total
|
||||||
|
const total =
|
||||||
|
typeof totalRaw === 'number' && !Number.isNaN(totalRaw)
|
||||||
|
? totalRaw
|
||||||
|
: list.length
|
||||||
|
return { list, total }
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatOperationLabel(row: any): string {
|
||||||
|
const name = row?.operation_name
|
||||||
|
const code = row?.operation_code
|
||||||
|
if (name && String(name).trim() && name !== code) return String(name)
|
||||||
|
if (name && String(name).trim()) return String(name)
|
||||||
|
if (code) return String(code)
|
||||||
|
return '—'
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasExternalPayload(row: any): boolean {
|
||||||
|
const id = row?.external_log_id
|
||||||
|
if (id === undefined || id === null || id === '') return false
|
||||||
|
const n = typeof id === 'number' ? id : Number(id)
|
||||||
|
return Number.isFinite(n) && n > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => entryId.value,
|
||||||
|
(newId) => {
|
||||||
|
if (newId) {
|
||||||
|
pagination.page = 1
|
||||||
|
loadLogs()
|
||||||
|
} else {
|
||||||
|
tableData.value = []
|
||||||
|
pagination.total = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
async function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
await loadLogs()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
await loadLogs()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleRefresh() {
|
||||||
|
pagination.page = 1
|
||||||
|
await loadLogs()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadLogs() {
|
||||||
|
if (!entryId.value) return
|
||||||
|
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const response: any = await queryEntryLogs({
|
||||||
|
id: entryId.value,
|
||||||
|
page: pagination.page,
|
||||||
|
pageSize: pagination.pageSize
|
||||||
|
})
|
||||||
|
if (response && ![1, 200].includes(response.code)) {
|
||||||
|
throw new Error(response?.message || '请求失败')
|
||||||
|
}
|
||||||
|
const { list, total } = extractLogListPayload(response)
|
||||||
|
tableData.value = list
|
||||||
|
pagination.total = total
|
||||||
|
} catch (error: any) {
|
||||||
|
console.error('storage.entry.queryEntryLogs failed:', error)
|
||||||
|
ElMessage.error(error?.message || '获取操作日志失败')
|
||||||
|
tableData.value = []
|
||||||
|
pagination.total = 0
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function viewData(row: any) {
|
||||||
|
const raw = row.external_log_id
|
||||||
|
const n = typeof raw === 'number' ? raw : Number(raw)
|
||||||
|
requestId.value = Number.isFinite(n) ? n : 0
|
||||||
|
requestType.value = row.external_log_type || ''
|
||||||
|
showRequestData.value = true
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.log-container {
|
||||||
|
height: 100%;
|
||||||
|
padding: 8px 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.toolbar-btn-group {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
margin-top: 8px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-muted {
|
||||||
|
color: #c0c4cc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -238,12 +238,16 @@ export function isPendingEntryOrderStatus(status: unknown): boolean {
|
|||||||
return upper === 'PENDING' || upper === 'CREATED' || normalized === '待入库' || normalized === '已创建'
|
return upper === 'PENDING' || upper === 'CREATED' || normalized === '待入库' || normalized === '已创建'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 是否允许快捷直入(storage.entry.quickInbound,仅 CREATED) */
|
/** 是否允许快捷直入(storage.entry.quickInbound,仅 CREATED 且未绑定收货单) */
|
||||||
export function canQuickInbound(status: unknown): boolean {
|
export function canQuickInbound(status: unknown, hasReceiving?: unknown, receivingBindings?: unknown): boolean {
|
||||||
if (status === null || status === undefined || status === '') return false
|
if (status === null || status === undefined || status === '') return false
|
||||||
const normalized = String(status).trim()
|
const normalized = String(status).trim()
|
||||||
const upper = normalized.toUpperCase()
|
const upper = normalized.toUpperCase()
|
||||||
return upper === 'CREATED' || normalized === '已创建'
|
if (upper !== 'CREATED' && normalized !== '已创建') return false
|
||||||
|
// 已绑定收货单的排除虚拟直入
|
||||||
|
if (hasReceiving === true) return false
|
||||||
|
if (Array.isArray(receivingBindings) && receivingBindings.length > 0) return false
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 快捷直入表单只读字段(对应接口入参 id 及展示用单据信息) */
|
/** 快捷直入表单只读字段(对应接口入参 id 及展示用单据信息) */
|
||||||
@ -326,6 +330,17 @@ export function canBindEntryOrder(status: unknown): boolean {
|
|||||||
return upper === 'CREATED' || normalized === '已创建'
|
return upper === 'CREATED' || normalized === '已创建'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 是否允许开始入库(状态为 CREATED 且已绑定收货单) */
|
||||||
|
export function canStartReceiving(status: unknown, hasReceiving: unknown, receivingBindings: unknown): boolean {
|
||||||
|
if (status === null || status === undefined) return false
|
||||||
|
const upper = String(status).trim().toUpperCase()
|
||||||
|
if (upper !== 'CREATED') return false
|
||||||
|
// hasReceiving 为 true 或 receivingBindings 数组非空表示已绑定收货单
|
||||||
|
if (hasReceiving === true) return true
|
||||||
|
if (Array.isArray(receivingBindings) && receivingBindings.length > 0) return true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/** storage.entry.list 虚拟 where 字段(需原样传 boolean,不能包 operator) */
|
/** storage.entry.list 虚拟 where 字段(需原样传 boolean,不能包 operator) */
|
||||||
export const entryListVirtualWhereFields = ['hasReceiving'] as const
|
export const entryListVirtualWhereFields = ['hasReceiving'] as const
|
||||||
|
|
||||||
|
|||||||
@ -111,7 +111,16 @@
|
|||||||
|
|
||||||
<template #column-row_action="{ row }">
|
<template #column-row_action="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="canQuickInbound(row.order_status)"
|
v-if="canStartReceiving(row.order_status, row.hasReceiving, row.receivingBindings)"
|
||||||
|
link
|
||||||
|
type="warning"
|
||||||
|
size="small"
|
||||||
|
@click.stop="handleReviewEntry(row)"
|
||||||
|
>
|
||||||
|
开始入库
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="canQuickInbound(row.order_status, row.hasReceiving, row.receivingBindings)"
|
||||||
link
|
link
|
||||||
type="success"
|
type="success"
|
||||||
size="small"
|
size="small"
|
||||||
@ -209,6 +218,74 @@
|
|||||||
<el-button size="small" type="primary" :loading="createLoading" @click="submitCreateEntry">确定</el-button>
|
<el-button size="small" type="primary" :loading="createLoading" @click="submitCreateEntry">确定</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 开始入库确认对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="reviewDialogVisible"
|
||||||
|
title="开始入库确认"
|
||||||
|
width="800px"
|
||||||
|
align-center
|
||||||
|
@closed="handleReviewDialogClosed"
|
||||||
|
>
|
||||||
|
<div v-if="reviewTargetRow" class="review-dialog-content">
|
||||||
|
<div class="review-summary">
|
||||||
|
<el-descriptions :column="2" size="small" border>
|
||||||
|
<el-descriptions-item label="入库单号">{{ reviewTargetRow.entry_order_code || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="货主">{{ reviewTargetRow.store_name || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="订单状态">
|
||||||
|
<el-tag size="small" :type="getEntryOrderStatusTagType(reviewTargetRow.order_status)">
|
||||||
|
{{ formatEntryOrderStatus(reviewTargetRow.order_status) }}
|
||||||
|
</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="入库类型">{{ translateEntryField('order_type', reviewTargetRow.order_type) }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="review-binding-section">
|
||||||
|
<div class="review-section-title">收货对照预览</div>
|
||||||
|
<el-table
|
||||||
|
v-loading="reviewCompareLoading"
|
||||||
|
:data="reviewCompareRows"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
size="small"
|
||||||
|
row-key="rowKey"
|
||||||
|
empty-text="暂无对照数据"
|
||||||
|
max-height="360"
|
||||||
|
>
|
||||||
|
<el-table-column label="匹配" width="80" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag size="small" :type="row.matchTagType">{{ row.matchStatusLabel }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="入库商品" min-width="150" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ row.entryName }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="收货商品" min-width="150" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ row.receivingName }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划数量" width="100" align="right">
|
||||||
|
<template #default="{ row }">{{ row.entryQty }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="收货可用" width="100" align="right">
|
||||||
|
<template #default="{ row }">{{ row.receivingAvailable }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button size="small" :disabled="reviewSubmitting" @click="reviewDialogVisible = false">取消</el-button>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
type="warning"
|
||||||
|
:loading="reviewSubmitting"
|
||||||
|
@click="handleReviewConfirm"
|
||||||
|
>
|
||||||
|
确定开始入库
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -232,6 +309,7 @@ import {
|
|||||||
isPendingEntryOrderStatus,
|
isPendingEntryOrderStatus,
|
||||||
canQuickInbound,
|
canQuickInbound,
|
||||||
canBindEntryOrder,
|
canBindEntryOrder,
|
||||||
|
canStartReceiving,
|
||||||
finalizeEntryListWhere,
|
finalizeEntryListWhere,
|
||||||
formatEntryHasReceiving,
|
formatEntryHasReceiving,
|
||||||
formatReceivingBindingsSummary,
|
formatReceivingBindingsSummary,
|
||||||
@ -343,6 +421,12 @@ const selectedRow = computed(() => {
|
|||||||
const bindDialogVisible = ref(false)
|
const bindDialogVisible = ref(false)
|
||||||
const bindTargetRow = ref<any>(null)
|
const bindTargetRow = ref<any>(null)
|
||||||
|
|
||||||
|
const reviewDialogVisible = ref(false)
|
||||||
|
const reviewTargetRow = ref<any>(null)
|
||||||
|
const reviewSubmitting = ref(false)
|
||||||
|
const reviewCompareLoading = ref(false)
|
||||||
|
const reviewCompareRows = ref<any[]>([])
|
||||||
|
|
||||||
function openBindDialog(row: any) {
|
function openBindDialog(row: any) {
|
||||||
if (!canBindEntryOrder(row?.order_status)) return
|
if (!canBindEntryOrder(row?.order_status)) return
|
||||||
bindTargetRow.value = row
|
bindTargetRow.value = row
|
||||||
@ -761,6 +845,104 @@ async function handleRowQuickInbound(row: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 构建收货对照预览行 */
|
||||||
|
function buildReviewCompareRow(record: any, index: number) {
|
||||||
|
const raw = record as Record<string, unknown>
|
||||||
|
const status = String(raw.match_status ?? '').toLowerCase()
|
||||||
|
const entryName = raw.warehouse_item_name as string || raw.receiving_product_name as string || '—'
|
||||||
|
const receivingName = raw.receiving_product_name as string || raw.warehouse_item_name as string || '—'
|
||||||
|
const entryQty = raw.entry_count ?? raw.entry_received ?? '—'
|
||||||
|
const receivingAvailable = raw.receiving_available ?? raw.receiving_actual_quantity ?? raw.receiving_allocated ?? '—'
|
||||||
|
|
||||||
|
const tagMap: Record<string, string> = {
|
||||||
|
matched: 'success',
|
||||||
|
entry_only: 'warning',
|
||||||
|
receiving_only: 'primary',
|
||||||
|
}
|
||||||
|
const labelMap: Record<string, string> = {
|
||||||
|
matched: '已匹配',
|
||||||
|
entry_only: '仅入库',
|
||||||
|
receiving_only: '仅收货',
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
rowKey: `review-compare-${index}`,
|
||||||
|
matchStatus: status,
|
||||||
|
matchTagType: tagMap[status] || 'info',
|
||||||
|
matchStatusLabel: labelMap[status] || status,
|
||||||
|
entryName,
|
||||||
|
receivingName,
|
||||||
|
entryQty: entryQty === '—' ? '—' : String(entryQty),
|
||||||
|
receivingAvailable: receivingAvailable === '—' ? '—' : String(receivingAvailable),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 开始入库(打开确认弹窗,拉取收货对照数据) */
|
||||||
|
async function handleReviewEntry(row: any) {
|
||||||
|
reviewTargetRow.value = row
|
||||||
|
reviewDialogVisible.value = true
|
||||||
|
reviewCompareLoading.value = true
|
||||||
|
reviewCompareRows.value = []
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 从 row 的 receivingBindings 中提取收货单 ID
|
||||||
|
const bindings = row.receivingBindings || []
|
||||||
|
const receivingIds = bindings
|
||||||
|
.map((item: any) => Number(item.receiving_id))
|
||||||
|
.filter((id: number) => Number.isFinite(id) && id > 0)
|
||||||
|
|
||||||
|
if (receivingIds.length > 0 && row.id) {
|
||||||
|
const res = await entryApi.receivingCompare({
|
||||||
|
entry_order_id: Number(row.id),
|
||||||
|
receiving_ids: receivingIds,
|
||||||
|
})
|
||||||
|
const payload = (res.data && typeof res.data === 'object' ? { ...res, ...res.data } : res) as any
|
||||||
|
const allRecords: any[] = []
|
||||||
|
for (const item of (payload.comparisons ?? [])) {
|
||||||
|
const records = [
|
||||||
|
...(Array.isArray(item.comparison) ? item.comparison : []),
|
||||||
|
...(Array.isArray(item.receiving_only) ? item.receiving_only : []),
|
||||||
|
]
|
||||||
|
allRecords.push(...records)
|
||||||
|
}
|
||||||
|
reviewCompareRows.value = allRecords.map(buildReviewCompareRow)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('拉取收货对照数据失败', e)
|
||||||
|
reviewCompareRows.value = []
|
||||||
|
} finally {
|
||||||
|
reviewCompareLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleReviewDialogClosed() {
|
||||||
|
reviewTargetRow.value = null
|
||||||
|
reviewCompareRows.value = []
|
||||||
|
reviewCompareLoading.value = false
|
||||||
|
reviewSubmitting.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 确定开始入库(审核入库单,CREATED → PENDING) */
|
||||||
|
async function handleReviewConfirm() {
|
||||||
|
if (!reviewTargetRow.value) return
|
||||||
|
reviewSubmitting.value = true
|
||||||
|
try {
|
||||||
|
const res = await entryApi.reviewEntry({ id: Number(reviewTargetRow.value.id) })
|
||||||
|
if (res && (res.code === 200)) {
|
||||||
|
ElMessage.success('开始入库成功')
|
||||||
|
reviewDialogVisible.value = false
|
||||||
|
await loadData()
|
||||||
|
entryDetailRefreshTick.value += 1
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res?.message || '开始入库失败')
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
ElMessage.error(e?.message || '开始入库失败')
|
||||||
|
} finally {
|
||||||
|
reviewSubmitting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function handleCompleteEntry() {
|
async function handleCompleteEntry() {
|
||||||
const targets = getActionTargetRows()
|
const targets = getActionTargetRows()
|
||||||
if (!targets.length) {
|
if (!targets.length) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user