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

View File

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

View File

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

View File

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

View File

@ -146,7 +146,7 @@
</div> </div>
<div class="detail-container" v-loading="detailLoading"> <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"> <template v-if="detailRecord">
<!-- 主表信息 --> <!-- 主表信息 -->
<div class="section"> <div class="section">
@ -1089,8 +1089,8 @@ onMounted(() => {
color: #c0c4cc; color: #c0c4cc;
} }
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px, /* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(拆包详情面板自带
由各详情页自身 padding 控制上下留白 */ padding: 6px 10px 8px),左右 10px,内容滚动交给各 detail-page */
.order-sub-container .main-content .lower-level .detail-container { .order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px; padding: 0 10px;
} }
@ -1120,13 +1120,28 @@ onMounted(() => {
line-height: 1.4; line-height: 1.4;
} }
.detail-descriptions :deep(.el-descriptions__label) { .detail-descriptions {
width: 110px; :deep(.el-descriptions__label) {
background: #fafbfc; width: 110px;
font-weight: 500; 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 { .copyable {
cursor: pointer; cursor: pointer;
color: #409eff; color: #409eff;

View File

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

View File

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

View File

@ -1,99 +1,153 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="批量导入包材" class="package-material-import-dialog"
width="min(1080px, 96vw)"
align-center align-center
width="1020px"
append-to-body append-to-body
:show-close="false"
destroy-on-close destroy-on-close
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="batch-import-toolbar"> <!-- 面板结构 / 尺寸对齐 storage/receiving「批量导入商品」 -->
<input <div class="task-panel">
ref="importInputRef" <header class="task-panel__head">
type="file" <div class="task-panel__titles">
accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" <h2>批量导入包材</h2>
style="display: none" <p>选择 Excel 文件后在此预览导入结果,失败行可单独重试</p>
@change="handleFileChange" </div>
/> <button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<el-button size="small" @click="triggerFileSelect">选择Excel</el-button> <svg viewBox="0 0 12 12" fill="none">
<el-button size="small" @click="downloadTemplate">下载模板</el-button> <path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
<el-button size="small" @click="clearData">清除数据</el-button> </svg>
<el-button size="small" :loading="retryLoading" @click="retryFailedRows">只重试失败</el-button> </button>
<el-button size="small" type="primary" :loading="importLoading" @click="submitBatchImport">导入</el-button> </header>
<span class="picker-hint">已选文件:{{ fileName || '未选择' }}</span>
</div>
<div class="picker-table-wrap"> <div class="task-panel__body">
<UpperTable <input
:data="previewRows" ref="importInputRef"
:show-selection="false" type="file"
:pagination="{ currentPage: 1, pageSize: 200, total: previewRows.length }" accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:columns="previewColumns" style="display: none"
> @change="handleFileChange"
<template #column-row_no="{ row }"> />
{{ row.row_no }}
</template> <div class="task-panel__toolbar">
<template #column-material_code="{ row }"> <div class="task-panel__toolbar-main">
<span :class="{ 'cell-required-empty': !row.material_code && row.import_status !== '成功' }"> <el-button size="small" @click="triggerFileSelect">选择Excel</el-button>
{{ row.material_code || '--' }} <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> </span>
</template> </div>
<template #column-material_name="{ row }">
<span :class="{ 'cell-required-empty': !row.material_name && row.import_status !== '成功' }"> <div class="task-panel__section">
{{ row.material_name || '--' }} <div class="batch-import-table">
</span> <UpperTable
</template> ref="tableRef"
<template #column-length="{ row }"> :data="pagedRows"
{{ formatCellNumber(row.length) }} :show-selection="false"
</template> :show-pagination="false"
<template #column-width="{ row }"> default-align="center"
{{ formatCellNumber(row.width) }} empty-text="请先选择 Excel 文件"
</template> :pagination="{
<template #column-height="{ row }"> currentPage: page,
{{ formatCellNumber(row.height) }} pageSize,
</template> total: previewRows.length,
<template #column-weight="{ row }"> }"
{{ formatCellNumber(row.weight) ? formatCellNumber(row.weight) + 'g' : '--' }} :columns="previewColumns"
</template> >
<template #column-cost_price="{ row }"> <template #column-row_no="{ row }">
{{ formatCellNumber(row.cost_price) }} {{ row.row_no }}
</template> </template>
<template #column-status="{ row }"> <template #column-material_code="{ row }">
{{ formatStatusLabel(row.status) }} <span :class="{ 'cell-required-empty': !row.material_code && row.import_status !== '成功' }">
</template> {{ row.material_code || '--' }}
<template #column-import_status="{ row }"> </span>
<el-tag v-if="row.import_status === '成功'" type="success" size="small">成功</el-tag> </template>
<el-tag v-else-if="row.import_status === '失败'" type="danger" size="small">失败</el-tag> <template #column-material_name="{ row }">
<el-tag v-else type="info" size="small">待导入</el-tag> <span :class="{ 'cell-required-empty': !row.material_name && row.import_status !== '成功' }">
</template> {{ row.material_name || '--' }}
<template #column-import_message="{ row }"> </span>
{{ row.import_message || '--' }} </template>
</template> <template #column-length="{ row }">
<template #column-retry_action="{ row }"> {{ formatCellNumber(row.length) }}
<el-button </template>
v-if="row.import_status === '失败'" <template #column-width="{ row }">
type="primary" {{ formatCellNumber(row.width) }}
link </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" size="small"
:loading="row._retrying" class="batch-import-pagination"
@click="retrySingleRow(row)" @current-change="handlePageChange"
> @size-change="handlePageSizeChange"
重试 />
</el-button> <el-button size="small" @click="visible = false">关闭</el-button>
<span v-else>--</span> </div>
</template> </footer>
</UpperTable>
</div> </div>
<template #footer>
<el-button size="small" @click="visible = false">关闭</el-button>
</template>
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { computed, nextTick, ref, watch } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import * as XLSX from 'xlsx' import * as XLSX from 'xlsx'
import UpperTable from '@/components/UpperTable/index.vue' import UpperTable from '@/components/UpperTable/index.vue'
@ -120,6 +174,15 @@ interface ImportPreviewRow extends PackageMaterialRecord {
const previewRows = ref<ImportPreviewRow[]>([]) 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 = [ const previewColumns = [
{ prop: 'row_no', label: '行号', width: '70' }, { prop: 'row_no', label: '行号', width: '70' },
{ prop: 'material_code', label: '包材编码', minWidth: '120' }, { prop: 'material_code', label: '包材编码', minWidth: '120' },
@ -141,9 +204,39 @@ watch(visible, (opened) => {
if (!opened) { if (!opened) {
fileName.value = '' fileName.value = ''
previewRows.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() { function triggerFileSelect() {
importInputRef.value?.click() importInputRef.value?.click()
} }
@ -172,6 +265,7 @@ function downloadTemplate() {
function clearData() { function clearData() {
previewRows.value = [] previewRows.value = []
fileName.value = '' fileName.value = ''
page.value = 1
if (importInputRef.value) { if (importInputRef.value) {
importInputRef.value.value = '' importInputRef.value.value = ''
} }
@ -297,6 +391,7 @@ async function handleFileChange(event: Event) {
return return
} }
previewRows.value = rows previewRows.value = rows
page.value = 1
ElMessage.success(`已解析 ${rows.length} 条包材数据`) ElMessage.success(`已解析 ${rows.length} 条包材数据`)
} catch (error) { } catch (error) {
console.error('解析 Excel 失败', error) console.error('解析 Excel 失败', error)
@ -428,23 +523,182 @@ async function retrySingleRow(row: ImportPreviewRow) {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.batch-import-toolbar { /* 面板结构 / 尺寸对齐 storage/receiving「批量导入商品」 */
.task-panel {
display: flex; display: flex;
align-items: center; flex-direction: column;
gap: 8px; height: min(680px, calc(100vh - 96px));
margin-bottom: 12px; background: #fff;
flex-wrap: wrap; 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; 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; 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; .batch-import-table {
overflow: auto; 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 { .cell-required-empty {
@ -452,3 +706,20 @@ async function retrySingleRow(row: ImportPreviewRow) {
font-weight: 500; font-weight: 500;
} }
</style> </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 <sync-order-ids-form
v-model="syncOrderIdsDialogVisible" v-model="syncOrderIdsDialogVisible"
:order-count="selectionRows.length" :order-count="selectionRows.length"
:order-ids="getSelectedIds()"
:loading="syncOrderIdsLoading" :loading="syncOrderIdsLoading"
:request-id="syncOrderIdsRequestId" :request-id="syncOrderIdsRequestId"
:task-status="syncOrderIdsTaskStatus" :task-status="syncOrderIdsTaskStatus"

View File

@ -24,17 +24,20 @@
@submit="emit('submit')" @submit="emit('submit')"
> >
<template #footer> <template #footer>
<template v-if="isProgress"> <!-- 页脚按钮间距对齐顶部工具栏(OrderToolbarButtonGroup:gap 6px) -->
<el-button size="small" @click="visible = false"> <div class="storage-allocate-footer">
{{ progressState === 'running' ? '后台运行' : '关闭' }} <template v-if="isProgress">
</el-button> <el-button size="small" @click="visible = false">
</template> {{ progressState === 'running' ? '后台运行' : '关闭' }}
<template v-else> </el-button>
<el-button size="small" @click="visible = false">取消</el-button> </template>
<el-button size="small" type="primary" :loading="loading" @click="emit('submit')"> <template v-else>
{{ submitButtonText }} <el-button size="small" @click="visible = false">取消</el-button>
</el-button> <el-button size="small" type="primary" :loading="loading" @click="emit('submit')">
</template> {{ submitButtonText }}
</el-button>
</template>
</div>
</template> </template>
</UnifiedTaskProgressDialog> </UnifiedTaskProgressDialog>
</template> </template>
@ -165,3 +168,18 @@ function handleToggleField(field: ProgressFormField) {
} }
} }
</script> </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')" @closed="emit('closed')"
@submit="emit('submit')" @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 #footer>
<template v-if="isProgress"> <!-- 页脚按钮间距对齐顶部工具栏(OrderToolbarButtonGroup:gap 6px) -->
<el-button size="small" @click="visible = false"> <div class="sync-order-ids-footer">
{{ progressState === 'running' ? '后台运行' : '关闭' }} <template v-if="isProgress">
</el-button> <el-button size="small" @click="visible = false">
</template> {{ progressState === 'running' ? '后台运行' : '关闭' }}
<template v-else> </el-button>
<el-button size="small" @click="visible = false">取消</el-button> </template>
<el-button size="small" type="primary" :loading="loading" @click="emit('submit')"> <template v-else>
确认同步 <el-button size="small" @click="visible = false">取消</el-button>
</el-button> <el-button size="small" type="primary" :loading="loading" @click="emit('submit')">
</template> 确认同步
</el-button>
</template>
</div>
</template> </template>
</UnifiedTaskProgressDialog> </UnifiedTaskProgressDialog>
</template> </template>
<script setup lang="ts"> <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 UnifiedTaskProgressDialog from '@/components/task-progress/UnifiedTaskProgressDialog.vue'
import type { ProgressFormField, ProgressMetricItem, ProgressState } from '@/components/task-progress/types' import type { ProgressFormField, ProgressMetricItem, ProgressState } from '@/components/task-progress/types'
@ -47,6 +88,8 @@ const visible = defineModel<boolean>({ default: false })
const props = defineProps<{ const props = defineProps<{
orderCount: number orderCount: number
/** 当前勾选的订单 ID(提交前展示,便于核对) */
orderIds?: Array<number | string>
loading: boolean loading: boolean
requestId?: string requestId?: string
taskStatus?: string taskStatus?: string
@ -125,9 +168,56 @@ const progressDetail = computed(() => {
}) })
const formFields = computed<ProgressFormField[]>(() => [ 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 progressMetrics = computed<ProgressMetricItem[]>(() => {
const metrics: ProgressMetricItem[] = [] const metrics: ProgressMetricItem[] = []
if (props.totalCount != null) metrics.push({ label: '总数', value: props.totalCount }) if (props.totalCount != null) metrics.push({ label: '总数', value: props.totalCount })
@ -137,3 +227,92 @@ const progressMetrics = computed<ProgressMetricItem[]>(() => {
return metrics return metrics
}) })
</script> </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 <sync-order-ids-form
v-model="syncOrderIdsDialogVisible" v-model="syncOrderIdsDialogVisible"
:order-count="selectionRows.length" :order-count="selectionRows.length"
:order-ids="getSelectedIds()"
:loading="syncOrderIdsLoading" :loading="syncOrderIdsLoading"
:request-id="syncOrderIdsRequestId" :request-id="syncOrderIdsRequestId"
:task-status="syncOrderIdsTaskStatus" :task-status="syncOrderIdsTaskStatus"

View File

@ -368,12 +368,10 @@
show-selection show-selection
table-size="small" table-size="small"
:pagination="groupOrderPagination" :pagination="groupOrderPagination"
:page-sizes="[10, 20, 50, 100]" :show-pagination="false"
:query-time="groupOrderQueryTime" :query-time="groupOrderQueryTime"
empty-text="暂无可抓取的团购单结构" empty-text="暂无可抓取的团购单结构"
@selection-change="handleGroupOrderSelectionChange" @selection-change="handleGroupOrderSelectionChange"
@page-change="handleGroupOrderPageChange"
@page-size-change="handleGroupOrderPageSizeChange"
> >
<template #column-store_name="{ row }"> <template #column-store_name="{ row }">
{{ getGroupOrderStoreText(row) }} {{ getGroupOrderStoreText(row) }}
@ -400,8 +398,26 @@
</div> </div>
</div> </div>
<template #footer> <template #footer>
<el-button size="small" @click="groupOrderDialogVisible = false">取消</el-button> <!-- 页脚:左侧提示 + 分页与按钮同一水平行(对齐 storage/receiving「批量导入商品」) -->
<el-button size="small" type="primary" :loading="groupOrderSubmitting" @click="submitGroupOrderDialog">抓取选中结构</el-button> <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> </template>
</el-dialog> </el-dialog>
@ -4208,6 +4224,59 @@ async function submitFallbackOrderFetchByIds() {
flex-direction: column; 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 { .group-order-selected-count {
margin-left: 12px; margin-left: 12px;

View File

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

View File

@ -810,8 +810,6 @@ onMounted(() => {
/* 基本信息 / 商品图片面板:分区标题统一样式(对齐 express/waybill「运单明细」新样式) */ /* 基本信息 / 商品图片面板:分区标题统一样式(对齐 express/waybill「运单明细」新样式) */
.detail-panel, .detail-panel,
.image-panel { .image-panel {
padding: 8px 0;
.section-title { .section-title {
font-size: 14px; font-size: 14px;
font-weight: 600; 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 { .detail-panel .detail-descriptions {
:deep(.el-descriptions__label) { :deep(.el-descriptions__label) {
width: 120px; width: 110px;
min-width: 110px;
background: #fafbfc; background: #fafbfc;
font-weight: 500; font-weight: 500;
} }
:deep(.el-descriptions__content) {
word-break: break-word;
}
} }
.empty-tip { .empty-tip {

View File

@ -1,58 +1,67 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="货单绑定到入库单"
width="1200px"
class="entry-bind-dialog" class="entry-bind-dialog"
width="min(1200px, 96vw)"
align-center align-center
append-to-body append-to-body
:show-close="false"
destroy-on-close destroy-on-close
:close-on-click-modal="false"
@closed="handleClosed" @closed="handleClosed"
> >
<div class="bind-dialog-content"> <!-- 面板结构对齐「批量导入商品」/「查询系统商品」等 task-panel 弹窗 -->
<div v-if="entryOrderCode" class="entry-order-summary"> <div class="task-panel">
<span class="summary-inline"> <header class="task-panel__head">
<span class="summary-label">入库单号</span> <div class="task-panel__titles">
<span class="summary-value">{{ entryOrderCode }}</span> <h2>货单绑定到入库单</h2>
</span> <p>勾选已审核的收货单,左侧实时对照入库单与收货单的商品与数量</p>
<span v-if="entryStoreName" class="summary-inline"> </div>
<span class="summary-label">货主</span> <button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<span class="summary-value">{{ entryStoreName }}</span> <svg viewBox="0 0 12 12" fill="none">
</span> <path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
<span v-if="entryOrderStatusLabel" class="summary-inline"> </svg>
<span class="summary-label">订单状态</span> </button>
<el-tag size="small" :type="entryOrderStatusTag">{{ entryOrderStatusLabel }}</el-tag> </header>
</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>
<div class="bind-dialog-body"> <div class="task-panel__body">
<div class="bind-dialog-layout"> <!-- 入库单关键信息:单行展示,不占表格空间 -->
<section class="bind-dialog-center"> <div class="entry-summary">
<div class="compare-table"> <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 class="compare-group-header">
<div <div
v-for="(group, groupIndex) in entryBindCompareGroupHeaders" v-for="(group, groupIndex) in entryBindCompareGroupHeaders"
@ -109,21 +118,28 @@
</div> </div>
</section> </section>
<section class="bind-dialog-right"> <section class="bind-column bind-column--receiving">
<div class="panel-title">收货表单</div> <!-- <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"> <div class="task-panel__toolbar">
<span v-if="entryStoreName" class="toolbar-meta">货主:{{ entryStoreName }}</span> <div class="task-panel__toolbar-main">
<span class="toolbar-meta">已审核 {{ pagination.total }} 条</span> <el-button size="small" :loading="receivingListLoading" @click="loadReceivingList">
<el-button size="small" :loading="receivingListLoading" @click="loadReceivingList"> 刷新
刷新 </el-button>
</el-button> </div>
<span v-if="entryStoreName" class="task-panel__file-hint" :title="entryStoreName">
货主:{{ entryStoreName }}
</span>
</div> </div>
<div ref="tableHostRef" class="receiving-table-wrap"> <div ref="tableHostRef" class="bind-table-wrap">
<el-table <el-table
ref="receivingTableRef" ref="receivingTableRef"
class="entry-bind-receiving-table"
v-loading="receivingListLoading" v-loading="receivingListLoading"
:data="receivingList" :data="receivingList"
border border
@ -156,38 +172,39 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </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> </section>
</div> </div>
</div> </div>
</div>
<template #footer> <footer class="task-panel__foot">
<el-button size="small" :disabled="bindSubmitting" @click="visible = false">取消</el-button> <span class="task-panel__hint" :class="{ 'is-warning': hintWarning }">{{ bindHintText }}</span>
<el-button <div class="task-panel__actions">
size="small" <el-pagination
type="primary" v-model:current-page="pagination.currentPage"
:loading="bindSubmitting" v-model:page-size="pagination.pageSize"
:disabled="!canSubmitBind" :total="pagination.total"
@click="handleBindSubmit" :page-sizes="[5, 10, 20, 50]"
> :disabled="receivingListLoading"
确认绑定 background
</el-button> size="small"
</template> 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> </el-dialog>
</template> </template>
@ -205,7 +222,6 @@ import {
type EntryDetailItem, type EntryDetailItem,
type EntryOrderDetail, type EntryOrderDetail,
type ReceivingCompareResponse, type ReceivingCompareResponse,
type ReceivingCompareItem,
type ReceivingCompareRow, type ReceivingCompareRow,
} from '@/api/storage.entry/entry' } from '@/api/storage.entry/entry'
import { import {
@ -317,26 +333,6 @@ const entryOrderStatusLabel = computed(() => {
const entryOrderStatusTag = computed(() => getEntryOrderStatusTagType(props.row?.order_status)) 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(() => { const entryTotalQuantity = computed(() => {
// 1) 优先:接口在 entryOrder 外层返回的 total_quantity // 1) 优先:接口在 entryOrder 外层返回的 total_quantity
if (entryTotalQuantityRaw.value !== null && entryTotalQuantityRaw.value !== undefined) { if (entryTotalQuantityRaw.value !== null && entryTotalQuantityRaw.value !== undefined) {
@ -373,6 +369,21 @@ const canSubmitBind = computed(
!receivingListLoading.value !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 { function isApiSuccess(res: { code?: number; flag?: string } | null | undefined): boolean {
if (!res) return false if (!res) return false
if (res.code === 200 || res.code === 1) return true if (res.code === 200 || res.code === 1) return true
@ -856,86 +867,232 @@ watch(
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.bind-dialog-content { /* 面板结构 / 尺寸对齐「批量导入商品」(storage/receiving Product.vue) */
.task-panel {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: min(680px, calc(100vh - 96px));
min-height: 0; 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; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
gap: 8px 20px; gap: 4px 20px;
margin-bottom: 8px; padding: 6px 12px;
padding: 6px 10px; border: 1px solid #ebeef5;
background: #f5f7fa;
border-radius: 4px; border-radius: 4px;
flex-shrink: 0; background: #fafafa;
font-size: 12px; font-size: 12px;
line-height: 1.4; line-height: 20px;
} }
.summary-inline { .entry-summary__item {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
min-width: 0; min-width: 0;
} }
.summary-label { .entry-summary__label {
color: #909399; color: #909399;
white-space: nowrap; white-space: nowrap;
} }
.summary-value { .entry-summary__value {
color: #303133; color: #303133;
word-break: break-all; white-space: nowrap;
}
.summary-inline--remark {
flex-basis: 100%;
}
.summary-value--remark {
max-width: 600px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap;
} }
.bind-dialog-body { /* 左右两栏:对照表 / 收货单列表 */
.bind-layout {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
}
.bind-dialog-layout {
display: flex; display: flex;
gap: 12px; gap: 12px;
align-items: stretch;
height: 100%;
min-height: 0;
} }
.bind-dialog-center { .bind-column {
flex: 1;
min-width: 0;
min-height: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 10px; gap: 6px;
border: 1px solid #ebeef5; min-width: 0;
border-radius: 4px; min-height: 0;
background: #fff;
&--compare {
flex: 1 1 auto;
}
&--receiving {
flex: 0 0 430px;
width: 430px;
max-width: 430px;
}
} }
.compare-table { .compare-table {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; flex: 1;
min-height: 0; min-height: 0;
border: 1px solid #dcdfe6; border: 1px solid #ebeef5;
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
} }
@ -1052,109 +1209,55 @@ watch(
color: #606266; color: #606266;
} }
.bind-dialog-right { .bind-table-wrap {
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 {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow: hidden; min-width: 0;
display: flex;
flex-direction: column;
border: 1px solid #dcdfe6;
border-radius: 4px; border-radius: 4px;
overflow: hidden;
} }
.entry-bind-receiving-table { /* 页脚分页:与按钮同行,尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
:deep(.el-table__header th.el-table__cell) { .bind-pagination {
border-right: 1px solid #ebeef5; flex: none;
border-bottom: 1px solid #dcdfe6; margin-right: 4px;
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;
:deep(.el-pagination) { :deep(.el-pagination) {
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-end; 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>
<style lang="scss"> <style lang="scss">
/* /* el-dialog 会被 append 到 body:面板自带页头 / 页脚,去掉默认头 / 内边距 */
* 弹窗自带居中(position: fixed + translate)。 .el-dialog.entry-bind-dialog {
* 原来靠 `.el-overlay-dialog:has(> .el-dialog.entry-bind-dialog){display:flex;align-items:center;justify-content:center}` 居中, padding: 0;
* 但下面同时给弹窗写了 `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;
overflow: hidden; overflow: hidden;
}
.el-overlay-dialog > .el-dialog.entry-bind-dialog .el-dialog__body { .el-dialog__header,
flex: 1; .el-dialog__footer {
min-height: 0; display: none;
overflow: hidden; }
.el-dialog__body {
padding: 0;
}
} }
</style> </style>

View File

@ -1,8 +1,10 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
:title="isBatchMode ? '批量导入入库' : '导入入库'" :class="{ 'direct-inbound-batch-dialog': isBatchMode }"
:width="isBatchMode ? '980px' : '520px'" :title="isBatchMode ? undefined : '导入入库'"
:width="isBatchMode ? 'min(1080px, 96vw)' : '520px'"
:show-close="!isBatchMode"
align-center align-center
append-to-body append-to-body
destroy-on-close destroy-on-close
@ -90,113 +92,141 @@
</el-form> </el-form>
</template> </template>
<template v-else-if="isBatchMode"> <!-- 批量导入:面板结构 / 尺寸对齐 storage/receiving「批量导入商品」 -->
<div class="batch-import-panel"> <div v-else-if="isBatchMode" class="task-panel">
<el-alert <header class="task-panel__head">
type="info" <div class="task-panel__titles">
:closable="false" <h2>批量导入入库</h2>
show-icon <p>上传与入库明细字段一致的 Excel,至少填写「SKU」和「入库数量」(或「实收数量」),解析后可在此调整</p>
title="请上传与入库明细表格字段一致的 Excel 文件,至少填写「SKU」和「入库数量」(或「实收数量」)。解析后可在下方表格中手动修改。" </div>
class="batch-tip" <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"> <div class="task-panel__body">
<el-button size="small" @click="handleDownloadTemplate">下载模板</el-button> <div class="task-panel__toolbar">
<el-upload <div class="task-panel__toolbar-main">
accept=".xlsx,.xls" <el-upload
:auto-upload="false" accept=".xlsx,.xls"
:show-file-list="false" :auto-upload="false"
:disabled="submitting || parsing" :show-file-list="false"
@change="handleFileChange" :disabled="submitting || parsing"
> @change="handleFileChange"
<el-button size="small" type="primary" :loading="parsing">选择 Excel 文件</el-button> >
</el-upload> <el-button size="small" type="primary" :loading="parsing" :disabled="submitting">
<span v-if="importFileName" class="file-name">{{ importFileName }}</span> 选择 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> </div>
<el-table <div class="task-panel__section">
v-if="parsedRows.length" <div class="batch-import-table">
:data="pagedParsedRows" <UpperTable
border :data="pagedParsedRows"
size="small" row-key="rowIndex"
max-height="360" :show-selection="false"
> :show-pagination="false"
<el-table-column prop="rowIndex" label="Excel行" width="72" align="center" /> default-align="center"
<el-table-column prop="stock_id" label="SKU" width="90" align="right" /> empty-text="请先选择 Excel 文件"
<el-table-column prop="warehouse_item_code" label="商品编码" min-width="120" show-overflow-tooltip /> :pagination="{
<el-table-column prop="warehouse_item_name" label="商品名称" min-width="140" show-overflow-tooltip /> currentPage: parsedPage,
<el-table-column prop="remaining_quantity" label="剩余可入" width="82" align="right" /> pageSize: parsedPageSize,
<el-table-column label="入库数量" width="120" align="center"> total: parsedRows.length,
<template #default="{ row }"> }"
<el-input-number :columns="batchImportColumns"
v-model="row.quantity" >
:min="1" <template #column-quantity="{ row }">
:max="getBatchRowMaxQuantity(row)" <el-input-number
:precision="0" v-model="row.quantity"
size="small" :min="1"
controls-position="right" :max="getBatchRowMaxQuantity(row)"
style="width: 100%" :precision="0"
/> size="small"
</template> controls-position="right"
</el-table-column> style="width: 100%"
<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"
/> />
</el-select> </template>
</template> <template #column-inbound_type="{ row }">
</el-table-column> <el-select v-model="row.inbound_type" size="small" style="width: 100%">
<el-table-column label="库位ID" width="168"> <el-option
<template #default="{ row }"> v-for="opt in directInboundInboundTypeOptions"
<div class="batch-cell-action"> :key="opt.value"
<span class="space-keyword-text">{{ row.space_keyword || '--' }}</span> :label="opt.label"
<el-button type="primary" link size="small" @click="openBatchRowSpacePicker(row)"> :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> </el-button>
</div> </template>
</template> </UpperTable>
</el-table-column> </div>
<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
/>
</div> </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> <template #footer>
<el-button size="small" :disabled="submitting" @click="visible = false">取消</el-button> <template v-if="!isBatchMode">
<el-button <el-button size="small" :disabled="submitting" @click="visible = false">取消</el-button>
size="small" <el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">
type="primary" 确认导入
:loading="submitting" </el-button>
:disabled="isBatchMode && !parsedRows.length" </template>
@click="handleSubmit"
>
确认导入
</el-button>
</template> </template>
</el-dialog> </el-dialog>
@ -229,6 +259,8 @@
:loading="spaceLoading" :loading="spaceLoading"
:show-selection="true" :show-selection="true"
:multiple-selection="spaceSelection" :multiple-selection="spaceSelection"
:show-pagination="false"
default-align="center"
:pagination="{ :pagination="{
currentPage: spacePagination.page, currentPage: spacePagination.page,
pageSize: spacePagination.pageSize, pageSize: spacePagination.pageSize,
@ -242,14 +274,26 @@
]" ]"
@selection-change="handleSpaceSelectionChange" @selection-change="handleSpaceSelectionChange"
@row-click="handleSpaceRowClick" @row-click="handleSpaceRowClick"
@page-change="querySpaces"
@page-size-change="onSpacePageSizeChange"
/> />
</div> </div>
</div> </div>
<template #footer> <template #footer>
<el-button size="small" @click="spacePickerVisible = false">取消</el-button> <div class="picker-footer">
<el-button size="small" type="primary" @click="applySelectedSpace">使用选中库位</el-button> <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> </template>
</el-dialog> </el-dialog>
</template> </template>
@ -313,6 +357,20 @@ const pagedParsedRows = computed(() => {
return parsedRows.value.slice(start, start + parsedPageSize.value) 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({ const singleForm = reactive({
quantity: 1, quantity: 1,
inbound_type: 'import' as 'import' | 'pda', inbound_type: 'import' as 'import' | 'pda',
@ -521,6 +579,10 @@ function onSpacePageSizeChange(size: number) {
void querySpaces(1) void querySpaces(1)
} }
function onSpacePageChange(page: number) {
void querySpaces(page)
}
async function querySpaces(page = 1) { async function querySpaces(page = 1) {
spaceLoading.value = true spaceLoading.value = true
try { try {
@ -785,31 +847,180 @@ async function handleSubmit() {
} }
} }
.batch-import-panel { /* 批量导入入库面板:结构 / 尺寸对齐 storage/receiving「批量导入商品」 */
.batch-tip { .task-panel {
margin-bottom: 12px; 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; display: flex;
align-items: center; align-items: center;
gap: 8px; 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 { :deep(.el-pagination__total),
font-size: 12px; :deep(.el-pagination__sizes) {
color: #606266; display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
}
:deep(.el-input__wrapper) {
padding: 0 4px;
} }
} }
.batch-cell-action { .batch-cell-action {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
gap: 6px; gap: 6px;
min-width: 0;
.space-keyword-text { .space-keyword-text {
flex: 1;
min-width: 0; min-width: 0;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -833,4 +1044,34 @@ async function handleSubmit() {
.picker-table-wrap { .picker-table-wrap {
height: 440px; 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> </style>

View File

@ -1,62 +1,69 @@
<template> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="解除收货单绑定"
width="780px"
class="entry-unbind-dialog" class="entry-unbind-dialog"
width="min(760px, 96vw)"
align-center align-center
append-to-body append-to-body
:show-close="false"
destroy-on-close destroy-on-close
:close-on-click-modal="false"
@closed="handleClosed" @closed="handleClosed"
> >
<div class="unbind-content"> <!-- 面板结构对齐「批量导入商品」/「货单绑定到入库单」等 task-panel 弹窗 -->
<!-- 入库单摘要(对应接口入参 entry_order_id 的主表信息) --> <div class="task-panel">
<div v-if="entryOrderCode" class="entry-order-summary"> <header class="task-panel__head">
<span class="summary-inline"> <div class="task-panel__titles">
<span class="summary-label">入库单号</span> <h2>解除收货单绑定</h2>
<span class="summary-value">{{ entryOrderCode }}</span> <p>解除所选收货单与本入库单的关联,并按数量台账回滚其已入库进度</p>
</span> </div>
<span v-if="entryOrderId" class="summary-inline"> <button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
<span class="summary-label">入库单ID</span> <svg viewBox="0 0 12 12" fill="none">
<span class="summary-value">{{ entryOrderId }}</span> <path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</span> </svg>
<span v-if="entryStoreName" class="summary-inline"> </button>
<span class="summary-label">货主</span> </header>
<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>
<el-alert type="warning" :closable="false" show-icon class="unbind-tip"> <div class="task-panel__body">
<template #title> <!-- 入库单关键信息:单行展示 -->
解除绑定将释放所选收货单与本入库单的主表关联,并按数量台账<b>回滚其已入库进度</b>;仅「已创建 / 待入库」状态的入库单可解绑。 <div class="entry-summary">
</template> <span class="entry-summary__item">
</el-alert> <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(勾选收货单) --> <p class="task-panel__form-tip">
<el-form :model="form" label-width="120px" size="small" class="unbind-form"> 仅「已创建 / 待入库」状态的入库单可解绑;解绑后不可撤销,请谨慎操作。
<el-form-item label="入库单ID"> </p>
<el-input
:model-value="form.entry_order_id ? String(form.entry_order_id) : '—'"
disabled
placeholder="--"
/>
</el-form-item>
<el-form-item <div class="task-panel__section">
:label="'待解绑收货单' + (selectedRows.length ? `(${selectedRows.length})` : '')" <!-- <div class="task-panel__section-head">
> <span class="task-panel__section-title">已绑定收货单</span>
<div v-loading="bindingsLoading" class="receiving-table-wrap"> <span class="task-panel__section-meta">
已选 {{ selectedRows.length }} 条 · 共 {{ bindingRows.length }} 条
</span>
</div> -->
<div v-loading="bindingsLoading" class="unbind-table-wrap">
<el-table <el-table
ref="receivingTableRef" ref="receivingTableRef"
:data="bindingRows" :data="bindingRows"
border border
stripe stripe
size="small" size="small"
max-height="240" height="260"
row-key="rowKey" row-key="rowKey"
empty-text="该入库单暂无可解绑的收货单" empty-text="该入库单暂无可解绑的收货单"
:row-class-name="receivingRowClassName" :row-class-name="receivingRowClassName"
@ -83,61 +90,63 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div class="form-item-tip"> </div>
勾选已绑定的收货单,确认后将调用接口解除绑定并回滚入库进度。
</div>
</el-form-item>
</el-form>
<!-- 解绑结果明细(存在失败或部分成功时展示) --> <!-- 解绑结果明细(存在失败或部分成功时展示) -->
<div v-if="resultVisible" class="unbind-result"> <div v-if="resultVisible" class="unbind-result">
<div <div class="result-summary" :class="resultSummaryClass">
class="result-summary" {{ resultSummaryText }}
: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> </div>
</div> <div v-if="resultFailedRows.length" class="result-block">
<div v-if="resultSuccessRows.length" class="result-block"> <div class="result-block-title result-block-title--danger">
<div class="result-block-title result-block-title--success">成功明细({{ resultSuccessRows.length }})</div> 失败明细({{ resultFailedRows.length }})
<div v-for="item in resultSuccessRows" :key="'s-' + item.receiving_id" class="result-row"> </div>
<span class="result-receiving">{{ item.receiving_number || ('收货单#' + item.receiving_id) }}</span> <div v-for="item in resultFailedRows" :key="'f-' + item.receiving_id" class="result-row">
<el-tag size="small" type="success">已解绑</el-tag> <span class="result-receiving">{{ item.receiving_number || ('收货单#' + item.receiving_id) }}</span>
<span class="result-message"> <el-tag size="small" type="danger">{{ item.error_code_label }}</el-tag>
释放明细 {{ item.released_detail_count ?? 0 }} 条,回滚入库 {{ formatRollback(item.rolled_back_quantity) }} <span class="result-message">{{ item.message || '解绑失败' }}</span>
</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>
</div> </div>
</div>
<template #footer> <footer class="task-panel__foot">
<el-button size="small" :disabled="unbindSubmitting" @click="visible = false"> <span class="task-panel__hint" :class="{ 'is-warning': hintWarning }">{{ unbindHintText }}</span>
{{ resultVisible ? '关闭' : '取消' }} <div class="task-panel__actions">
</el-button> <el-button size="small" :disabled="unbindSubmitting" @click="visible = false">
<el-button {{ resultVisible ? '关闭' : '取消' }}
v-if="!resultVisible" </el-button>
size="small" <el-button
type="danger" v-if="!resultVisible"
:loading="unbindSubmitting" size="small"
:disabled="!canSubmitUnbind" type="danger"
@click="handleUnbindSubmit" :loading="unbindSubmitting"
> :disabled="!canSubmitUnbind"
确认解绑 @click="handleUnbindSubmit"
</el-button> >
</template> 确认解绑
</el-button>
</div>
</footer>
</div>
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <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 { ElMessage, ElMessageBox } from 'element-plus'
import type { TableInstance } from 'element-plus' import type { TableInstance } from 'element-plus'
import { getEntryDetail, unbindReceiving } from '@/api/storage.entry/entry' import { getEntryDetail, unbindReceiving } from '@/api/storage.entry/entry'
@ -210,8 +219,6 @@ const visible = computed({
set: (value: boolean) => emit('update:modelValue', value), 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 receivingTableRef = ref<TableInstance | null>(null)
const bindingsLoading = ref(false) const bindingsLoading = ref(false)
const unbindSubmitting = ref(false) const unbindSubmitting = ref(false)
@ -256,6 +263,18 @@ const canSubmitUnbind = computed(
() => !!entryOrderId.value && selectedRows.value.length > 0 && !unbindSubmitting.value && !bindingsLoading.value () => !!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(() => { const resultSummaryText = computed(() => {
return `处理完成:成功解绑 ${resultSuccessRows.value.length} 条,失败 ${resultFailedRows.value.length} 条` return `处理完成:成功解绑 ${resultSuccessRows.value.length} 条,失败 ${resultFailedRows.value.length} 条`
}) })
@ -364,7 +383,6 @@ function handleClosed() {
resultSuccessRows.value = [] resultSuccessRows.value = []
resultFailedRows.value = [] resultFailedRows.value = []
unbindSubmitting.value = false unbindSubmitting.value = false
form.entry_order_id = null
emit('closed') emit('closed')
} }
@ -479,81 +497,196 @@ watch(
() => [props.modelValue, props.row?.id, props.row?.order_status] as const, () => [props.modelValue, props.row?.id, props.row?.order_status] as const,
([open]) => { ([open]) => {
if (!open) return if (!open) return
form.entry_order_id = entryOrderId.value
void loadBoundReceivings() void loadBoundReceivings()
} }
) )
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.unbind-content { /* 面板结构 / 尺寸对齐「批量导入商品」(storage/receiving Product.vue) */
.task-panel {
display: flex; display: flex;
flex-direction: column; 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; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
gap: 8px 20px; gap: 4px 20px;
padding: 6px 10px; padding: 6px 12px;
background: #f5f7fa; border: 1px solid #ebeef5;
border-radius: 4px; border-radius: 4px;
background: #fafafa;
font-size: 12px; font-size: 12px;
line-height: 1.4; line-height: 20px;
} }
.summary-inline { .entry-summary__item {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
min-width: 0; min-width: 0;
} }
.summary-label { .entry-summary__label {
color: #909399; color: #909399;
white-space: nowrap; white-space: nowrap;
} }
.summary-value { .entry-summary__value {
color: #303133; color: #303133;
word-break: break-all; white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
.unbind-tip { .unbind-table-wrap {
:deep(.el-alert__title) { min-width: 0;
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;
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
} }
.form-item-tip {
margin-top: 4px;
font-size: 12px;
color: #909399;
line-height: 1.5;
}
.unbind-result { .unbind-result {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -628,3 +761,20 @@ watch(
pointer-events: none; pointer-events: none;
} }
</style> </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> <template>
<el-dialog <el-dialog
v-model="visible" v-model="visible"
title="库位商品查询" class="space-stock-dialog"
width="1000px" width="min(1000px, 96vw)"
align-center align-center
append-to-body append-to-body
:show-close="false"
destroy-on-close destroy-on-close
:close-on-click-modal="false"
@closed="handleClosed" @closed="handleClosed"
> >
<div class="space-stock-toolbar"> <!-- 面板结构对齐「批量导入商品」/「货单绑定到入库单」等 task-panel 弹窗 -->
<el-autocomplete <div class="task-panel">
v-model="keyword" <header class="task-panel__head">
class="space-keyword" <div class="task-panel__titles">
size="small" <h2>库位商品查询</h2>
clearable <p>扫码或输入库位编码 / 名称 / 库位ID,查看该库位下的有量库存</p>
value-key="label" </div>
:trigger-on-focus="false" <button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
:fetch-suggestions="fetchSpaceSuggestions" <svg viewBox="0 0 12 12" fill="none">
placeholder="扫码/输入库位编码、名称或库位ID" <path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
@select="handleSpaceSelect" </svg>
@keyup.enter="handleQuery" </button>
/> </header>
<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 class="space-meta"> <div class="task-panel__body">
<el-descriptions :column="4" size="small" border> <div class="task-panel__toolbar">
<el-descriptions-item label="库位ID">{{ formatInventoryOptionalText(spaceInfo?.id) }}</el-descriptions-item> <div class="task-panel__toolbar-main">
<el-descriptions-item label="库位编码">{{ formatInventoryOptionalText(spaceInfo?.space_code) }}</el-descriptions-item> <!-- ⚠️ 外层包裹层必须保留:el-autocomplete 根节点自带 `width: var(--el-input-width)=100%`,
<el-descriptions-item label="库位名称">{{ formatInventoryOptionalText(spaceInfo?.custom_name) }}</el-descriptions-item> 直接把 width 写在组件 class 上会被它撑满一整行,导致后面的按钮被挤到下一行 -->
<el-descriptions-item label="库位状态">{{ formatInventoryOptionalText(spaceInfo?.space_status) }}</el-descriptions-item> <div class="space-keyword">
</el-descriptions> <el-autocomplete
<div class="space-summary"> v-model="keyword"
<span>商品种类:{{ list.length }}</span> size="small"
<span>总数量:{{ summary.quantity }}</span> clearable
<span>可用数量:{{ summary.available }}</span> value-key="label"
<span>锁定数量:{{ summary.locked }}</span> :trigger-on-focus="false"
<span>拦截锁定:{{ summary.intercept }}</span> :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> </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> </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> </el-dialog>
</template> </template>
<script setup lang="ts"> <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 { ElMessage } from 'element-plus'
import type { TableInstance } from 'element-plus'
import * as inventoryApi from '@/api/storage.inventory/inventory' import * as inventoryApi from '@/api/storage.inventory/inventory'
import * as indexApi from '@/api/index/index' import * as indexApi from '@/api/index/index'
import { import {
@ -98,6 +167,55 @@ const spaceOptions = ref<Array<Record<string, any>>>([])
/** el-autocomplete 选中后紧接的 Enter 不再重复按关键字解析 */ /** el-autocomplete 选中后紧接的 Enter 不再重复按关键字解析 */
let skipNextEnter = false 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({ const summary = reactive({
quantity: 0, quantity: 0,
available: 0, available: 0,
@ -105,6 +223,13 @@ const summary = reactive({
intercept: 0 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 { function formatCell(prop: string, row: any): string {
if (row === null || row === undefined) return '--' if (row === null || row === undefined) return '--'
@ -226,6 +351,8 @@ async function loadBySpaceId(spaceId: number) {
summary.locked += Number(row.locked_quantity || 0) summary.locked += Number(row.locked_quantity || 0)
summary.intercept += Number(row.intercept_locked_quantity || 0) summary.intercept += Number(row.intercept_locked_quantity || 0)
}) })
// 新库位的库存从第一页开始看
pagination.currentPage = 1
} else { } else {
list.value = [] list.value = []
resetSummary() resetSummary()
@ -251,6 +378,9 @@ function handleClosed() {
list.value = [] list.value = []
spaceInfo.value = null spaceInfo.value = null
currentSpaceId.value = null currentSpaceId.value = null
pagination.currentPage = 1
pagination.pageSize = 20
pagination.total = 0
resetSummary() resetSummary()
} }
@ -273,30 +403,297 @@ watch(
}, },
{ immediate: true } { immediate: true }
) )
// 弹窗打开后等待布局完成再测一次表格高度(destroy-on-close 会重建 DOM)
watch(
visible,
(opened) => {
if (!opened) return
void nextTick(() => {
requestAnimationFrame(syncTableHeight)
})
}
)
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.space-stock-toolbar { /* 面板结构 / 尺寸对齐「批量导入商品」(storage/receiving Product.vue) */
.task-panel {
display: flex; display: flex;
align-items: center; flex-direction: column;
gap: 8px; height: min(680px, calc(100vh - 96px));
margin-bottom: 10px; background: #fff;
color: #303133;
.space-keyword { &__head {
width: 340px; 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 { /* 库位关键字输入框:固定宽度,禁止被 el-autocomplete 自带的 width:100% 撑满 */
margin-bottom: 10px; .space-keyword {
flex: 0 0 340px;
width: 340px;
min-width: 0;
.space-summary { :deep(.el-autocomplete) {
display: flex; 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; flex-wrap: wrap;
gap: 16px; justify-content: flex-end;
margin-top: 8px; --el-pagination-button-width: 28px;
font-size: 12px; --el-pagination-button-height: 28px;
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;
}
}
</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> </style>

View File

@ -88,125 +88,210 @@
</div> </div>
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="dialogTitle" class="transfer-dialog"
width="480px" width="min(560px, 92vw)"
align-center align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@closed="resetTransferDialog" @closed="resetTransferDialog"
> >
<p v-if="transferMode === 'location'" class="transfer-hint"> <!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
单条 wms_storage 记录移库;移库数量不填则全量移库。 <div class="task-panel">
</p> <header class="task-panel__head">
<p v-else-if="transferMode === 'product'" class="transfer-hint"> <div class="task-panel__titles">
按原库位 + 商品合并移库,自动合并该库位下该商品的所有库存;不适用于开启批次管理且多批次的商品。 <h2>{{ dialogTitle }}</h2>
</p> <p>{{ transferSubtitle }}</p>
<div class="transfer-form"> </div>
<el-input v-model="targetSpace" placeholder="目标库位编码或 ID,扫码或输入" clearable /> <button class="task-panel__close" type="button" aria-label="关闭" @click="dialogVisible = false">
<div class="target-space-tip"> <svg viewBox="0 0 12 12" fill="none">
<span v-if="spaceName">目标库位名称: {{ spaceName }}</span> <path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
<span v-else-if="targetSpace && targetSpaceError" class="target-space-error">未找到库位</span> </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> </div>
<el-input-number
v-model="transferQty" <footer class="task-panel__foot">
:min="1" <span class="task-panel__hint">{{ transferHintText }}</span>
:placeholder="transferMode === 'product' ? '移库数量(必填)' : '移库数量(不填则全量移库)'" <div class="task-panel__actions">
style="width: 100%;" <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> </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>
<el-dialog <el-dialog
v-model="expiryDialogVisible" v-model="expiryDialogVisible"
title="维护生产日期 / 到期日期" class="expiry-dialog"
width="560px" width="min(560px, 92vw)"
align-center align-center
append-to-body
:show-close="false"
destroy-on-close
:close-on-click-modal="false"
@opened="handleExpiryDialogOpened" @opened="handleExpiryDialogOpened"
@closed="resetExpiryForm" @closed="resetExpiryForm"
> >
<el-descriptions class="expiry-context" :column="2" size="small" border> <!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
<el-descriptions-item label="库存记录ID">{{ expiryRow?.storage_id ?? '--' }}</el-descriptions-item> <div class="task-panel">
<el-descriptions-item label="批次号">{{ expiryRow?.batch_no || '--' }}</el-descriptions-item> <header class="task-panel__head">
<el-descriptions-item label="商品">{{ expiryItemLabel }}</el-descriptions-item> <div class="task-panel__titles">
<el-descriptions-item label="库位">{{ expiryRow?.space_code || '--' }}</el-descriptions-item> <h2>维护生产日期 / 到期日期</h2>
</el-descriptions> <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"> <div class="task-panel__body">
输入框已回显库内当前日期:不改动=保持原值(不下发);改选日期=下发新日期;点「清空」清空输入框=下发 null 置空。两个日期至少改一项,且生产日期不得晚于到期日期。 <div class="task-panel__form">
</p> <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"> <div class="task-panel__field task-panel__field--input">
<el-form-item label="生产日期"> <span class="task-panel__field-label">生产日期</span>
<div class="expiry-field"> <el-date-picker
<el-date-picker ref="productionPickerRef"
ref="productionPickerRef" v-model="expiryForm.productionDate"
v-model="expiryForm.productionDate" type="date"
type="date" value-format="YYYY-MM-DD"
value-format="YYYY-MM-DD" format="YYYY-MM-DD"
format="YYYY-MM-DD" placeholder="请选择生产日期"
placeholder="请选择生产日期" class="expiry-date-picker"
class="expiry-date-picker" clearable
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 <el-button
size="small" size="small"
type="primary" type="primary"
link :loading="expiryLoading"
class="expiry-clear-btn" :disabled="!hasExpiryChange"
:disabled="!expiryForm.productionDate" @click="confirmExpiry"
@click="expiryForm.productionDate = ''"
> >
清空 确认维护
</el-button> </el-button>
</div> </div>
</el-form-item> </footer>
</div>
<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>
</el-dialog> </el-dialog>
<div ref="tableWrapRef" class="detail-table-wrap"> <div ref="tableWrapRef" class="detail-table-wrap">
<upper-table <upper-table
@ -437,6 +522,63 @@ const canTransferByProduct = computed(() => {
return true 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) { function normalizeRow(r: any) {
if (!r) return null if (!r) return null
const row = { ...r } const row = { ...r }
@ -689,6 +831,15 @@ const hasExpiryChange = computed(
resolveExpiryFieldPayload(expiryForm.expiryDate, expiryRow.value?.expiry_date) !== undefined 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,用于判断该行是否可维护日期) */ /** 行上的库存记录 ID(无则返回 null,用于判断该行是否可维护日期) */
function getRowStorageId(row: any): number | null { function getRowStorageId(row: any): number | null {
const id = Number(row?.storage_id) const id = Number(row?.storage_id)
@ -979,76 +1130,213 @@ watch(targetSpace, (val) => {
display: inline-block; display: inline-block;
} }
.transfer-hint { }
margin: 0 0 12px;
font-size: 12px; /* 日期维护弹窗:日期选择器与「清空」按钮的宽度约束 */
color: #909399; .expiry-date-picker {
line-height: 1.5; 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; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
} }
.target-space-tip { &__field {
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 {
display: flex; display: flex;
gap: 8px; align-items: center;
padding: 8px 10px; justify-content: space-between;
gap: 16px;
min-height: 40px;
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px; border-radius: 4px;
background: #f5f7fa; background: #fafafa;
font-size: 12px;
color: #606266;
line-height: 1.6;
.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; color: #909399;
} }
}
.expiry-preview-text { &__form-tip {
word-break: break-all; 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>
<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"> <style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss"; @use "../../../order/orderManagement/styles/order-sub.scss";
/* 基础信息面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */ /* 面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
.transaction-detail { .transaction-detail {
padding: 8px 0; height: 100%;
overflow-y: auto;
padding: 6px 10px 8px;
box-sizing: border-box;
}
.section { .section {
margin-bottom: 12px; margin-bottom: 12px;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
}
} }
}
.section-title { .section-title {
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
margin-bottom: 10px; margin-bottom: 10px;
padding-left: 8px; padding-left: 8px;
border-left: 3px solid #409eff; border-left: 3px solid #409eff;
line-height: 1.4; line-height: 1.4;
} }
.detail-descriptions :deep(.el-descriptions__label) { .detail-descriptions {
width: 120px; :deep(.el-descriptions__label) {
width: 110px;
min-width: 110px;
background: #fafbfc; background: #fafbfc;
font-weight: 500; font-weight: 500;
} }
:deep(.el-descriptions__content) {
word-break: break-word;
}
} }
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

@ -35,6 +35,7 @@
:columns="productquick" :columns="productquick"
:show-selection="true" :show-selection="true"
:selectable="canDeleteDetailRow" :selectable="canDeleteDetailRow"
default-align="center"
:pagination="pagination" :pagination="pagination"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:query-time="queryTime" :query-time="queryTime"
@ -274,39 +275,86 @@
<el-dialog <el-dialog
v-model="bindDialogVisible" v-model="bindDialogVisible"
title="明细绑定" class="bind-detail-dialog"
width="min(640px, 92vw)"
align-center align-center
width="640px"
append-to-body append-to-body
:show-close="false"
destroy-on-close destroy-on-close
:close-on-click-modal="false"
@closed="resetBindForm" @closed="resetBindForm"
> >
<el-form :model="bindForm" label-width="130px" size="small"> <!-- 面板结构对齐「批量驳回收货单」 -->
<el-form-item <div class="task-panel">
v-for="field in bindDetailProductFormConfig" <header class="task-panel__head">
:key="field.prop" <div class="task-panel__titles">
:required="field.required" <h2>明细绑定</h2>
> <p>将收货明细绑定到当前仓库下的系统商品</p>
<template #label>{{ field.label }}</template> </div>
<template v-if="field.type === 'display'"> <button class="task-panel__close" type="button" aria-label="关闭" @click="bindDialogVisible = false">
<span class="bind-display-value">{{ formatBindDisplayValue(field.prop) }}</span> <svg viewBox="0 0 12 12" fill="none">
</template> <path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
<template v-else-if="field.type === 'product-picker'"> </svg>
<div class="bind-product-picker"> </button>
<el-input :model-value="bindSelectedProductDisplay" readonly placeholder="请选择系统商品"> </header>
<template #append>
<el-button @click="openBindSystemProductPicker">查询系统商品</el-button> <div class="task-panel__body">
</template> <div class="task-panel__form">
</el-input> <template v-for="field in bindDetailProductFormConfig" :key="field.prop">
<p v-if="field.hint" class="picker-hint">{{ field.hint }}</p> <div
</div> v-if="field.type === 'display'"
</template> class="task-panel__field"
</el-form-item> :class="{ 'task-panel__field--stack': field.prop === 'barcode' && bindBarcodeHiddenCount > 0 }"
</el-form> >
<template #footer> <span class="task-panel__field-label">{{ field.label }}</span>
<el-button size="small" @click="bindDialogVisible = false">取消</el-button> <div v-if="field.prop === 'barcode'" class="task-panel__barcode">
<el-button size="small" type="primary" :loading="bindSaving" @click="submitBindDetail">确认绑定</el-button> <template v-if="bindVisibleBarcodes.length">
</template> <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>
<el-dialog <el-dialog
@ -430,6 +478,8 @@
:loading="spaceLoading" :loading="spaceLoading"
:show-selection="true" :show-selection="true"
:multiple-selection="spaceSelection" :multiple-selection="spaceSelection"
:show-pagination="false"
default-align="center"
:pagination="{ currentPage: spacePagination.page, pageSize: spacePagination.pageSize, total: spacePagination.total }" :pagination="{ currentPage: spacePagination.page, pageSize: spacePagination.pageSize, total: spacePagination.total }"
:columns="[ :columns="[
{ prop: 'id', label: '库位ID', width: '120' }, { prop: 'id', label: '库位ID', width: '120' },
@ -439,14 +489,26 @@
]" ]"
@selection-change="handleSpaceSelectionChange" @selection-change="handleSpaceSelectionChange"
@row-click="handleSpaceRowClick" @row-click="handleSpaceRowClick"
@page-change="querySpaces"
@page-size-change="onSpacePageSizeChange"
/> />
</div> </div>
</div> </div>
<template #footer> <template #footer>
<el-button size="small" @click="spacePickerVisible = false">取消</el-button> <div class="picker-footer">
<el-button size="small" type="primary" @click="applySelectedSpace">使用选中库位</el-button> <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> </template>
</el-dialog> </el-dialog>
@ -1209,8 +1271,24 @@ const formatBindDisplayValue = (prop: string) => {
return val 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 = () => { const resetBindForm = () => {
bindingDetailRow.value = null bindingDetailRow.value = null
bindBarcodeExpanded.value = false
bindForm.detail_id = '' bindForm.detail_id = ''
bindForm.product_name = '' bindForm.product_name = ''
bindForm.barcode = '' bindForm.barcode = ''
@ -1529,6 +1607,7 @@ const openBindDialog = (row: any) => {
} }
bindingDetailRow.value = row bindingDetailRow.value = row
bindBarcodeExpanded.value = false
bindForm.detail_id = String(detailId) bindForm.detail_id = String(detailId)
bindForm.product_name = row?.product_name ?? row?.item_name ?? '' bindForm.product_name = row?.product_name ?? row?.item_name ?? ''
bindForm.barcode = normalizeBarcodeString(row?.barcodes, row?.barcode) || '' bindForm.barcode = normalizeBarcodeString(row?.barcodes, row?.barcode) || ''
@ -2144,6 +2223,10 @@ const onSpacePageSizeChange = (size: number) => {
querySpaces(1) querySpaces(1)
} }
const onSpacePageChange = (page: number) => {
querySpaces(page)
}
const querySpaces = async (page = 1) => { const querySpaces = async (page = 1) => {
spaceLoading.value = true spaceLoading.value = true
try { try {
@ -3009,6 +3092,102 @@ onUnmounted(() => {
flex-shrink: 0; 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 { &__toolbar-main {
display: flex; display: flex;
align-items: center; align-items: center;
@ -3204,6 +3383,19 @@ onUnmounted(() => {
height: 440px; 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 { .batch-import-table {
height: min(450px, calc(100vh - 280px)); height: min(450px, calc(100vh - 280px));
@ -3451,15 +3643,6 @@ onUnmounted(() => {
z-index: 3; z-index: 3;
} }
.bind-display-value {
color: #606266;
word-break: break-all;
}
.bind-product-picker {
width: 100%;
}
.edit-detail-form { .edit-detail-form {
:deep(.el-input-group) { :deep(.el-input-group) {
width: 100%; width: 100%;
@ -3560,7 +3743,8 @@ onUnmounted(() => {
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板(同手工录入运单号) */ /* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板(同手工录入运单号) */
.el-dialog.batch-import-dialog, .el-dialog.batch-import-dialog,
.el-dialog.system-product-dialog { .el-dialog.system-product-dialog,
.el-dialog.bind-detail-dialog {
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;

View File

@ -482,19 +482,47 @@ export const PRODUCT_DETAIL_ACTIONS_COLUMN = {
className: 'product-detail-actions-col' className: 'product-detail-actions-col'
} as const } 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 = [ export const productquick = [
{ prop: 'images', label: '图片', width: '120', align: 'center', fixed: 'left' }, { prop: 'images', label: '图片', width: '120', align: 'center', fixed: 'left' },
{ prop: 'product_name', label: '商品名称', width: '200', fixed: 'left' }, { prop: 'product_name', label: '商品名称', width: '200', fixed: 'left' },
{ prop: 'id', label: '收货编码', width: '100' }, { 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: 'stock_id', label: 'SKUID', width: '100' },
{ prop: 'match_status', label: '匹配状态', width: '100', align: 'center' }, { prop: 'match_status', label: '匹配状态', width: '100', align: 'center' },
{ prop: 'actual_quantity', label: '收货数量', width: '100', align: 'right' }, { prop: 'actual_quantity', label: '收货数量', width: '100', align: 'center' },
{ prop: 'box_quantity', label: '箱数', width: '100', align: 'right' }, { prop: 'box_quantity', label: '箱数', width: '100', align: 'center' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '100', align: 'right' }, { prop: 'boxes_per_pallet', label: '箱规', width: '100', align: 'center' },
{ prop: 'box_remainder', label: '不满一箱', width: '90', align: 'right' }, { prop: 'box_remainder', label: '不满一箱', width: '90', align: 'center' },
{ prop: 'weight', label: '重量(g)', width: '100', align: 'right' }, { prop: 'weight', label: '重量(g)', width: '100', align: 'center' },
{ prop: 'box_weight', label: '箱重(g)', width: '100', align: 'right' }, { prop: 'box_weight', label: '箱重(g)', width: '100', align: 'center' },
{ prop: 'batch_number', label: '批次号', width: '120' }, { prop: 'batch_number', label: '批次号', width: '120' },
{ prop: 'production_date', label: '生产日期', width: '120' }, { prop: 'production_date', label: '生产日期', width: '120' },
{ prop: 'expiry_date', label: '到期日期', width: '120' }, { prop: 'expiry_date', label: '到期日期', width: '120' },

View File

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

View File

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

View File

@ -167,7 +167,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="detail_id" label="明细ID" width="90" align="center" /> <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> <template #default="{ row }">{{ locationLabel(row) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="盘点状态" width="100" align="center"> <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> <el-tag v-if="row.is_empty" type="info" size="small" class="unknown-tag">空库位</el-tag>
</template> </template>
</el-table-column> </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> <template #default="{ row }">{{ (row.checkers || []).join('、') || '—' }}</template>
</el-table-column> </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> <template #default="{ row }">{{ formatTime(row.checked_at) }}</template>
</el-table-column> </el-table-column>
<!-- <!--
@ -256,19 +256,19 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="detail_id" label="明细ID" width="90" align="center" /> <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> <template #default="{ row }">{{ row.item_code || '—' }}</template>
</el-table-column> </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> <template #default="{ row }">{{ row.item_name || '—' }}</template>
</el-table-column> </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> <template #default="{ row }">{{ row.spec || '—' }}</template>
</el-table-column> </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> <template #default="{ row }">{{ row.store_name || '—' }}</template>
</el-table-column> </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> <template #default="{ row }">{{ locationCodes(row) }}</template>
</el-table-column> </el-table-column>
<el-table-column v-if="!isBlind" label="账面数量" width="100" align="center"> <el-table-column v-if="!isBlind" label="账面数量" width="100" align="center">
@ -344,10 +344,10 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="id" label="库位ID" width="90" align="center" /> <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> <template #default="{ row }">{{ spaceLocationLabel(row) }}</template>
</el-table-column> </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> <template #default="{ row }">{{ row.custom_barcode || '—' }}</template>
</el-table-column> </el-table-column>
<el-table-column label="任务商品" width="100" align="center"> <el-table-column label="任务商品" width="100" align="center">

View File

@ -15,65 +15,100 @@
<template> <template>
<el-dialog <el-dialog
:model-value="visible" :model-value="visible"
title="上报实盘" class="check-report-dialog"
width="min(520px, 92vw)" width="min(560px, 92vw)"
align-center align-center
append-to-body
:show-close="false"
:close-on-click-modal="false" :close-on-click-modal="false"
@update:model-value="handleVisibleChange" @update:model-value="handleVisibleChange"
@closed="handleClosed" @closed="handleClosed"
> >
<el-form label-width="96px" size="small"> <!-- 面板结构对齐 storage/receiving「批量驳回收货单」 -->
<el-form-item label="明细"> <div class="task-panel">
<span class="value-text">{{ detailLabel }}</span> <header class="task-panel__head">
</el-form-item> <div class="task-panel__titles">
<el-form-item label="本次商品"> <h2>上报实盘</h2>
<span class="value-text">{{ stockLabel }}</span> <p>同一「明细 + 商品 + 库位」重复上报会覆盖原记录</p>
</el-form-item> </div>
<el-form-item label="库位"> <button
<span class="value-text">{{ location || '无库位' }}</span> class="task-panel__close"
</el-form-item> type="button"
<el-form-item label="实盘数量" required> aria-label="关闭"
<el-input-number @click="handleVisibleChange(false)"
v-model="form.quantity" >
:min="0" <svg viewBox="0 0 12 12" fill="none">
:step="1" <path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
step-strictly </svg>
controls-position="right" </button>
class="quantity-input" </header>
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>
<el-alert <div class="task-panel__body">
v-if="form.barcode.trim()" <div class="task-panel__form">
type="warning" <div class="task-panel__field">
:closable="false" <span class="task-panel__field-label">明细</span>
show-icon <strong class="task-panel__field-value">{{ detailLabel }}</strong>
title="已填未匹配条码:后端先按条码匹配系统商品,命中则按该商品覆盖上报;未命中则记为未知商品(无账面,实盘大于 0 即盘盈)。" </div>
/> <div class="task-panel__field">
<div v-else class="tip-text"> <span class="task-panel__field-label">本次商品</span>
覆盖式上报:同一「明细 + 商品 + 库位」重复上报会更新原记录(不新增)。 <strong class="task-panel__field-value">{{ stockLabel }}</strong>
</div> </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="task-panel__field task-panel__field--input">
<div class="dialog-footer"> <span class="task-panel__field-label">
<el-button size="small" @click="handleVisibleChange(false)">取消</el-button> 实盘数量<span class="required-mark">*</span>
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit"> </span>
确认上报 <el-input-number
</el-button> 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> </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> </el-dialog>
</template> </template>
@ -221,25 +256,177 @@ async function handleSubmit() {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.value-text { /* 面板结构 / 尺寸对齐 storage/receiving「批量驳回收货单」 */
font-size: 13px; .task-panel {
background: #fff;
color: #303133; 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 { .required-mark {
width: 160px; color: #f56c6c;
} margin-left: 4px;
}
.tip-text { </style>
font-size: 12px;
color: #909399; <style lang="scss">
} /* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板 */
.el-dialog.check-report-dialog {
.dialog-footer { padding: 0;
display: flex; overflow: hidden;
justify-content: flex-end;
align-items: center; .el-dialog__header {
gap: 8px; display: none;
}
.el-dialog__body {
padding: 0;
}
} }
</style> </style>

View File

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

View File

@ -147,15 +147,17 @@
</el-tabs> </el-tabs>
</div> </div>
<div class="detail-container"> <div class="detail-container">
<component <div v-if="activeDetailTab" class="detail-page order-detail-wrapper">
:is="activeDetailTabComponent" <component
:row="selectedDetail" :is="activeDetailTabComponent"
:detail-config="currentDetailConfig" :row="selectedDetail"
:api-method="currentDetailTabApiMethod" :detail-config="currentDetailConfig"
@add-items="handlePanelAddItems" :api-method="currentDetailTabApiMethod"
@export-detail="handlePanelExportDetail" @add-items="handlePanelAddItems"
@changed="handlePanelChanged" @export-detail="handlePanelExportDetail"
/> @changed="handlePanelChanged"
/>
</div>
</div> </div>
</div> </div>
@ -270,6 +272,66 @@
:meta="detailExportTaskProgress" :meta="detailExportTaskProgress"
:update-time="detailExportTaskProgress.updateTime" :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> </div>
</template> </template>
@ -524,31 +586,46 @@ async function handleOperationAction(key: string, row: Record<string, any>) {
} }
} }
/** 审核驳回:弹输入框收驳回原因(文档:reason 可选,缺省保留原备注) */ /** 审核驳回:面板弹窗收驳回原因(reason 可选,留空保留原备注) */
async function handleAuditReject(row: Record<string, any>) { 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) const id = Number(row?.id)
let reason = '' if (!Number.isFinite(id) || id <= 0) {
try { ElMessage.warning('缺少有效的盘点单ID')
const res = await ElMessageBox.prompt( return
'驳回原因将写入盘点单备注(可留空,留空则保留原备注)', }
`驳回盘点单 ${row?.check_no ?? ''}`, rejectRow.value = row
{ rejectReason.value = ''
confirmButtonText: '确定驳回', rejectDialogVisible.value = true
cancelButtonText: '取消', }
inputType: 'textarea',
inputPlaceholder: '可留空', /** 提交驳回:调用 stock.check.audit(action=reject) */
type: 'warning', async function submitAuditReject() {
buttonSize: 'small' const id = Number(rejectRow.value?.id)
} if (!Number.isFinite(id) || id <= 0) {
) ElMessage.warning('缺少有效的盘点单ID')
reason = String(res.value ?? '').trim() return
} catch { }
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) */ /* 布局样式对齐 order/orderManagement(order-sub.scss) */
@use "../../order/orderManagement/styles/order-sub.scss"; @use "../../order/orderManagement/styles/order-sub.scss";
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px, /* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(波次明细/盘点单信息面板
由各详情面板自身 padding 控制上下留白 */ 自带 padding: 6px 10px 8px),只留左右 10px,内容滚动交给详情面板 */
.order-sub-container .main-content .lower-level .detail-container { .order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px; 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; font-size: 13px;
color: #909399; 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> </style>

View File

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