This commit is contained in:
yin 2026-10-23 18:00:35 +08:00
parent 7a8a087b17
commit e8b3eda895
35 changed files with 3958 additions and 1273 deletions

View File

@ -33,6 +33,8 @@
<strong v-else class="task-panel__field-value">{{ field.value ?? '—' }}</strong>
</div>
</div>
<!-- 表单态自定义扩展区(如:展示已选订单 ID 列表) -->
<slot name="form-extra" />
<p v-if="formTip" class="task-panel__form-tip">{{ formTip }}</p>
</template>

View File

@ -12,6 +12,9 @@
@closed="emit('closed')"
>
<TaskProgressPanel v-bind="panelProps" @close="close" @toggle-field="emit('toggle-field', $event)">
<template #form-extra>
<slot name="form-extra" />
</template>
<template #footer>
<span class="utp-hint">{{ footerHint }}</span>
<div class="utp-actions">

View File

@ -125,11 +125,12 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
</script>
<style lang="scss" scoped>
/* 容器对齐 order/orderManagement 的 OrderDetailPanel(.order-detail-view) */
/* 面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.detail-panel {
flex: 1;
min-height: 0;
padding: 10px;
padding: 6px 10px 8px;
height: 100%;
box-sizing: border-box;
overflow: auto;
@ -162,10 +163,15 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 120px;
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
.order-list-pre {

View File

@ -723,6 +723,15 @@ onMounted(() => {
/* 布局样式对齐 order/orderManagement(order-sub.scss) */
@use "../../order/orderManagement/styles/order-sub.scss";
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(明细面板自带
padding: 6px 10px 8px),只留左右 10px。
⚠️ 必须用完整路径选择器:共享 order-sub.scss 的同名规则权重更高,
写成 `.lower-level .detail-container` 会被它覆盖成 padding: 0。 */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
overflow: auto;
}
/* ================================================================
整体布局
================================================================ */

View File

