629
This commit is contained in:
parent
cde142f113
commit
57b95fb8bf
@ -26,9 +26,10 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<!-- 已迁移至 ScanBox:搜索订单号 -->
|
||||
<!-- <div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -179,7 +180,6 @@ const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const detailVisible = ref(true)
|
||||
|
||||
const quickSearch = ref('')
|
||||
const toolbarButtons = archiveOrderToolbarButtons
|
||||
|
||||
const selectedRow = computed(() => {
|
||||
@ -268,22 +268,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
function buildWhere() {
|
||||
let where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
if (quickSearch.value) {
|
||||
const q = quickSearch.value.trim()
|
||||
if (/^\d+$/.test(q)) {
|
||||
where.id = {
|
||||
operator: 'eq',
|
||||
value: Number(q),
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
where.delivery_order_code = {
|
||||
operator: 'like',
|
||||
value: q,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
return sanitizeArchiveListWhere(where)
|
||||
}
|
||||
|
||||
@ -366,11 +351,6 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function openColumnConfigPanel() {
|
||||
upperTable.value?.openColumnConfig?.()
|
||||
}
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
@close="handleClose"
|
||||
@closed="resetForm"
|
||||
>
|
||||
<el-alert
|
||||
<!-- <el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
style="margin-bottom: 12px"
|
||||
title="仅需运单号与包材,系统自动反查订单运单记录并绑定包材,无需订单 ID。"
|
||||
/>
|
||||
/> -->
|
||||
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="96px" @submit.prevent>
|
||||
<el-form-item label="运单号" prop="waybill_code">
|
||||
|
||||
@ -1095,6 +1095,8 @@ export const orderIdScanField = scanBasicField({ label: '订单ID', value: 'id',
|
||||
export const orderFlagScanField = scanBasicField({ label: '订单标记', value: 'order_flag', type: 'text', operators: ['like', 'notlike'], defaultOperator: 'like' })
|
||||
export const waveNoScanField = scanBasicField({ label: '波次号', value: 'wave_no', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
||||
export const deliveryOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'delivery_order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
||||
/** ScanBox:搜索订单号(模糊匹配发货单号,替代表格右上角快捷搜索) */
|
||||
export const orderQuickSearchScanField = scanBasicField({ label: '搜索订单号', value: 'delivery_order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'like' })
|
||||
export const sourceOrderCodesScanField = scanBasicField({ label: '平台交易单号', value: 'source_order_codes', 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' })
|
||||
@ -1146,6 +1148,17 @@ export const waveAssignmentScanField = scanBasicField({
|
||||
]
|
||||
})
|
||||
|
||||
/** ScanBox:储位分配(合并 unassigned/assigning/error 为「未分配」) */
|
||||
export const storageAssignScanField = scanWorkflowField({
|
||||
label: '储位分配',
|
||||
value: 'storage_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '未分配', value: '__storage_assign_unassigned__', operator: 'in', conditionValue: ['unassigned', 'assigning', 'error'] },
|
||||
{ label: '已完成', value: '__storage_assign_completed__', operator: 'eq', conditionValue: 'completed' }
|
||||
]
|
||||
})
|
||||
|
||||
/** ScanBox:快递公司(快递编码),选项由 index.getExpressList + fillExpressCompanyScanFieldOptions 注入 */
|
||||
export const expressCompanyScanField = scanBasicField({
|
||||
label: '快递公司',
|
||||
@ -1225,7 +1238,8 @@ export const deliveryAvailableFields = [
|
||||
// 基础信息
|
||||
storeScanField,
|
||||
orderIdScanField,
|
||||
deliveryOrderCodeScanField,
|
||||
orderQuickSearchScanField,
|
||||
// deliveryOrderCodeScanField,
|
||||
sourceOrderCodesScanField,
|
||||
orderFlagScanField,
|
||||
waveAssignmentScanField,
|
||||
@ -1441,7 +1455,8 @@ export const reviewAvailableFields = [
|
||||
// 基础信息
|
||||
storeScanField,
|
||||
orderIdScanField,
|
||||
deliveryOrderCodeScanField,
|
||||
orderQuickSearchScanField,
|
||||
// deliveryOrderCodeScanField,
|
||||
sourceOrderCodesScanField,
|
||||
waveAssignmentScanField,
|
||||
waveNoScanField,
|
||||
@ -1588,7 +1603,8 @@ export const pendingAvailableFields = [
|
||||
// 基础信息
|
||||
storeScanField,
|
||||
orderIdScanField,
|
||||
pendingOrderCodeScanField,
|
||||
orderQuickSearchScanField,
|
||||
// pendingOrderCodeScanField,
|
||||
sourceOrderCodesScanField,
|
||||
orderFlagScanField,
|
||||
waveAssignmentScanField,
|
||||
@ -1612,7 +1628,8 @@ export const pendingAvailableFields = [
|
||||
orderStatusScanField(pendingOrderStatusFilterOptions),
|
||||
syncStatusScanField,
|
||||
recheckStatusScanField,
|
||||
storageStatusScanField,
|
||||
storageAssignScanField,
|
||||
// storageStatusScanField,
|
||||
postStatusScanField,
|
||||
pickStatusScanField,
|
||||
packStatusScanField,
|
||||
@ -1913,8 +1930,9 @@ export const expectionOrderAvailableFields = [
|
||||
// 基础信息
|
||||
storeScanField,
|
||||
orderIdScanField,
|
||||
exceptionOrderCodeScanField,
|
||||
deliveryOrderCodeScanField,
|
||||
orderQuickSearchScanField,
|
||||
// exceptionOrderCodeScanField,
|
||||
// deliveryOrderCodeScanField,
|
||||
sourceOrderCodesScanField,
|
||||
orderFlagScanField,
|
||||
waveAssignmentScanField,
|
||||
@ -1930,7 +1948,8 @@ export const expectionOrderAvailableFields = [
|
||||
orderStatusScanField(exceptionOrderStatusFilterOptions),
|
||||
syncStatusScanField,
|
||||
recheckStatusScanField,
|
||||
storageStatusScanField,
|
||||
storageAssignScanField,
|
||||
// storageStatusScanField,
|
||||
postStatusScanField,
|
||||
pickStatusScanField,
|
||||
packStatusScanField,
|
||||
@ -2025,8 +2044,9 @@ export const archiveAvailableFields = [
|
||||
// 基础信息
|
||||
storeScanField,
|
||||
orderIdScanField,
|
||||
exceptionOrderCodeScanField,
|
||||
deliveryOrderCodeScanField,
|
||||
orderQuickSearchScanField,
|
||||
// exceptionOrderCodeScanField,
|
||||
// deliveryOrderCodeScanField,
|
||||
sourceOrderCodesScanField,
|
||||
waveAssignmentScanField,
|
||||
waveNoScanField,
|
||||
|
||||
@ -26,9 +26,10 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<!-- 已迁移至 ScanBox:搜索订单号 -->
|
||||
<!-- <div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -174,7 +175,6 @@ const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const detailVisible = ref(true)
|
||||
|
||||
const quickSearch = ref('')
|
||||
const toolbarButtons = deliveryExceptionToolbarButtons
|
||||
|
||||
const selectedRow = computed(() => {
|
||||
@ -263,22 +263,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
function buildWhere() {
|
||||
let where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
if (quickSearch.value) {
|
||||
const q = quickSearch.value.trim()
|
||||
if (/^\d+$/.test(q)) {
|
||||
where.id = {
|
||||
operator: 'eq',
|
||||
value: Number(q),
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
where.delivery_order_code = {
|
||||
operator: 'like',
|
||||
value: q,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
return sanitizeDeliveryExpectionListWhere(where)
|
||||
}
|
||||
|
||||
@ -361,11 +346,6 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function openColumnConfigPanel() {
|
||||
upperTable.value?.openColumnConfig?.()
|
||||
}
|
||||
|
||||
@ -26,9 +26,10 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<!-- 已迁移至 ScanBox:搜索订单号 -->
|
||||
<!-- <div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -174,7 +175,6 @@ const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const detailVisible = ref(true)
|
||||
|
||||
const quickSearch = ref('')
|
||||
const toolbarButtons = entrustWarehouseToolbarButtons
|
||||
|
||||
const selectedRow = computed(() => {
|
||||
@ -263,22 +263,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
function buildWhere() {
|
||||
let where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
if (quickSearch.value) {
|
||||
const q = quickSearch.value.trim()
|
||||
if (/^\d+$/.test(q)) {
|
||||
where.id = {
|
||||
operator: 'eq',
|
||||
value: Number(q),
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
where.delivery_order_code = {
|
||||
operator: 'like',
|
||||
value: q,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
return sanitizeEntrustListWhere(where)
|
||||
}
|
||||
|
||||
@ -361,11 +346,6 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function openColumnConfigPanel() {
|
||||
upperTable.value?.openColumnConfig?.()
|
||||
}
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
:layout-key="toolbarLayoutKey"
|
||||
@action="handleToolbarButtonClick"
|
||||
/>
|
||||
<el-select
|
||||
<!-- 已迁移至 ScanBox:储位分配 -->
|
||||
<!-- <el-select
|
||||
v-model="storageAssignFilter"
|
||||
placeholder="储位分配"
|
||||
size="small"
|
||||
@ -34,7 +35,7 @@
|
||||
>
|
||||
<el-option label="未分配" value="unassigned" />
|
||||
<el-option label="已完成" value="completed" />
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
|
||||
<template v-for="(btn, index) in expectionOrderbuttonList" :key="index">
|
||||
<el-dropdown
|
||||
@ -71,9 +72,10 @@
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<!-- 已迁移至 ScanBox:搜索订单号 -->
|
||||
<!-- <div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -467,12 +469,6 @@ const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const detailVisible = ref(true)
|
||||
|
||||
const quickSearch = ref('')
|
||||
const storageAssignFilter = ref<string>('')
|
||||
const handleStorageAssignFilterChange = () => {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
const toolbarButtons = exceptionToolbarButtons
|
||||
|
||||
const selectedRow = computed(() => {
|
||||
@ -651,37 +647,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
function buildExportWhere() {
|
||||
let where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
if (quickSearch.value) {
|
||||
const q = quickSearch.value.trim()
|
||||
// 输入纯数字时同时按订单ID和发货单号搜索
|
||||
if (/^\d+$/.test(q)) {
|
||||
where.id = {
|
||||
operator: 'eq',
|
||||
value: Number(q),
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
where.delivery_order_code = {
|
||||
operator: 'like',
|
||||
value: q,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
// 储位分配筛选:未分配合并 unassigned/assigning/error
|
||||
if (storageAssignFilter.value === 'unassigned') {
|
||||
where.storage_status = {
|
||||
operator: 'in',
|
||||
value: ['unassigned', 'assigning', 'error'],
|
||||
type: 'text'
|
||||
}
|
||||
} else if (storageAssignFilter.value === 'completed') {
|
||||
where.storage_status = {
|
||||
operator: 'eq',
|
||||
value: 'completed',
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
return sanitizeExpectionListWhere(where)
|
||||
}
|
||||
|
||||
@ -783,11 +749,6 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function openResolveExceptionDialog() {
|
||||
if (!selectionRows.value.length) {
|
||||
ElMessage.warning('请先勾选需要处理的异常订单')
|
||||
|
||||
@ -7,13 +7,13 @@
|
||||
destroy-on-close
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<el-alert
|
||||
<!-- <el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="为指定待处理订单创建运单记录(wms_order_express),仅允许步骤为 1~3 且出库状态非待出库的订单。"
|
||||
class="manual-waybill-alert"
|
||||
/>
|
||||
/> -->
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formModel"
|
||||
|
||||
@ -26,7 +26,8 @@
|
||||
:layout-key="toolbarLayoutKey"
|
||||
@action="handleToolbarButtonClick"
|
||||
/>
|
||||
<el-select
|
||||
<!-- 已迁移至 ScanBox:储位分配 -->
|
||||
<!-- <el-select
|
||||
v-model="storageAssignFilter"
|
||||
placeholder="储位分配"
|
||||
size="small"
|
||||
@ -36,12 +37,13 @@
|
||||
>
|
||||
<el-option label="未分配" value="unassigned" />
|
||||
<el-option label="已完成" value="completed" />
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<!-- 已迁移至 ScanBox:搜索订单号 -->
|
||||
<!-- <div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -428,12 +430,6 @@ const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const detailVisible = ref(true)
|
||||
|
||||
const quickSearch = ref('')
|
||||
const storageAssignFilter = ref<string>('')
|
||||
const handleStorageAssignFilterChange = () => {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
const toolbarButtons = pendingToolbarButtons
|
||||
const initialConditions = computed(() => {
|
||||
const waveNo = String(route.query.wave_no || '').trim()
|
||||
@ -560,35 +556,6 @@ function buildExportWhere() {
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
if (quickSearch.value) {
|
||||
const q = quickSearch.value.trim()
|
||||
if (/^\d+$/.test(q)) {
|
||||
where.id = {
|
||||
operator: 'eq',
|
||||
value: Number(q),
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
where.delivery_order_code = {
|
||||
operator: 'like',
|
||||
value: q,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
// 储位分配筛选:未分配合并 unassigned/assigning/error
|
||||
if (storageAssignFilter.value === 'unassigned') {
|
||||
where.storage_status = {
|
||||
operator: 'in',
|
||||
value: ['unassigned', 'assigning', 'error'],
|
||||
type: 'text'
|
||||
}
|
||||
} else if (storageAssignFilter.value === 'completed') {
|
||||
where.storage_status = {
|
||||
operator: 'eq',
|
||||
value: 'completed',
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
return sanitizePendingListWhere(where)
|
||||
}
|
||||
|
||||
@ -655,11 +622,6 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function openResolveExceptionDialog() {
|
||||
if (!selectionRows.value.length) {
|
||||
ElMessage.warning('请先勾选需要处理的异常订单')
|
||||
|
||||
@ -27,9 +27,10 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<!-- 已迁移至 ScanBox:搜索订单号 -->
|
||||
<!-- <div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -225,7 +226,6 @@ const selectionRows = ref<any[]>([])
|
||||
const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
|
||||
const quickSearch = ref('')
|
||||
const toolbarButtons = reviewToolbarButtons
|
||||
|
||||
const selectedRow = computed(() => {
|
||||
@ -341,22 +341,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
function buildExportWhere() {
|
||||
let where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
if (quickSearch.value) {
|
||||
const q = quickSearch.value.trim()
|
||||
if (/^\d+$/.test(q)) {
|
||||
where.id = {
|
||||
operator: 'eq',
|
||||
value: Number(q),
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
where.delivery_order_code = {
|
||||
operator: 'like',
|
||||
value: q,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
const where = buildOrderWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
return sanitizeReviewListWhere(where)
|
||||
}
|
||||
|
||||
@ -423,11 +408,6 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function openColumnConfigPanel() {
|
||||
upperTable.value?.openColumnConfig?.()
|
||||
}
|
||||
|
||||
@ -1,123 +1,157 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="商品导入"
|
||||
width="80vw"
|
||||
width="92%"
|
||||
align-center
|
||||
class="import-dialog"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
class="stock-import-dialog"
|
||||
:before-close="handleBeforeClose"
|
||||
>
|
||||
<div class="import-dialog-body">
|
||||
<div class="import-toolbar">
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
type="file"
|
||||
class="hidden-file-input"
|
||||
accept=".xlsx,.xls,.csv"
|
||||
@change="handleFileChange"
|
||||
/>
|
||||
<el-button size="small" type="primary" @click="triggerFileSelect">选择文件</el-button>
|
||||
<el-button size="small" @click="downloadTemplate">下载模板</el-button>
|
||||
<el-button size="small" type="success" @click="addRow">新增行</el-button>
|
||||
<el-button size="small" type="danger" :disabled="!hasSelection" @click="deleteSelectedRows">删除行</el-button>
|
||||
<el-button size="small" @click="clearData">清空数据</el-button>
|
||||
<span class="import-file-name">{{ selectedFileName || '未选择文件' }}</span>
|
||||
</div>
|
||||
<div class="import-summary">
|
||||
汇总:共 {{ importSummary.total }} 条,新增 {{ importSummary.addCount }} 条,修改 {{ importSummary.updateCount }} 条
|
||||
<template #header>
|
||||
<div class="create-order-dialog-header">
|
||||
<span class="create-order-dialog-title">商品导入</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="import-table-wrap">
|
||||
<el-table :data="importRows" border size="small" height="100%" @selection-change="onSelectionChange">
|
||||
<el-table-column type="selection" width="40" fixed="left" />
|
||||
<el-table-column label="SKU" min-width="140" fixed="left">
|
||||
<template #header>
|
||||
<span>SKU <el-tooltip content="留空为新增商品" placement="top"><span style="color:#909399;font-size:11px">ⓘ</span></el-tooltip></span>
|
||||
</template>
|
||||
<template #default="{ row }"><el-input v-model="row.sku" size="small" readonly placeholder="留空为新增" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品编码" min-width="140">
|
||||
<template #default="{ row }"><el-input v-model="row.itemCode" size="small" clearable :class="requiredClass(row.itemCode)" @change="revalidateRow(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" min-width="140">
|
||||
<template #default="{ row }"><el-input v-model="row.itemName" size="small" clearable :class="requiredClass(row.itemName)" @change="revalidateRow(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="货物编码" min-width="140">
|
||||
<template #default="{ row }"><el-input v-model="row.cargoCode" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="条码" min-width="140">
|
||||
<template #default="{ row }"><el-input v-model="row.barcode" size="small" clearable :class="requiredClass(row.barcode)" @change="revalidateRow(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="SKU规格" min-width="140">
|
||||
<template #default="{ row }"><el-input v-model="row.skuSpec" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存单位" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.stockUnit" size="small" clearable :class="requiredClass(row.stockUnit)" @change="revalidateRow(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.brand" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="毛重" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.grossWeight" size="small" clearable :class="requiredClass(row.grossWeight)" @change="revalidateRow(row)" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标价" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.tagPrice" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零售价" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.retailPrice" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="货主" min-width="160" fixed="left">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.storeName"
|
||||
size="small"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!!row.sku.trim()"
|
||||
:placeholder="row.sku.trim() ? '已有SKU无需填写' : '请选择货主'"
|
||||
:class="requiredClass(!row.sku.trim() ? row.storeName : 'x')"
|
||||
style="width:100%"
|
||||
@change="revalidateRow(row)"
|
||||
>
|
||||
<el-option
|
||||
v-for="s in stores"
|
||||
:key="s.value"
|
||||
:label="s.label"
|
||||
:value="s.label"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" min-width="180" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip v-if="row.status === 'error'" :content="row.errorMsg" placement="top">
|
||||
<el-tag type="danger" size="small" style="cursor:pointer" @click.stop="copyError(row.errorMsg)">失败</el-tag>
|
||||
</el-tooltip>
|
||||
<template v-else-if="row.status === 'invalid'">
|
||||
<el-tooltip v-if="row.missingFields" :content="'缺失:' + row.missingFields" placement="top">
|
||||
<el-tag type="warning" size="small" style="cursor:pointer;margin-right:4px" @click.stop="copyError('缺失:' + row.missingFields)">缺失数据</el-tag>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="row.storeError" :content="row.storeError" placement="top">
|
||||
<el-tag type="danger" size="small" style="cursor:pointer" @click.stop="copyError(row.storeError)">货主异常</el-tag>
|
||||
</el-tooltip>
|
||||
<div class="batch-import-toolbar">
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
type="file"
|
||||
class="hidden-file-input"
|
||||
accept=".xlsx,.xls,.csv"
|
||||
@change="handleFileChange"
|
||||
/>
|
||||
<el-button @click="triggerFileSelect">选择Excel</el-button>
|
||||
<el-button @click="downloadTemplate">下载模板</el-button>
|
||||
<el-button @click="addRow">添加明细</el-button>
|
||||
<el-button type="danger" plain :disabled="!hasSelection" @click="deleteSelectedRows">删除行</el-button>
|
||||
<el-button @click="clearData">清除数据</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">确认导入</el-button>
|
||||
<span class="picker-hint">已选文件:{{ selectedFileName || '未选择' }}</span>
|
||||
</div>
|
||||
|
||||
<div class="batch-import-summary">
|
||||
汇总:共 {{ importSummary.total }} 条,新增 {{ importSummary.addCount }} 条,修改 {{ importSummary.updateCount }} 条
|
||||
</div>
|
||||
|
||||
<div class="create-order-body">
|
||||
<div class="create-order-left">
|
||||
<div class="preview-table-wrap">
|
||||
<el-table :data="importRows" border size="small" height="100%" @selection-change="onSelectionChange">
|
||||
<el-table-column type="selection" width="40" fixed="left" />
|
||||
<el-table-column label="SKU" min-width="140" fixed="left">
|
||||
<template #header>
|
||||
<span>SKU <el-tooltip content="留空为新增商品" placement="top"><span class="field-tip">ⓘ</span></el-tooltip></span>
|
||||
</template>
|
||||
<el-tag v-else-if="row.status === 'success'" type="success" size="small">成功</el-tag>
|
||||
<el-tag v-else type="info" size="small">未提交</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.sku" size="small" readonly placeholder="留空为新增" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品编码" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'cell-required-empty': !row.itemCode.trim() }">
|
||||
<el-input v-model="row.itemCode" size="small" clearable @change="revalidateRow(row)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'cell-required-empty': !row.itemName.trim() }">
|
||||
<el-input v-model="row.itemName" size="small" clearable @change="revalidateRow(row)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="货物编码" min-width="140">
|
||||
<template #default="{ row }"><el-input v-model="row.cargoCode" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="条码" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'cell-required-empty': !row.barcode.trim() }">
|
||||
<el-input v-model="row.barcode" size="small" clearable @change="revalidateRow(row)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="SKU规格" min-width="140">
|
||||
<template #default="{ row }"><el-input v-model="row.skuSpec" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存单位" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'cell-required-empty': !row.stockUnit.trim() }">
|
||||
<el-input v-model="row.stockUnit" size="small" clearable @change="revalidateRow(row)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.brand" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="毛重" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'cell-required-empty': !row.grossWeight.trim() }">
|
||||
<el-input v-model="row.grossWeight" size="small" clearable @change="revalidateRow(row)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标价" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.tagPrice" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零售价" min-width="120">
|
||||
<template #default="{ row }"><el-input v-model="row.retailPrice" size="small" clearable /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="货主" min-width="160" fixed="left">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'cell-required-empty': !row.sku.trim() && !row.storeName.trim() }">
|
||||
<el-select
|
||||
v-model="row.storeName"
|
||||
size="small"
|
||||
clearable
|
||||
filterable
|
||||
:disabled="!!row.sku.trim()"
|
||||
:placeholder="row.sku.trim() ? '已有SKU无需填写' : '请选择货主'"
|
||||
style="width:100%"
|
||||
@change="revalidateRow(row)"
|
||||
>
|
||||
<el-option
|
||||
v-for="s in stores"
|
||||
:key="s.value"
|
||||
:label="s.label"
|
||||
:value="s.label"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" min-width="180" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip v-if="row.status === 'error'" :content="row.errorMsg" placement="top">
|
||||
<el-tag type="danger" size="small" class="status-tag" @click.stop="copyError(row.errorMsg)">失败</el-tag>
|
||||
</el-tooltip>
|
||||
<template v-else-if="row.status === 'invalid'">
|
||||
<el-tooltip v-if="row.missingFields" :content="'缺失:' + row.missingFields" placement="top">
|
||||
<el-tag type="warning" size="small" class="status-tag status-tag--gap" @click.stop="copyError('缺失:' + row.missingFields)">缺失数据</el-tag>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="row.storeError" :content="row.storeError" placement="top">
|
||||
<el-tag type="danger" size="small" class="status-tag" @click.stop="copyError(row.storeError)">货主异常</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<el-tag v-else-if="row.status === 'success'" type="success" size="small">成功</el-tag>
|
||||
<el-tag v-else type="info" size="small">未提交</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">提交</el-button>
|
||||
<el-button @click="handleCloseAttempt">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template> </el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { DialogBeforeCloseFn } from 'element-plus'
|
||||
import * as XLSX from 'xlsx'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
@ -152,13 +186,7 @@ const emit = defineEmits<{ 'update:modelValue': [boolean]; 'success': [] }>()
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (v) => {
|
||||
if (!v) {
|
||||
handleCloseAttempt()
|
||||
} else {
|
||||
emit('update:modelValue', true)
|
||||
}
|
||||
}
|
||||
set: (v) => emit('update:modelValue', v)
|
||||
})
|
||||
|
||||
const fileInputRef = ref<HTMLInputElement | null>(null)
|
||||
@ -175,17 +203,29 @@ const importSummary = computed(() => {
|
||||
return { total: nonEmpty.length, addCount: nonEmpty.length - updateCount, updateCount }
|
||||
})
|
||||
|
||||
async function handleCloseAttempt() {
|
||||
const handleBeforeClose: DialogBeforeCloseFn = (done) => {
|
||||
void handleCloseAttempt().then((closed) => {
|
||||
if (closed) done()
|
||||
})
|
||||
}
|
||||
|
||||
async function handleCloseAttempt(): Promise<boolean> {
|
||||
const nonEmpty = importRows.value.filter(r => Object.values(r).some(v => String(v || '').trim() !== '' && v !== r.status && v !== r.errorMsg))
|
||||
if (!nonEmpty.length) { doClose(); return }
|
||||
if (!nonEmpty.length) {
|
||||
doClose()
|
||||
return true
|
||||
}
|
||||
const hasUnsubmitted = importRows.value.some(r => r.status === '')
|
||||
const hasFailed = importRows.value.some(r => r.status === 'error')
|
||||
if (hasUnsubmitted || hasFailed) {
|
||||
try {
|
||||
await ElMessageBox.confirm('有未提交或失败的数据,关闭将丢失修改,确定关闭?', '提示', { type: 'warning', confirmButtonText: '确定关闭', cancelButtonText: '取消' })
|
||||
} catch { return }
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
doClose()
|
||||
return true
|
||||
}
|
||||
|
||||
function doClose() {
|
||||
@ -230,26 +270,18 @@ function validateRow(r: ImportRow): string[] {
|
||||
return msgs
|
||||
}
|
||||
|
||||
function requiredClass(val: string): string {
|
||||
return val.trim() ? '' : 'required-error'
|
||||
}
|
||||
|
||||
/** 重新校验单行并更新状态 */
|
||||
function revalidateRow(r: ImportRow) {
|
||||
// 跳过空行
|
||||
if (!Object.values(r).some(v => String(v || '').trim() !== '' && v !== r.status && v !== r.errorMsg && v !== r.missingFields && v !== r.storeError)) {
|
||||
r.status = ''; r.missingFields = ''; r.storeError = ''
|
||||
return
|
||||
}
|
||||
// 清除旧状态
|
||||
r.status = ''; r.missingFields = ''; r.storeError = ''
|
||||
// 必填字段检查
|
||||
const missing = validateRow(r)
|
||||
if (missing.length) {
|
||||
r.missingFields = missing.join('、')
|
||||
r.status = 'invalid'
|
||||
}
|
||||
// 货主匹配检查(无SKU的新增行)
|
||||
if (!r.sku.trim() && r.storeName.trim()) {
|
||||
const match = stores.value.find(s => s.label === r.storeName.trim() || String(s.value) === r.storeName.trim())
|
||||
if (!match) {
|
||||
@ -327,22 +359,17 @@ function mapRow(row: Record<string, any>): ImportRow {
|
||||
}
|
||||
}
|
||||
|
||||
/** 对所有行做校验并标记状态,返回 invalid 行数 */
|
||||
function validateAllRows(): number {
|
||||
const storeList = stores.value
|
||||
let invalidCount = 0
|
||||
for (const r of importRows.value) {
|
||||
// 跳过空行
|
||||
if (!Object.values(r).some(v => String(v || '').trim() !== '' && v !== r.status && v !== r.errorMsg && v !== r.missingFields && v !== r.storeError)) continue
|
||||
// 清除旧状态
|
||||
r.status = ''; r.errorMsg = ''; r.missingFields = ''; r.storeError = ''
|
||||
// 必填字段检查
|
||||
const missing = validateRow(r)
|
||||
if (missing.length) {
|
||||
r.missingFields = missing.join('、')
|
||||
r.status = 'invalid'
|
||||
}
|
||||
// 货主匹配检查(无SKU的新增行)
|
||||
if (!r.sku.trim() && r.storeName.trim()) {
|
||||
const match = storeList.find(s => s.label === r.storeName.trim() || String(s.value) === r.storeName.trim())
|
||||
if (!match) {
|
||||
@ -366,7 +393,6 @@ async function parseExcel(file: File) {
|
||||
if (mapped.length > IMPORT_MAX_ROWS) { ElMessage.error(`不超过 ${IMPORT_MAX_ROWS} 行`); return }
|
||||
importRows.value = mapped.length ? mapped : []
|
||||
selectedRows.value = []
|
||||
// 导入后立即校验
|
||||
const invalidCount = validateAllRows()
|
||||
const suffix = invalidCount ? `,其中 ${invalidCount} 行数据不完整` : ''
|
||||
ElMessage.success(`已读取 ${mapped.length} 条${suffix}`)
|
||||
@ -376,10 +402,8 @@ async function parseExcel(file: File) {
|
||||
async function handleSubmit() {
|
||||
const storeList = stores.value
|
||||
|
||||
// 提交前清除状态
|
||||
importRows.value.forEach(r => { r.status = ''; r.errorMsg = '' })
|
||||
|
||||
// 预校验:标记不符合规则的行
|
||||
const invalidCount = validateAllRows()
|
||||
if (invalidCount) {
|
||||
ElMessage.warning(`共 ${invalidCount} 行数据不完整,请补全后提交`)
|
||||
@ -416,7 +440,6 @@ async function handleSubmit() {
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
// 提交前清除所有行的状态
|
||||
importRows.value.forEach(r => { r.status = ''; r.errorMsg = '' })
|
||||
const res: any = await stockApi.importStockWarehouse(payload)
|
||||
const total = Number(res?.total_count ?? payload.length)
|
||||
@ -425,7 +448,6 @@ async function handleSubmit() {
|
||||
const fail = Number(res?.fail_count ?? 0)
|
||||
const failItems: Array<{ index: number; error: string }> = res?.fail_items || []
|
||||
|
||||
// 标记所有行状态
|
||||
const failIdxSet = new Set(failItems.map(f => f.index))
|
||||
for (let i = 0; i < importRows.value.length; i++) {
|
||||
const row = importRows.value[i]
|
||||
@ -434,15 +456,14 @@ async function handleSubmit() {
|
||||
}
|
||||
}
|
||||
|
||||
// 标记失败行
|
||||
for (const item of failItems) {
|
||||
const idx = item.index
|
||||
if (idx >= 0 && idx < importRows.value.length) {
|
||||
const row = importRows.value[idx]
|
||||
if (row) {
|
||||
row.status = 'error'
|
||||
row.errorMsg = item.error || '导入失败'
|
||||
}
|
||||
const row = importRows.value[idx]
|
||||
if (row) {
|
||||
row.status = 'error'
|
||||
row.errorMsg = item.error || '导入失败'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,15 +478,95 @@ async function handleSubmit() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.hidden-file-input { display: none; }
|
||||
:deep(.import-dialog.el-dialog) { max-width: none; height: 80vh; display: flex; flex-direction: column; }
|
||||
:deep(.import-dialog .el-dialog__body) { flex: 1; min-height: 0; padding: 12px 16px; overflow: hidden; }
|
||||
.import-dialog-body { height: 100%; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; }
|
||||
.import-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||
.import-file-name { color: #606266; font-size: 12px; }
|
||||
.import-summary { color: #606266; font-size: 13px; }
|
||||
.import-table-wrap { flex: 1; min-height: 0; overflow: hidden; }
|
||||
.import-table-wrap :deep(.el-table) { height: 100%; }
|
||||
.required-error :deep(.el-input__wrapper) { box-shadow: 0 0 0 1px #f56c6c inset !important; }
|
||||
<style scoped lang="scss">
|
||||
.hidden-file-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.create-order-dialog-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.create-order-dialog-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.batch-import-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.batch-import-summary {
|
||||
margin-bottom: 10px;
|
||||
color: #606266;
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.picker-hint {
|
||||
color: #606266;
|
||||
font-size: 12px;
|
||||
max-width: 360px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.create-order-body {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
height: 520px;
|
||||
min-height: 420px;
|
||||
}
|
||||
|
||||
.create-order-left {
|
||||
flex: 1 1 100%;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.preview-table-wrap {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.preview-table-wrap :deep(.el-table) {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.field-tip {
|
||||
color: #909399;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.status-tag--gap {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
:deep(.cell-required-empty) {
|
||||
.el-input__wrapper,
|
||||
.el-select__wrapper {
|
||||
box-shadow: 0 0 0 1px #f56c6c inset !important;
|
||||
}
|
||||
|
||||
.el-input__inner::placeholder {
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -541,11 +541,10 @@ export const stockToolbarButtons: StockToolbarButtonConfig[] = [
|
||||
disabledKey: 'hasNoSelection',
|
||||
action: 'confirmBatchDelete'
|
||||
},
|
||||
{ key: 'clearData', label: '清空数据', type: 'warning', size: 'small', action: 'handleClearData' },
|
||||
// { key: 'clearData', label: '清空数据', type: 'warning', size: 'small', action: 'handleClearData' },
|
||||
{
|
||||
key: 'export',
|
||||
label: '导出',
|
||||
type: 'success',
|
||||
size: 'small',
|
||||
permissionKey: 'warehouseExport',
|
||||
loadingKey: 'exportLoading',
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<div class="panel-actions">
|
||||
<el-button-group class="toolbar-btn-group">
|
||||
<el-tooltip
|
||||
content="需按批次查询且选中单条库存记录(含 storage_id)"
|
||||
content="需在左侧查询设置中开启「按批次查询」并选中单条库存记录(含 storage_id)"
|
||||
:disabled="canTransferByLocation"
|
||||
>
|
||||
<span class="transfer-btn-wrap">
|
||||
@ -202,7 +202,7 @@ const loadData = () => {
|
||||
|
||||
function openTransferDialog(mode: TransferMode) {
|
||||
if (mode === 'location' && !canTransferByLocation.value) {
|
||||
ElMessage.warning('当前记录缺少库存记录 ID,请开启「按批次查询」后选择明细行')
|
||||
ElMessage.warning('当前记录缺少库存记录 ID,请在左侧查询设置中开启「按批次查询」后选择明细行')
|
||||
return
|
||||
}
|
||||
if (mode === 'product' && !canTransferByProduct.value) {
|
||||
|
||||
@ -26,14 +26,6 @@
|
||||
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
|
||||
<!-- <el-button>是否按批次显示</el-button> -->
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<span class="toolbar-label">按批次查询</span>
|
||||
<el-select v-model="groupByBatch" size="small" style="width:120px" @change="handleGroupByBatchChange">
|
||||
<el-option label="否" :value="false" />
|
||||
<el-option label="是" :value="true" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -202,6 +194,8 @@ import {
|
||||
formatInventoryTypeLabel,
|
||||
inventoryExportColumns,
|
||||
isInventoryFlagEnabled,
|
||||
normalizeScanConditionToInventoryWhere,
|
||||
parseInventoryGroupByBatch,
|
||||
productstockColums,
|
||||
} from './inventory-config'
|
||||
import { exportUpperTableRows } from '@/views/order/orderManagement/utils/export'
|
||||
@ -261,7 +255,8 @@ const queryTime = ref(0)
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const tableSize = ref('small')
|
||||
const groupByBatch = ref(false)
|
||||
const currentConditionRaw = ref<any>(null)
|
||||
const groupByBatch = computed(() => parseInventoryGroupByBatch(currentConditionRaw.value))
|
||||
const columns = computed(() => {
|
||||
const cols: any[] = JSON.parse(JSON.stringify(productstockColums))
|
||||
if (groupByBatch.value) {
|
||||
@ -345,7 +340,9 @@ async function loadData() {
|
||||
try {
|
||||
const params: any = {
|
||||
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
|
||||
where: scanBox.value?.getConditions?.() || {},
|
||||
where: normalizeScanConditionToInventoryWhere(
|
||||
currentConditionRaw.value ?? scanBox.value?.getConditions?.() ?? {}
|
||||
),
|
||||
group_by_batch: groupByBatch.value
|
||||
}
|
||||
|
||||
@ -436,17 +433,23 @@ async function loadFilterData() {
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
currentConditionRaw.value = condition
|
||||
pagination.currentPage = 1
|
||||
selectedEntryId.value = null
|
||||
loadData()
|
||||
}
|
||||
|
||||
const handleConditionClear = () => {
|
||||
currentConditionRaw.value = {}
|
||||
pagination.currentPage = 1
|
||||
selectedEntryId.value = null
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleConditionReset() {
|
||||
currentConditionRaw.value = {}
|
||||
pagination.currentPage = 1
|
||||
selectedEntryId.value = null
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
}
|
||||
@ -531,12 +534,6 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleGroupByBatchChange() {
|
||||
pagination.currentPage = 1
|
||||
selectedEntryId.value = null
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleCreateEntry() {
|
||||
ElMessage.info('新建入库单')
|
||||
}
|
||||
@ -581,7 +578,7 @@ async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
|
||||
|
||||
const params: any = {
|
||||
pagination: { page: 1, pageSize: 10000 },
|
||||
where: scanBox.value?.getConditions?.() || {},
|
||||
where: normalizeScanConditionToInventoryWhere(currentConditionRaw.value ?? scanBox.value?.getConditions?.() ?? {}),
|
||||
group_by_batch: true
|
||||
}
|
||||
const res: any = await inventoryApi.getInventoryList(params)
|
||||
@ -700,18 +697,6 @@ function orderStatusTagType(val: string): any {
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
|
||||
.order-sub-container .main-content {
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
|
||||
.toolbar-label {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.expiry-date-expired {
|
||||
color: #f56c6c;
|
||||
font-weight: 600;
|
||||
|
||||
@ -3,6 +3,58 @@ import { scanWorkflowField } from '@/views/order/orderManagement/config/order-co
|
||||
/** ScanBox 基础信息分组(对齐收货单排版) */
|
||||
export const INVENTORY_SCAN_BASIC_INFO_GROUP = '基础信息'
|
||||
|
||||
/** ScanBox 筛选字段分组(库存模块专用) */
|
||||
export const INVENTORY_SCAN_FIELD_GROUPS = {
|
||||
basic: '基础信息',
|
||||
options: '查询设置'
|
||||
} as const
|
||||
|
||||
type InventoryScanFieldGroupKey = keyof typeof INVENTORY_SCAN_FIELD_GROUPS
|
||||
|
||||
export function inventoryScanField<G extends InventoryScanFieldGroupKey>(
|
||||
group: G,
|
||||
field: Record<string, any>
|
||||
) {
|
||||
return { ...field, group: INVENTORY_SCAN_FIELD_GROUPS[group] }
|
||||
}
|
||||
|
||||
function extractInventoryScanConds(condition: any): Record<string, any> | null {
|
||||
if (!condition || typeof condition !== 'object') return null
|
||||
if (condition.conditions && typeof condition.conditions === 'object') {
|
||||
return condition.conditions
|
||||
}
|
||||
return condition
|
||||
}
|
||||
|
||||
/** 从 ScanBox 条件解析 group_by_batch(默认 false = 合并模式) */
|
||||
export function parseInventoryGroupByBatch(condition: any): boolean {
|
||||
const conds = extractInventoryScanConds(condition)
|
||||
if (!conds || !Object.prototype.hasOwnProperty.call(conds, 'group_by_batch')) {
|
||||
return false
|
||||
}
|
||||
const raw = conds.group_by_batch?.value ?? conds.group_by_batch
|
||||
if (raw === true || raw === 'true' || raw === 1 || raw === '1') return true
|
||||
return false
|
||||
}
|
||||
|
||||
/** 将 ScanBox 条件转为 list 接口 where(排除查询设置项 group_by_batch) */
|
||||
export function normalizeScanConditionToInventoryWhere(condition: any): Record<string, any> {
|
||||
const conds = extractInventoryScanConds(condition)
|
||||
if (!conds) return {}
|
||||
|
||||
const where: Record<string, any> = {}
|
||||
Object.keys(conds).forEach((key) => {
|
||||
if (key === 'group_by_batch') return
|
||||
const c = conds[key]
|
||||
if (c && typeof c === 'object' && !Array.isArray(c) && 'value' in c) {
|
||||
where[key] = c
|
||||
} else {
|
||||
where[key] = c
|
||||
}
|
||||
})
|
||||
return where
|
||||
}
|
||||
|
||||
/** 为库存 ScanBox 基础信息字段附加分组标签 */
|
||||
export type InventoryScanFieldConfig = Record<string, any> & {
|
||||
group: string
|
||||
@ -51,6 +103,13 @@ export const availableFields: InventoryScanFieldConfig[] = [
|
||||
{ label: '分配', value: 'FP' }
|
||||
]
|
||||
}) as InventoryScanFieldConfig,
|
||||
inventoryScanField('options', {
|
||||
value: 'group_by_batch',
|
||||
label: '按批次查询',
|
||||
type: 'boolean',
|
||||
defaultValue: false,
|
||||
placeholder: '开启后按库存明细逐条返回;关闭则按库位+商品合并'
|
||||
})
|
||||
]
|
||||
/** 库位展示名:优先 custom_name,其次 space_code */
|
||||
export function formatInventorySpaceLabel(space?: Record<string, any> | null, fallback = ''): string {
|
||||
|
||||
@ -93,7 +93,7 @@
|
||||
<template v-if="!isRowReadOnly(row)">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
link
|
||||
size="small"
|
||||
@click.stop="openBindDialog(row)"
|
||||
>
|
||||
@ -189,7 +189,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="editDialogVisible" :title="editDialogTitle" align-center width="760px" append-to-body>
|
||||
<el-form :model="editForm" label-width="110px" size="small">
|
||||
<el-form :model="editForm" label-width="110px" size="small" class="edit-detail-form">
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="6"><el-form-item><template #label>实际收货数量<span class="required-mark">*</span></template><el-input v-model="editForm.actual_quantity" clearable @input="handleQuantityLinkage('actual_quantity')" /></el-form-item></el-col>
|
||||
<el-col :span="6"><el-form-item><template #label>箱数<span class="required-mark">*</span></template><el-input v-model="editForm.box_quantity" clearable @input="handleQuantityLinkage('box_quantity')" /></el-form-item></el-col>
|
||||
@ -240,7 +240,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12"><el-form-item label="毛重/重量"><el-input v-model="editForm.weight" clearable /></el-form-item></el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="SKU">
|
||||
<el-input v-model="editForm.system_product_id" readonly>
|
||||
<template #append>
|
||||
@ -249,23 +249,22 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="12">
|
||||
<el-form-item>
|
||||
<template #label>条码<span v-if="!hasSkuSelected" class="required-mark">*</span></template>
|
||||
<el-input v-model="editForm.barcode" clearable :disabled="hasSkuSelected" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="24">
|
||||
<el-form-item>
|
||||
<template #label>商品名称<span v-if="!hasSkuSelected" class="required-mark">*</span></template>
|
||||
<el-input v-model="editForm.product_name" clearable :disabled="hasSkuSelected" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8"><el-form-item label="箱长"><el-input v-model="editForm.box_length" clearable /></el-form-item></el-col>
|
||||
<el-col :span="8"><el-form-item label="箱宽"><el-input v-model="editForm.box_width" clearable /></el-form-item></el-col>
|
||||
<el-col :span="8"><el-form-item label="箱高"><el-input v-model="editForm.box_height" clearable /></el-form-item></el-col>
|
||||
|
||||
<el-col :span="12"><el-form-item label="箱长"><el-input v-model="editForm.box_length" clearable /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="箱宽"><el-input v-model="editForm.box_width" clearable /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="箱高"><el-input v-model="editForm.box_height" clearable /></el-form-item></el-col>
|
||||
<el-col :span="12"><el-form-item label="实测箱重"><el-input v-model="editForm.box_weight" clearable /></el-form-item></el-col>
|
||||
|
||||
<el-col :span="24"><el-form-item label="备注"><el-input v-model="editForm.remark" type="textarea" :rows="3" clearable /></el-form-item></el-col>
|
||||
@ -595,7 +594,7 @@ const isRowNotStored = (row?: any) => {
|
||||
return !Number.isFinite(storedQuantity) || storedQuantity <= 0
|
||||
}
|
||||
|
||||
if (storageStatus === 'none' || storageStatus === '未入库') return true
|
||||
if (storageStatus === 'waiting' || storageStatus === '待入库' || storageStatus === 'none' || storageStatus === '未入库') return true
|
||||
if (storageStatus === 'all' || storageStatus === '全部入库' || storageStatus === 'partial' || storageStatus === '部分入库') {
|
||||
return false
|
||||
}
|
||||
@ -2816,6 +2815,17 @@ onUnmounted(() => {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.edit-detail-form {
|
||||
:deep(.el-input-group) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.el-form-item .el-input),
|
||||
:deep(.el-form-item .el-date-editor) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.right-col {
|
||||
grid-column: 2 / 3;
|
||||
grid-row: 2 / 3;
|
||||
@ -2873,6 +2883,13 @@ onUnmounted(() => {
|
||||
color: #E6A23C;
|
||||
border: 1px solid #f5dab1;
|
||||
}
|
||||
|
||||
/* 待入库 - 蓝色 */
|
||||
.storage-status-waiting {
|
||||
background-color: #ecf5ff;
|
||||
color: #409EFF;
|
||||
border: 1px solid #b3d8ff;
|
||||
}
|
||||
|
||||
/* 未入库 - 灰色 */
|
||||
.storage-status-none {
|
||||
|
||||
@ -41,6 +41,7 @@ export const detailStatusConfig = {
|
||||
export const storageStatusConfig = {
|
||||
all: { text: '全部入库', tagType: 'success' },
|
||||
partial: { text: '部分入库', tagType: 'warning' },
|
||||
waiting: { text: '待入库', tagType: 'primary' },
|
||||
none: { text: '未入库', tagType: 'info' }
|
||||
}
|
||||
|
||||
@ -48,6 +49,7 @@ export const storageStatusConfig = {
|
||||
export const productStorageStatusConfig: any = {
|
||||
all: { text: '全部入库', tagType: 'success', color: '#67C23A' },
|
||||
partial: { text: '部分入库', tagType: 'warning', color: '#E6A23C' },
|
||||
waiting: { text: '待入库', tagType: 'primary', color: '#409EFF' },
|
||||
none: { text: '未入库', tagType: 'info', color: '#909399' }
|
||||
}
|
||||
|
||||
@ -302,7 +304,8 @@ export const availableFields: ReceivingScanFieldConfig[] = [
|
||||
label: '入库状态',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ value: 'none', label: '待入库' },
|
||||
{ value: 'waiting', label: '待入库' },
|
||||
{ value: 'none', label: '未入库' },
|
||||
{ value: 'partial', label: '部分入库' },
|
||||
{ value: 'all', label: '已入库' }
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user