@ -857,8 +857,8 @@ onMounted(() => {
<style scoped lang="scss">
@use "../../order/orderManagement/styles/order-sub.scss";
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(各 detail-page 自带
8px 上下间距),只保留左右 10px,避免与面板内边距叠加 */
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(任务详情面板自带
padding: 6px 10px 8px),只留左右 10px,避免与面板内边距叠加 */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
overflow: auto;
@ -871,8 +871,12 @@ onMounted(() => {
padding: 8px 0;
}
/* 任务详情面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
/* 任务详情面板:自带内边距,
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.detail-page.detail-panel {
padding: 6px 10px 8px;
box-sizing: border-box;
.section {
margin-bottom: 12px;
@ -891,10 +895,17 @@ onMounted(() => {
line-height: 1.4;
}
.detail-descriptions :deep(.el-descriptions__label) {
width: 100px;
background: #fafbfc;
font-weight: 500;
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
}
}

View File

@ -146,7 +146,7 @@
</div>
<div class="detail-container" v-loading="detailLoading">
<div v-if="detailActiveTab === 'detail'" class="detail-page detail-scroll">
<div v-if="detailActiveTab === 'detail'" class="detail-page detail-scroll detail-panel">
<template v-if="detailRecord">
<!-- 主表信息 -->
<div class="section">
@ -1089,8 +1089,8 @@ onMounted(() => {
color: #c0c4cc;
}
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px,
由各详情页自身 padding 控制上下留白 */
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(拆包详情面板自带
padding: 6px 10px 8px),左右 10px,内容滚动交给各 detail-page */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
}
@ -1120,13 +1120,28 @@ onMounted(() => {
line-height: 1.4;
}
.detail-descriptions :deep(.el-descriptions__label) {
width: 110px;
background: #fafbfc;
font-weight: 500;
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
}
/* 拆包详情面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致;
明细分页 / 拆包录像两个 tab 仍用 .detail-scroll 的 padding: 8px 0 */
.detail-scroll.detail-panel {
padding: 6px 10px 8px;
box-sizing: border-box;
}
.copyable {
cursor: pointer;
color: #409eff;

View File

@ -114,8 +114,13 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
<style lang="scss" scoped>
@use "../../../../order/orderManagement/styles/order-sub.scss";
/* 面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.detail-panel {
padding: 8px 0;
height: 100%;
overflow-y: auto;
padding: 6px 10px 8px;
box-sizing: border-box;
}
.empty-tip {
@ -145,10 +150,15 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 120px;
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
.order-list-pre {

View File

@ -995,7 +995,9 @@ onMounted(() => {
min-height: 0;
display: flex;
flex-direction: column;
padding: 10px;
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(明细面板自带
padding: 6px 10px 8px),只留左右 10px */
padding: 0 10px;
overflow: auto;
}
}

View File

@ -1,99 +1,153 @@
<template>
<el-dialog
v-model="visible"
title="批量导入包材"
class="package-material-import-dialog"
width="min(1080px, 96vw)"
align-center
width="1020px"
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
>
<div class="batch-import-toolbar">
<input
ref="importInputRef"
type="file"
accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
style="display: none"
@change="handleFileChange"
/>
<el-button size="small" @click="triggerFileSelect">选择Excel</el-button>
<el-button size="small" @click="downloadTemplate">下载模板</el-button>
<el-button size="small" @click="clearData">清除数据</el-button>
<el-button size="small" :loading="retryLoading" @click="retryFailedRows">只重试失败</el-button>
<el-button size="small" type="primary" :loading="importLoading" @click="submitBatchImport">导入</el-button>
<span class="picker-hint">已选文件:{{ fileName || '未选择' }}</span>
</div>
<!-- 面板结构 / 尺寸对齐 storage/receiving「批量导入商品」 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>批量导入包材</h2>
<p>选择 Excel 文件后在此预览导入结果,失败行可单独重试</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="picker-table-wrap">
<UpperTable
:data="previewRows"
:show-selection="false"
:pagination="{ currentPage: 1, pageSize: 200, total: previewRows.length }"
:columns="previewColumns"
>
<template #column-row_no="{ row }">
{{ row.row_no }}
</template>
<template #column-material_code="{ row }">
<span :class="{ 'cell-required-empty': !row.material_code && row.import_status !== '成功' }">
{{ row.material_code || '--' }}
<div class="task-panel__body">
<input
ref="importInputRef"
type="file"
accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
style="display: none"
@change="handleFileChange"
/>
<div class="task-panel__toolbar">
<div class="task-panel__toolbar-main">
<el-button size="small" @click="triggerFileSelect">选择Excel</el-button>
<el-button size="small" @click="downloadTemplate">下载模板</el-button>
<el-button size="small" type="danger" plain :disabled="!previewRows.length" @click="clearData">
清除数据
</el-button>
<el-button size="small" type="primary" plain :loading="retryLoading" @click="retryFailedRows">
只重试失败
</el-button>
<el-button size="small" type="primary" :loading="importLoading" @click="submitBatchImport">
导入
</el-button>
</div>
<span class="task-panel__file-hint" :title="fileName">
已选文件:{{ fileName || '未选择' }}
</span>
</template>
<template #column-material_name="{ row }">
<span :class="{ 'cell-required-empty': !row.material_name && row.import_status !== '成功' }">
{{ row.material_name || '--' }}
</span>
</template>
<template #column-length="{ row }">
{{ formatCellNumber(row.length) }}
</template>
<template #column-width="{ row }">
{{ formatCellNumber(row.width) }}
</template>
<template #column-height="{ row }">
{{ formatCellNumber(row.height) }}
</template>
<template #column-weight="{ row }">
{{ formatCellNumber(row.weight) ? formatCellNumber(row.weight) + 'g' : '--' }}
</template>
<template #column-cost_price="{ row }">
{{ formatCellNumber(row.cost_price) }}
</template>
<template #column-status="{ row }">
{{ formatStatusLabel(row.status) }}
</template>
<template #column-import_status="{ row }">
<el-tag v-if="row.import_status === '成功'" type="success" size="small">成功</el-tag>
<el-tag v-else-if="row.import_status === '失败'" type="danger" size="small">失败</el-tag>
<el-tag v-else type="info" size="small">待导入</el-tag>
</template>
<template #column-import_message="{ row }">
{{ row.import_message || '--' }}
</template>
<template #column-retry_action="{ row }">
<el-button
v-if="row.import_status === '失败'"
type="primary"
link
</div>
<div class="task-panel__section">
<div class="batch-import-table">
<UpperTable
ref="tableRef"
:data="pagedRows"
:show-selection="false"
:show-pagination="false"
default-align="center"
empty-text="请先选择 Excel 文件"
:pagination="{
currentPage: page,
pageSize,
total: previewRows.length,
}"
:columns="previewColumns"
>
<template #column-row_no="{ row }">
{{ row.row_no }}
</template>
<template #column-material_code="{ row }">
<span :class="{ 'cell-required-empty': !row.material_code && row.import_status !== '成功' }">
{{ row.material_code || '--' }}
</span>
</template>
<template #column-material_name="{ row }">
<span :class="{ 'cell-required-empty': !row.material_name && row.import_status !== '成功' }">
{{ row.material_name || '--' }}
</span>
</template>
<template #column-length="{ row }">
{{ formatCellNumber(row.length) }}
</template>
<template #column-width="{ row }">
{{ formatCellNumber(row.width) }}
</template>
<template #column-height="{ row }">
{{ formatCellNumber(row.height) }}
</template>
<template #column-weight="{ row }">
{{ formatCellNumber(row.weight) ? formatCellNumber(row.weight) + 'g' : '--' }}
</template>
<template #column-cost_price="{ row }">
{{ formatCellNumber(row.cost_price) }}
</template>
<template #column-status="{ row }">
{{ formatStatusLabel(row.status) }}
</template>
<template #column-import_status="{ row }">
<el-tag v-if="row.import_status === '成功'" type="success" size="small">成功</el-tag>
<el-tag v-else-if="row.import_status === '失败'" type="danger" size="small">失败</el-tag>
<el-tag v-else type="info" size="small">待导入</el-tag>
</template>
<template #column-import_message="{ row }">
{{ row.import_message || '--' }}
</template>
<template #column-retry_action="{ row }">
<el-button
v-if="row.import_status === '失败'"
type="primary"
link
size="small"
:loading="row._retrying"
@click="retrySingleRow(row)"
>
重试
</el-button>
<span v-else>--</span>
</template>
</UpperTable>
</div>
</div>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">{{ importHintText }}</span>
<div class="task-panel__actions">
<el-pagination
v-model:current-page="page"
v-model:page-size="pageSize"
:page-sizes="[50, 100, 200, 500]"
:total="previewRows.length"
layout="total, sizes, prev, pager, next"
background
size="small"
:loading="row._retrying"
@click="retrySingleRow(row)"
>
重试
</el-button>
<span v-else>--</span>
</template>
</UpperTable>
class="batch-import-pagination"
@current-change="handlePageChange"
@size-change="handlePageSizeChange"
/>
<el-button size="small" @click="visible = false">关闭</el-button>
</div>
</footer>
</div>
<template #footer>
<el-button size="small" @click="visible = false">关闭</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { computed, nextTick, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import * as XLSX from 'xlsx'
import UpperTable from '@/components/UpperTable/index.vue'
@ -120,6 +174,15 @@ interface ImportPreviewRow extends PackageMaterialRecord {
const previewRows = ref<ImportPreviewRow[]>([])
/** 前端分页:预览行一次性存在本地,分页只影响展示 */
const tableRef = ref<InstanceType<typeof UpperTable> | null>(null)
const page = ref(1)
const pageSize = ref(200)
const pagedRows = computed(() => {
const start = (page.value - 1) * pageSize.value
return previewRows.value.slice(start, start + pageSize.value)
})
const previewColumns = [
{ prop: 'row_no', label: '行号', width: '70' },
{ prop: 'material_code', label: '包材编码', minWidth: '120' },
@ -141,9 +204,39 @@ watch(visible, (opened) => {
if (!opened) {
fileName.value = ''
previewRows.value = []
page.value = 1
}
})
/** 数据量 / 每页条数变化后,把当前页收敛到有效范围 */
watch([() => previewRows.value.length, pageSize], () => {
const maxPage = Math.max(1, Math.ceil(previewRows.value.length / pageSize.value))
if (page.value > maxPage) page.value = maxPage
})
function handlePageChange(value: number) {
page.value = value
void nextTick(() => tableRef.value?.getTableRef()?.setScrollTop(0))
}
function handlePageSizeChange(size: number) {
pageSize.value = size
page.value = 1
void nextTick(() => tableRef.value?.getTableRef()?.setScrollTop(0))
}
/** 页脚提示:按导入状态统计条数 */
const importHintText = computed(() => {
const total = previewRows.value.length
if (!total) return '请选择 Excel 文件后预览导入数据'
const success = previewRows.value.filter((row) => row.import_status === '成功').length
const failed = previewRows.value.filter((row) => row.import_status === '失败').length
const pending = total - success - failed
if (failed) return `成功 ${success} 条 · 失败 ${failed} 条 · 待导入 ${pending} 条`
if (success) return `已导入 ${success} 条 · 待导入 ${pending} 条`
return `待导入 ${pending} 条`
})
function triggerFileSelect() {
importInputRef.value?.click()
}
@ -172,6 +265,7 @@ function downloadTemplate() {
function clearData() {
previewRows.value = []
fileName.value = ''
page.value = 1
if (importInputRef.value) {
importInputRef.value.value = ''
}
@ -297,6 +391,7 @@ async function handleFileChange(event: Event) {
return
}
previewRows.value = rows
page.value = 1
ElMessage.success(`已解析 ${rows.length} 条包材数据`)
} catch (error) {
console.error('解析 Excel 失败', error)
@ -428,23 +523,182 @@ async function retrySingleRow(row: ImportPreviewRow) {
</script>
<style lang="scss" scoped>
.batch-import-toolbar {
/* 面板结构 / 尺寸对齐 storage/receiving「批量导入商品」 */
.task-panel {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
flex-wrap: wrap;
flex-direction: column;
height: min(680px, calc(100vh - 96px));
background: #fff;
color: #303133;
.picker-hint {
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 16px 8px;
flex-shrink: 0;
}
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
font-size: 13px;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 6px 16px 0;
display: flex;
flex-direction: column;
gap: 10px;
overflow: hidden;
}
/* 工具栏:按钮间距 6px,与 OrderToolbarButtonGroup 一致 */
&__toolbar {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
&__toolbar-main {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
min-width: 0;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
&__file-hint {
margin-left: auto;
min-width: 0;
max-width: 40%;
font-size: 12px;
line-height: 20px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__section {
display: flex;
flex-direction: column;
gap: 6px;
flex: 1;
min-height: 0;
}
&__foot {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
padding: 12px 16px 16px;
flex-shrink: 0;
}
&__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
.picker-table-wrap {
max-height: 480px;
overflow: auto;
/* 表格固定高度:数据少也保持同样大小,超出容器时表格内部滚动 */
.batch-import-table {
flex: 1;
min-height: 0;
min-width: 0;
border-radius: 4px;
overflow: hidden;
}
/* 页脚分页:与按钮同行,尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
.batch-import-pagination {
flex: none;
margin-right: 4px;
:deep(.el-pagination) {
flex-wrap: wrap;
justify-content: flex-end;
--el-pagination-button-width: 28px;
--el-pagination-button-height: 28px;
}
:deep(.el-pagination__total),
:deep(.el-pagination__sizes) {
display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
}
:deep(.el-input__wrapper) {
padding: 0 4px;
}
}
.cell-required-empty {
@ -452,3 +706,20 @@ async function retrySingleRow(row: ImportPreviewRow) {
font-weight: 500;
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:面板自带页头 / 页脚,去掉默认头 / 内边距 */
.el-dialog.package-material-import-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header,
.el-dialog__footer {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -256,6 +256,7 @@
<sync-order-ids-form
v-model="syncOrderIdsDialogVisible"
:order-count="selectionRows.length"
:order-ids="getSelectedIds()"
:loading="syncOrderIdsLoading"
:request-id="syncOrderIdsRequestId"
:task-status="syncOrderIdsTaskStatus"

View File

@ -24,17 +24,20 @@
@submit="emit('submit')"
>
<template #footer>
<template v-if="isProgress">
<el-button size="small" @click="visible = false">
{{ progressState === 'running' ? '后台运行' : '关闭' }}
</el-button>
</template>
<template v-else>
<el-button size="small" @click="visible = false">取消</el-button>
<el-button size="small" type="primary" :loading="loading" @click="emit('submit')">
{{ submitButtonText }}
</el-button>
</template>
<!-- 页脚按钮间距对齐顶部工具栏(OrderToolbarButtonGroup:gap 6px) -->
<div class="storage-allocate-footer">
<template v-if="isProgress">
<el-button size="small" @click="visible = false">
{{ progressState === 'running' ? '后台运行' : '关闭' }}
</el-button>
</template>
<template v-else>
<el-button size="small" @click="visible = false">取消</el-button>
<el-button size="small" type="primary" :loading="loading" @click="emit('submit')">
{{ submitButtonText }}
</el-button>
</template>
</div>
</template>
</UnifiedTaskProgressDialog>
</template>
@ -165,3 +168,18 @@ function handleToggleField(field: ProgressFormField) {
}
}
</script>
<style scoped lang="scss">
/* 页脚按钮间距:对齐顶部工具栏(OrderToolbarButtonGroup gap 6px),
并去掉 el-button 默认左外边距,避免与 gap 叠加 */
.storage-allocate-footer {
display: flex;
align-items: center;
gap: 6px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
</style>

View File

@ -22,24 +22,65 @@
@closed="emit('closed')"
@submit="emit('submit')"
>
<!-- 已选订单 ID:让提交前能核对具体写哪几条订单 -->
<template #form-extra>
<div v-if="normalizedOrderIds.length || invalidOrderCount > 0" class="sync-ids">
<div class="sync-ids__head">
<span class="sync-ids__title">订单 ID<em>{{ normalizedOrderIds.length }}</em></span>
<span class="sync-ids__ops">
<el-button
v-if="normalizedOrderIds.length"
link
type="primary"
size="small"
@click="copyOrderIds"
>
复制全部
</el-button>
<el-button
v-if="normalizedOrderIds.length > ID_PREVIEW_LIMIT"
link
type="primary"
size="small"
@click="idsExpanded = !idsExpanded"
>
{{ idsExpanded ? '收起' : '展开全部' }}
</el-button>
</span>
</div>
<div class="sync-ids__list">
<span v-for="id in visibleOrderIds" :key="id" class="sync-ids__tag">{{ id }}</span>
<span v-if="hiddenOrderIdCount" class="sync-ids__more" @click="idsExpanded = true">
…等 {{ normalizedOrderIds.length }} 条
</span>
</div>
<p v-if="invalidOrderCount > 0" class="sync-ids__warn">
有 {{ invalidOrderCount }} 条选中行缺少有效订单 ID,不会被同步
</p>
</div>
</template>
<template #footer>
<template v-if="isProgress">
<el-button size="small" @click="visible = false">
{{ progressState === 'running' ? '后台运行' : '关闭' }}
</el-button>
</template>
<template v-else>
<el-button size="small" @click="visible = false">取消</el-button>
<el-button size="small" type="primary" :loading="loading" @click="emit('submit')">
确认同步
</el-button>
</template>
<!-- 页脚按钮间距对齐顶部工具栏(OrderToolbarButtonGroup:gap 6px) -->
<div class="sync-order-ids-footer">
<template v-if="isProgress">
<el-button size="small" @click="visible = false">
{{ progressState === 'running' ? '后台运行' : '关闭' }}
</el-button>
</template>
<template v-else>
<el-button size="small" @click="visible = false">取消</el-button>
<el-button size="small" type="primary" :loading="loading" @click="emit('submit')">
确认同步
</el-button>
</template>
</div>
</template>
</UnifiedTaskProgressDialog>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { computed, ref } from 'vue'
import { ElMessage } from 'element-plus'
import UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
import type { ProgressFormField, ProgressMetricItem, ProgressState } from '@/components/task-progress/types'
@ -47,6 +88,8 @@ const visible = defineModel<boolean>({ default: false })
const props = defineProps<{
orderCount: number
/** 当前勾选的订单 ID(提交前展示,便于核对) */
orderIds?: Array<number | string>
loading: boolean
requestId?: string
taskStatus?: string
@ -125,9 +168,56 @@ const progressDetail = computed(() => {
})
const formFields = computed<ProgressFormField[]>(() => [
{ label: '当前勾选订单', value: `${props.orderCount} 条` }
{ label: '当前勾选订单', value: `${selectedOrderCount.value} 条` }
])
/** 订单 ID 预览条数,超出后默认折叠 */
const ID_PREVIEW_LIMIT = 20
const idsExpanded = ref(false)
/** 去重后的订单 ID(接口 order_ids 为必填,空值 / 重复值先清理) */
const normalizedOrderIds = computed<string[]>(() => {
const seen = new Set<string>()
const result: string[] = []
for (const raw of props.orderIds ?? []) {
const id = String(raw ?? '').trim()
if (!id || seen.has(id)) continue
seen.add(id)
result.push(id)
}
return result
})
/** 提交时实际同步的条数:优先取有效 ID 数 */
const selectedOrderCount = computed(() => normalizedOrderIds.value.length || props.orderCount)
/** 已选行中缺少有效 ID 的数量(未传入 orderIds 时不判断) */
const invalidOrderCount = computed(() => {
if (!props.orderIds) return 0
return Math.max(0, Number(props.orderCount || 0) - normalizedOrderIds.value.length)
})
const visibleOrderIds = computed(() =>
idsExpanded.value ? normalizedOrderIds.value : normalizedOrderIds.value.slice(0, ID_PREVIEW_LIMIT)
)
const hiddenOrderIdCount = computed(() =>
Math.max(0, normalizedOrderIds.value.length - visibleOrderIds.value.length)
)
async function copyOrderIds() {
const text = normalizedOrderIds.value.join(',')
if (!text) return
try {
if (!navigator.clipboard?.writeText) throw new Error('no clipboard api')
await navigator.clipboard.writeText(text)
ElMessage.success(`已复制 ${normalizedOrderIds.value.length} 个订单 ID`)
} catch {
ElMessage.warning('复制失败,请手动选择复制')
}
}
const progressMetrics = computed<ProgressMetricItem[]>(() => {
const metrics: ProgressMetricItem[] = []
if (props.totalCount != null) metrics.push({ label: '总数', value: props.totalCount })
@ -137,3 +227,92 @@ const progressMetrics = computed<ProgressMetricItem[]>(() => {
return metrics
})
</script>
<style scoped lang="scss">
/* 已选订单 ID:标签式列表,超出高度内部滚动 */
.sync-ids {
margin-top: 8px;
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fff;
}
.sync-ids__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.sync-ids__title {
font-size: 12px;
line-height: 20px;
color: #606266;
em {
margin-left: 4px;
font-style: normal;
font-weight: 600;
color: #303133;
}
}
.sync-ids__ops {
display: flex;
align-items: center;
gap: 4px;
flex: none;
:deep(.el-button) {
margin: 0;
}
}
.sync-ids__list {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-top: 6px;
max-height: 96px;
overflow: auto;
}
.sync-ids__tag {
padding: 0 6px;
border-radius: 3px;
background: #f4f4f5;
font-size: 12px;
line-height: 20px;
color: #606266;
font-variant-numeric: tabular-nums;
}
.sync-ids__more {
padding: 0 6px;
font-size: 12px;
line-height: 20px;
color: #409eff;
cursor: pointer;
}
.sync-ids__warn {
margin: 6px 0 0;
font-size: 12px;
line-height: 18px;
color: #e6a23c;
}
/* 页脚按钮间距:对齐顶部工具栏(OrderToolbarButtonGroup gap 6px),
并去掉 el-button 默认左外边距,避免与 gap 叠加 */
.sync-order-ids-footer {
display: flex;
align-items: center;
gap: 6px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
</style>

View File

@ -252,6 +252,7 @@
<sync-order-ids-form
v-model="syncOrderIdsDialogVisible"
:order-count="selectionRows.length"
:order-ids="getSelectedIds()"
:loading="syncOrderIdsLoading"
:request-id="syncOrderIdsRequestId"
:task-status="syncOrderIdsTaskStatus"

View File

@ -368,12 +368,10 @@
show-selection
table-size="small"
:pagination="groupOrderPagination"
:page-sizes="[10, 20, 50, 100]"
:show-pagination="false"
:query-time="groupOrderQueryTime"
empty-text="暂无可抓取的团购单结构"
@selection-change="handleGroupOrderSelectionChange"
@page-change="handleGroupOrderPageChange"
@page-size-change="handleGroupOrderPageSizeChange"
>
<template #column-store_name="{ row }">
{{ getGroupOrderStoreText(row) }}
@ -400,8 +398,26 @@
</div>
</div>
<template #footer>
<el-button size="small" @click="groupOrderDialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="groupOrderSubmitting" @click="submitGroupOrderDialog">抓取选中结构</el-button>
<!-- 页脚:左侧提示 + 分页与按钮同一水平行(对齐 storage/receiving「批量导入商品」) -->
<div class="group-order-footer">
<span class="group-order-footer__hint">
已选 {{ groupOrderSelectionRows.length }} 个结构 · 勾选左侧结构后点击「抓取选中结构」
</span>
<el-pagination
v-model:current-page="groupOrderPagination.currentPage"
v-model:page-size="groupOrderPagination.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="groupOrderPagination.total"
layout="total, sizes, prev, pager, next"
background
size="small"
class="group-order-pagination"
@current-change="handleGroupOrderPageChange"
@size-change="handleGroupOrderPageSizeChange"
/>
<el-button size="small" @click="groupOrderDialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="groupOrderSubmitting" @click="submitGroupOrderDialog">抓取选中结构</el-button>
</div>
</template>
</el-dialog>
@ -4208,6 +4224,59 @@ async function submitFallbackOrderFetchByIds() {
flex-direction: column;
}
/* 页脚:左侧短提示 + 分页与按钮同一水平行(对齐「批量导入商品」页脚) */
.group-order-footer {
display: flex;
align-items: center;
justify-content: flex-end;
flex-wrap: wrap;
gap: 12px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
/* 页脚左下角提示:占据左侧剩余空间,内容过长时省略 */
.group-order-footer__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
line-height: 20px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 分页尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
.group-order-pagination {
flex: none;
margin-right: 4px;
:deep(.el-pagination) {
flex-wrap: wrap;
justify-content: flex-end;
--el-pagination-button-width: 28px;
--el-pagination-button-height: 28px;
}
:deep(.el-pagination__total),
:deep(.el-pagination__sizes) {
display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
}
:deep(.el-input__wrapper) {
padding: 0 4px;
}
}
/* 分页条右侧:跨页累计选中结构数 */
.group-order-selected-count {
margin-left: 12px;

View File

@ -136,6 +136,7 @@
<sync-order-ids-form
v-model="syncOrderIdsDialogVisible"
:order-count="selectionRows.length"
:order-ids="getSelectedIds()"
:loading="syncOrderIdsLoading"
:request-id="syncOrderIdsRequestId"
:task-status="syncOrderIdsTaskStatus"

View File

@ -810,8 +810,6 @@ onMounted(() => {
/* 基本信息 / 商品图片面板:分区标题统一样式(对齐 express/waybill「运单明细」新样式) */
.detail-panel,
.image-panel {
padding: 8px 0;
.section-title {
font-size: 14px;
font-weight: 600;
@ -838,12 +836,30 @@ onMounted(() => {
}
}
/* 基本信息面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.detail-panel {
height: 100%;
overflow-y: auto;
padding: 6px 10px 8px;
box-sizing: border-box;
}
.image-panel {
padding: 8px 0;
}
.detail-panel .detail-descriptions {
:deep(.el-descriptions__label) {
width: 120px;
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
.empty-tip {

View File

@ -1,58 +1,67 @@
<template>
<el-dialog
v-model="visible"
title="货单绑定到入库单"
width="1200px"
class="entry-bind-dialog"
width="min(1200px, 96vw)"
align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@closed="handleClosed"
>
<div class="bind-dialog-content">
<div v-if="entryOrderCode" class="entry-order-summary">
<span class="summary-inline">
<span class="summary-label">入库单号</span>
<span class="summary-value">{{ entryOrderCode }}</span>
</span>
<span v-if="entryStoreName" class="summary-inline">
<span class="summary-label">货主</span>
<span class="summary-value">{{ entryStoreName }}</span>
</span>
<span v-if="entryOrderStatusLabel" class="summary-inline">
<span class="summary-label">订单状态</span>
<el-tag size="small" :type="entryOrderStatusTag">{{ entryOrderStatusLabel }}</el-tag>
</span>
<span v-if="entryTotalOrderLines" class="summary-inline">
<span class="summary-label">商品类型数</span>
<span class="summary-value">{{ entryTotalOrderLines }}</span>
</span>
<span v-if="entryTotalQuantity" class="summary-inline">
<span class="summary-label">商品总数</span>
<span class="summary-value">{{ entryTotalQuantity }}</span>
</span>
<span v-if="entryExpressCode" class="summary-inline">
<span class="summary-label">运单号</span>
<span class="summary-value">{{ entryExpressCode }}</span>
</span>
<span v-if="entryLogisticsName" class="summary-inline">
<span class="summary-label">物流公司</span>
<span class="summary-value">{{ entryLogisticsName }}</span>
</span>
<span v-if="entryPurchaseOrderCode" class="summary-inline">
<span class="summary-label">单据编号</span>
<span class="summary-value">{{ entryPurchaseOrderCode }}</span>
</span>
<span v-if="entryRemark" class="summary-inline summary-inline--remark">
<span class="summary-label">备注</span>
<span class="summary-value summary-value--remark">{{ entryRemark }}</span>
</span>
</div>
<!-- 面板结构对齐「批量导入商品」/「查询系统商品」等 task-panel 弹窗 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>货单绑定到入库单</h2>
<p>勾选已审核的收货单,左侧实时对照入库单与收货单的商品与数量</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="bind-dialog-body">
<div class="bind-dialog-layout">
<section class="bind-dialog-center">
<div class="compare-table">
<div class="task-panel__body">
<!-- 入库单关键信息:单行展示,不占表格空间 -->
<div class="entry-summary">
<span class="entry-summary__item">
<span class="entry-summary__label">入库单号</span>
<span class="entry-summary__value">{{ entryOrderCode || '—' }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">货主</span>
<span class="entry-summary__value">{{ entryStoreName || '—' }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">状态</span>
<el-tag v-if="entryOrderStatusLabel" size="small" :type="entryOrderStatusTag">
{{ entryOrderStatusLabel }}
</el-tag>
<span v-else class="entry-summary__value">—</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">商品类型数</span>
<span class="entry-summary__value">{{ entryTotalOrderLines || '—' }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">商品总数</span>
<span class="entry-summary__value">{{ entryTotalQuantity || '—' }}</span>
</span>
</div>
<div class="bind-layout">
<section class="bind-column bind-column--compare">
<div class="task-panel__section-head">
<span class="task-panel__section-title">入库 / 收货对照</span>
<span class="task-panel__section-meta">
{{ compareRows.length ? `共 ${compareRows.length} 条` : '未选择收货单' }}
</span>
</div>
<div class="compare-table">
<div class="compare-group-header">
<div
v-for="(group, groupIndex) in entryBindCompareGroupHeaders"
@ -109,21 +118,28 @@
</div>
</section>
<section class="bind-dialog-right">
<div class="panel-title">收货表单</div>
<section class="bind-column bind-column--receiving">
<!-- <div class="task-panel__section-head">
<span class="task-panel__section-title">收货单</span>
<span class="task-panel__section-meta">
已选 {{ selectedReceivingRows.length }} 条 · 已审核 {{ pagination.total }} 条
</span>
</div> -->
<div class="receiving-toolbar">
<span v-if="entryStoreName" class="toolbar-meta">货主:{{ entryStoreName }}</span>
<span class="toolbar-meta">已审核 {{ pagination.total }} 条</span>
<el-button size="small" :loading="receivingListLoading" @click="loadReceivingList">
刷新
</el-button>
<div class="task-panel__toolbar">
<div class="task-panel__toolbar-main">
<el-button size="small" :loading="receivingListLoading" @click="loadReceivingList">
刷新
</el-button>
</div>
<span v-if="entryStoreName" class="task-panel__file-hint" :title="entryStoreName">
货主:{{ entryStoreName }}
</span>
</div>
<div ref="tableHostRef" class="receiving-table-wrap">
<div ref="tableHostRef" class="bind-table-wrap">
<el-table
ref="receivingTableRef"
class="entry-bind-receiving-table"
v-loading="receivingListLoading"
:data="receivingList"
border
@ -156,38 +172,39 @@
</el-table-column>
</el-table>
</div>
<div class="receiving-pagination">
<el-pagination
v-model:current-page="pagination.currentPage"
v-model:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[5, 10, 20]"
:disabled="receivingListLoading"
background
size="small"
layout="total, sizes, prev, pager, next"
@current-change="handlePageChange"
@size-change="handlePageSizeChange"
/>
</div>
</section>
</div>
</div>
</div>
<template #footer>
<el-button size="small" :disabled="bindSubmitting" @click="visible = false">取消</el-button>
<el-button
size="small"
type="primary"
:loading="bindSubmitting"
:disabled="!canSubmitBind"
@click="handleBindSubmit"
>
确认绑定
</el-button>
</template>
<footer class="task-panel__foot">
<span class="task-panel__hint" :class="{ 'is-warning': hintWarning }">{{ bindHintText }}</span>
<div class="task-panel__actions">
<el-pagination
v-model:current-page="pagination.currentPage"
v-model:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[5, 10, 20, 50]"
:disabled="receivingListLoading"
background
size="small"
layout="total, sizes, prev, pager, next"
class="bind-pagination"
@current-change="handlePageChange"
@size-change="handlePageSizeChange"
/>
<el-button size="small" :disabled="bindSubmitting" @click="visible = false">取消</el-button>
<el-button
size="small"
type="primary"
:loading="bindSubmitting"
:disabled="!canSubmitBind"
@click="handleBindSubmit"
>
确认绑定
</el-button>
</div>
</footer>
</div>
</el-dialog>
</template>
@ -205,7 +222,6 @@ import {
type EntryDetailItem,
type EntryOrderDetail,
type ReceivingCompareResponse,
type ReceivingCompareItem,
type ReceivingCompareRow,
} from '@/api/storage.entry/entry'
import {
@ -317,26 +333,6 @@ const entryOrderStatusLabel = computed(() => {
const entryOrderStatusTag = computed(() => getEntryOrderStatusTagType(props.row?.order_status))
const entryRemark = computed(() => {
const remark = props.row?.remark
return remark !== null && remark !== undefined && String(remark).trim() ? String(remark).trim() : ''
})
const entryExpressCode = computed(() => {
const code = props.row?.express_code
return code !== null && code !== undefined && String(code).trim() ? String(code).trim() : ''
})
const entryLogisticsName = computed(() => {
const name = props.row?.logistics_name
return name !== null && name !== undefined && String(name).trim() ? String(name).trim() : ''
})
const entryPurchaseOrderCode = computed(() => {
const code = props.row?.purchase_order_code
return code !== null && code !== undefined && String(code).trim() ? String(code).trim() : ''
})
const entryTotalQuantity = computed(() => {
// 1) 优先:接口在 entryOrder 外层返回的 total_quantity
if (entryTotalQuantityRaw.value !== null && entryTotalQuantityRaw.value !== undefined) {
@ -373,6 +369,21 @@ const canSubmitBind = computed(
!receivingListLoading.value
)
/** 页脚提示:随选择与对照结果变化 */
const bindHintText = computed(() => {
if (!entryStoreId.value) return '当前入库单缺少货主信息'
if (!selectedReceivingRows.value.length) return '请选择需要绑定的收货单'
if (compareLoading.value) return '正在对照商品…'
return isEntryFullyCovered.value ? '已覆盖当前入库单全部商品' : '部分入库商品尚未匹配到收货商品'
})
const hintWarning = computed(
() =>
selectedReceivingRows.value.length > 0 &&
!isEntryFullyCovered.value &&
!compareLoading.value
)
function isApiSuccess(res: { code?: number; flag?: string } | null | undefined): boolean {
if (!res) return false
if (res.code === 200 || res.code === 1) return true
@ -856,86 +867,232 @@ watch(
</script>
<style scoped lang="scss">
.bind-dialog-content {
/* 面板结构 / 尺寸对齐「批量导入商品」(storage/receiving Product.vue) */
.task-panel {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
height: min(680px, calc(100vh - 96px));
background: #fff;
color: #303133;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 16px 8px;
flex-shrink: 0;
}
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 6px 16px 0;
display: flex;
flex-direction: column;
gap: 10px;
overflow: hidden;
}
&__section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
flex-shrink: 0;
}
&__section-title {
font-size: 12px;
line-height: 20px;
color: #606266;
padding-left: 2px;
flex-shrink: 0;
}
&__section-meta {
font-size: 12px;
line-height: 20px;
color: #909399;
}
/* 工具栏:按钮间距 6px,与 OrderToolbarButtonGroup 一致 */
&__toolbar {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
&__toolbar-main {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
min-width: 0;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
&__file-hint {
margin-left: auto;
min-width: 0;
max-width: 45%;
font-size: 12px;
line-height: 20px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__foot {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
padding: 12px 16px 16px;
flex-shrink: 0;
}
&__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&.is-warning {
color: #e6a23c;
}
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
.entry-order-summary {
/* 入库单关键信息:单行标签 + 值(表格式改成紧凑条) */
.entry-summary {
flex-shrink: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 20px;
margin-bottom: 8px;
padding: 6px 10px;
background: #f5f7fa;
gap: 4px 20px;
padding: 6px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
flex-shrink: 0;
background: #fafafa;
font-size: 12px;
line-height: 1.4;
line-height: 20px;
}
.summary-inline {
.entry-summary__item {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.summary-label {
.entry-summary__label {
color: #909399;
white-space: nowrap;
}
.summary-value {
.entry-summary__value {
color: #303133;
word-break: break-all;
}
.summary-inline--remark {
flex-basis: 100%;
}
.summary-value--remark {
max-width: 600px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bind-dialog-body {
/* 左右两栏:对照表 / 收货单列表 */
.bind-layout {
flex: 1;
min-height: 0;
}
.bind-dialog-layout {
display: flex;
gap: 12px;
align-items: stretch;
height: 100%;
min-height: 0;
}
.bind-dialog-center {
flex: 1;
min-width: 0;
min-height: 0;
.bind-column {
display: flex;
flex-direction: column;
padding: 10px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fff;
gap: 6px;
min-width: 0;
min-height: 0;
&--compare {
flex: 1 1 auto;
}
&--receiving {
flex: 0 0 430px;
width: 430px;
max-width: 430px;
}
}
.compare-table {
display: flex;
flex-direction: column;
height: 100%;
flex: 1;
min-height: 0;
border: 1px solid #dcdfe6;
border: 1px solid #ebeef5;
border-radius: 4px;
overflow: hidden;
}
@ -1052,109 +1209,55 @@ watch(
color: #606266;
}
.bind-dialog-right {
flex: 0 0 380px;
width: 380px;
max-width: 380px;
min-height: 0;
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px;
border: 1px solid #ebeef5;
border-left: 2px solid #dcdfe6;
border-radius: 4px;
background: #fff;
}
.panel-title {
font-size: 13px;
font-weight: 600;
color: #303133;
line-height: 1.4;
flex-shrink: 0;
}
.receiving-toolbar {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
flex-wrap: wrap;
flex-shrink: 0;
}
.toolbar-meta {
font-size: 12px;
color: #909399;
white-space: nowrap;
}
.receiving-table-wrap {
.bind-table-wrap {
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
border: 1px solid #dcdfe6;
min-width: 0;
border-radius: 4px;
overflow: hidden;
}
.entry-bind-receiving-table {
:deep(.el-table__header th.el-table__cell) {
border-right: 1px solid #ebeef5;
border-bottom: 1px solid #dcdfe6;
background: #f5f7fa;
}
:deep(.el-table__body td.el-table__cell) {
border-right: 1px solid #ebeef5;
}
:deep(.el-table__border-left-patch) {
border-bottom: 1px solid #dcdfe6;
}
}
.receiving-pagination {
display: flex;
justify-content: flex-end;
flex-shrink: 0;
padding-top: 2px;
/* 页脚分页:与按钮同行,尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
.bind-pagination {
flex: none;
margin-right: 4px;
:deep(.el-pagination) {
flex-wrap: wrap;
justify-content: flex-end;
--el-pagination-button-width: 28px;
--el-pagination-button-height: 28px;
}
:deep(.el-pagination__total),
:deep(.el-pagination__sizes) {
display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
}
:deep(.el-input__wrapper) {
padding: 0 4px;
}
}
</style>
<style lang="scss">
/*
* 弹窗自带居中(position: fixed + translate)。
* 原来靠 `.el-overlay-dialog:has(> .el-dialog.entry-bind-dialog){display:flex;align-items:center;justify-content:center}` 居中,
* 但下面同时给弹窗写了 `margin: 0`(覆盖了 EP 的 `.el-dialog.is-align-center{margin:auto}`),
* 于是不支持 :has() 的内核(Chrome<105 / Safari<15.4 / Firefox<121 / 老版国产浏览器)里弹窗会贴到左上角。
* 改成弹窗自己定位后任何浏览器都居中,:has() 规则已删除。
*/
.el-overlay-dialog > .el-dialog.entry-bind-dialog {
width: 1200px !important;
height: 596px;
max-height: 596px;
margin: 0;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
box-sizing: border-box;
/* el-dialog 会被 append 到 body:面板自带页头 / 页脚,去掉默认头 / 内边距 */
.el-dialog.entry-bind-dialog {
padding: 0;
overflow: hidden;
}
.el-overlay-dialog > .el-dialog.entry-bind-dialog .el-dialog__body {
flex: 1;
min-height: 0;
overflow: hidden;
.el-dialog__header,
.el-dialog__footer {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -1,8 +1,10 @@
<template>
<el-dialog
v-model="visible"
:title="isBatchMode ? '批量导入入库' : '导入入库'"
:width="isBatchMode ? '980px' : '520px'"
:class="{ 'direct-inbound-batch-dialog': isBatchMode }"
:title="isBatchMode ? undefined : '导入入库'"
:width="isBatchMode ? 'min(1080px, 96vw)' : '520px'"
:show-close="!isBatchMode"
align-center
append-to-body
destroy-on-close
@ -90,113 +92,141 @@
</el-form>
</template>
<template v-else-if="isBatchMode">
<div class="batch-import-panel">
<el-alert
type="info"
:closable="false"
show-icon
title="请上传与入库明细表格字段一致的 Excel 文件,至少填写「SKU」和「入库数量」(或「实收数量」)。解析后可在下方表格中手动修改。"
class="batch-tip"
/>
<!-- 批量导入:面板结构 / 尺寸对齐 storage/receiving「批量导入商品」 -->
<div v-else-if="isBatchMode" class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>批量导入入库</h2>
<p>上传与入库明细字段一致的 Excel,至少填写「SKU」和「入库数量」(或「实收数量」),解析后可在此调整</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="batch-toolbar">
<el-button size="small" @click="handleDownloadTemplate">下载模板</el-button>
<el-upload
accept=".xlsx,.xls"
:auto-upload="false"
:show-file-list="false"
:disabled="submitting || parsing"
@change="handleFileChange"
>
<el-button size="small" type="primary" :loading="parsing">选择 Excel 文件</el-button>
</el-upload>
<span v-if="importFileName" class="file-name">{{ importFileName }}</span>
<div class="task-panel__body">
<div class="task-panel__toolbar">
<div class="task-panel__toolbar-main">
<el-upload
accept=".xlsx,.xls"
:auto-upload="false"
:show-file-list="false"
:disabled="submitting || parsing"
@change="handleFileChange"
>
<el-button size="small" type="primary" :loading="parsing" :disabled="submitting">
选择 Excel 文件
</el-button>
</el-upload>
<el-button size="small" :disabled="submitting" @click="handleDownloadTemplate">下载模板</el-button>
<el-button
size="small"
type="danger"
plain
:disabled="submitting || !parsedRows.length"
@click="resetBatchState"
>
清除数据
</el-button>
</div>
<span class="task-panel__file-hint" :title="importFileName">
已选文件:{{ importFileName || '未选择' }}
</span>
</div>
<el-table
v-if="parsedRows.length"
:data="pagedParsedRows"
border
size="small"
max-height="360"
>
<el-table-column prop="rowIndex" label="Excel行" width="72" align="center" />
<el-table-column prop="stock_id" label="SKU" width="90" align="right" />
<el-table-column prop="warehouse_item_code" label="商品编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="warehouse_item_name" label="商品名称" min-width="140" show-overflow-tooltip />
<el-table-column prop="remaining_quantity" label="剩余可入" width="82" align="right" />
<el-table-column label="入库数量" width="120" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.quantity"
:min="1"
:max="getBatchRowMaxQuantity(row)"
:precision="0"
size="small"
controls-position="right"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column label="入库方式" width="110" align="center">
<template #default="{ row }">
<el-select v-model="row.inbound_type" size="small" style="width: 100%">
<el-option
v-for="opt in directInboundInboundTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
<div class="task-panel__section">
<div class="batch-import-table">
<UpperTable
:data="pagedParsedRows"
row-key="rowIndex"
:show-selection="false"
:show-pagination="false"
default-align="center"
empty-text="请先选择 Excel 文件"
:pagination="{
currentPage: parsedPage,
pageSize: parsedPageSize,
total: parsedRows.length,
}"
:columns="batchImportColumns"
>
<template #column-quantity="{ row }">
<el-input-number
v-model="row.quantity"
:min="1"
:max="getBatchRowMaxQuantity(row)"
:precision="0"
size="small"
controls-position="right"
style="width: 100%"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="库位ID" width="168">
<template #default="{ row }">
<div class="batch-cell-action">
<span class="space-keyword-text">{{ row.space_keyword || '--' }}</span>
<el-button type="primary" link size="small" @click="openBatchRowSpacePicker(row)">
选择库位
</template>
<template #column-inbound_type="{ row }">
<el-select v-model="row.inbound_type" size="small" style="width: 100%">
<el-option
v-for="opt in directInboundInboundTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</template>
<template #column-space_keyword="{ row }">
<div class="batch-cell-action">
<span class="space-keyword-text">{{ row.space_keyword || '--' }}</span>
<el-button type="primary" link size="small" @click="openBatchRowSpacePicker(row)">
选择库位
</el-button>
</div>
</template>
<template #column-remark="{ row }">
<el-input v-model="row.remark" size="small" placeholder="可选" clearable />
</template>
<template #column-operation="{ row }">
<el-button type="danger" link size="small" @click="removeParsedRow(row)">
删除
</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="备注" min-width="120">
<template #default="{ row }">
<el-input v-model="row.remark" size="small" placeholder="可选" clearable />
</template>
</el-table-column>
<el-table-column label="操作" width="64" align="center" fixed="right">
<template #default="{ row }">
<el-button link type="danger" size="small" @click="removeParsedRow(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="display:flex;justify-content:flex-end;padding:8px 4px 0;">
<el-pagination
v-model:current-page="parsedPage"
:page-size="parsedPageSize"
:total="parsedRows.length"
:page-sizes="[50, 100, 200, 500, 1000]"
layout="total, sizes, prev, pager, next, jumper"
small
background
/>
</template>
</UpperTable>
</div>
</div>
</div>
</template>
<footer class="task-panel__foot">
<div class="task-panel__actions">
<el-pagination
v-model:current-page="parsedPage"
v-model:page-size="parsedPageSize"
:page-sizes="[50, 100, 200, 500, 1000]"
:total="parsedRows.length"
layout="total, sizes, prev, pager, next"
background
size="small"
class="batch-import-pagination"
/>
<el-button size="small" :disabled="submitting" @click="visible = false">取消</el-button>
<el-button
size="small"
type="primary"
:loading="submitting"
:disabled="!parsedRows.length"
@click="handleSubmit"
>
确认导入
</el-button>
</div>
</footer>
</div>
<template #footer>
<el-button size="small" :disabled="submitting" @click="visible = false">取消</el-button>
<el-button
size="small"
type="primary"
:loading="submitting"
:disabled="isBatchMode && !parsedRows.length"
@click="handleSubmit"
>
确认导入
</el-button>
<template v-if="!isBatchMode">
<el-button size="small" :disabled="submitting" @click="visible = false">取消</el-button>
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">
确认导入
</el-button>
</template>
</template>
</el-dialog>
@ -229,6 +259,8 @@
:loading="spaceLoading"
:show-selection="true"
:multiple-selection="spaceSelection"
:show-pagination="false"
default-align="center"
:pagination="{
currentPage: spacePagination.page,
pageSize: spacePagination.pageSize,
@ -242,14 +274,26 @@
]"
@selection-change="handleSpaceSelectionChange"
@row-click="handleSpaceRowClick"
@page-change="querySpaces"
@page-size-change="onSpacePageSizeChange"
/>
</div>
</div>
<template #footer>
<el-button size="small" @click="spacePickerVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="applySelectedSpace">使用选中库位</el-button>
<div class="picker-footer">
<el-pagination
v-model:current-page="spacePagination.page"
v-model:page-size="spacePagination.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="spacePagination.total"
layout="total, sizes, prev, pager, next"
background
size="small"
class="space-picker-pagination"
@current-change="onSpacePageChange"
@size-change="onSpacePageSizeChange"
/>
<el-button size="small" @click="spacePickerVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="applySelectedSpace">使用选中库位</el-button>
</div>
</template>
</el-dialog>
</template>
@ -313,6 +357,20 @@ const pagedParsedRows = computed(() => {
return parsedRows.value.slice(start, start + parsedPageSize.value)
})
/** 批量导入预览列:结构 / 尺寸对齐 storage/receiving「批量导入商品」 */
const batchImportColumns = [
{ prop: 'rowIndex', label: 'Excel行', width: '80' },
{ prop: 'stock_id', label: 'SKU', width: '110' },
{ prop: 'warehouse_item_code', label: '商品编码', minWidth: '150' },
{ prop: 'warehouse_item_name', label: '商品名称', minWidth: '170' },
{ prop: 'remaining_quantity', label: '剩余可入', width: '90' },
{ prop: 'quantity', label: '入库数量', width: '120' },
{ prop: 'inbound_type', label: '入库方式', width: '110' },
{ prop: 'space_keyword', label: '库位', width: '190' },
{ prop: 'remark', label: '备注', minWidth: '150' },
{ prop: 'operation', label: '操作', width: '70', fixed: 'right' },
]
const singleForm = reactive({
quantity: 1,
inbound_type: 'import' as 'import' | 'pda',
@ -521,6 +579,10 @@ function onSpacePageSizeChange(size: number) {
void querySpaces(1)
}
function onSpacePageChange(page: number) {
void querySpaces(page)
}
async function querySpaces(page = 1) {
spaceLoading.value = true
try {
@ -785,31 +847,180 @@ async function handleSubmit() {
}
}
.batch-import-panel {
.batch-tip {
margin-bottom: 12px;
/* 批量导入入库面板:结构 / 尺寸对齐 storage/receiving「批量导入商品」 */
.task-panel {
display: flex;
flex-direction: column;
max-height: calc(100vh - 96px);
background: #fff;
color: #303133;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 16px 8px;
flex-shrink: 0;
}
.batch-toolbar {
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 6px 16px 0;
display: flex;
flex-direction: column;
overflow-y: auto;
}
/* 工具栏:按钮间距 6px,与 OrderToolbarButtonGroup 一致 */
&__toolbar {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
&__toolbar-main {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
min-width: 0;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
&__file-hint {
margin-left: auto;
min-width: 0;
max-width: 40%;
font-size: 12px;
line-height: 20px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__section {
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 10px;
flex-shrink: 0;
}
&__foot {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
padding: 12px 16px 16px;
flex-shrink: 0;
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
/* 表格固定高度:数据少也保持同样大小,超出容器时表格内部滚动(短屏自适应) */
.batch-import-table {
height: min(450px, calc(100vh - 280px));
border-radius: 4px;
overflow: hidden;
}
/* 分页位于页脚按钮左侧;尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
.batch-import-pagination,
.space-picker-pagination {
flex: none;
margin-right: 4px;
:deep(.el-pagination) {
flex-wrap: wrap;
justify-content: flex-end;
--el-pagination-button-width: 28px;
--el-pagination-button-height: 28px;
}
.file-name {
font-size: 12px;
color: #606266;
:deep(.el-pagination__total),
:deep(.el-pagination__sizes) {
display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
}
:deep(.el-input__wrapper) {
padding: 0 4px;
}
}
.batch-cell-action {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
min-width: 0;
.space-keyword-text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
@ -833,4 +1044,34 @@ async function handleSubmit() {
.picker-table-wrap {
height: 440px;
}
/* 选择系统库位:分页与按钮同行(对齐「批量导入商品」页脚) */
.picker-footer {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:批量面板自带页头 / 页脚,去掉默认头 / 内边距 */
.el-dialog.direct-inbound-batch-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header,
.el-dialog__footer {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -1,62 +1,69 @@
<template>
<el-dialog
v-model="visible"
title="解除收货单绑定"
width="780px"
class="entry-unbind-dialog"
width="min(760px, 96vw)"
align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@closed="handleClosed"
>
<div class="unbind-content">
<!-- 入库单摘要(对应接口入参 entry_order_id 的主表信息) -->
<div v-if="entryOrderCode" class="entry-order-summary">
<span class="summary-inline">
<span class="summary-label">入库单号</span>
<span class="summary-value">{{ entryOrderCode }}</span>
</span>
<span v-if="entryOrderId" class="summary-inline">
<span class="summary-label">入库单ID</span>
<span class="summary-value">{{ entryOrderId }}</span>
</span>
<span v-if="entryStoreName" class="summary-inline">
<span class="summary-label">货主</span>
<span class="summary-value">{{ entryStoreName }}</span>
</span>
<span v-if="entryOrderStatusLabel" class="summary-inline">
<span class="summary-label">订单状态</span>
<el-tag size="small" :type="entryOrderStatusTag">{{ entryOrderStatusLabel }}</el-tag>
</span>
</div>
<!-- 面板结构对齐「批量导入商品」/「货单绑定到入库单」等 task-panel 弹窗 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>解除收货单绑定</h2>
<p>解除所选收货单与本入库单的关联,并按数量台账回滚其已入库进度</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<el-alert type="warning" :closable="false" show-icon class="unbind-tip">
<template #title>
解除绑定将释放所选收货单与本入库单的主表关联,并按数量台账<b>回滚其已入库进度</b>;仅「已创建 / 待入库」状态的入库单可解绑。
</template>
</el-alert>
<div class="task-panel__body">
<!-- 入库单关键信息:单行展示 -->
<div class="entry-summary">
<span class="entry-summary__item">
<span class="entry-summary__label">入库单号</span>
<span class="entry-summary__value">{{ entryOrderCode || '—' }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">货主</span>
<span class="entry-summary__value">{{ entryStoreName || '—' }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">状态</span>
<el-tag v-if="entryOrderStatusLabel" size="small" :type="entryOrderStatusTag">
{{ entryOrderStatusLabel }}
</el-tag>
<span v-else class="entry-summary__value">—</span>
</span>
</div>
<!-- 表单:入参 entry_order_id(只读) + receiving_ids(勾选收货单) -->
<el-form :model="form" label-width="120px" size="small" class="unbind-form">
<el-form-item label="入库单ID">
<el-input
:model-value="form.entry_order_id ? String(form.entry_order_id) : '—'"
disabled
placeholder="--"
/>
</el-form-item>
<p class="task-panel__form-tip">
仅「已创建 / 待入库」状态的入库单可解绑;解绑后不可撤销,请谨慎操作。
</p>
<el-form-item
:label="'待解绑收货单' + (selectedRows.length ? `(${selectedRows.length})` : '')"
>
<div v-loading="bindingsLoading" class="receiving-table-wrap">
<div class="task-panel__section">
<!-- <div class="task-panel__section-head">
<span class="task-panel__section-title">已绑定收货单</span>
<span class="task-panel__section-meta">
已选 {{ selectedRows.length }} 条 · 共 {{ bindingRows.length }} 条
</span>
</div> -->
<div v-loading="bindingsLoading" class="unbind-table-wrap">
<el-table
ref="receivingTableRef"
:data="bindingRows"
border
stripe
size="small"
max-height="240"
height="260"
row-key="rowKey"
empty-text="该入库单暂无可解绑的收货单"
:row-class-name="receivingRowClassName"
@ -83,61 +90,63 @@
</el-table-column>
</el-table>
</div>
<div class="form-item-tip">
勾选已绑定的收货单,确认后将调用接口解除绑定并回滚入库进度。
</div>
</el-form-item>
</el-form>
</div>
<!-- 解绑结果明细(存在失败或部分成功时展示) -->
<div v-if="resultVisible" class="unbind-result">
<div
class="result-summary"
:class="resultSummaryClass"
>
{{ resultSummaryText }}
</div>
<div v-if="resultFailedRows.length" class="result-block">
<div class="result-block-title result-block-title--danger">失败明细({{ resultFailedRows.length }})</div>
<div v-for="item in resultFailedRows" :key="'f-' + item.receiving_id" class="result-row">
<span class="result-receiving">{{ item.receiving_number || ('收货单#' + item.receiving_id) }}</span>
<el-tag size="small" type="danger">{{ item.error_code_label }}</el-tag>
<span class="result-message">{{ item.message || '解绑失败' }}</span>
<!-- 解绑结果明细(存在失败或部分成功时展示) -->
<div v-if="resultVisible" class="unbind-result">
<div class="result-summary" :class="resultSummaryClass">
{{ resultSummaryText }}
</div>
</div>
<div v-if="resultSuccessRows.length" class="result-block">
<div class="result-block-title result-block-title--success">成功明细({{ resultSuccessRows.length }})</div>
<div v-for="item in resultSuccessRows" :key="'s-' + item.receiving_id" class="result-row">
<span class="result-receiving">{{ item.receiving_number || ('收货单#' + item.receiving_id) }}</span>
<el-tag size="small" type="success">已解绑</el-tag>
<span class="result-message">
释放明细 {{ item.released_detail_count ?? 0 }} 条,回滚入库 {{ formatRollback(item.rolled_back_quantity) }}
</span>
<div v-if="resultFailedRows.length" class="result-block">
<div class="result-block-title result-block-title--danger">
失败明细({{ resultFailedRows.length }})
</div>
<div v-for="item in resultFailedRows" :key="'f-' + item.receiving_id" class="result-row">
<span class="result-receiving">{{ item.receiving_number || ('收货单#' + item.receiving_id) }}</span>
<el-tag size="small" type="danger">{{ item.error_code_label }}</el-tag>
<span class="result-message">{{ item.message || '解绑失败' }}</span>
</div>
</div>
<div v-if="resultSuccessRows.length" class="result-block">
<div class="result-block-title result-block-title--success">
成功明细({{ resultSuccessRows.length }})
</div>
<div v-for="item in resultSuccessRows" :key="'s-' + item.receiving_id" class="result-row">
<span class="result-receiving">{{ item.receiving_number || ('收货单#' + item.receiving_id) }}</span>
<el-tag size="small" type="success">已解绑</el-tag>
<span class="result-message">
释放明细 {{ item.released_detail_count ?? 0 }} 条,回滚入库
{{ formatRollback(item.rolled_back_quantity) }}
</span>
</div>
</div>
</div>
</div>
</div>
<template #footer>
<el-button size="small" :disabled="unbindSubmitting" @click="visible = false">
{{ resultVisible ? '关闭' : '取消' }}
</el-button>
<el-button
v-if="!resultVisible"
size="small"
type="danger"
:loading="unbindSubmitting"
:disabled="!canSubmitUnbind"
@click="handleUnbindSubmit"
>
确认解绑
</el-button>
</template>
<footer class="task-panel__foot">
<span class="task-panel__hint" :class="{ 'is-warning': hintWarning }">{{ unbindHintText }}</span>
<div class="task-panel__actions">
<el-button size="small" :disabled="unbindSubmitting" @click="visible = false">
{{ resultVisible ? '关闭' : '取消' }}
</el-button>
<el-button
v-if="!resultVisible"
size="small"
type="danger"
:loading="unbindSubmitting"
:disabled="!canSubmitUnbind"
@click="handleUnbindSubmit"
>
确认解绑
</el-button>
</div>
</footer>
</div>
</el-dialog>
</template>
<script setup lang="ts">
import { computed, nextTick, reactive, ref, watch } from 'vue'
import { computed, nextTick, ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { TableInstance } from 'element-plus'
import { getEntryDetail, unbindReceiving } from '@/api/storage.entry/entry'
@ -210,8 +219,6 @@ const visible = computed({
set: (value: boolean) => emit('update:modelValue', value),
})
const form = reactive<{ entry_order_id?: number | null }>({ entry_order_id: null })
const receivingTableRef = ref<TableInstance | null>(null)
const bindingsLoading = ref(false)
const unbindSubmitting = ref(false)
@ -256,6 +263,18 @@ const canSubmitUnbind = computed(
() => !!entryOrderId.value && selectedRows.value.length > 0 && !unbindSubmitting.value && !bindingsLoading.value
)
/** 页脚提示:随选择 / 结果状态变化 */
const unbindHintText = computed(() => {
if (resultVisible.value) return '请查看上方处理结果'
if (!bindingRows.value.length) return '该入库单暂无可解绑的收货单'
if (!selectedRows.value.length) return '请勾选需要解绑的收货单'
return '确认后将回滚所选收货单的入库进度'
})
const hintWarning = computed(
() => !resultVisible.value && selectedRows.value.length > 0
)
const resultSummaryText = computed(() => {
return `处理完成:成功解绑 ${resultSuccessRows.value.length} 条,失败 ${resultFailedRows.value.length} 条`
})
@ -364,7 +383,6 @@ function handleClosed() {
resultSuccessRows.value = []
resultFailedRows.value = []
unbindSubmitting.value = false
form.entry_order_id = null
emit('closed')
}
@ -479,81 +497,196 @@ watch(
() => [props.modelValue, props.row?.id, props.row?.order_status] as const,
([open]) => {
if (!open) return
form.entry_order_id = entryOrderId.value
void loadBoundReceivings()
}
)
</script>
<style scoped lang="scss">
.unbind-content {
/* 面板结构 / 尺寸对齐「批量导入商品」(storage/receiving Product.vue) */
.task-panel {
display: flex;
flex-direction: column;
gap: 10px;
max-height: calc(100vh - 96px);
background: #fff;
color: #303133;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 16px 8px;
flex-shrink: 0;
}
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 6px 16px 0;
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
}
&__form-tip {
margin: 0;
padding: 8px 12px;
border-radius: 4px;
background: #f4f4f5;
font-size: 12px;
line-height: 18px;
color: #909399;
flex-shrink: 0;
}
&__section {
display: flex;
flex-direction: column;
gap: 6px;
flex-shrink: 0;
}
&__section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
&__section-title {
font-size: 12px;
line-height: 20px;
color: #606266;
padding-left: 2px;
flex-shrink: 0;
}
&__section-meta {
font-size: 12px;
line-height: 20px;
color: #909399;
}
&__foot {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
padding: 12px 16px 16px;
flex-shrink: 0;
}
&__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&.is-warning {
color: #e6a23c;
}
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
.entry-order-summary {
/* 入库单关键信息:单行标签 + 值 */
.entry-summary {
flex-shrink: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 20px;
padding: 6px 10px;
background: #f5f7fa;
gap: 4px 20px;
padding: 6px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fafafa;
font-size: 12px;
line-height: 1.4;
line-height: 20px;
}
.summary-inline {
.entry-summary__item {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.summary-label {
.entry-summary__label {
color: #909399;
white-space: nowrap;
}
.summary-value {
.entry-summary__value {
color: #303133;
word-break: break-all;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.unbind-tip {
:deep(.el-alert__title) {
font-size: 12px;
line-height: 1.5;
}
b {
color: #e6a23c;
}
}
.unbind-form {
padding-top: 2px;
:deep(.el-form-item__label) {
font-weight: 500;
}
}
.receiving-table-wrap {
width: 100%;
border: 1px solid #dcdfe6;
.unbind-table-wrap {
min-width: 0;
border-radius: 4px;
overflow: hidden;
}
.form-item-tip {
margin-top: 4px;
font-size: 12px;
color: #909399;
line-height: 1.5;
}
.unbind-result {
display: flex;
flex-direction: column;
@ -628,3 +761,20 @@ watch(
pointer-events: none;
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:面板自带页头 / 页脚,去掉默认头 / 内边距 */
.el-dialog.entry-unbind-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header,
.el-dialog__footer {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -1,77 +1,146 @@
<template>
<el-dialog
v-model="visible"
title="库位商品查询"
width="1000px"
class="space-stock-dialog"
width="min(1000px, 96vw)"
align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@closed="handleClosed"
>
<div class="space-stock-toolbar">
<el-autocomplete
v-model="keyword"
class="space-keyword"
size="small"
clearable
value-key="label"
:trigger-on-focus="false"
:fetch-suggestions="fetchSpaceSuggestions"
placeholder="扫码/输入库位编码、名称或库位ID"
@select="handleSpaceSelect"
@keyup.enter="handleQuery"
/>
<el-button size="small" type="primary" :loading="loading" @click="handleQuery">查询</el-button>
<el-button size="small" :loading="loading" :disabled="!currentSpaceId" @click="loadBySpaceId(currentSpaceId as number)">
刷新
</el-button>
</div>
<!-- 面板结构对齐「批量导入商品」/「货单绑定到入库单」等 task-panel 弹窗 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>库位商品查询</h2>
<p>扫码或输入库位编码 / 名称 / 库位ID,查看该库位下的有量库存</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="space-meta">
<el-descriptions :column="4" size="small" border>
<el-descriptions-item label="库位ID">{{ formatInventoryOptionalText(spaceInfo?.id) }}</el-descriptions-item>
<el-descriptions-item label="库位编码">{{ formatInventoryOptionalText(spaceInfo?.space_code) }}</el-descriptions-item>
<el-descriptions-item label="库位名称">{{ formatInventoryOptionalText(spaceInfo?.custom_name) }}</el-descriptions-item>
<el-descriptions-item label="库位状态">{{ formatInventoryOptionalText(spaceInfo?.space_status) }}</el-descriptions-item>
</el-descriptions>
<div class="space-summary">
<span>商品种类:{{ list.length }}</span>
<span>总数量:{{ summary.quantity }}</span>
<span>可用数量:{{ summary.available }}</span>
<span>锁定数量:{{ summary.locked }}</span>
<span>拦截锁定:{{ summary.intercept }}</span>
<div class="task-panel__body">
<div class="task-panel__toolbar">
<div class="task-panel__toolbar-main">
<!-- ⚠️ 外层包裹层必须保留:el-autocomplete 根节点自带 `width: var(--el-input-width)=100%`,
直接把 width 写在组件 class 上会被它撑满一整行,导致后面的按钮被挤到下一行 -->
<div class="space-keyword">
<el-autocomplete
v-model="keyword"
size="small"
clearable
value-key="label"
:trigger-on-focus="false"
:fetch-suggestions="fetchSpaceSuggestions"
placeholder="扫码/输入库位编码、名称或库位ID"
@select="handleSpaceSelect"
@keyup.enter="handleQuery"
/>
</div>
<el-button size="small" type="primary" :loading="loading" @click="handleQuery">查询</el-button>
<el-button
size="small"
:loading="loading"
:disabled="!currentSpaceId"
@click="loadBySpaceId(currentSpaceId as number)"
>
刷新
</el-button>
</div>
</div>
<!-- 库位关键信息:单行展示 -->
<div class="entry-summary">
<span class="entry-summary__item">
<span class="entry-summary__label">库位ID</span>
<span class="entry-summary__value">{{ formatInventoryOptionalText(spaceInfo?.id) }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">库位编码</span>
<span class="entry-summary__value">{{ formatInventoryOptionalText(spaceInfo?.space_code) }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">库位名称</span>
<span class="entry-summary__value">{{ formatInventoryOptionalText(spaceInfo?.custom_name) }}</span>
</span>
<span class="entry-summary__item">
<span class="entry-summary__label">库位状态</span>
<span class="entry-summary__value">{{ formatInventoryOptionalText(spaceInfo?.space_status) }}</span>
</span>
</div>
<div class="space-summary">
<span class="space-summary__item"><span>商品种类</span><strong>{{ list.length }}</strong></span>
<span class="space-summary__item"><span>总数量</span><strong>{{ summary.quantity }}</strong></span>
<span class="space-summary__item"><span>可用数量</span><strong>{{ summary.available }}</strong></span>
<span class="space-summary__item"><span>锁定数量</span><strong>{{ summary.locked }}</strong></span>
<span class="space-summary__item"><span>拦截锁定</span><strong>{{ summary.intercept }}</strong></span>
</div>
<div class="task-panel__section">
<!-- <div class="task-panel__section-head">
<span class="task-panel__section-title">库存明细</span>
<span class="task-panel__section-meta">共 {{ list.length }} 条</span>
</div> -->
<div ref="tableHostRef" class="space-stock-table">
<el-table
ref="tableRef"
:data="pagedList"
border
stripe
size="small"
:height="tableHeight"
v-loading="loading"
empty-text="该库位暂无有量库存"
>
<el-table-column
v-for="col in spaceStockColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:formatter="(row: any) => formatCell(col.prop, row)"
show-overflow-tooltip
/>
</el-table>
</div>
</div>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">{{ spaceHintText }}</span>
<div class="task-panel__actions">
<el-pagination
v-model:current-page="pagination.currentPage"
v-model:page-size="pagination.pageSize"
:page-sizes="[20, 50, 100, 200]"
:total="pagination.total"
:disabled="loading"
background
size="small"
layout="total, sizes, prev, pager, next"
class="space-stock-pagination"
@current-change="handlePageChange"
@size-change="handlePageSizeChange"
/>
<el-button size="small" @click="visible = false">关闭</el-button>
</div>
</footer>
</div>
<el-table
:data="list"
border
stripe
size="small"
height="360"
v-loading="loading"
empty-text="该库位暂无有量库存"
>
<el-table-column
v-for="col in spaceStockColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:formatter="(row: any) => formatCell(col.prop, row)"
show-overflow-tooltip
/>
</el-table>
<template #footer>
<el-button size="small" @click="visible = false">关闭</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue'
import { computed, nextTick, reactive, ref, watch } from 'vue'
import { useResizeObserver } from '@vueuse/core'
import { ElMessage } from 'element-plus'
import type { TableInstance } from 'element-plus'
import * as inventoryApi from '@/api/storage.inventory/inventory'
import * as indexApi from '@/api/index/index'
import {
@ -98,6 +167,55 @@ const spaceOptions = ref<Array<Record<string, any>>>([])
/** el-autocomplete 选中后紧接的 Enter 不再重复按关键字解析 */
let skipNextEnter = false
const tableRef = ref<TableInstance | null>(null)
const tableHostRef = ref<HTMLElement | null>(null)
const tableHeight = ref(360)
/** 前端分页(接口不分页,一次性返回该库位全部有量库存) */
const pagination = reactive({
currentPage: 1,
pageSize: 20,
total: 0
})
const pagedList = computed(() => {
const start = (pagination.currentPage - 1) * pagination.pageSize
return list.value.slice(start, start + pagination.pageSize)
})
/** 数据量 / 每页条数变化后,同步总数并把当前页收敛到有效范围 */
watch(
[() => list.value.length, () => pagination.pageSize],
() => {
pagination.total = list.value.length
const maxPage = Math.max(1, Math.ceil(list.value.length / pagination.pageSize))
if (pagination.currentPage > maxPage) pagination.currentPage = maxPage
}
)
function syncTableHeight() {
const el = tableHostRef.value
if (!el) return
const height = el.getBoundingClientRect().height
if (height >= 120) tableHeight.value = Math.floor(height)
}
useResizeObserver(tableHostRef, (entries) => {
const height = entries[0]?.contentRect.height ?? 0
if (height >= 120) tableHeight.value = Math.floor(height)
})
function handlePageChange(page: number) {
pagination.currentPage = page
void nextTick(() => tableRef.value?.setScrollTop(0))
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
void nextTick(() => tableRef.value?.setScrollTop(0))
}
const summary = reactive({
quantity: 0,
available: 0,
@ -105,6 +223,13 @@ const summary = reactive({
intercept: 0
})
/** 页脚提示:随当前库位与查询结果变化 */
const spaceHintText = computed(() => {
if (!currentSpaceId.value) return '请扫码或输入库位后查询'
if (loading.value) return '正在查询库存…'
return list.value.length ? `当前库位共 ${list.value.length} 种商品有库存` : '当前库位暂无有量库存'
})
/** 单行取值:条码走统一格式化,其余空值统一显示 -- */
function formatCell(prop: string, row: any): string {
if (row === null || row === undefined) return '--'
@ -226,6 +351,8 @@ async function loadBySpaceId(spaceId: number) {
summary.locked += Number(row.locked_quantity || 0)
summary.intercept += Number(row.intercept_locked_quantity || 0)
})
// 新库位的库存从第一页开始看
pagination.currentPage = 1
} else {
list.value = []
resetSummary()
@ -251,6 +378,9 @@ function handleClosed() {
list.value = []
spaceInfo.value = null
currentSpaceId.value = null
pagination.currentPage = 1
pagination.pageSize = 20
pagination.total = 0
resetSummary()
}
@ -273,30 +403,297 @@ watch(
},
{ immediate: true }
)
// 弹窗打开后等待布局完成再测一次表格高度(destroy-on-close 会重建 DOM)
watch(
visible,
(opened) => {
if (!opened) return
void nextTick(() => {
requestAnimationFrame(syncTableHeight)
})
}
)
</script>
<style scoped lang="scss">
.space-stock-toolbar {
/* 面板结构 / 尺寸对齐「批量导入商品」(storage/receiving Product.vue) */
.task-panel {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
flex-direction: column;
height: min(680px, calc(100vh - 96px));
background: #fff;
color: #303133;
.space-keyword {
width: 340px;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 16px 8px;
flex-shrink: 0;
}
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 6px 16px 0;
display: flex;
flex-direction: column;
gap: 10px;
overflow: hidden;
}
/* 工具栏:按钮间距 6px,与 OrderToolbarButtonGroup 一致 */
&__toolbar {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
&__toolbar-main {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
min-width: 0;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
&__section {
display: flex;
flex-direction: column;
gap: 6px;
flex: 1;
min-height: 0;
}
&__section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
&__section-title {
font-size: 12px;
line-height: 20px;
color: #606266;
padding-left: 2px;
flex-shrink: 0;
}
&__section-meta {
font-size: 12px;
line-height: 20px;
color: #909399;
}
&__foot {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
padding: 12px 16px 16px;
flex-shrink: 0;
}
&__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
.space-meta {
margin-bottom: 10px;
/* 库位关键字输入框:固定宽度,禁止被 el-autocomplete 自带的 width:100% 撑满 */
.space-keyword {
flex: 0 0 340px;
width: 340px;
min-width: 0;
.space-summary {
display: flex;
:deep(.el-autocomplete) {
width: 100%;
}
:deep(.el-input) {
width: 100%;
}
}
/* 库位关键信息:单行标签 + 值 */
.entry-summary {
flex-shrink: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px 20px;
padding: 6px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fafafa;
font-size: 12px;
line-height: 20px;
}
.entry-summary__item {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.entry-summary__label {
color: #909399;
white-space: nowrap;
}
.entry-summary__value {
color: #303133;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 库存统计:一行纯文字,不占容器 */
.space-summary {
flex-shrink: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px 20px;
padding-left: 2px;
font-size: 12px;
line-height: 20px;
}
.space-summary__item {
display: inline-flex;
align-items: center;
gap: 6px;
span {
color: #909399;
}
strong {
font-size: 13px;
font-weight: 500;
color: #303133;
}
}
.space-stock-table {
flex: 1;
min-height: 0;
min-width: 0;
border-radius: 4px;
overflow: hidden;
}
/* 页脚分页:与按钮同行,尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
.space-stock-pagination {
flex: none;
margin-right: 4px;
:deep(.el-pagination) {
flex-wrap: wrap;
gap: 16px;
margin-top: 8px;
font-size: 12px;
color: #606266;
justify-content: flex-end;
--el-pagination-button-width: 28px;
--el-pagination-button-height: 28px;
}
:deep(.el-pagination__total),
:deep(.el-pagination__sizes) {
display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
}
:deep(.el-input__wrapper) {
padding: 0 4px;
}
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:面板自带页头 / 页脚,去掉默认头 / 内边距 */
.el-dialog.space-stock-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header,
.el-dialog__footer {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -88,125 +88,210 @@
</div>
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="480px"
class="transfer-dialog"
width="min(560px, 92vw)"
align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@closed="resetTransferDialog"
>
<p v-if="transferMode === 'location'" class="transfer-hint">
单条 wms_storage 记录移库;移库数量不填则全量移库。
</p>
<p v-else-if="transferMode === 'product'" class="transfer-hint">
按原库位 + 商品合并移库,自动合并该库位下该商品的所有库存;不适用于开启批次管理且多批次的商品。
</p>
<div class="transfer-form">
<el-input v-model="targetSpace" placeholder="目标库位编码或 ID,扫码或输入" clearable />
<div class="target-space-tip">
<span v-if="spaceName">目标库位名称: {{ spaceName }}</span>
<span v-else-if="targetSpace && targetSpaceError" class="target-space-error">未找到库位</span>
<!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>{{ dialogTitle }}</h2>
<p>{{ transferSubtitle }}</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="dialogVisible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="task-panel__body">
<div class="task-panel__form">
<div class="task-panel__field">
<span class="task-panel__field-label">商品</span>
<strong class="task-panel__field-value">{{ transferItemLabel }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">原库位</span>
<strong class="task-panel__field-value">{{ transferFromSpaceLabel }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">可移数量</span>
<strong class="task-panel__field-value">{{ transferAvailableLabel }}</strong>
</div>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">目标库位</span>
<el-input v-model="targetSpace" placeholder="目标库位编码或 ID,扫码或输入" clearable />
</div>
<div class="task-panel__field task-panel__field--plain">
<span class="task-panel__field-label">库位名称</span>
<strong
class="task-panel__field-value"
:class="{ 'is-danger': transferTargetSpaceInvalid }"
>
{{ transferTargetSpaceLabel }}
</strong>
</div>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">移库数量</span>
<el-input-number
v-model="transferQty"
:min="1"
:placeholder="transferMode === 'product' ? '必填' : '不填则全量移库'"
controls-position="right"
style="width: 100%"
/>
</div>
</div>
<p class="task-panel__form-tip">{{ transferTipText }}</p>
</div>
<el-input-number
v-model="transferQty"
:min="1"
:placeholder="transferMode === 'product' ? '移库数量(必填)' : '移库数量(不填则全量移库)'"
style="width: 100%;"
/>
<footer class="task-panel__foot">
<span class="task-panel__hint">{{ transferHintText }}</span>
<div class="task-panel__actions">
<el-button size="small" @click="dialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="transferLoading" @click="confirmTransfer">
{{ confirmButtonText }}
</el-button>
</div>
</footer>
</div>
<template #footer>
<el-button size="small" @click="dialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="transferLoading" @click="confirmTransfer">
{{ confirmButtonText }}
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="expiryDialogVisible"
title="维护生产日期 / 到期日期"
width="560px"
class="expiry-dialog"
width="min(560px, 92vw)"
align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@opened="handleExpiryDialogOpened"
@closed="resetExpiryForm"
>
<el-descriptions class="expiry-context" :column="2" size="small" border>
<el-descriptions-item label="库存记录ID">{{ expiryRow?.storage_id ?? '--' }}</el-descriptions-item>
<el-descriptions-item label="批次号">{{ expiryRow?.batch_no || '--' }}</el-descriptions-item>
<el-descriptions-item label="商品">{{ expiryItemLabel }}</el-descriptions-item>
<el-descriptions-item label="库位">{{ expiryRow?.space_code || '--' }}</el-descriptions-item>
</el-descriptions>
<!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>维护生产日期 / 到期日期</h2>
<p>不改动=保持库内原值,改选=下发新日期,清空输入框=下发 null 置空</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="expiryDialogVisible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<p class="expiry-hint">
输入框已回显库内当前日期:不改动=保持原值(不下发);改选日期=下发新日期;点「清空」清空输入框=下发 null 置空。两个日期至少改一项,且生产日期不得晚于到期日期。
</p>
<div class="task-panel__body">
<div class="task-panel__form">
<div class="task-panel__field">
<span class="task-panel__field-label">库存记录ID</span>
<strong class="task-panel__field-value">{{ expiryRow?.storage_id ?? '—' }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">商品</span>
<strong class="task-panel__field-value">{{ expiryItemLabel }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">批次号</span>
<strong class="task-panel__field-value">{{ expiryRow?.batch_no || '—' }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">库位</span>
<strong class="task-panel__field-value">{{ expiryRow?.space_code || '—' }}</strong>
</div>
<el-form label-width="80px" size="small" class="expiry-form">
<el-form-item label="生产日期">
<div class="expiry-field">
<el-date-picker
ref="productionPickerRef"
v-model="expiryForm.productionDate"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="请选择生产日期"
class="expiry-date-picker"
clearable
/>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">生产日期</span>
<el-date-picker
ref="productionPickerRef"
v-model="expiryForm.productionDate"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="请选择生产日期"
class="expiry-date-picker"
clearable
/>
<el-button
size="small"
type="primary"
link
class="expiry-clear-btn"
:disabled="!expiryForm.productionDate"
@click="expiryForm.productionDate = ''"
>
清空
</el-button>
</div>
<div class="task-panel__field task-panel__field--plain">
<span class="task-panel__field-label">库内生产日期</span>
<strong class="task-panel__field-value is-muted">
{{ formatExpiryValue(expiryRow?.production_date) }}
</strong>
</div>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">到期日期</span>
<el-date-picker
ref="expiryPickerRef"
v-model="expiryForm.expiryDate"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="请选择到期日期"
class="expiry-date-picker"
clearable
/>
<el-button
size="small"
type="primary"
link
class="expiry-clear-btn"
:disabled="!expiryForm.expiryDate"
@click="expiryForm.expiryDate = ''"
>
清空
</el-button>
</div>
<div class="task-panel__field task-panel__field--plain">
<span class="task-panel__field-label">库内到期日期</span>
<strong class="task-panel__field-value is-muted">
{{ formatExpiryValue(expiryRow?.expiry_date) }}
</strong>
</div>
</div>
<p class="task-panel__form-tip">
两个日期至少改一项;生产日期不得晚于到期日期;清空输入框将下发 null 置空该字段。
</p>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">{{ expiryHintText }}</span>
<div class="task-panel__actions">
<el-button size="small" @click="expiryDialogVisible = false">取消</el-button>
<el-button
size="small"
type="primary"
link
class="expiry-clear-btn"
:disabled="!expiryForm.productionDate"
@click="expiryForm.productionDate = ''"
:loading="expiryLoading"
:disabled="!hasExpiryChange"
@click="confirmExpiry"
>
清空
确认维护
</el-button>
</div>
</el-form-item>
<el-form-item label="到期日期">
<div class="expiry-field">
<el-date-picker
ref="expiryPickerRef"
v-model="expiryForm.expiryDate"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="请选择到期日期"
class="expiry-date-picker"
clearable
/>
<el-button
size="small"
type="primary"
link
class="expiry-clear-btn"
:disabled="!expiryForm.expiryDate"
@click="expiryForm.expiryDate = ''"
>
清空
</el-button>
</div>
</el-form-item>
</el-form>
<!-- <div class="expiry-preview">
<span class="expiry-preview-label">提交内容</span>
<span class="expiry-preview-text">{{ expiryPayloadPreview }}</span>
</div> -->
<template #footer>
<el-button size="small" @click="expiryDialogVisible = false">取消</el-button>
<el-button
size="small"
type="primary"
:loading="expiryLoading"
:disabled="!hasExpiryChange"
@click="confirmExpiry"
>
确认维护
</el-button>
</template>
</footer>
</div>
</el-dialog>
<div ref="tableWrapRef" class="detail-table-wrap">
<upper-table
@ -437,6 +522,63 @@ const canTransferByProduct = computed(() => {
return true
})
/* ───────────────── 移库弹窗:面板展示与提示 ───────────────── */
/** 商品:名称(编码) */
const transferItemLabel = computed(() => {
const row = activeRow.value || {}
const name = String(row.item_name || row.stock?.item_name || '').trim()
const code = String(row.item_code || row.stock?.item_code || '').trim()
if (name && code) return `${name}(${code})`
return name || code || '—'
})
/** 原库位 */
const transferFromSpaceLabel = computed(() => {
const row = activeRow.value || {}
return String(row.space_code || '—')
})
/** 可移数量:可用 → 总数量 → 实物数 依次兜底 */
const transferAvailableLabel = computed(() => {
const row = activeRow.value || {}
const qty = row.available_quantity ?? row.quantity ?? row.physical_quantity
return qty === null || qty === undefined || qty === '' ? '—' : String(qty)
})
/** 副标题:说明当前移库模式 */
const transferSubtitle = computed(() =>
transferMode.value === 'product'
? '按原库位 + 商品合并移库,自动合并该库位下该商品的全部库存'
: '单条库存记录移库,数量不填则整条全量移库'
)
/** 底部说明:模式差异与注意事项 */
const transferTipText = computed(() =>
transferMode.value === 'product'
? '开启批次管理且存在多批次的商品不支持按商品移库;移库数量为必填项。'
: '目标库位支持库位编码或库位 ID;移库数量不填则按整条库存记录全量移库。'
)
/** 目标库位名称:未输入 / 识别中 / 未找到 / 已识别 */
const transferTargetSpaceLabel = computed(() => {
if (!String(targetSpace.value ?? '').trim()) return '—'
if (spaceName.value) return spaceName.value
return targetSpaceError.value ? '未找到库位' : '识别中…'
})
const transferTargetSpaceInvalid = computed(
() => !!targetSpaceError.value && !!String(targetSpace.value ?? '').trim()
)
/** 页脚提示:随输入状态变化 */
const transferHintText = computed(() => {
if (!String(targetSpace.value ?? '').trim()) return '请输入或扫码目标库位'
if (transferTargetSpaceInvalid.value) return '目标库位不存在,请重新输入'
if (transferMode.value === 'product' && !transferQty.value) return '按商品移库需填写移库数量'
return '提交前请确认目标库位与移库数量'
})
function normalizeRow(r: any) {
if (!r) return null
const row = { ...r }
@ -689,6 +831,15 @@ const hasExpiryChange = computed(
resolveExpiryFieldPayload(expiryForm.expiryDate, expiryRow.value?.expiry_date) !== undefined
)
/** 页脚提示:未改动 / 日期先后不合法 / 可提交 */
const expiryHintText = computed(() => {
if (!hasExpiryChange.value) return '尚未修改日期,请至少调整一项'
const production = String(expiryForm.productionDate || '').trim()
const expiry = String(expiryForm.expiryDate || '').trim()
if (production && expiry && production > expiry) return '生产日期不能晚于到期日期'
return '提交后将更新该库存记录的日期'
})
/** 行上的库存记录 ID(无则返回 null,用于判断该行是否可维护日期) */
function getRowStorageId(row: any): number | null {
const id = Number(row?.storage_id)
@ -979,76 +1130,213 @@ watch(targetSpace, (val) => {
display: inline-block;
}
.transfer-hint {
margin: 0 0 12px;
font-size: 12px;
color: #909399;
line-height: 1.5;
}
/* 日期维护弹窗:日期选择器与「清空」按钮的宽度约束 */
.expiry-date-picker {
flex: 1;
min-width: 0;
}
.expiry-clear-btn {
flex-shrink: 0;
}
/* 移库弹窗:面板结构 / 尺寸对齐 storage/receiving「批量驳回收货单」 */
.task-panel {
display: flex;
flex-direction: column;
max-height: calc(100vh - 96px);
background: #fff;
color: #303133;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 16px 8px;
flex-shrink: 0;
}
.transfer-form {
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 6px 16px 0;
display: flex;
flex-direction: column;
overflow-y: auto;
}
&__form {
display: flex;
flex-direction: column;
gap: 8px;
}
.target-space-tip {
min-height: 22px;
font-size: 12px;
}
.target-space-error {
color: #f56c6c;
}
.expiry-context {
margin-bottom: 12px;
}
.expiry-hint {
margin: 0 0 12px;
font-size: 12px;
color: #909399;
line-height: 1.5;
}
.expiry-form {
.expiry-field {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
width: 100%;
}
.expiry-date-picker {
flex: 1;
min-width: 0;
}
.expiry-clear-btn {
flex-shrink: 0;
}
}
.expiry-preview {
&__field {
display: flex;
gap: 8px;
padding: 8px 10px;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 40px;
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #f5f7fa;
font-size: 12px;
color: #606266;
line-height: 1.6;
background: #fafafa;
.expiry-preview-label {
flex-shrink: 0;
/* 输入行:不需要灰色容器,与上方静态信息行拉开层次 */
&--input {
align-items: center;
min-height: 0;
padding: 4px 12px 0;
border: none;
border-radius: 0;
background: transparent;
:deep(.el-input),
:deep(.el-input-number),
:deep(.el-date-editor) {
flex: 1;
min-width: 0;
}
}
/* 纯展示行(如识别到的库位名称):无容器,紧贴输入框 */
&--plain {
min-height: 0;
padding: 0 12px;
border: none;
border-radius: 0;
background: transparent;
}
}
&__field-label {
font-size: 12px;
line-height: 20px;
color: #606266;
flex-shrink: 0;
white-space: nowrap;
}
&__field-value {
font-size: 13px;
font-weight: 500;
color: #303133;
text-align: right;
word-break: break-all;
&.is-danger {
color: #f56c6c;
}
/* 只作参考的库内原值,弱化展示 */
&.is-muted {
font-weight: 400;
color: #909399;
}
}
.expiry-preview-text {
word-break: break-all;
&__form-tip {
margin: 8px 0 12px;
padding: 8px 12px;
border-radius: 4px;
background: #f4f4f5;
font-size: 12px;
line-height: 18px;
color: #909399;
}
&__foot {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
padding: 12px 16px 16px;
flex-shrink: 0;
}
&__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:面板自带页头 / 页脚,去掉默认头 / 内边距 */
.el-dialog.transfer-dialog,
.el-dialog.expiry-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header,
.el-dialog__footer {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -49,32 +49,43 @@ defineProps<{
<style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss";
/* 基础信息面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
/* 面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.transaction-detail {
padding: 8px 0;
height: 100%;
overflow-y: auto;
padding: 6px 10px 8px;
box-sizing: border-box;
}
.section {
margin-bottom: 12px;
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
&:last-child {
margin-bottom: 0;
}
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.detail-descriptions :deep(.el-descriptions__label) {
width: 120px;
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
</style>

View File

@ -494,8 +494,8 @@ function handleExportAction(action: string) {
<style lang="scss" scoped>
@use "../../order/orderManagement/styles/order-sub.scss";
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(基础信息组件自带
padding: 8px 0),只保留左右 10px,避免与组件内边距叠加 */
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(基础信息组件自带
padding: 6px 10px 8px),只留左右 10px,内容滚动交给详情面板 */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
overflow: auto;

View File

@ -84,33 +84,44 @@ defineProps<{
<style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss";
/* 基础信息面板:分区标题 + 带边框描述列表(对齐货主侧 store/index.vue 与 stock/external_stock) */
/* 面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.productflow-detail {
padding: 8px 0;
height: 100%;
overflow-y: auto;
padding: 6px 10px 8px;
box-sizing: border-box;
}
.section {
margin-bottom: 12px;
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
&:last-child {
margin-bottom: 0;
}
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.detail-descriptions :deep(.el-descriptions__label) {
width: 100px;
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
.qty-up {

View File

@ -766,16 +766,15 @@ onMounted(() => {
}
}
}
}
.detail-container {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
/* 详情区外壳不留上/下间距,由各详情组件自身控制(对齐 stock/external_stock) */
padding: 0 10px;
overflow: auto;
}
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(基础信息组件自带
padding: 6px 10px 8px),只留左右 10px,内容滚动交给详情面板。
⚠️ 必须用完整路径选择器:共享 order-sub.scss 的同名规则权重更高(4 个类),
写成 `.lower-level .detail-container` 会被它覆盖成 padding: 0。 */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
overflow: auto;
}
/* ---- 无选中项占位 ---- */

View File

@ -844,48 +844,56 @@ onMounted(() => {
}
}
}
}
.detail-container {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
/* 详情区外壳不留上/下间距,由 .detail-panel 自身控制(对齐 stock/external_stock) */
padding: 0 10px;
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(基础信息面板自带
padding: 6px 10px 8px),只留左右 10px,内容滚动交给详情面板。
⚠️ 必须用完整路径选择器:共享 order-sub.scss 的同名规则权重更高(4 个类),
写成 `.lower-level .detail-container` 会被它覆盖成 padding: 0。 */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
overflow: auto;
.detail-page {
height: 100%;
overflow: auto;
}
.detail-page {
height: 100%;
overflow: auto;
/* 基础信息面板:自带内边距 6px 10px 8px(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.detail-page.detail-panel {
padding: 6px 10px 8px;
box-sizing: border-box;
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
}
/* 基础信息面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
.detail-page.detail-panel {
padding: 8px 0;
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.detail-descriptions :deep(.el-descriptions__label) {
width: 100px;
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
}
}

View File

@ -35,6 +35,7 @@
:columns="productquick"
:show-selection="true"
:selectable="canDeleteDetailRow"
default-align="center"
:pagination="pagination"
:page-sizes="[10, 20, 50, 100]"
:query-time="queryTime"
@ -274,39 +275,86 @@
<el-dialog
v-model="bindDialogVisible"
title="明细绑定"
class="bind-detail-dialog"
width="min(640px, 92vw)"
align-center
width="640px"
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@closed="resetBindForm"
>
<el-form :model="bindForm" label-width="130px" size="small">
<el-form-item
v-for="field in bindDetailProductFormConfig"
:key="field.prop"
:required="field.required"
>
<template #label>{{ field.label }}</template>
<template v-if="field.type === 'display'">
<span class="bind-display-value">{{ formatBindDisplayValue(field.prop) }}</span>
</template>
<template v-else-if="field.type === 'product-picker'">
<div class="bind-product-picker">
<el-input :model-value="bindSelectedProductDisplay" readonly placeholder="请选择系统商品">
<template #append>
<el-button @click="openBindSystemProductPicker">查询系统商品</el-button>
</template>
</el-input>
<p v-if="field.hint" class="picker-hint">{{ field.hint }}</p>
</div>
</template>
</el-form-item>
</el-form>
<template #footer>
<el-button size="small" @click="bindDialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="bindSaving" @click="submitBindDetail">确认绑定</el-button>
</template>
<!-- 面板结构对齐「批量驳回收货单」 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>明细绑定</h2>
<p>将收货明细绑定到当前仓库下的系统商品</p>
</div>
<button class="task-panel__close" type="button" aria-label="关闭" @click="bindDialogVisible = false">
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="task-panel__body">
<div class="task-panel__form">
<template v-for="field in bindDetailProductFormConfig" :key="field.prop">
<div
v-if="field.type === 'display'"
class="task-panel__field"
:class="{ 'task-panel__field--stack': field.prop === 'barcode' && bindBarcodeHiddenCount > 0 }"
>
<span class="task-panel__field-label">{{ field.label }}</span>
<div v-if="field.prop === 'barcode'" class="task-panel__barcode">
<template v-if="bindVisibleBarcodes.length">
<span
v-for="code in bindVisibleBarcodes"
:key="code"
class="task-panel__barcode-item"
>
{{ code }}
</span>
<button
v-if="bindBarcodeHiddenCount > 0"
class="task-panel__barcode-toggle"
type="button"
@click="bindBarcodeExpanded = !bindBarcodeExpanded"
>
{{ bindBarcodeExpanded ? '收起' : `+${bindBarcodeHiddenCount}` }}
</button>
</template>
<span v-else class="task-panel__barcode-empty">—</span>
</div>
<strong v-else class="task-panel__field-value">{{ formatBindDisplayValue(field.prop) }}</strong>
</div>
<div v-else class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">
{{ field.label }}<span v-if="field.required" class="required-mark">*</span>
</span>
<el-input :model-value="bindSelectedProductDisplay" readonly placeholder="请选择系统商品">
<template #append>
<el-button @click="openBindSystemProductPicker">查询系统商品</el-button>
</template>
</el-input>
</div>
</template>
</div>
<p class="task-panel__form-tip">
须选择当前仓库下的系统商品(StockWarehouse.id);绑定后收货明细会关联该商品。
</p>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">提交前请确认已选择系统商品</span>
<div class="task-panel__actions">
<el-button size="small" @click="bindDialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="bindSaving" @click="submitBindDetail">确认绑定</el-button>
</div>
</footer>
</div>
</el-dialog>
<el-dialog
@ -430,6 +478,8 @@
:loading="spaceLoading"
:show-selection="true"
:multiple-selection="spaceSelection"
:show-pagination="false"
default-align="center"
:pagination="{ currentPage: spacePagination.page, pageSize: spacePagination.pageSize, total: spacePagination.total }"
:columns="[
{ prop: 'id', label: '库位ID', width: '120' },
@ -439,14 +489,26 @@
]"
@selection-change="handleSpaceSelectionChange"
@row-click="handleSpaceRowClick"
@page-change="querySpaces"
@page-size-change="onSpacePageSizeChange"
/>
</div>
</div>
<template #footer>
<el-button size="small" @click="spacePickerVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="applySelectedSpace">使用选中库位</el-button>
<div class="picker-footer">
<el-pagination
v-model:current-page="spacePagination.page"
v-model:page-size="spacePagination.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="spacePagination.total"
layout="total, sizes, prev, pager, next"
background
size="small"
class="system-product-pagination"
@current-change="onSpacePageChange"
@size-change="onSpacePageSizeChange"
/>
<el-button size="small" @click="spacePickerVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="applySelectedSpace">使用选中库位</el-button>
</div>
</template>
</el-dialog>
@ -1209,8 +1271,24 @@ const formatBindDisplayValue = (prop: string) => {
return val
}
/** 明细绑定:收货条码多值折叠(只显示首个 + `+N` 展开) */
const bindBarcodeExpanded = ref(false)
const bindBarcodeValues = computed(() => {
const text = String(bindForm.barcode ?? '').trim()
if (!text) return []
return text
.split(/[|,,;;]/)
.map((item) => item.trim())
.filter(Boolean)
})
const bindBarcodeHiddenCount = computed(() => Math.max(0, bindBarcodeValues.value.length - 1))
const bindVisibleBarcodes = computed(() =>
bindBarcodeExpanded.value ? bindBarcodeValues.value : bindBarcodeValues.value.slice(0, 1)
)
const resetBindForm = () => {
bindingDetailRow.value = null
bindBarcodeExpanded.value = false
bindForm.detail_id = ''
bindForm.product_name = ''
bindForm.barcode = ''
@ -1529,6 +1607,7 @@ const openBindDialog = (row: any) => {
}
bindingDetailRow.value = row
bindBarcodeExpanded.value = false
bindForm.detail_id = String(detailId)
bindForm.product_name = row?.product_name ?? row?.item_name ?? ''
bindForm.barcode = normalizeBarcodeString(row?.barcodes, row?.barcode) || ''
@ -2144,6 +2223,10 @@ const onSpacePageSizeChange = (size: number) => {
querySpaces(1)
}
const onSpacePageChange = (page: number) => {
querySpaces(page)
}
const querySpaces = async (page = 1) => {
spaceLoading.value = true
try {
@ -3009,6 +3092,102 @@ onUnmounted(() => {
flex-shrink: 0;
}
&__form {
display: flex;
flex-direction: column;
gap: 8px;
}
&__field {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 40px;
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fafafa;
/* 输入行:不需要灰色容器,与上方静态信息行拉开层次 */
&--input {
align-items: center;
min-height: 0;
padding: 4px 0 0 12px;
border: none;
border-radius: 0;
background: transparent;
.el-input {
flex: 1;
min-width: 0;
}
}
/* 多值行:标签在上、值在下(如多个条码) */
&--stack {
flex-direction: column;
align-items: stretch;
gap: 4px;
.task-panel__barcode {
justify-content: flex-start;
}
}
}
&__field-label {
font-size: 12px;
line-height: 20px;
color: #606266;
flex-shrink: 0;
white-space: nowrap;
}
&__field-value {
font-size: 13px;
font-weight: 500;
color: #303133;
text-align: right;
word-break: break-all;
}
/* 多值条码折叠(同 UpperTable copyAction 列的 +N 折叠交互) */
&__barcode {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 4px 8px;
min-width: 0;
}
&__barcode-item {
font-size: 13px;
color: #303133;
word-break: break-all;
}
&__barcode-toggle {
flex: none;
padding: 0;
border: none;
background: none;
font-size: 12px;
line-height: 1.4;
color: #909399;
cursor: pointer;
&:hover {
color: #409eff;
}
}
&__barcode-empty {
font-size: 13px;
color: #909399;
}
&__toolbar-main {
display: flex;
align-items: center;
@ -3204,6 +3383,19 @@ onUnmounted(() => {
height: 440px;
}
/* 选择系统库位:分页与按钮同行(对齐「批量导入商品」页脚) */
.picker-footer {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
/* 表格固定高度:数据少也保持同样大小,超出容器时表格内部滚动(短屏自适应) */
.batch-import-table {
height: min(450px, calc(100vh - 280px));
@ -3451,15 +3643,6 @@ onUnmounted(() => {
z-index: 3;
}
.bind-display-value {
color: #606266;
word-break: break-all;
}
.bind-product-picker {
width: 100%;
}
.edit-detail-form {
:deep(.el-input-group) {
width: 100%;
@ -3560,7 +3743,8 @@ onUnmounted(() => {
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板(同手工录入运单号) */
.el-dialog.batch-import-dialog,
.el-dialog.system-product-dialog {
.el-dialog.system-product-dialog,
.el-dialog.bind-detail-dialog {
padding: 0;
overflow: hidden;

View File

@ -482,19 +482,47 @@ export const PRODUCT_DETAIL_ACTIONS_COLUMN = {
className: 'product-detail-actions-col'
} as const
/** 解析多值条码:数组(含 {barcode|code|value} 对象)或逗号/竖线/分号分隔字符串 */
function parseBarcodeValues(raw: unknown): string[] {
if (Array.isArray(raw)) {
return raw
.map((item) => {
if (item && typeof item === 'object') {
const candidate = (item as any).barcode ?? (item as any).code ?? (item as any).value
return String(candidate ?? '').trim()
}
return String(item ?? '').trim()
})
.filter(Boolean)
}
const text = String(raw ?? '').trim()
if (!text) return []
return text
.split(/[|,,;;]/)
.map((item) => item.trim())
.filter(Boolean)
}
export const productquick = [
{ prop: 'images', label: '图片', width: '120', align: 'center', fixed: 'left' },
{ prop: 'product_name', label: '商品名称', width: '200', fixed: 'left' },
{ prop: 'id', label: '收货编码', width: '100' },
{ prop: 'barcode', label: '条码', width: '150' },
{
prop: 'barcode',
label: '条码',
width: '180',
copyAction: 'copy',
// 多值折叠:只显示首个条码 + `+N` 展开全部(数据可能为 barcodes 数组或 barcode 分隔串)
copyValue: (row: any) => parseBarcodeValues(row?.barcodes ?? row?.barcode)
},
{ prop: 'stock_id', label: 'SKUID', width: '100' },
{ prop: 'match_status', label: '匹配状态', width: '100', align: 'center' },
{ prop: 'actual_quantity', label: '收货数量', width: '100', align: 'right' },
{ prop: 'box_quantity', label: '箱数', width: '100', align: 'right' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '100', align: 'right' },
{ prop: 'box_remainder', label: '不满一箱', width: '90', align: 'right' },
{ prop: 'weight', label: '重量(g)', width: '100', align: 'right' },
{ prop: 'box_weight', label: '箱重(g)', width: '100', align: 'right' },
{ prop: 'actual_quantity', label: '收货数量', width: '100', align: 'center' },
{ prop: 'box_quantity', label: '箱数', width: '100', align: 'center' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '100', align: 'center' },
{ prop: 'box_remainder', label: '不满一箱', width: '90', align: 'center' },
{ prop: 'weight', label: '重量(g)', width: '100', align: 'center' },
{ prop: 'box_weight', label: '箱重(g)', width: '100', align: 'center' },
{ prop: 'batch_number', label: '批次号', width: '120' },
{ prop: 'production_date', label: '生产日期', width: '120' },
{ prop: 'expiry_date', label: '到期日期', width: '120' },

View File

@ -788,7 +788,7 @@ onMounted(() => {
.detail-container {
flex: 1;
overflow: auto;
/* 详情区外壳不留上/下间距,由 .detail-panel 自身控制(对齐 stock/external_stock) */
/* 详情区外壳不留上/下间距(报表明细面板自带 padding: 6px 10px 8px),只留左右 10px */
padding: 0 10px;
.detail-page {
@ -796,9 +796,11 @@ onMounted(() => {
overflow: auto;
}
/* 报表明细面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
/* 报表明细面板:自带内边距,
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.detail-page.detail-panel {
padding: 8px 0;
padding: 6px 10px 8px;
box-sizing: border-box;
.section {
margin-bottom: 12px;
@ -818,10 +820,17 @@ onMounted(() => {
line-height: 1.4;
}
.detail-descriptions :deep(.el-descriptions__label) {
width: 120px;
background: #fafbfc;
font-weight: 500;
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
}
}

View File

@ -91,6 +91,7 @@
:columns="tableColumns"
row-key="flat_key"
table-size="small"
default-align="center"
:loading="loading"
:show-selection="true"
:selectable="isReportableRow"

View File

@ -167,7 +167,7 @@
</template>
</el-table-column>
<el-table-column prop="detail_id" label="明细ID" width="90" align="center" />
<el-table-column label="库位" min-width="180" show-overflow-tooltip>
<el-table-column label="库位" min-width="180" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ locationLabel(row) }}</template>
</el-table-column>
<el-table-column label="盘点状态" width="100" align="center">
@ -184,10 +184,10 @@
<el-tag v-if="row.is_empty" type="info" size="small" class="unknown-tag">空库位</el-tag>
</template>
</el-table-column>
<el-table-column label="盘点人" width="130" show-overflow-tooltip>
<el-table-column label="盘点人" width="130" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ (row.checkers || []).join('、') || '—' }}</template>
</el-table-column>
<el-table-column label="最近上报" width="160">
<el-table-column label="最近上报" width="160" align="center">
<template #default="{ row }">{{ formatTime(row.checked_at) }}</template>
</el-table-column>
<!--
@ -256,19 +256,19 @@
</template>
</el-table-column>
<el-table-column prop="detail_id" label="明细ID" width="90" align="center" />
<el-table-column label="商品编码" min-width="130" show-overflow-tooltip>
<el-table-column label="商品编码" min-width="130" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.item_code || '—' }}</template>
</el-table-column>
<el-table-column label="商品名称" min-width="160" show-overflow-tooltip>
<el-table-column label="商品名称" min-width="160" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.item_name || '—' }}</template>
</el-table-column>
<el-table-column label="规格" min-width="110" show-overflow-tooltip>
<el-table-column label="规格" min-width="110" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.spec || '—' }}</template>
</el-table-column>
<el-table-column label="货主" min-width="120" show-overflow-tooltip>
<el-table-column label="货主" min-width="120" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.store_name || '—' }}</template>
</el-table-column>
<el-table-column label="库位" min-width="150" show-overflow-tooltip>
<el-table-column label="库位" min-width="150" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ locationCodes(row) }}</template>
</el-table-column>
<el-table-column v-if="!isBlind" label="账面数量" width="100" align="center">
@ -344,10 +344,10 @@
</template>
</el-table-column>
<el-table-column prop="id" label="库位ID" width="90" align="center" />
<el-table-column label="库位" min-width="180" show-overflow-tooltip>
<el-table-column label="库位" min-width="180" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ spaceLocationLabel(row) }}</template>
</el-table-column>
<el-table-column label="自定义条码" min-width="130" show-overflow-tooltip>
<el-table-column label="自定义条码" min-width="130" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.custom_barcode || '—' }}</template>
</el-table-column>
<el-table-column label="任务商品" width="100" align="center">

View File

@ -15,65 +15,100 @@
<template>
<el-dialog
:model-value="visible"
title="上报实盘"
width="min(520px, 92vw)"
class="check-report-dialog"
width="min(560px, 92vw)"
align-center
append-to-body
:show-close="false"
:close-on-click-modal="false"
@update:model-value="handleVisibleChange"
@closed="handleClosed"
>
<el-form label-width="96px" size="small">
<el-form-item label="明细">
<span class="value-text">{{ detailLabel }}</span>
</el-form-item>
<el-form-item label="本次商品">
<span class="value-text">{{ stockLabel }}</span>
</el-form-item>
<el-form-item label="库位">
<span class="value-text">{{ location || '无库位' }}</span>
</el-form-item>
<el-form-item label="实盘数量" required>
<el-input-number
v-model="form.quantity"
:min="0"
:step="1"
step-strictly
controls-position="right"
class="quantity-input"
placeholder="请输入实盘数量"
/>
</el-form-item>
<el-form-item label="未匹配条码">
<el-input
v-model="form.barcode"
clearable
placeholder="扫到系统里没有的商品时填写(留空=按明细商品上报)"
/>
</el-form-item>
<el-form-item v-if="form.barcode.trim()" label="商品名称">
<el-input v-model="form.item_name" clearable placeholder="未知商品名称,留空则用条码" />
</el-form-item>
</el-form>
<!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>上报实盘</h2>
<p>同一「明细 + 商品 + 库位」重复上报会覆盖原记录</p>
</div>
<button
class="task-panel__close"
type="button"
aria-label="关闭"
@click="handleVisibleChange(false)"
>
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<el-alert
v-if="form.barcode.trim()"
type="warning"
:closable="false"
show-icon
title="已填未匹配条码:后端先按条码匹配系统商品,命中则按该商品覆盖上报;未命中则记为未知商品(无账面,实盘大于 0 即盘盈)。"
/>
<div v-else class="tip-text">
覆盖式上报:同一「明细 + 商品 + 库位」重复上报会更新原记录(不新增)。
</div>
<div class="task-panel__body">
<div class="task-panel__form">
<div class="task-panel__field">
<span class="task-panel__field-label">明细</span>
<strong class="task-panel__field-value">{{ detailLabel }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">本次商品</span>
<strong class="task-panel__field-value">{{ stockLabel }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">库位</span>
<strong class="task-panel__field-value">{{ location || '无库位' }}</strong>
</div>
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="handleVisibleChange(false)">取消</el-button>
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">
确认上报
</el-button>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">
实盘数量<span class="required-mark">*</span>
</span>
<el-input-number
v-model="form.quantity"
:min="0"
:step="1"
step-strictly
controls-position="right"
class="quantity-input"
placeholder="请输入实盘数量"
/>
</div>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">未匹配条码</span>
<el-input
v-model="form.barcode"
clearable
placeholder="扫到系统里没有的商品时填写(留空=按明细商品上报)"
/>
</div>
<div v-if="form.barcode.trim()" class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">商品名称</span>
<el-input v-model="form.item_name" clearable placeholder="未知商品名称,留空则用条码" />
</div>
</div>
<p
v-if="form.barcode.trim()"
class="task-panel__form-tip task-panel__form-tip--warning"
>
已填未匹配条码:后端先按条码匹配系统商品,命中则按该商品覆盖上报;未命中则记为未知商品(无账面,实盘大于 0 即盘盈)。
</p>
<p v-else class="task-panel__form-tip">
覆盖式上报:同一「明细 + 商品 + 库位」重复上报会更新原记录(不新增)
</p>
</div>
</template>
<footer class="task-panel__foot">
<span class="task-panel__hint">提交前请确认实盘数量</span>
<div class="task-panel__actions">
<el-button size="small" @click="handleVisibleChange(false)">取消</el-button>
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">
确认上报
</el-button>
</div>
</footer>
</div>
</el-dialog>
</template>
@ -221,25 +256,177 @@ async function handleSubmit() {
</script>
<style scoped lang="scss">
.value-text {
font-size: 13px;
/* 面板结构 / 尺寸对齐 storage/receiving「批量驳回收货单」 */
.task-panel {
background: #fff;
color: #303133;
word-break: break-all;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px;
}
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
padding: 12px 16px 0;
}
&__form {
display: flex;
flex-direction: column;
gap: 8px;
}
&__field {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 40px;
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fafafa;
/* 输入行:不需要灰色容器,与上方静态信息行拉开层次 */
&--input {
align-items: center;
min-height: 0;
padding: 4px 0 0 12px;
border: none;
border-radius: 0;
background: transparent;
.el-input {
flex: 1;
min-width: 0;
}
.quantity-input {
width: 100%;
}
}
}
&__field-label {
font-size: 12px;
line-height: 20px;
color: #606266;
flex-shrink: 0;
white-space: nowrap;
}
&__field-value {
font-size: 13px;
font-weight: 500;
color: #303133;
text-align: right;
word-break: break-all;
}
&__form-tip {
margin: 8px 0 0;
padding: 8px 12px;
border-radius: 4px;
background: #f4f4f5;
font-size: 12px;
line-height: 18px;
color: #909399;
&--warning {
background: #fdf6ec;
color: #e6a23c;
}
}
&__foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 16px;
}
&__hint {
font-size: 12px;
color: #909399;
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
.quantity-input {
width: 160px;
}
.tip-text {
font-size: 12px;
color: #909399;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 8px;
.required-mark {
color: #f56c6c;
margin-left: 4px;
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板 */
.el-dialog.check-report-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -139,22 +139,22 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入) */
@use "../../../../order/orderManagement/styles/order-sub.scss";
/* 面板自带内边距 8px 0(左右由宿主 .detail-container 的 padding: 0 10px 提供),
合计内容缩进 10px,对齐 express/waybill 的 DetailPanel / stock/external_stock「基本信息」 */
/* 面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「波次明细」面板(WaveBatchDetailPanel)完全一致 */
.detail-panel {
flex: 1;
min-height: 0;
height: 100%;
padding: 8px 0;
overflow-y: auto;
padding: 6px 10px 8px;
box-sizing: border-box;
overflow: auto;
}
.empty-tip {
text-align: center;
font-size: 13px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
padding: 40px 0;
font-size: 13px;
}
.section {
@ -177,10 +177,15 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 120px;
width: 110px;
min-width: 110px;
background: #fafbfc;
font-weight: 500;
}
:deep(.el-descriptions__content) {
word-break: break-word;
}
}
.order-list-pre {

View File

@ -147,15 +147,17 @@
</el-tabs>
</div>
<div class="detail-container">
<component
:is="activeDetailTabComponent"
:row="selectedDetail"
:detail-config="currentDetailConfig"
:api-method="currentDetailTabApiMethod"
@add-items="handlePanelAddItems"
@export-detail="handlePanelExportDetail"
@changed="handlePanelChanged"
/>
<div v-if="activeDetailTab" class="detail-page order-detail-wrapper">
<component
:is="activeDetailTabComponent"
:row="selectedDetail"
:detail-config="currentDetailConfig"
:api-method="currentDetailTabApiMethod"
@add-items="handlePanelAddItems"
@export-detail="handlePanelExportDetail"
@changed="handlePanelChanged"
/>
</div>
</div>
</div>
@ -270,6 +272,66 @@
:meta="detailExportTaskProgress"
:update-time="detailExportTaskProgress.updateTime"
/>
<!-- ===== 驳回盘点单(对齐 storage/receiving「批量驳回收货单」) ===== -->
<el-dialog
v-model="rejectDialogVisible"
class="reject-stockcheck-dialog"
width="min(560px, 92vw)"
align-center
append-to-body
:show-close="false"
:close-on-click-modal="false"
>
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>驳回盘点单</h2>
<p>驳回后盘点单退回可重新编辑状态</p>
</div>
<button
class="task-panel__close"
type="button"
aria-label="关闭"
@click="rejectDialogVisible = false"
>
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="task-panel__body">
<div class="task-panel__form">
<div class="task-panel__field">
<span class="task-panel__field-label">盘点单号</span>
<strong class="task-panel__field-value">{{ rejectRow?.check_no || '—' }}</strong>
</div>
<div class="task-panel__field task-panel__field--input task-panel__field--textarea">
<span class="task-panel__field-label">驳回原因</span>
<el-input
v-model="rejectReason"
type="textarea"
:rows="3"
placeholder="可留空(留空则保留原备注)"
/>
</div>
</div>
<p class="task-panel__form-tip">
驳回原因将写入盘点单备注;留空则保留原备注。
</p>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">提交前请确认盘点单状态</span>
<div class="task-panel__actions">
<el-button size="small" @click="rejectDialogVisible = false">取消</el-button>
<el-button size="small" type="warning" :loading="rejectLoading" @click="submitAuditReject">
确定驳回
</el-button>
</div>
</footer>
</div>
</el-dialog>
</div>
</template>
@ -524,31 +586,46 @@ async function handleOperationAction(key: string, row: Record<string, any>) {
}
}
/** 审核驳回:弹输入框收驳回原因(文档:reason 可选,缺省保留原备注) */
async function handleAuditReject(row: Record<string, any>) {
/** 审核驳回:面板弹窗收驳回原因(reason 可选,留空保留原备注) */
const rejectDialogVisible = ref(false)
const rejectLoading = ref(false)
const rejectReason = ref('')
const rejectRow = ref<Record<string, any> | null>(null)
function handleAuditReject(row: Record<string, any>) {
const id = Number(row?.id)
let reason = ''
try {
const res = await ElMessageBox.prompt(
'驳回原因将写入盘点单备注(可留空,留空则保留原备注)',
`驳回盘点单 ${row?.check_no ?? ''}`,
{
confirmButtonText: '确定驳回',
cancelButtonText: '取消',
inputType: 'textarea',
inputPlaceholder: '可留空',
type: 'warning',
buttonSize: 'small'
}
)
reason = String(res.value ?? '').trim()
} catch {
return // 用户取消
if (!Number.isFinite(id) || id <= 0) {
ElMessage.warning('缺少有效的盘点单ID')
return
}
rejectRow.value = row
rejectReason.value = ''
rejectDialogVisible.value = true
}
/** 提交驳回:调用 stock.check.audit(action=reject) */
async function submitAuditReject() {
const id = Number(rejectRow.value?.id)
if (!Number.isFinite(id) || id <= 0) {
ElMessage.warning('缺少有效的盘点单ID')
return
}
const reason = String(rejectReason.value ?? '').trim()
rejectLoading.value = true
try {
const res: any = await stockCheckAudit({ id, action: 'reject', ...(reason ? { reason } : {}) })
if (!isCheckApiSuccess(res)) {
throw new Error(res?.message || '驳回失败')
}
ElMessage.success('已驳回')
rejectDialogVisible.value = false
await reloadAndResyncDetail()
} catch (e: any) {
console.error('[stockcheck] 驳回盘点单失败', e)
ElMessage.error(e?.message || '驳回失败')
} finally {
rejectLoading.value = false
}
await runCheckAction(
() => stockCheckAudit({ id, action: 'reject', ...(reason ? { reason } : {}) }),
'已驳回'
)
}
/** 统一执行状态类操作:校验结果 → 提示 → 刷新列表并同步详情 */
@ -1030,10 +1107,21 @@ onMounted(() => {
/* 布局样式对齐 order/orderManagement(order-sub.scss) */
@use "../../order/orderManagement/styles/order-sub.scss";
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px,
由各详情面板自身 padding 控制上下留白 */
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(波次明细/盘点单信息面板
自带 padding: 6px 10px 8px),只留左右 10px,内容滚动交给详情面板 */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
overflow: auto;
}
.detail-page {
height: 100%;
overflow-x: hidden;
overflow-y: auto;
}
.order-detail-wrapper {
height: 100%;
}
/* ================================================================
@ -1111,4 +1199,175 @@ onMounted(() => {
font-size: 13px;
color: #909399;
}
/* ================================================================
8. 驳回盘点单面板(结构 / 尺寸对齐批量驳回收货单)
================================================================ */
.task-panel {
background: #fff;
color: #303133;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px;
}
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
padding: 12px 16px 0;
}
&__form {
display: flex;
flex-direction: column;
gap: 8px;
}
&__field {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 40px;
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fafafa;
/* 驳回原因输入行:不需要灰色容器,与上方静态信息行拉开层次 */
&--input {
align-items: center;
min-height: 0;
padding: 4px 0 0 12px;
border: none;
border-radius: 0;
background: transparent;
.el-input,
.el-textarea {
flex: 1;
min-width: 0;
}
}
&--textarea {
align-items: flex-start;
.task-panel__field-label {
padding-top: 7px;
}
}
}
&__field-label {
font-size: 12px;
line-height: 20px;
color: #606266;
flex-shrink: 0;
white-space: nowrap;
}
&__field-value {
font-size: 13px;
font-weight: 500;
color: #303133;
text-align: right;
word-break: break-all;
}
&__form-tip {
margin: 8px 0 0;
padding: 8px 12px;
border-radius: 4px;
background: #f4f4f5;
font-size: 12px;
line-height: 18px;
color: #909399;
}
&__foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 16px;
}
&__hint {
font-size: 12px;
color: #909399;
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板(同批量驳回收货单) */
.el-dialog.reject-stockcheck-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -19,149 +19,153 @@
<template>
<el-dialog
:model-value="visible"
:title="dialogTitle"
width="min(1080px, 95vw)"
class="check-stock-picker-dialog"
width="min(1080px, 96vw)"
align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@update:model-value="handleVisibleChange"
@closed="handleClosed"
>
<div class="picker-body">
<!-- ===== 商品类任务:从库存明细挑选商品 → stock_ids ===== -->
<template v-if="!isLocationMode">
<el-alert type="info" :closable="false" show-icon :title="goodsAlertText" />
<!-- 筛选行 -->
<div class="picker-filters">
<el-input
v-model="filters.keyword"
size="small"
clearable
placeholder="商品编码 / 名称 / 条码"
class="filter-item filter-item--keyword"
@keyup.enter="handleSearch"
/>
<el-input
v-model="filters.batch_no"
size="small"
clearable
placeholder="批次号"
class="filter-item"
@keyup.enter="handleSearch"
/>
<el-button size="small" type="primary" :loading="loading" @click="handleSearch">
查询
</el-button>
<el-button size="small" @click="handleResetFilters">重置</el-button>
</div>
<!-- 库存列表 -->
<div ref="tableHostRef" class="table-host">
<el-table
ref="tableRef"
v-loading="loading"
:data="rows"
:row-key="(row: any) => row._key"
border
stripe
size="small"
:height="tableHeight"
@selection-change="handleSelectionChange"
<!-- 面板结构对齐 storage/receiving「批量导入商品」 -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>{{ dialogTitle }}</h2>
<p>{{ isLocationMode ? '勾选盘点库位后加入当前盘点单' : '从库存明细勾选商品后加入当前盘点单' }}</p>
</div>
<button
class="task-panel__close"
type="button"
aria-label="关闭"
@click="handleVisibleChange(false)"
>
<el-table-column type="selection" width="45" :reserve-selection="true" />
<el-table-column prop="item_code" label="商品编码" min-width="130" show-overflow-tooltip />
<el-table-column prop="item_name" label="商品名称" min-width="160" show-overflow-tooltip />
<el-table-column prop="spec" label="规格" min-width="110" show-overflow-tooltip />
<el-table-column prop="store_name" label="货主" min-width="110" show-overflow-tooltip />
<el-table-column prop="space_code" label="库位" min-width="120" show-overflow-tooltip />
<el-table-column prop="batch_no" label="批次号" min-width="110" show-overflow-tooltip />
<el-table-column prop="quantity" label="库存数量" width="100" align="center" />
<el-table-column prop="available_quantity" label="可用数量" width="100" align="center" />
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<template #empty>
<div class="empty-tip">暂无库存数据</div>
</template>
</el-table>
</div>
<div class="task-panel__body">
<!-- <p class="task-panel__form-tip">
{{ isLocationMode ? locationAlertText : goodsAlertText }}
</p> -->
<!-- 分页 -->
<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"
background
size="small"
@current-change="loadRows"
@size-change="handleSizeChange"
/>
</div>
</template>
<!-- ===== 商品类任务:从库存明细挑选商品 → stock_ids ===== -->
<template v-if="!isLocationMode">
<!-- 筛选行 -->
<div class="task-panel__toolbar">
<div class="task-panel__toolbar-main">
<el-input
v-model="filters.keyword"
size="small"
clearable
placeholder="商品编码 / 名称 / 条码"
class="filter-item filter-item--keyword"
@keyup.enter="handleSearch"
/>
<el-input
v-model="filters.batch_no"
size="small"
clearable
placeholder="批次号"
class="filter-item"
@keyup.enter="handleSearch"
/>
<el-button size="small" type="primary" :loading="loading" @click="handleSearch">
查询
</el-button>
<el-button size="small" @click="handleResetFilters">重置</el-button>
</div>
</div>
<!-- 库存列表 -->
<div class="task-panel__section">
<!-- <div class="task-panel__section-head">
<span class="task-panel__section-title">库存明细</span>
<span class="task-panel__section-meta">已选 {{ selectedRows.length }} 行</span>
</div> -->
<div ref="tableHostRef" class="picker-table">
<el-table
ref="tableRef"
v-loading="loading"
:data="rows"
:row-key="(row: any) => row._key"
border
stripe
size="small"
:height="tableHeight"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="45" :reserve-selection="true" />
<el-table-column prop="item_code" label="商品编码" min-width="130" show-overflow-tooltip />
<el-table-column prop="item_name" label="商品名称" min-width="160" show-overflow-tooltip />
<el-table-column prop="spec" label="规格" min-width="110" show-overflow-tooltip />
<el-table-column prop="store_name" label="货主" min-width="110" show-overflow-tooltip />
<el-table-column prop="space_code" label="库位" min-width="120" show-overflow-tooltip />
<el-table-column prop="batch_no" label="批次号" min-width="110" show-overflow-tooltip />
<el-table-column prop="quantity" label="库存数量" width="100" align="center" />
<el-table-column prop="available_quantity" label="可用数量" width="100" align="center" />
<template #empty>
<div class="empty-tip">暂无库存数据</div>
</template>
</el-table>
</div>
</div>
</template>
<!-- ===== 库位类任务:勾选库位(location_ids)→ addLocationDetail ===== -->
<template v-else>
<el-alert
type="info"
:closable="false"
show-icon
:title="locationAlertText"
/>
<!-- 库位筛选 -->
<div class="picker-filters">
<el-input
v-model="spaceFilters.keyword"
size="small"
clearable
placeholder="库位编码 / 自定义名称 / 自定义编码"
class="filter-item filter-item--keyword"
@keyup.enter="handleSpaceSearch"
/>
<el-button size="small" type="primary" :loading="spaceLoading" @click="handleSpaceSearch">
查询
</el-button>
<el-button size="small" @click="handleSpaceReset">重置</el-button>
<div class="task-panel__toolbar">
<div class="task-panel__toolbar-main">
<el-input
v-model="spaceFilters.keyword"
size="small"
clearable
placeholder="库位编码 / 自定义名称 / 自定义编码"
class="filter-item filter-item--keyword"
@keyup.enter="handleSpaceSearch"
/>
<el-button size="small" type="primary" :loading="spaceLoading" @click="handleSpaceSearch">
查询
</el-button>
<el-button size="small" @click="handleSpaceReset">重置</el-button>
</div>
</div>
<!-- 库位列表(多选,跨页保留勾选) -->
<div ref="spaceTableHostRef" class="table-host">
<el-table
ref="spaceTableRef"
v-loading="spaceLoading"
:data="spaceRows"
:row-key="(row: any) => row.id"
border
stripe
size="small"
:height="tableHeight"
@selection-change="handleSpaceSelectionChange"
>
<el-table-column type="selection" width="45" :reserve-selection="true" />
<el-table-column prop="id" label="库位ID" width="90" align="center" />
<el-table-column prop="custom_name" label="自定义名称" min-width="140" show-overflow-tooltip />
<el-table-column prop="custom_code" label="自定义编码" min-width="140" show-overflow-tooltip />
<el-table-column prop="space_code" label="库位编码" min-width="150" show-overflow-tooltip />
<div class="task-panel__section">
<div class="task-panel__section-head">
<span class="task-panel__section-title">库位列表</span>
<span class="task-panel__section-meta">已选 {{ selectedLocationIds.length }} 个</span>
</div>
<div ref="spaceTableHostRef" class="picker-table">
<el-table
ref="spaceTableRef"
v-loading="spaceLoading"
:data="spaceRows"
:row-key="(row: any) => row.id"
border
stripe
size="small"
:height="tableHeight"
@selection-change="handleSpaceSelectionChange"
>
<el-table-column type="selection" width="45" :reserve-selection="true" />
<el-table-column prop="id" label="库位ID" width="90" align="center" />
<el-table-column prop="custom_name" label="自定义名称" min-width="140" show-overflow-tooltip />
<el-table-column prop="custom_code" label="自定义编码" min-width="140" show-overflow-tooltip />
<el-table-column prop="space_code" label="库位编码" min-width="150" show-overflow-tooltip />
<template #empty>
<div class="empty-tip">暂无库位数据</div>
</template>
</el-table>
</div>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination
v-model:current-page="spacePagination.page"
v-model:page-size="spacePagination.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="spacePagination.total"
layout="total, sizes, prev, pager, next"
background
size="small"
@current-change="loadSpaceRows"
@size-change="handleSpaceSizeChange"
/>
<template #empty>
<div class="empty-tip">暂无库位数据</div>
</template>
</el-table>
</div>
</div>
<!-- 已勾选库位 -->
@ -208,12 +212,37 @@
</el-collapse-item>
</el-collapse>
</template>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<span class="selected-tip">{{ submitChannelTip }}</span>
<div class="footer-buttons">
<footer class="task-panel__foot">
<span class="task-panel__hint">{{ submitChannelTip }}</span>
<div class="task-panel__actions">
<el-pagination
v-if="!isLocationMode"
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"
background
size="small"
class="picker-pagination"
@current-change="loadRows"
@size-change="handleSizeChange"
/>
<el-pagination
v-else
v-model:current-page="spacePagination.page"
v-model:page-size="spacePagination.pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="spacePagination.total"
layout="total, sizes, prev, pager, next"
background
size="small"
class="picker-pagination"
@current-change="loadSpaceRows"
@size-change="handleSpaceSizeChange"
/>
<el-button size="small" @click="handleVisibleChange(false)">取消</el-button>
<el-button
size="small"
@ -225,8 +254,8 @@
确认添加
</el-button>
</div>
</div>
</template>
</footer>
</div>
</el-dialog>
</template>
@ -753,34 +782,184 @@ watch(
</script>
<style lang="scss" scoped>
.picker-body {
/* 面板结构 / 尺寸对齐 storage/receiving「批量导入商品」 */
.task-panel {
display: flex;
flex-direction: column;
gap: 8px;
}
max-height: calc(100vh - 96px);
background: #fff;
color: #303133;
/* 筛选行:不要套卡片,仅做对齐 + 单行 */
.picker-filters {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
flex-shrink: 0;
.filter-item {
width: 200px;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 16px 8px;
flex-shrink: 0;
}
.filter-item--keyword {
width: 260px;
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 6px 16px 0;
display: flex;
flex-direction: column;
overflow-y: auto;
}
&__toolbar {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
&__toolbar-main {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
min-width: 0;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
&__form-tip {
margin: 0;
padding: 8px 12px;
border-radius: 4px;
background: #f4f4f5;
font-size: 12px;
line-height: 18px;
color: #909399;
}
&__section {
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 10px;
flex-shrink: 0;
}
&__section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
&__section-title {
font-size: 12px;
line-height: 20px;
color: #606266;
padding-left: 2px;
flex-shrink: 0;
}
&__section-meta {
font-size: 12px;
line-height: 20px;
color: #909399;
}
&__foot {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 12px;
padding: 12px 16px 16px;
flex-shrink: 0;
}
&__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
color: #909399;
}
&__actions {
display: flex;
align-items: center;
gap: 8px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}
.table-host {
flex: 1;
min-height: 200px;
min-width: 0;
/* 筛选输入框宽度 */
.filter-item {
width: 200px;
}
.filter-item--keyword {
width: 260px;
}
/* 表格固定高度:数据少也保持同样大小,超出时表格内部滚动(短屏自适应) */
.picker-table {
height: min(520px, calc(100vh - 340px));
border-radius: 4px;
overflow: hidden;
/* 勾选列(表头 + 数据单元格)复选框居中显示 */
:deep(.el-table-column--selection .cell) {
display: flex;
align-items: center;
justify-content: center;
padding: 0;
}
}
.empty-tip {
@ -796,11 +975,13 @@ watch(
gap: 6px;
max-height: 120px;
overflow-y: auto;
margin-top: 10px;
}
/* 库位模式:手动输入库位编码(兼容通道) */
.location-manual {
flex-shrink: 0;
margin-top: 8px;
border-top: none;
:deep(.el-collapse-item__header) {
@ -829,12 +1010,23 @@ watch(
color: #909399;
}
/* 分页器:右对齐 + 「每页条数」下拉与 UpperTable 同宽 80px */
.pagination-container {
flex-shrink: 0;
display: flex;
justify-content: flex-end;
align-items: center;
/* 分页位于页脚按钮左侧;尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
.picker-pagination {
flex: none;
margin-right: 4px;
:deep(.el-pagination) {
flex-wrap: wrap;
justify-content: flex-end;
--el-pagination-button-width: 28px;
--el-pagination-button-height: 28px;
}
:deep(.el-pagination__total),
:deep(.el-pagination__sizes) {
display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
@ -844,22 +1036,20 @@ watch(
padding: 0 4px;
}
}
</style>
.dialog-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
<style lang="scss">
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板 */
.el-dialog.check-stock-picker-dialog {
padding: 0;
overflow: hidden;
.selected-tip {
font-size: 12px;
color: #909399;
.el-dialog__header {
display: none;
}
.footer-buttons {
display: flex;
align-items: center;
gap: 8px;
.el-dialog__body {
padding: 0;
}
}
</style>