refactor(detail): 详情与日志列表统一迁移 UpperTable,任务进度支持收起为浮窗
- 新增 TaskProgressFloatWidget;TaskProgressDialog 增加 minimizable 与 minimize 事件,运行中可「收起后台」,浮窗继续轮询并支持点击还原窗口, 运单页「更新揽收状态」已接入 - UpperTable 新增 #pagination-info 插槽(支持「已选 N 项」等精简文案), 运单号列对齐方式透传给 WaybillCodeActions - 盘点、入库、出库、收货、波次、订单明细、库存详情、仓库与店铺等 20+ 处 日志/明细列表由 el-table 迁移至 UpperTable,统一分页、行选择、 虚拟滚动、状态文本样式与列插槽 - 拆包录像列表、出库单详情表单、运单称重弹窗等按 task-panel 结构统一; 运单轨迹浮层支持拖动并复用 task-panel 标题与关闭样式 - 补充相关样式,修正内嵌表格高度与分页区布局,避免卡片阴影与高度塌陷
This commit is contained in:
parent
d21839b99d
commit
2a37739b7d
@ -19,6 +19,15 @@
|
||||
@close="emit('close')"
|
||||
>
|
||||
<template #footer>
|
||||
<el-button
|
||||
v-if="minimizable && polling"
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
@click="emit('minimize')"
|
||||
>
|
||||
收起后台
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:type="polling ? 'default' : 'primary'"
|
||||
@ -46,11 +55,14 @@ const props = defineProps<{
|
||||
errorText?: string
|
||||
resultText?: string
|
||||
updateTime?: string
|
||||
/** 运行中是否允许收起后台(收起后由页面显示悬浮条,继续轮询) */
|
||||
minimizable?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void
|
||||
(e: 'close'): void
|
||||
(e: 'minimize'): void
|
||||
}>()
|
||||
|
||||
const normalizedPercent = computed(() => {
|
||||
@ -83,7 +95,12 @@ const tipText = computed(() => {
|
||||
return ''
|
||||
})
|
||||
|
||||
const footerHint = computed(() =>
|
||||
progressState.value === 'running' ? '任务处理中,请稍候' : '任务已结束,可关闭窗口'
|
||||
)
|
||||
const footerHint = computed(() => {
|
||||
if (progressState.value === 'running') {
|
||||
return props.minimizable
|
||||
? '任务在后台执行,可收起窗口继续操作,不会中断'
|
||||
: '任务处理中,请稍候'
|
||||
}
|
||||
return '任务已结束,可关闭窗口'
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -109,6 +109,7 @@
|
||||
:codes="getWaybillCellCodes(scope.row, column)"
|
||||
:label="column.label || '运单号'"
|
||||
:collapse="column.copyMultiCollapse === true"
|
||||
:align="column.align || defaultAlign"
|
||||
/>
|
||||
<span
|
||||
v-else-if="column.formatter"
|
||||
@ -242,7 +243,10 @@
|
||||
<!-- 分页区域 -->
|
||||
<div class="pagination-container" v-if="showPagination">
|
||||
<div class="pagination-info">
|
||||
已选 {{ selectedCount }} 条,查询用时 {{ (queryTime / 1000).toFixed(2) }} 秒
|
||||
<!-- 左侧文案:默认「已选 N 条 + 查询用时」,页面可用 #pagination-info 精简(如只要「已选 N 项」) -->
|
||||
<slot name="pagination-info" :count="selectedCount" :query-time="queryTime">
|
||||
已选 {{ selectedCount }} 条,查询用时 {{ (queryTime / 1000).toFixed(2) }} 秒
|
||||
</slot>
|
||||
<!-- 可选扩展插槽:紧随“查询用时”展示统计/通知(如平均拣货/复核时长),页面按需提供内容 -->
|
||||
<slot name="pagination-info-extra" />
|
||||
</div>
|
||||
|
||||
154
src/components/task-progress/TaskProgressFloatWidget.vue
Normal file
154
src/components/task-progress/TaskProgressFloatWidget.vue
Normal file
@ -0,0 +1,154 @@
|
||||
<!--
|
||||
TaskProgressFloatWidget — 异步任务进度浮条(配合 TaskProgressDialog 的「收起后台」)
|
||||
|
||||
· 任务运行中收起进度弹窗后显示,后台继续轮询,切换页面不中断
|
||||
· 点击浮条 / 「还原窗口」重新展开进度弹窗
|
||||
· 视觉与 order/orderManagement「建单」后台浮条(CreateOrderFloatWidget)一致
|
||||
-->
|
||||
<template>
|
||||
<transition name="task-float">
|
||||
<div
|
||||
v-if="visible"
|
||||
class="task-float"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:title="`${title || '任务'}:点击还原窗口`"
|
||||
@click="emit('restore')"
|
||||
@keydown.enter.prevent="emit('restore')"
|
||||
>
|
||||
<div class="task-float__header">
|
||||
<span class="task-float__title">{{ title || '任务' }}</span>
|
||||
<el-button
|
||||
class="task-float__close"
|
||||
link
|
||||
type="info"
|
||||
:icon="Close"
|
||||
aria-label="关闭"
|
||||
@click.stop="emit('close')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="task-float__body">
|
||||
<p class="task-float__status" :class="{ 'is-error': Boolean(errorText) }">{{ statusText }}</p>
|
||||
<el-progress
|
||||
class="task-float__progress"
|
||||
:percentage="percent"
|
||||
:status="errorText ? 'exception' : polling ? undefined : 'success'"
|
||||
:stroke-width="6"
|
||||
:show-text="false"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" size="small" class="task-float__restore" @click.stop="emit('restore')">
|
||||
还原窗口
|
||||
</el-button>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { Close } from '@element-plus/icons-vue'
|
||||
|
||||
const props = defineProps<{
|
||||
/** 是否显示(= 弹窗已收起且任务未关闭) */
|
||||
visible: boolean
|
||||
title?: string
|
||||
/** 后端轮询是否仍在进行 */
|
||||
polling: boolean
|
||||
progressPercent: number
|
||||
/** 状态文案(处理中 / 已完成 / 失败…) */
|
||||
statusLabel?: string
|
||||
errorText?: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'restore'): void
|
||||
(e: 'close'): void
|
||||
}>()
|
||||
|
||||
const percent = computed(() => {
|
||||
const value = Number(props.progressPercent || 0)
|
||||
if (!Number.isFinite(value)) return 0
|
||||
return Math.min(100, Math.max(0, Math.round(value)))
|
||||
})
|
||||
|
||||
const statusText = computed(() => {
|
||||
if (props.errorText) return `任务失败:${props.errorText}`
|
||||
if (props.polling) {
|
||||
return `${props.statusLabel || '处理中'} ${percent.value}% · 后台运行中,点击还原窗口`
|
||||
}
|
||||
return '任务已完成,点击还原窗口'
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.task-float {
|
||||
position: fixed;
|
||||
right: 24px;
|
||||
bottom: 24px;
|
||||
z-index: 3000;
|
||||
width: 220px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
border: 1px solid #d9ecff;
|
||||
box-shadow: 0 8px 24px rgba(64, 158, 255, 0.18);
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.task-float:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 12px 28px rgba(64, 158, 255, 0.24);
|
||||
}
|
||||
|
||||
.task-float__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.task-float__title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.task-float__close {
|
||||
padding: 0;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.task-float__body {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.task-float__status {
|
||||
margin: 0 0 8px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: #606266;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.task-float__status.is-error {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.task-float__restore {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.task-float-enter-active,
|
||||
.task-float-leave-active {
|
||||
transition: opacity 0.15s ease, transform 0.15s ease;
|
||||
}
|
||||
|
||||
.task-float-enter-from,
|
||||
.task-float-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(6px);
|
||||
}
|
||||
</style>
|
||||
@ -7,7 +7,7 @@
|
||||
· 查看轨迹:打开可拖动的悬浮窗(无遮罩、层级最高),按运单号查询轨迹
|
||||
-->
|
||||
<template>
|
||||
<div class="waybill-code-actions">
|
||||
<div class="waybill-code-actions" :class="`is-${align}`">
|
||||
<template v-for="(code, index) in visibleCodes" :key="`${code}-${index}`">
|
||||
<el-dropdown
|
||||
trigger="hover"
|
||||
@ -68,10 +68,13 @@ const props = withDefaults(defineProps<{
|
||||
collapse?: boolean
|
||||
/** 无运单号时的占位文案 */
|
||||
emptyText?: string
|
||||
/** 单元格对齐方式(与 el-table 列 align 保持一致,默认左对齐) */
|
||||
align?: 'left' | 'center' | 'right'
|
||||
}>(), {
|
||||
label: '运单号',
|
||||
collapse: false,
|
||||
emptyText: '—'
|
||||
emptyText: '—',
|
||||
align: 'left'
|
||||
})
|
||||
|
||||
const expanded = ref(false)
|
||||
@ -120,8 +123,19 @@ function handleCommand(command: string, code: string) {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 2px 6px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
|
||||
/* 跟随列对齐:flex 容器不会自动继承单元格 text-align,需按 align 显式设置 */
|
||||
&.is-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&.is-right {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.waybill-code-link {
|
||||
|
||||
@ -17,18 +17,22 @@
|
||||
role="dialog"
|
||||
aria-label="运单轨迹"
|
||||
>
|
||||
<header class="wb-float-header" @pointerdown="startDrag">
|
||||
<span class="wb-float-title">运单轨迹</span>
|
||||
<span class="wb-float-code" :title="waybillCode || ''">{{ waybillCode || '—' }}</span>
|
||||
<header class="task-panel__head wb-float-header" @pointerdown="startDrag">
|
||||
<div class="task-panel__titles wb-float-titles">
|
||||
<h2>运单轨迹</h2>
|
||||
<p :title="waybillCode || ''">{{ waybillCode || '—' }}</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="wb-float-close"
|
||||
class="task-panel__close wb-float-close"
|
||||
aria-label="关闭"
|
||||
title="关闭"
|
||||
@pointerdown.stop
|
||||
@click="close"
|
||||
>
|
||||
×
|
||||
<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="wb-float-body">
|
||||
@ -158,64 +162,77 @@ onBeforeUnmount(() => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border: 1px solid #dcdfe6;
|
||||
color: #303133;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 标题区:对齐项目表单弹窗(task-panel__head)—— 标题 + 副标题 + 右上角 SVG 关闭 */
|
||||
.wb-float-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
background: #f5f7fa;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 14px 16px 10px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
flex: 0 0 auto;
|
||||
cursor: move;
|
||||
user-select: none;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.wb-float-title {
|
||||
flex: 0 0 auto;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.wb-float-code {
|
||||
flex: 1 1 auto;
|
||||
.wb-float-titles {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 4px 0 0;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #909399;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.wb-float-close {
|
||||
flex: 0 0 auto;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
padding: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
flex: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: #909399;
|
||||
font-size: 16px;
|
||||
line-height: 18px;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s;
|
||||
|
||||
svg {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #e4e7ed;
|
||||
color: #303133;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
.wb-float-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 8px 10px 10px;
|
||||
padding: 10px 16px 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
@ -153,8 +153,7 @@ defineExpose({ refresh, copyTrace })
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid #f0f2f5;
|
||||
margin-bottom: 8px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
@ -178,7 +177,9 @@ defineExpose({ refresh, copyTrace })
|
||||
|
||||
.trace-timeline {
|
||||
position: relative;
|
||||
padding: 10px 0 0 6px;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 2px 0 0 6px;
|
||||
overflow: auto;
|
||||
|
||||
.trace-item {
|
||||
|
||||
@ -7,47 +7,43 @@
|
||||
-->
|
||||
<template>
|
||||
<div class="log-panel">
|
||||
<div v-if="apiLoading" v-loading="true" class="log-empty">加载中…</div>
|
||||
<template v-else>
|
||||
<el-table
|
||||
v-if="logs.length"
|
||||
:data="pagedLogs"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
height="100%"
|
||||
class="log-table"
|
||||
>
|
||||
<el-table-column prop="time" label="时间" width="175" />
|
||||
<el-table-column prop="operator" label="操作人" width="120" />
|
||||
<el-table-column prop="action" label="操作类型" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="结果" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="resultTagType(row)">{{ row.result }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.detail || '—' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div v-else class="log-empty">暂无操作日志</div>
|
||||
|
||||
<div v-if="logs.length > pageSize" class="log-pagination">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="logs.length"
|
||||
layout="total, prev, pager, next"
|
||||
background
|
||||
size="small"
|
||||
/>
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button size="small" type="primary" :loading="apiLoading" @click="loadLogs">刷新</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
:table-id="`${tableIdPrefix}-logs`"
|
||||
:data="pagedLogs"
|
||||
:columns="logColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="apiLoading"
|
||||
:row-key="(row: LogItem) => row.__key"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-result="{ row }">
|
||||
<el-tag size="small" :type="resultTagType(row)">{{ row.result }}</el-tag>
|
||||
</template>
|
||||
<template #column-detail="{ row }">{{ row.detail || '—' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -58,34 +54,70 @@ interface LogItem {
|
||||
detail?: string
|
||||
time: string
|
||||
level: 'success' | 'info' | 'warning' | 'error'
|
||||
/** 本地行 key(日志无 id) */
|
||||
__key?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 当前选中行数据(用于生成关联日志) */
|
||||
row: Record<string, any> | null
|
||||
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||
apiMethod?: (...args: any[]) => Promise<any>
|
||||
}>()
|
||||
/** 列配置持久化前缀(区分不同页面) */
|
||||
tableIdPrefix?: string
|
||||
}>(), {
|
||||
apiMethod: undefined,
|
||||
tableIdPrefix: 'log-panel'
|
||||
})
|
||||
|
||||
/** 通过 API 获取的真实日志列表 */
|
||||
const apiLogs = ref<LogItem[] | null>(null)
|
||||
const apiLoading = ref(false)
|
||||
|
||||
/** 表格本地分页(对齐 order/orderManagement 的 log.vue 体验) */
|
||||
/** 日志列配置(UpperTable) */
|
||||
const logColumns = [
|
||||
{ prop: 'time', label: '时间', width: '175' },
|
||||
{ prop: 'operator', label: '操作人', width: '120' },
|
||||
{ prop: 'action', label: '操作类型', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'result', label: '结果', width: '90' },
|
||||
{ prop: 'detail', label: '说明', minWidth: '220', showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
/** 表格本地分页(对齐 storage/receiving 操作日志体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 10
|
||||
const pageSize = ref(10)
|
||||
const pagination = computed(() => ({
|
||||
currentPage: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
total: logs.value.length
|
||||
}))
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize
|
||||
return logs.value.slice(start, start + pageSize)
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return logs.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
function resultTagType(row: LogItem): string {
|
||||
if (row.result === '成功') return 'success'
|
||||
if (row.result === '失败') return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
watch(() => props.row, async (newRow) => {
|
||||
watch(() => props.row, () => {
|
||||
void loadLogs()
|
||||
}, { immediate: true })
|
||||
|
||||
/** 拉取日志(按钮「刷新」也走这个函数) */
|
||||
async function loadLogs() {
|
||||
const newRow = props.row
|
||||
currentPage.value = 1
|
||||
if (newRow && props.apiMethod) {
|
||||
apiLoading.value = true
|
||||
@ -119,7 +151,7 @@ watch(() => props.row, async (newRow) => {
|
||||
} else {
|
||||
apiLogs.value = null
|
||||
}
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
/** 基于 row 生成模拟日志(无 apiMethod 时使用) */
|
||||
const mockLogs = computed<LogItem[]>(() => {
|
||||
@ -150,17 +182,16 @@ const mockLogs = computed<LogItem[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志(附本地行 key) */
|
||||
const logs = computed<LogItem[]>(() => {
|
||||
if (apiLogs.value !== null) {
|
||||
return apiLogs.value
|
||||
}
|
||||
return mockLogs.value
|
||||
const list = apiLogs.value !== null ? apiLogs.value : mockLogs.value
|
||||
return list.map((item, index) => ({ ...item, __key: `log-${index}` }))
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 对齐 order/orderManagement 的 log.vue(el-table 表格 + 本地分页) */
|
||||
/* 样式对齐 storage/receiving「操作日志」:
|
||||
header-actions(按钮行) + table-host(自适应剩余高度) + 左下角已选 / 右下分页 */
|
||||
.log-panel {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@ -169,26 +200,64 @@ const logs = computed<LogItem[]>(() => {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.log-table {
|
||||
flex: 1;
|
||||
.header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.log-empty {
|
||||
flex: 1;
|
||||
.left-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
padding: 40px 0;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.log-pagination {
|
||||
flex-shrink: 0;
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 10px;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -22,52 +22,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
:table-id="`${tableIdPrefix}-logs`"
|
||||
:data="pagedLogs"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
:height="tableHeight"
|
||||
v-loading="apiLoading"
|
||||
class="log-table"
|
||||
:columns="logColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="apiLoading"
|
||||
:row-key="(row: LogItem) => row.__key"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<el-table-column prop="time" label="时间" width="175" />
|
||||
<el-table-column prop="operator" label="操作人" width="120" />
|
||||
<el-table-column prop="action" label="操作类型" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="结果" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.detail || '—' }}</template>
|
||||
</el-table-column>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无操作日志</div>
|
||||
<template #column-result="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div v-if="logs.length > pageSize" class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="logs.length"
|
||||
layout="total, prev, pager, next"
|
||||
background
|
||||
size="small"
|
||||
/>
|
||||
<template #column-detail="{ row }">{{ row.detail || '—' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -78,47 +64,55 @@ interface LogItem {
|
||||
detail?: string
|
||||
time: string
|
||||
level: 'success' | 'info' | 'warning' | 'error'
|
||||
/** 本地行 key(日志无 id) */
|
||||
__key?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 当前选中行数据(用于生成关联日志) */
|
||||
row: Record<string, any> | null
|
||||
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||
apiMethod?: (...args: any[]) => Promise<any>
|
||||
}>()
|
||||
/** 列配置持久化前缀(区分不同页面) */
|
||||
tableIdPrefix?: string
|
||||
}>(), {
|
||||
tableIdPrefix: 'data-ordersummary'
|
||||
})
|
||||
|
||||
/** 通过 API 获取的真实日志列表 */
|
||||
const apiLogs = ref<LogItem[] | null>(null)
|
||||
const apiLoading = ref(false)
|
||||
|
||||
/** 表格自适应高度:容器 ref + 测高(不要给 el-table 写 height="100%",EP parseHeight('100%') → NaN) */
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
/** 日志列配置(UpperTable) */
|
||||
const logColumns = [
|
||||
{ prop: 'time', label: '时间', width: '175' },
|
||||
{ prop: 'operator', label: '操作人', width: '120' },
|
||||
{ prop: 'action', label: '操作类型', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'result', label: '结果', width: '90' },
|
||||
{ prop: 'detail', label: '说明', minWidth: '220', showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
/** 表格本地分页(对齐 storage/receiving 操作日志体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pagination = computed(() => ({
|
||||
currentPage: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
total: logs.value.length
|
||||
}))
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return logs.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
})
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
}
|
||||
|
||||
/** 表格本地分页(对齐 storage/receiving「操作日志」体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 10
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize
|
||||
return logs.value.slice(start, start + pageSize)
|
||||
})
|
||||
|
||||
watch(currentPage, resetTableScroll)
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
function resultTagType(row: LogItem): string {
|
||||
if (row.result === '成功') return 'success'
|
||||
@ -197,17 +191,15 @@ const mockLogs = computed<LogItem[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志(附本地行 key) */
|
||||
const logs = computed<LogItem[]>(() => {
|
||||
if (apiLogs.value !== null) {
|
||||
return apiLogs.value
|
||||
}
|
||||
return mockLogs.value
|
||||
const list = apiLogs.value !== null ? apiLogs.value : mockLogs.value
|
||||
return list.map((item, index) => ({ ...item, __key: `log-${index}` }))
|
||||
})
|
||||
|
||||
/** 数据变化后页码超出范围时回退到最后一页(必须放在 logs 声明之后,否则 setup 阶段 TDZ 报错) */
|
||||
watch(logs, (list) => {
|
||||
const maxPage = Math.max(1, Math.ceil(list.length / pageSize))
|
||||
const maxPage = Math.max(1, Math.ceil(list.length / pageSize.value))
|
||||
if (currentPage.value > maxPage) currentPage.value = maxPage
|
||||
})
|
||||
</script>
|
||||
@ -256,14 +248,36 @@ watch(logs, (list) => {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
|
||||
@ -267,43 +267,43 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 拆包录像分页列表 -->
|
||||
<div v-else class="detail-page detail-scroll">
|
||||
<div v-loading="videoListLoading" class="detail-list-pane">
|
||||
<el-table :data="videoListRows" size="small" border stripe>
|
||||
<el-table-column prop="id" label="录像ID" width="90" />
|
||||
<el-table-column label="摄像头" min-width="130" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.camera_name || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="110">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(videoStatusTagType(row.status))">{{ videoStatusLabel(row.status) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="created_at" label="创建时间" width="170" />
|
||||
<el-table-column label="操作" width="110" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="row.video_url" link type="primary" size="small" @click="handlePlayVideo(row)">播放</el-button>
|
||||
<span v-else-if="row.status === 'failed'" class="detail-video-unavailable">录像不可用</span>
|
||||
<span v-else class="detail-video-unplayable">不可播放</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 拆包录像分页列表:对齐 storage/receiving 商品明细/操作日志(UpperTable + 多选 + 分页) -->
|
||||
<div v-else class="detail-page detail-scroll detail-scroll--table">
|
||||
<!-- 按钮行(对齐 storage/receiving 商品明细/操作日志:左侧刷新) -->
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button size="small" type="primary" :loading="videoListLoading" @click="handleRefreshVideoList">刷新</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-list-pane">
|
||||
<upper-table
|
||||
table-id="return-unpack-video-list"
|
||||
:data="videoListRows"
|
||||
:columns="videoColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="videoPagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="videoListLoading"
|
||||
row-key="id"
|
||||
empty-text="暂无录像"
|
||||
@page-change="loadVideoListPage"
|
||||
@page-size-change="handleVideoPageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无录像</div>
|
||||
<template #column-camera_name="{ row }">{{ row.camera_name || '-' }}</template>
|
||||
<template #column-status="{ row }">
|
||||
<span :class="getStatusTextClass(videoStatusTagType(row.status))">{{ videoStatusLabel(row.status) }}</span>
|
||||
</template>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
v-if="videoPagination.total > videoPagination.pageSize"
|
||||
class="detail-pagination"
|
||||
layout="prev, pager, next, total"
|
||||
size="small"
|
||||
background
|
||||
:current-page="videoPagination.currentPage"
|
||||
:page-size="videoPagination.pageSize"
|
||||
:total="videoPagination.total"
|
||||
@current-change="loadVideoListPage"
|
||||
/>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button v-if="row.video_url" link type="primary" size="small" @click="handlePlayVideo(row)">播放</el-button>
|
||||
<span v-else-if="row.status === 'failed'" class="detail-video-unavailable">录像不可用</span>
|
||||
<span v-else class="detail-video-unplayable">不可播放</span>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -852,6 +852,31 @@ const videoListLoading = ref(false)
|
||||
const videoListRows = ref<any[]>([])
|
||||
const videoPagination = reactive({ currentPage: 1, pageSize: 10, total: 0 })
|
||||
|
||||
/** 拆包录像列配置(UpperTable) */
|
||||
const videoColumns = [
|
||||
{ prop: 'id', label: '录像ID', width: '90' },
|
||||
{ prop: 'camera_name', label: '摄像头', minWidth: '130', showOverflowTooltip: true },
|
||||
{ prop: 'status', label: '状态', width: '110' },
|
||||
{ prop: 'created_at', label: '创建时间', width: '170' },
|
||||
{ prop: 'actions', label: '操作', width: '110', fixed: 'right' }
|
||||
]
|
||||
|
||||
function handleVideoPageSizeChange(pageSize: number) {
|
||||
videoPagination.pageSize = pageSize
|
||||
videoPagination.currentPage = 1
|
||||
void loadVideoListPage(1)
|
||||
}
|
||||
|
||||
/** 刷新当前页拆包录像;若刷新后当前页已无数据(总数变化),自动回退到最后一个有效页 */
|
||||
async function handleRefreshVideoList() {
|
||||
const page = videoPagination.currentPage || 1
|
||||
await loadVideoListPage(page)
|
||||
if (videoListRows.value.length === 0 && videoPagination.total > 0 && page > 1) {
|
||||
const lastPage = Math.max(1, Math.ceil(videoPagination.total / videoPagination.pageSize))
|
||||
if (lastPage < page) await loadVideoListPage(lastPage)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleViewDetail(row: any) {
|
||||
selectedRecord.value = row
|
||||
detailVisible.value = true
|
||||
@ -1172,10 +1197,66 @@ onMounted(() => {
|
||||
min-height: 160px;
|
||||
}
|
||||
|
||||
.detail-pagination {
|
||||
margin-top: 6px;
|
||||
/* 拆包录像:表格自己滚动,外层不滚(UpperTable 需要确定高度);已选数量在左下角 */
|
||||
.detail-scroll.detail-scroll--table {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
flex-direction: column;
|
||||
padding: 8px 0 0;
|
||||
|
||||
/* 按钮行:与 storage/receiving 商品明细/操作日志一致,无边框/无背景 */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.left-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail-list-pane {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.order-items-table-wrap {
|
||||
|
||||
@ -253,7 +253,7 @@
|
||||
|
||||
<!-- 批量更新揽收状态(waybill.warehouse.updateReceive 异步任务) -->
|
||||
<TaskProgressDialog
|
||||
v-if="receiveProgressVisible"
|
||||
v-if="receiveProgressVisible && !receiveProgressMinimized"
|
||||
:visible="receiveProgressVisible"
|
||||
title="更新揽收状态"
|
||||
:polling="receiveProgressPolling"
|
||||
@ -261,7 +261,21 @@
|
||||
:progress-percent="receiveProgressState.progress"
|
||||
:status-label="receiveProgressStatusLabel"
|
||||
:error-text="receiveProgressState.error"
|
||||
@close="closeReceiveProgress"
|
||||
minimizable
|
||||
@minimize="minimizeReceiveProgress"
|
||||
@close="handleCloseReceiveProgress"
|
||||
/>
|
||||
|
||||
<!-- 收起后台后的进度浮条:点击还原窗口,任务继续在后台轮询 -->
|
||||
<TaskProgressFloatWidget
|
||||
:visible="receiveProgressVisible && receiveProgressMinimized"
|
||||
title="更新揽收状态"
|
||||
:polling="receiveProgressPolling"
|
||||
:progress-percent="receiveProgressState.progress"
|
||||
:status-label="receiveProgressStatusLabel"
|
||||
:error-text="receiveProgressState.error"
|
||||
@restore="restoreReceiveProgress"
|
||||
@close="handleCloseReceiveProgress"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@ -285,6 +299,7 @@ import OperationCellRenderer from './components/OperationCellRenderer.vue'
|
||||
import TransferByWaybillsDialog from './components/TransferByWaybillsDialog.vue'
|
||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||
import TaskProgressDialog from '@/components/TaskProgressDialog.vue'
|
||||
import TaskProgressFloatWidget from '@/components/task-progress/TaskProgressFloatWidget.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { waybillWarehouseDetail } from '@/api/waybill.warehouse'
|
||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||
@ -832,12 +847,15 @@ const {
|
||||
},
|
||||
onSuccess: async () => {
|
||||
ElMessage.success('揽收状态更新完成')
|
||||
// 任务结束后若处于收起状态,自动还原弹窗展示结果
|
||||
receiveProgressMinimized.value = false
|
||||
upperTableRef.value?.clearSelection?.()
|
||||
selectedRows.value = []
|
||||
await loadData()
|
||||
},
|
||||
onError: (error: string) => {
|
||||
ElMessage.error(error || '揽收状态更新失败')
|
||||
receiveProgressMinimized.value = false
|
||||
}
|
||||
})
|
||||
|
||||
@ -853,6 +871,41 @@ const receiveProgressStatusLabel = computed(() => {
|
||||
return map[receiveProgressState.status] || receiveProgressState.status || '—'
|
||||
})
|
||||
|
||||
/** 进度弹窗是否已收起(收起后显示右下角浮条,后台继续轮询) */
|
||||
const receiveProgressMinimized = ref(false)
|
||||
|
||||
/** 收起后台(对齐 order/orderManagement「建单」:表单可收起,任务不中断) */
|
||||
function minimizeReceiveProgress() {
|
||||
receiveProgressMinimized.value = true
|
||||
}
|
||||
|
||||
/** 还原进度弹窗 */
|
||||
function restoreReceiveProgress() {
|
||||
receiveProgressMinimized.value = false
|
||||
}
|
||||
|
||||
/** 关闭进度(运行中关闭会停止轮询,需二次确认避免误关) */
|
||||
async function handleCloseReceiveProgress() {
|
||||
if (receiveProgressPolling.value) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'任务仍在后台执行,关闭后将不再显示进度,是否继续?',
|
||||
'关闭进度窗口',
|
||||
{
|
||||
type: 'warning',
|
||||
buttonSize: 'small',
|
||||
confirmButtonText: '关闭',
|
||||
cancelButtonText: '取消'
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
}
|
||||
receiveProgressMinimized.value = false
|
||||
closeReceiveProgress()
|
||||
}
|
||||
|
||||
/** 提交揽收状态更新任务(选中 / 全部 共用) */
|
||||
async function submitReceiveTask(waybillCodes: string[]) {
|
||||
const cfg = currentTabConfig.value
|
||||
|
||||
@ -22,52 +22,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
:table-id="`${tableIdPrefix}-logs`"
|
||||
:data="pagedLogs"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
:height="tableHeight"
|
||||
v-loading="apiLoading"
|
||||
class="log-table"
|
||||
:columns="logColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="apiLoading"
|
||||
:row-key="(row: LogItem) => row.__key"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<el-table-column prop="time" label="时间" width="175" />
|
||||
<el-table-column prop="operator" label="操作人" width="120" />
|
||||
<el-table-column prop="action" label="操作类型" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="结果" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.detail || '—' }}</template>
|
||||
</el-table-column>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无操作日志</div>
|
||||
<template #column-result="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div v-if="logs.length > pageSize" class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="logs.length"
|
||||
layout="total, prev, pager, next"
|
||||
background
|
||||
size="small"
|
||||
/>
|
||||
<template #column-detail="{ row }">{{ row.detail || '—' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -78,47 +64,55 @@ interface LogItem {
|
||||
detail?: string
|
||||
time: string
|
||||
level: 'success' | 'info' | 'warning' | 'error'
|
||||
/** 本地行 key(日志无 id) */
|
||||
__key?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 当前选中行数据(用于生成关联日志) */
|
||||
row: Record<string, any> | null
|
||||
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||
apiMethod?: (...args: any[]) => Promise<any>
|
||||
}>()
|
||||
/** 列配置持久化前缀(区分不同页面) */
|
||||
tableIdPrefix?: string
|
||||
}>(), {
|
||||
tableIdPrefix: 'mode-config'
|
||||
})
|
||||
|
||||
/** 通过 API 获取的真实日志列表 */
|
||||
const apiLogs = ref<LogItem[] | null>(null)
|
||||
const apiLoading = ref(false)
|
||||
|
||||
/** 表格自适应高度:容器 ref + 测高(不要给 el-table 写 height="100%",EP parseHeight('100%') → NaN) */
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
/** 日志列配置(UpperTable) */
|
||||
const logColumns = [
|
||||
{ prop: 'time', label: '时间', width: '175' },
|
||||
{ prop: 'operator', label: '操作人', width: '120' },
|
||||
{ prop: 'action', label: '操作类型', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'result', label: '结果', width: '90' },
|
||||
{ prop: 'detail', label: '说明', minWidth: '220', showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
/** 表格本地分页(对齐 storage/receiving 操作日志体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pagination = computed(() => ({
|
||||
currentPage: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
total: logs.value.length
|
||||
}))
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return logs.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
})
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
}
|
||||
|
||||
/** 表格本地分页(对齐 storage/receiving「操作日志」体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 10
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize
|
||||
return logs.value.slice(start, start + pageSize)
|
||||
})
|
||||
|
||||
watch(currentPage, resetTableScroll)
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
function resultTagType(row: LogItem): string {
|
||||
if (row.result === '成功') return 'success'
|
||||
@ -197,17 +191,15 @@ const mockLogs = computed<LogItem[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志(附本地行 key) */
|
||||
const logs = computed<LogItem[]>(() => {
|
||||
if (apiLogs.value !== null) {
|
||||
return apiLogs.value
|
||||
}
|
||||
return mockLogs.value
|
||||
const list = apiLogs.value !== null ? apiLogs.value : mockLogs.value
|
||||
return list.map((item, index) => ({ ...item, __key: `log-${index}` }))
|
||||
})
|
||||
|
||||
/** 数据变化后页码超出范围时回退到最后一页(必须放在 logs 声明之后,否则 setup 阶段 TDZ 报错) */
|
||||
watch(logs, (list) => {
|
||||
const maxPage = Math.max(1, Math.ceil(list.length / pageSize))
|
||||
const maxPage = Math.max(1, Math.ceil(list.length / pageSize.value))
|
||||
if (currentPage.value > maxPage) currentPage.value = maxPage
|
||||
})
|
||||
</script>
|
||||
@ -256,14 +248,36 @@ watch(logs, (list) => {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
|
||||
@ -1,46 +1,72 @@
|
||||
<template>
|
||||
<div class="express-waybill-panel" v-loading="loading">
|
||||
<div class="express-waybill-panel">
|
||||
<template v-if="orderId">
|
||||
<div class="toolbar">
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadDetail">刷新</el-button>
|
||||
<!-- <el-button size="small" type="primary" plain @click="openQuickBindDialog">按运单绑定包材</el-button> -->
|
||||
<!-- <el-tag v-if="waybillCodesText" size="small" type="info">运单汇总:{{ waybillCodesText }}</el-tag> -->
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadDetail">刷新</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table :data="expressRows" border stripe size="small" empty-text="暂无运单信息" align="center">
|
||||
<el-table-column prop="waybill_code" label="运单号" min-width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<!-- 表格:对齐 storage/receiving 入库记录(UpperTable + 多选 + 分页) -->
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
table-id="order-management-express"
|
||||
:data="pagedExpressRows"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="waybill_code"
|
||||
empty-text="暂无运单信息"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadDetail"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-waybill_code="{ row }">
|
||||
<div class="express-waybill-cell">
|
||||
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
|
||||
<el-tag v-if="row.is_main" size="small" type="danger" effect="dark" style="margin-left:4px">主</el-tag>
|
||||
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" align="center" />
|
||||
<el-tag v-if="row.is_main" size="small" type="danger" effect="dark">主</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="logistics_name" label="物流公司" min-width="120" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="logistics_interface_name" label="快递接口" min-width="120" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="称重(g)" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-logistics_name="{ row }">
|
||||
{{ row.logistics_name || '—' }}
|
||||
</template>
|
||||
|
||||
<template #column-logistics_interface_name="{ row }">
|
||||
{{ row.logistics_interface_name || '—' }}
|
||||
</template>
|
||||
|
||||
<template #column-weighing_weight="{ row }">
|
||||
{{ formatWeight(row.weighing_weight) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分配时间" width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-created_at="{ row }">
|
||||
{{ formatTime(row.created_at) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="包材" min-width="140" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-package_material_name_snapshot="{ row }">
|
||||
{{ row.package_material_name_snapshot || row.package_material_code || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="320" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small" @click="openWeighingDialog(row)">称重</el-button>
|
||||
<el-button link type="success" size="small" @click="openBindDialog(row)">绑定包材</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleInterceptScan(row)">库内拦截确认</el-button>
|
||||
|
||||
<template #column-actions="{ row }">
|
||||
<div class="express-row-actions">
|
||||
<el-button link type="primary" size="small" @click="openWeighingDialog(row)">称重</el-button>
|
||||
<el-button link type="success" size="small" @click="openBindDialog(row)">绑定包材</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleInterceptScan(row)">库内拦截确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</upper-table>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="empty-tip">请从上方列表中选择订单</div>
|
||||
|
||||
@ -113,12 +139,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { orderDetail, orderUpdateExpressWeighingWeight } from '@/api/order.index/orderindex'
|
||||
import { interceptScan } from '@/api/order.recheckorder/recheckOrder'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '@/views/order/shared/orderListExport'
|
||||
import BindPackageMaterialByWaybillDialog from './BindPackageMaterialByWaybillDialog.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
|
||||
import { toWaybillCodes } from '@/components/waybill/waybill-column'
|
||||
|
||||
@ -136,6 +163,51 @@ const quickBindDialogVisible = ref(false)
|
||||
const quickBindWaybillCode = ref('')
|
||||
const expressRows = ref<any[]>([])
|
||||
const waybillCodesText = ref('')
|
||||
const queryTime = ref(0)
|
||||
const tableRef = ref<any>(null)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
/** 列配置(对齐 storage/receiving 入库记录:UpperTable + 多选 + 分页) */
|
||||
const columns = [
|
||||
{ prop: 'waybill_code', label: '运单号', minWidth: '160' },
|
||||
{ prop: 'logistics_name', label: '物流公司', minWidth: '120', showOverflowTooltip: true },
|
||||
{ prop: 'logistics_interface_name', label: '快递接口', minWidth: '120', showOverflowTooltip: true },
|
||||
{ prop: 'weighing_weight', label: '称重(g)', width: '110' },
|
||||
{ prop: 'created_at', label: '分配时间', width: '140' },
|
||||
{ prop: 'package_material_name_snapshot', label: '包材', minWidth: '140', showOverflowTooltip: true },
|
||||
{ prop: 'actions', label: '操作', width: '320', fixed: 'right' }
|
||||
]
|
||||
|
||||
/** 前端分页(order.detail 一次返回全部运单) */
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const pagedExpressRows = computed(() => {
|
||||
const start = (pagination.currentPage - 1) * pagination.pageSize
|
||||
return expressRows.value.slice(start, start + pagination.pageSize)
|
||||
})
|
||||
|
||||
watch(expressRows, (rows) => {
|
||||
pagination.total = rows.length
|
||||
const maxPage = Math.max(1, Math.ceil(rows.length / pagination.pageSize))
|
||||
if (pagination.currentPage > maxPage) pagination.currentPage = maxPage
|
||||
})
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
const weighingForm = reactive({
|
||||
waybill_code: '',
|
||||
@ -166,6 +238,7 @@ async function loadDetail() {
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const res: any = await orderDetail({
|
||||
id: orderId.value,
|
||||
@ -183,6 +256,7 @@ async function loadDetail() {
|
||||
waybillCodesText.value = ''
|
||||
ElMessage.error(error?.message || '获取运单信息失败')
|
||||
} finally {
|
||||
queryTime.value = Date.now() - startedAt
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
@ -276,6 +350,9 @@ async function submitWeighing() {
|
||||
watch(
|
||||
() => orderId.value,
|
||||
() => {
|
||||
pagination.currentPage = 1
|
||||
selectedRows.value = []
|
||||
nextTick(() => tableRef.value?.clearSelection?.())
|
||||
loadDetail()
|
||||
},
|
||||
{ immediate: true }
|
||||
@ -464,25 +541,108 @@ watch(
|
||||
}
|
||||
}
|
||||
|
||||
/* 列表区样式对齐 storage/receiving 入库记录(Storage.vue):
|
||||
header-actions 按钮行 + table-host 自适应高度 + UpperTable 分页右对齐 */
|
||||
.express-waybill-panel {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 6px 10px 8px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 8px;
|
||||
background: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
.header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
.left-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 表格容器:为 UpperTable 提供弹性高度(对齐 storage/receiving) */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
/* 运单号单元格:运单号 + 「主」标记整体居中(WaybillCodeActions 根节点是 100% 宽的 flex) */
|
||||
.express-waybill-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.waybill-code-actions) {
|
||||
flex: 0 1 auto;
|
||||
width: auto;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
/* 行内操作:按钮等距、不换行错位 */
|
||||
.express-row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 2px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="order-items-detail" v-loading="loading">
|
||||
<div class="order-items-detail">
|
||||
<div v-if="!row?.id" class="empty-tip">请从上方列表中选择一项查看商品明细</div>
|
||||
<template v-else>
|
||||
<div class="header-actions">
|
||||
@ -16,63 +16,52 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
<!-- 表格:对齐 storage/receiving 入库记录(UpperTable + 多选 + 分页) -->
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
table-id="order-management-items"
|
||||
:data="pagedItems"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
>
|
||||
<el-table-column
|
||||
v-for="column in activeColumns"
|
||||
:key="column.prop"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
:width="column.width"
|
||||
:min-width="column.minWidth"
|
||||
:align="column.align"
|
||||
:show-overflow-tooltip="column.showOverflowTooltip"
|
||||
>
|
||||
<template #default="{ row: item }">
|
||||
<template v-if="column.image">
|
||||
<template v-if="Array.isArray(item.images) && item.images.length">
|
||||
<el-image
|
||||
class="item-image"
|
||||
:src="item.images[0]"
|
||||
:preview-src-list="item.images"
|
||||
preview-teleported
|
||||
fit="cover"
|
||||
/>
|
||||
</template>
|
||||
<span v-else class="cell-empty">—</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ formatCellValue(item, column) }}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无商品明细</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:columns="upperColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
:row-key="resolveItemRowKey"
|
||||
empty-text="暂无商品明细"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="handleRefresh"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template
|
||||
v-for="column in upperColumns"
|
||||
:key="column.prop"
|
||||
#[column.slotName]="{ row: item }"
|
||||
>
|
||||
<template v-if="column.image">
|
||||
<template v-if="Array.isArray(item.images) && item.images.length">
|
||||
<el-image
|
||||
class="item-image"
|
||||
:src="item.images[0]"
|
||||
:preview-src-list="item.images"
|
||||
preview-teleported
|
||||
fit="cover"
|
||||
/>
|
||||
</template>
|
||||
<span v-else class="cell-empty">—</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ formatCellValue(item, column) }}
|
||||
</template>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@ -81,7 +70,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import {
|
||||
formatOrderTime,
|
||||
@ -90,6 +78,7 @@ import {
|
||||
type OrderItemColumnConfig
|
||||
} from '../config/order-common-config'
|
||||
import { normalizeOrderDetailItems, parseOrderDetailPayload } from '@/views/order/shared/orderListExport'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import type { OrderDetailDisplayMode } from './OrderDetailDisplayToggle.vue'
|
||||
|
||||
const props = withDefaults(
|
||||
@ -115,33 +104,43 @@ const activeColumns = computed(() => {
|
||||
return props.compactColumns ?? orderItemCompactColumns
|
||||
})
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHeight = ref(220)
|
||||
/* UpperTable 列配置:在原有列基础上补充插槽名(表格统一走动态插槽渲染) */
|
||||
const upperColumns = computed(() =>
|
||||
activeColumns.value.map((column) => ({ ...column, slotName: `column-${column.prop}` }))
|
||||
)
|
||||
|
||||
/* 商品明细随订单明细接口一次性返回,所以用前端分页(交互对齐 stock/external_stock「外部绑定」) */
|
||||
const tableRef = ref<any>(null)
|
||||
const queryTime = ref(0)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
/* 商品明细随订单明细接口一次性返回,所以用前端分页(对齐 storage/receiving 入库记录) */
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
/** 当前页商品明细 */
|
||||
const pagedItems = computed(() => {
|
||||
const start = (pagination.page - 1) * pagination.pageSize
|
||||
const start = (pagination.currentPage - 1) * pagination.pageSize
|
||||
return items.value.slice(start, start + pagination.pageSize)
|
||||
})
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
/** 明细行唯一键:优先明细 ID,回退到商品+行号+SKU(保证多选勾选状态正确) */
|
||||
function resolveItemRowKey(row: Record<string, any>) {
|
||||
return (
|
||||
row?.id ??
|
||||
row?.order_item_id ??
|
||||
`${row?.item_code ?? ''}-${row?.order_line_no ?? ''}-${row?.stock_id ?? ''}`
|
||||
)
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
pagination.currentPage = page
|
||||
resetTableScroll()
|
||||
}
|
||||
|
||||
@ -153,14 +152,14 @@ function handleRefresh() {
|
||||
|
||||
function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
resetTableScroll()
|
||||
}
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
tableRef.value?.getTableRef?.()?.setScrollTop?.(0)
|
||||
})
|
||||
}
|
||||
|
||||
@ -208,6 +207,7 @@ async function loadItems() {
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const requestFn = props.detailRequest || orderPendingOrder.detail
|
||||
const res: any = await requestFn({
|
||||
@ -228,6 +228,7 @@ async function loadItems() {
|
||||
items.value = []
|
||||
} finally {
|
||||
pagination.total = items.value.length
|
||||
queryTime.value = Date.now() - startedAt
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
@ -235,7 +236,9 @@ async function loadItems() {
|
||||
watch(
|
||||
() => props.row?.id,
|
||||
() => {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
selectedRows.value = []
|
||||
nextTick(() => tableRef.value?.clearSelection?.())
|
||||
loadItems()
|
||||
},
|
||||
{ immediate: true }
|
||||
@ -247,7 +250,8 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 新设计(对齐 stock/external_stock「外部绑定」):面板自带内边距 + 表格自适应高度 + 右下角前端分页 */
|
||||
/* 列表区样式对齐 storage/receiving 入库记录(Storage.vue):
|
||||
header-actions 按钮行 + table-host 自适应高度 + UpperTable 分页右对齐 */
|
||||
.order-items-detail {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -264,9 +268,37 @@ onBeforeUnmount(() => {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 顶部操作行(对齐订单日志面板的 header-actions) */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
/* 顶部操作行(对齐 storage/receiving 的 header-actions) */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@ -289,23 +321,6 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.order-items-detail .pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
|
||||
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-image {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
@ -328,11 +343,4 @@ onBeforeUnmount(() => {
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 表格内部空态(#empty 插槽):表格已知高度,交给 el-table 自身居中即可 */
|
||||
.order-items-detail .table-host .empty-tip {
|
||||
height: auto;
|
||||
display: block;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -14,79 +14,65 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column prop="created_at" label="时间" width="175" />
|
||||
<el-table-column label="操作人" width="110">
|
||||
<template #default="{ row }">
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
table-id="order-management-logs"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
:row-key="resolveLogRowKey"
|
||||
empty-text="暂无订单日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="handleRefresh"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-operator_name="{ row }">
|
||||
{{ row.operator_name ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作类型" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-operation_name="{ row }">
|
||||
{{ formatOperationLabel(row) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平台" width="100" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-platform_name="{ row }">
|
||||
{{ row.platform_name || row.platform_code || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="外部日志" width="108" align="center">
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-external_log_type="{ row }">
|
||||
<el-tag v-if="row.external_log_type && row.external_log_type !== 'NONE'" size="small" type="info">
|
||||
{{ row.external_log_type }}
|
||||
</el-tag>
|
||||
<span v-else class="cell-muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-message="{ row }">
|
||||
{{ row.message ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="108" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
v-if="hasExternalPayload(scope.row)"
|
||||
v-if="hasExternalPayload(row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="viewData(scope.row)"
|
||||
@click="viewData(row)"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<span v-else class="cell-muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无订单日志</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
@ -104,8 +90,8 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { orderQueryOrderLogs } from '@/api/order.index/orderindex'
|
||||
|
||||
const props = defineProps<{
|
||||
@ -121,27 +107,43 @@ const requestId = ref(0)
|
||||
const requestType = ref('')
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const queryTime = ref(0)
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHeight = ref(220)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
/** 列配置(对齐 storage/receiving 入库记录:UpperTable + 多选 + 分页) */
|
||||
const columns = [
|
||||
{ prop: 'created_at', label: '时间', width: '175' },
|
||||
{ prop: 'operator_name', label: '操作人', width: '110' },
|
||||
{ prop: 'operation_name', label: '操作类型', minWidth: '160', showOverflowTooltip: true },
|
||||
{ prop: 'platform_name', label: '平台', width: '100', showOverflowTooltip: true },
|
||||
{ prop: 'external_log_type', label: '外部日志', width: '108' },
|
||||
{ prop: 'message', label: '说明', minWidth: '220', showOverflowTooltip: true },
|
||||
{ prop: 'actions', label: '操作', width: '108', fixed: 'right' }
|
||||
]
|
||||
|
||||
/** 日志行唯一键:优先 id,回退到业务字段组合(保证多选勾选状态正确) */
|
||||
function resolveLogRowKey(row: Record<string, any>) {
|
||||
return (
|
||||
row?.id ??
|
||||
row?.log_id ??
|
||||
`${row?.created_at ?? ''}-${row?.operation_code ?? ''}-${row?.operator_name ?? ''}-${row?.message ?? ''}`
|
||||
)
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
tableRef.value?.getTableRef?.()?.setScrollTop?.(0)
|
||||
})
|
||||
}
|
||||
|
||||
@ -186,8 +188,10 @@ function hasExternalPayload(row: any): boolean {
|
||||
watch(
|
||||
() => orderId.value,
|
||||
(newOrderId) => {
|
||||
selectedRows.value = []
|
||||
tableRef.value?.clearSelection?.()
|
||||
if (newOrderId) {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
loadOrderLogs()
|
||||
} else {
|
||||
tableData.value = []
|
||||
@ -198,20 +202,20 @@ watch(
|
||||
)
|
||||
|
||||
async function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
pagination.currentPage = page
|
||||
resetTableScroll()
|
||||
await loadOrderLogs()
|
||||
}
|
||||
|
||||
async function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
resetTableScroll()
|
||||
await loadOrderLogs()
|
||||
}
|
||||
|
||||
async function handleRefresh() {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
await loadOrderLogs()
|
||||
}
|
||||
|
||||
@ -219,10 +223,11 @@ async function loadOrderLogs() {
|
||||
if (!orderId.value) return
|
||||
|
||||
loading.value = true
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const response: any = await orderQueryOrderLogs({
|
||||
id: orderId.value,
|
||||
page: pagination.page,
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
if (response && ![1, 200].includes(response.code)) {
|
||||
@ -237,6 +242,7 @@ async function loadOrderLogs() {
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
} finally {
|
||||
queryTime.value = Date.now() - startedAt
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
@ -286,11 +292,40 @@ function viewData(row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
/* 与 storage/receiving(Product/Logs)一致:UpperTable 自适应高度 + 左下角「已选 N 项」 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.cell-muted {
|
||||
@ -304,23 +339,6 @@ function viewData(row: any) {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
|
||||
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
|
||||
@ -1,88 +1,137 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="运单称重"
|
||||
width="480px"
|
||||
class="express-weighing-dialog"
|
||||
width="min(560px, 92vw)"
|
||||
align-center
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<!-- <el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="weighing-form-alert"
|
||||
>
|
||||
<template #title>
|
||||
支持运单号模式(order_id=0)与订单模式(order_id 为正整数)。称重重量单位为 g,须大于 0 的整数。
|
||||
</template>
|
||||
</el-alert> -->
|
||||
<!-- 面板结构对齐「手工录入运单号」(ManualWaybillForm / task-panel) -->
|
||||
<div class="task-panel">
|
||||
<header class="task-panel__head">
|
||||
<div class="task-panel__titles">
|
||||
<h2>运单称重</h2>
|
||||
<p>支持运单号模式与订单模式,重量单位为克(g)</p>
|
||||
</div>
|
||||
<button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
|
||||
<svg viewBox="0 0 12 12" fill="none">
|
||||
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formModel"
|
||||
:rules="rules"
|
||||
label-width="96px"
|
||||
class="weighing-form"
|
||||
@submit.prevent
|
||||
>
|
||||
<el-form-item label="称重方式" prop="weighing_mode">
|
||||
<el-radio-group v-model="formModel.weighing_mode">
|
||||
<el-radio value="waybill">运单号模式</el-radio>
|
||||
<el-radio value="order">订单模式</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div class="task-panel__body">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formModel"
|
||||
:rules="rules"
|
||||
class="task-panel__form"
|
||||
@submit.prevent
|
||||
>
|
||||
<div class="task-panel__grid">
|
||||
<!-- 称重方式 -->
|
||||
<div class="task-panel__field task-panel__field--input task-panel__field--full">
|
||||
<span class="task-panel__field-label is-required">称重方式</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="weighing_mode">
|
||||
<el-radio-group v-model="formModel.weighing_mode">
|
||||
<el-radio value="waybill">运单号模式</el-radio>
|
||||
<el-radio value="order">订单模式</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-form-item v-if="formModel.weighing_mode === 'waybill'" label="运单号" prop="waybill_code">
|
||||
<el-input
|
||||
v-model="formModel.waybill_code"
|
||||
placeholder="请输入运单号"
|
||||
clearable
|
||||
maxlength="64"
|
||||
@keyup.enter="handleSubmit"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 运单号模式 -->
|
||||
<div
|
||||
v-if="formModel.weighing_mode === 'waybill'"
|
||||
class="task-panel__field task-panel__field--input"
|
||||
>
|
||||
<span class="task-panel__field-label is-required">运单号</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="waybill_code">
|
||||
<el-input
|
||||
v-model="formModel.waybill_code"
|
||||
placeholder="请输入运单号"
|
||||
clearable
|
||||
maxlength="64"
|
||||
@keyup.enter="handleSubmit"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<el-form-item label="订单 ID" prop="order_id">
|
||||
<el-input-number
|
||||
v-model="formModel.order_id"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
placeholder="请输入订单 ID"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="运单号" prop="order_waybill_code">
|
||||
<el-input
|
||||
v-model="formModel.order_waybill_code"
|
||||
placeholder="单运单订单可不填;多运单订单必填"
|
||||
clearable
|
||||
maxlength="64"
|
||||
@keyup.enter="handleSubmit"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<!-- 订单模式 -->
|
||||
<template v-else>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label is-required">订单 ID</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="order_id">
|
||||
<el-input-number
|
||||
v-model="formModel.order_id"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
placeholder="请输入订单 ID"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label">运单号</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="order_waybill_code">
|
||||
<el-input
|
||||
v-model="formModel.order_waybill_code"
|
||||
placeholder="单运单可不填;多运单必填"
|
||||
clearable
|
||||
maxlength="64"
|
||||
@keyup.enter="handleSubmit"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form-item label="称重重量(g)" prop="weighing_weight">
|
||||
<el-input-number
|
||||
v-model="formModel.weighing_weight"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
placeholder="请输入称重重量"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 称重重量 -->
|
||||
<div class="task-panel__field task-panel__field--input">
|
||||
<span class="task-panel__field-label is-required">称重重量(g)</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item prop="weighing_weight">
|
||||
<el-input-number
|
||||
v-model="formModel.weighing_weight"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
placeholder="请输入称重重量"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleSubmit">保存</el-button>
|
||||
</template>
|
||||
<p class="task-panel__form-tip">
|
||||
称重重量单位为克(g),须为大于 0 的整数;保存后立即更新该运单的称重重量。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<footer class="task-panel__foot">
|
||||
<span class="task-panel__hint">确认运单号与重量无误后保存</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="visible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" @click="handleSubmit">保存</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -256,11 +305,209 @@ watch(
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.weighing-form-alert {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
/* 面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm / task-panel) */
|
||||
.task-panel {
|
||||
background: #fff;
|
||||
color: #303133;
|
||||
|
||||
.weighing-form {
|
||||
padding-top: 4px;
|
||||
&__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;
|
||||
}
|
||||
|
||||
/* 双列栅格:每格一个「标签 + 控件」行,窄屏自动降为单列 */
|
||||
&__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
column-gap: 16px;
|
||||
row-gap: 8px;
|
||||
|
||||
@media (max-width: 720px) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
&__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: flex-start;
|
||||
min-height: 0;
|
||||
padding: 4px 0 0 12px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
|
||||
.task-panel__field-label {
|
||||
padding-top: 7px;
|
||||
|
||||
&.is-required::before {
|
||||
top: 7px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 整行占满(如单选组) */
|
||||
&--full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 标签列固定宽度(含必填星号占位):与控件左缘对齐 */
|
||||
&__field-label {
|
||||
position: relative;
|
||||
flex: 0 0 96px;
|
||||
width: 96px;
|
||||
padding-left: 10px;
|
||||
box-sizing: border-box;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #606266;
|
||||
text-align: left;
|
||||
|
||||
&.is-required::before {
|
||||
content: '*';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
line-height: 20px;
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
|
||||
&__field-form {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
max-width: none;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
margin-left: 0 !important;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.el-input),
|
||||
:deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&__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: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
/* el-dialog 会 append 到 body:去掉默认头/内边距,统一交给面板(同 ManualWaybillForm) */
|
||||
.el-dialog.express-weighing-dialog {
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
|
||||
.el-dialog__header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-dialog__body {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -196,67 +196,61 @@
|
||||
</div>
|
||||
<div class="detail-container">
|
||||
<div v-if="detailActiveTab === 'waveList'" class="detail-page wave-list-panel">
|
||||
<div ref="waveTableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="waveTableRef"
|
||||
:data="pagedTaskWaveList"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="waveTableHeight"
|
||||
>
|
||||
<el-table-column label="波次号" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row: waveRow }">
|
||||
<span
|
||||
class="click-copy-link"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
title="点击复制波次号"
|
||||
@click.stop="copyWaveNo(waveRow.wave_no)"
|
||||
@keydown.enter.prevent="copyWaveNo(waveRow.wave_no)"
|
||||
>
|
||||
{{ waveRow.wave_no || '—' }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="wave_id" label="波次ID" width="100" align="center" />
|
||||
<el-table-column prop="box_no" label="箱号" width="80" align="center" />
|
||||
<el-table-column label="状态" width="100" align="center">
|
||||
<template #default="{ row: waveRow }">
|
||||
<span :class="getStatusTextClass(getWaveStatusTagType(waveRow.status))">
|
||||
{{ getWaveStatusText(waveRow.status) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="绑定时间" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row: waveRow }">
|
||||
{{ formatWaveTime(waveRow.bind_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="拣货时间" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row: waveRow }">
|
||||
{{ formatWaveTime(waveRow.pick_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<div class="empty-tip">该任务暂无关联波次</div>
|
||||
</template>
|
||||
</el-table>
|
||||
<!-- 按钮行(对齐 storage/receiving 商品明细/操作日志:左侧刷新) -->
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadData">刷新</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="wavePagination.page"
|
||||
v-model:page-size="wavePagination.pageSize"
|
||||
<!-- 波次列表:对齐 storage/receiving 商品明细/操作日志(UpperTable + 多选 + 分页) -->
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
ref="waveTableRef"
|
||||
table-id="wave-pick-task-wave-list"
|
||||
:data="pagedTaskWaveList"
|
||||
:columns="waveColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="wavePagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="wavePagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handleWavePageSizeChange"
|
||||
@current-change="handleWavePageChange"
|
||||
/>
|
||||
:row-key="resolveWaveRowKey"
|
||||
empty-text="该任务暂无关联波次"
|
||||
@page-change="handleWavePageChange"
|
||||
@page-size-change="handleWavePageSizeChange"
|
||||
@selection-change="handleWaveSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-wave_no="{ row: waveRow }">
|
||||
<span
|
||||
class="click-copy-link"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
title="点击复制波次号"
|
||||
@click.stop="copyWaveNo(waveRow.wave_no)"
|
||||
@keydown.enter.prevent="copyWaveNo(waveRow.wave_no)"
|
||||
>
|
||||
{{ waveRow.wave_no || '—' }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-status="{ row: waveRow }">
|
||||
<span :class="getStatusTextClass(getWaveStatusTagType(waveRow.status))">
|
||||
{{ getWaveStatusText(waveRow.status) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #column-bind_time="{ row: waveRow }">
|
||||
{{ formatWaveTime(waveRow.bind_time) }}
|
||||
</template>
|
||||
|
||||
<template #column-pick_time="{ row: waveRow }">
|
||||
{{ formatWaveTime(waveRow.pick_time) }}
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -275,7 +269,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
@ -773,56 +766,70 @@ const selectedTaskWaveList = computed(() => {
|
||||
// 波次列表分页(波次随任务行一次性返回,所以用前端分页;
|
||||
// 交互与 stock/external_stock「外部绑定」erpStock.vue 一致)
|
||||
// ============================================================
|
||||
const waveTableHostRef = ref<HTMLElement | null>(null)
|
||||
const waveTableRef = ref<any>(null)
|
||||
/** 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const waveTableHeight = ref(200)
|
||||
|
||||
/** 波次列表列配置(UpperTable) */
|
||||
const waveColumns = [
|
||||
{ prop: 'wave_no', label: '波次号', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'wave_id', label: '波次ID', width: '100' },
|
||||
{ prop: 'box_no', label: '箱号', width: '80' },
|
||||
{ prop: 'status', label: '状态', width: '100' },
|
||||
{ prop: 'bind_time', label: '绑定时间', minWidth: '168', showOverflowTooltip: true },
|
||||
{ prop: 'pick_time', label: '拣货时间', minWidth: '168', showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
const wavePagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
/** 波次勾选行(UpperTable selection-change) */
|
||||
const waveSelectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
function handleWaveSelectionChange(rows: Record<string, any>[]) {
|
||||
waveSelectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 波次行唯一键:波次ID + 波次号 + 箱号(同一波次可能拆多箱) */
|
||||
function resolveWaveRowKey(row: Record<string, any>) {
|
||||
return `${row?.wave_id ?? ''}-${row?.wave_no ?? ''}-${row?.box_no ?? ''}`
|
||||
}
|
||||
|
||||
/** 当前页波次 */
|
||||
const pagedTaskWaveList = computed(() => {
|
||||
const start = (wavePagination.page - 1) * wavePagination.pageSize
|
||||
const start = (wavePagination.currentPage - 1) * wavePagination.pageSize
|
||||
return selectedTaskWaveList.value.slice(start, start + wavePagination.pageSize)
|
||||
})
|
||||
|
||||
useResizeObserver(waveTableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
waveTableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
|
||||
/** 切任务/刷新后波次数量会变:同步总数并回到第 1 页 */
|
||||
/** 切任务/刷新后波次数量会变:同步总数并回到第 1 页、清空勾选 */
|
||||
watch(
|
||||
selectedTaskWaveList,
|
||||
(rows) => {
|
||||
wavePagination.total = rows.length
|
||||
wavePagination.page = 1
|
||||
wavePagination.currentPage = 1
|
||||
waveSelectedRows.value = []
|
||||
nextTick(() => waveTableRef.value?.clearSelection?.())
|
||||
resetWaveTableScroll()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
function handleWavePageChange(page: number) {
|
||||
wavePagination.page = page
|
||||
wavePagination.currentPage = page
|
||||
resetWaveTableScroll()
|
||||
}
|
||||
|
||||
function handleWavePageSizeChange(pageSize: number) {
|
||||
wavePagination.pageSize = pageSize
|
||||
wavePagination.page = 1
|
||||
wavePagination.currentPage = 1
|
||||
resetWaveTableScroll()
|
||||
}
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetWaveTableScroll() {
|
||||
nextTick(() => {
|
||||
waveTableRef.value?.setScrollTop?.(0)
|
||||
waveTableRef.value?.getTableRef?.()?.setScrollTop?.(0)
|
||||
})
|
||||
}
|
||||
|
||||
@ -1318,8 +1325,7 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 波次列表面板(新设计:面板自带内边距 + 表格自适应高度 + 右下角前端分页,
|
||||
与 stock/external_stock「外部绑定」erpStock.vue 完全一致) */
|
||||
/* 波次列表面板(对齐 storage/receiving 商品明细/操作日志:table-host + UpperTable 多选/分页) */
|
||||
.wave-list-panel {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -1340,27 +1346,61 @@ onMounted(() => {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wave-list-panel .header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.wave-list-panel .left-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.wave-list-panel .table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wave-list-panel .pagination-container {
|
||||
margin-top: 6px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.wave-list-panel .table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wave-list-panel .table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.wave-list-panel .table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.wave-list-panel .pagination-container :deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.wave-list-panel .pagination-container :deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
.wave-list-panel .table-host :deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.upper-table-container.small :deep(.el-table) {
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
:pagination="pagination"
|
||||
:show-actions="true"
|
||||
:show-selection="true"
|
||||
row-key="id"
|
||||
@current-change="handleRowClick"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handleSizeChange"
|
||||
@ -802,10 +803,11 @@ onMounted(() => {
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳:不留上/下间距(外部绑定、日志组件自带 padding;
|
||||
基本信息、商品图片面板自带 padding),只保留左右 10px */
|
||||
基本信息、商品图片面板自带 padding),只保留左右 10px;
|
||||
溢出交给各面板自己处理,避免容器与面板双重滚动条 */
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
padding: 0 10px;
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 基本信息 / 商品图片面板:分区标题统一样式(对齐 express/waybill「运单明细」新样式) */
|
||||
@ -937,9 +939,12 @@ onMounted(() => {
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
/* 外部绑定 / 日志:内部是 storage/receiving 标准的固定高度表格面板
|
||||
(header-actions + 自适应表格 + 左下角已选),外层只负责把它撑满、不再滚动 */
|
||||
.erp-stock-wrapper,
|
||||
.log-wrapper {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -15,32 +15,34 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table ref="tableRef" :data="pagedTableData" border stripe size="small" style="width: 100%" :height="tableHeight">
|
||||
<el-table-column prop="create_from" label="来源" width="150" />
|
||||
<el-table-column prop="app_name" label="应用" width="120" />
|
||||
<el-table-column prop="item_code" label="外部编码" />
|
||||
<el-table-column prop="item_name" label="外部商品名称" />
|
||||
<el-table-column label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<el-button @click="unbindItem(scope.row)" type="primary" link size="small">解绑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
<!-- 表格:对齐 storage/receiving 商品明细/操作日志(UpperTable + 多选 + 分页) -->
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
table-id="stock-management-erp-bind"
|
||||
:data="pagedTableData"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
empty-text="暂无外部绑定"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="fetchStockInfo"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-actions="{ row }">
|
||||
<el-button type="primary" link size="small" @click="unbindItem(row)">解绑</el-button>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
@ -89,9 +91,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch, onMounted, nextTick } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { Refresh, Plus } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import StoreStock from './store_stock.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
@ -105,51 +106,59 @@ const tableData = ref<any[]>([])
|
||||
const showStoreStock = ref(false)
|
||||
const store_id = ref(0)
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
/* 表格高度由 UpperTable 自适应;分页器对齐 storage/receiving 入库记录 */
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHeight = ref(280)
|
||||
const queryTime = ref(0)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
/* 分页器(接口一次性返回全部关联,所以用前端分页,交互与日志一致) */
|
||||
/** 列配置(UpperTable) */
|
||||
const columns = [
|
||||
{ prop: 'create_from', label: '来源', width: '150' },
|
||||
{ prop: 'app_name', label: '应用', width: '120' },
|
||||
{ prop: 'item_code', label: '外部编码', minWidth: '150', showOverflowTooltip: true },
|
||||
{ prop: 'item_name', label: '外部商品名称', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'actions', label: '操作', width: '100', fixed: 'right' }
|
||||
]
|
||||
|
||||
/* 分页器(接口一次性返回全部关联,所以用前端分页) */
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 当前页数据 */
|
||||
const pagedTableData = computed(() => {
|
||||
const start = (pagination.page - 1) * pagination.pageSize
|
||||
const start = (pagination.currentPage - 1) * pagination.pageSize
|
||||
return tableData.value.slice(start, start + pagination.pageSize)
|
||||
})
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
pagination.currentPage = page
|
||||
resetTableScroll()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
resetTableScroll()
|
||||
}
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
tableRef.value?.getTableRef?.()?.setScrollTop?.(0)
|
||||
})
|
||||
}
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.id, (newVal) => {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
selectedRows.value = []
|
||||
nextTick(() => tableRef.value?.clearSelection?.())
|
||||
if (newVal) {
|
||||
fetchStockInfo()
|
||||
} else {
|
||||
@ -157,14 +166,6 @@ watch(() => props.id, (newVal) => {
|
||||
pagination.total = 0
|
||||
store_id.value = 0
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const el = tableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@ -195,6 +196,7 @@ async function fetchStockInfo() {
|
||||
if (!props.id) return
|
||||
|
||||
loading.value = true
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const response: any = await stockApi.getStoreStocks({
|
||||
stock_id: props.id
|
||||
@ -207,8 +209,8 @@ async function fetchStockInfo() {
|
||||
pagination.total = rows.length
|
||||
// 解绑/刷新后当前页可能已超出范围,回退到最后一页
|
||||
const maxPage = Math.max(1, Math.ceil(rows.length / pagination.pageSize))
|
||||
if (pagination.page > maxPage) {
|
||||
pagination.page = maxPage
|
||||
if (pagination.currentPage > maxPage) {
|
||||
pagination.currentPage = maxPage
|
||||
}
|
||||
} else {
|
||||
throw new Error('请求失败')
|
||||
@ -217,6 +219,7 @@ async function fetchStockInfo() {
|
||||
console.error('获取商品信息失败:', error)
|
||||
ElMessage.error('获取商品信息失败')
|
||||
} finally {
|
||||
queryTime.value = Date.now() - startedAt
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
@ -269,28 +272,40 @@ function handleAddBind() {
|
||||
}
|
||||
}
|
||||
|
||||
/* 与 storage/receiving 商品明细/操作日志一致:UpperTable 自适应高度 + 左下角「已选 N 项」 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
.table-host :deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.stock-erp-bind-dialog__body {
|
||||
|
||||
@ -1,23 +1,25 @@
|
||||
<template>
|
||||
<div class="stock-info-container">
|
||||
<!-- 概要条:左侧商品身份/管理标识,右侧关键数据(对齐 stock/pickingShortage 工具栏) -->
|
||||
<div class="info-summary">
|
||||
<div class="info-summary__identity">
|
||||
<span class="info-summary__name" :title="formData.item_name">{{ formData.item_name || '未命名商品' }}</span>
|
||||
<span class="info-summary__code">{{ formData.item_code || '未设置编码' }}</span>
|
||||
<span
|
||||
v-for="tag in managementTags"
|
||||
:key="tag.label"
|
||||
class="info-tag"
|
||||
:class="`info-tag--${tag.type}`"
|
||||
>{{ tag.label }}</span>
|
||||
<span v-if="formData.need_recheck === 'N'" class="info-tag info-tag--warning">跳过复核</span>
|
||||
<span
|
||||
v-if="!managementTags.length && formData.need_recheck !== 'N'"
|
||||
class="info-tag info-tag--muted"
|
||||
>无特殊管理</span>
|
||||
<!-- 面板头(对齐「新建波次策略」task-panel__head):左商品身份/管理标识,右关键数据 -->
|
||||
<header class="task-panel__head info-head">
|
||||
<div class="task-panel__titles">
|
||||
<h2 :title="formData.item_name">{{ formData.item_name || '未命名商品' }}</h2>
|
||||
<p>
|
||||
<span class="info-head__code">{{ formData.item_code || '未设置编码' }}</span>
|
||||
<span
|
||||
v-for="tag in managementTags"
|
||||
:key="tag.label"
|
||||
class="info-tag"
|
||||
:class="`info-tag--${tag.type}`"
|
||||
>{{ tag.label }}</span>
|
||||
<span v-if="formData.need_recheck === 'N'" class="info-tag info-tag--warning">跳过复核</span>
|
||||
<span
|
||||
v-if="!managementTags.length && formData.need_recheck !== 'N'"
|
||||
class="info-tag info-tag--muted"
|
||||
>无特殊管理</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="info-summary__metrics">
|
||||
<div class="info-head__metrics">
|
||||
<span class="summary-chip">标价 <strong>¥ {{ formatAmount(formData.tag_price) }}</strong></span>
|
||||
<span class="summary-chip summary-chip--primary">
|
||||
零售价 <strong>¥ {{ formatAmount(formData.retail_price) }}</strong>
|
||||
@ -26,25 +28,24 @@
|
||||
体积 <strong>{{ formatAmount(formData.volume, 0) }}<i>cm³</i></strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="loading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
label-width="88px"
|
||||
class="stock-info-form"
|
||||
:disabled="!hasPermission('stock.warehouse.saveWarehouseStock') || loading"
|
||||
>
|
||||
<div class="info-grid">
|
||||
<div class="task-panel__form info-stack">
|
||||
<!-- 基础信息 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">基础信息</h3>
|
||||
<span class="info-group__hint">编码、名称、规格与分类</span>
|
||||
</header>
|
||||
<div class="info-fields">
|
||||
<section class="info-block">
|
||||
<div class="task-panel__sub-head">
|
||||
<span class="task-panel__sub-title">基础信息</span>
|
||||
</div>
|
||||
<div class="task-panel__grid">
|
||||
<!-- 商品编码 -->
|
||||
<el-form-item label="商品编码" prop="item_code">
|
||||
<template #label>
|
||||
@ -142,12 +143,11 @@
|
||||
</section>
|
||||
|
||||
<!-- 价格与重量 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">价格与重量</h3>
|
||||
<span class="info-group__hint">金额单位:元 · 重量单位:克</span>
|
||||
</header>
|
||||
<div class="info-fields info-fields--4">
|
||||
<section class="info-block">
|
||||
<div class="task-panel__sub-head">
|
||||
<span class="task-panel__sub-title">价格与重量</span>
|
||||
</div>
|
||||
<div class="task-panel__grid">
|
||||
<el-form-item label="标价(¥)" prop="tag_price">
|
||||
<el-input-number v-model="formData.tag_price" :min="0" :precision="2" :controls="false" />
|
||||
</el-form-item>
|
||||
@ -164,12 +164,11 @@
|
||||
</section>
|
||||
|
||||
<!-- 管理设置 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">管理设置</h3>
|
||||
<span class="info-group__hint">决定入库、出库与复核校验规则</span>
|
||||
</header>
|
||||
<div class="info-fields">
|
||||
<section class="info-block">
|
||||
<div class="task-panel__sub-head">
|
||||
<span class="task-panel__sub-title">管理设置</span>
|
||||
</div>
|
||||
<div class="task-panel__grid">
|
||||
<!-- 管理标识 -->
|
||||
<el-form-item label="管理标识" class="info-field--full">
|
||||
<el-checkbox-group v-model="formData.managementFlags" class="management-flags">
|
||||
@ -230,12 +229,11 @@
|
||||
</section>
|
||||
|
||||
<!-- 尺寸与箱规 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">尺寸与箱规</h3>
|
||||
<span class="info-group__hint">体积由长 × 宽 × 高自动计算,启用箱规后需维护整箱参数</span>
|
||||
</header>
|
||||
<div class="info-fields info-fields--4">
|
||||
<section class="info-block">
|
||||
<div class="task-panel__sub-head">
|
||||
<span class="task-panel__sub-title">尺寸与箱规</span>
|
||||
</div>
|
||||
<div class="task-panel__grid">
|
||||
<el-form-item label="长度(cm)" prop="length">
|
||||
<el-input-number v-model="formData.length" :min="0" :precision="2" :controls="false" @change="calculateVolume" />
|
||||
</el-form-item>
|
||||
@ -324,12 +322,11 @@
|
||||
</section>
|
||||
|
||||
<!-- 作业要求:要求合并=Y 时只填一个「要求」(提交到打包要求),否则三个要求各传各的 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">作业要求</h3>
|
||||
<span class="info-group__hint">拣货、复核、打包流程分别可见对应要求,单项最多 255 字</span>
|
||||
</header>
|
||||
<div class="info-fields info-fields--3">
|
||||
<section class="info-block">
|
||||
<div class="task-panel__sub-head">
|
||||
<span class="task-panel__sub-title">作业要求</span>
|
||||
</div>
|
||||
<div class="task-panel__grid task-panel__grid--wide">
|
||||
<!-- 要求合并:Y=是,N=否;开启后所有接口输出都会输出该商品的打包要求 -->
|
||||
<el-form-item prop="merge_requirements" class="info-field--full">
|
||||
<template #label>
|
||||
@ -351,7 +348,6 @@
|
||||
v-if="formData.merge_requirements === 'Y'"
|
||||
prop="packing_requirements"
|
||||
label="要求"
|
||||
label-position="top"
|
||||
class="info-field--full"
|
||||
>
|
||||
<el-input
|
||||
@ -367,7 +363,7 @@
|
||||
|
||||
<!-- 合并关闭:打包/拣货/复核要求各传各的 -->
|
||||
<template v-else>
|
||||
<el-form-item prop="packing_requirements" label="打包要求" label-position="top">
|
||||
<el-form-item prop="packing_requirements" label="打包要求">
|
||||
<el-input
|
||||
v-model="formData.packing_requirements"
|
||||
type="textarea"
|
||||
@ -379,7 +375,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="pick_requirements" label="拣货要求" label-position="top">
|
||||
<el-form-item prop="pick_requirements" label="拣货要求">
|
||||
<el-input
|
||||
v-model="formData.pick_requirements"
|
||||
type="textarea"
|
||||
@ -391,7 +387,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="recheck_requirements" label="复核要求" label-position="top">
|
||||
<el-form-item prop="recheck_requirements" label="复核要求">
|
||||
<el-input
|
||||
v-model="formData.recheck_requirements"
|
||||
type="textarea"
|
||||
@ -408,11 +404,14 @@
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<div class="footer-actions" v-if="hasPermission('stock.warehouse.saveWarehouseStock')">
|
||||
<el-button size="small" type="danger" plain @click="resetForm">重置</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" @click="handleSave">保存</el-button>
|
||||
</div>
|
||||
<!-- 底部:左提示 / 右操作(对齐「新建波次策略」task-panel__foot) -->
|
||||
<footer v-if="hasPermission('stock.warehouse.saveWarehouseStock')" class="task-panel__foot info-foot">
|
||||
<span class="task-panel__hint">带 * 为必填;开启保质期管理或箱规后需补全对应参数</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="resetForm">重置</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" @click="handleSave">保存</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- 库存单位管理弹窗 -->
|
||||
<el-dialog
|
||||
@ -1159,52 +1158,32 @@ async function handleDeleteProhibited(id: number) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* ===== 概要条:左身份 / 右统计(工具栏式) ===== */
|
||||
.info-summary {
|
||||
/* ===== 面板头(对齐「新建波次策略」task-panel__head):左身份 / 右统计 ===== */
|
||||
.info-head {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px 12px;
|
||||
min-width: 0;
|
||||
margin: 6px 10px 0;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
padding: 10px 0 8px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
|
||||
&__identity {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
.task-panel__titles {
|
||||
h2 {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
color: #303133;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__name {
|
||||
min-width: 0;
|
||||
max-width: 360px;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
line-height: 20px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__code {
|
||||
flex: none;
|
||||
height: 20px;
|
||||
line-height: 18px;
|
||||
padding: 0 6px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
background: #fafbfc;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin: 4px 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__metrics {
|
||||
@ -1217,19 +1196,32 @@ async function handleDeleteProhibited(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
/* 统计 chip:与 stock/pickingShortage、库存页工具栏保持一致 */
|
||||
/* 商品编码:轻量灰字(不用灰底胶囊,避免与标识标签堆叠) */
|
||||
.info-head__code {
|
||||
flex: none;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #909399;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
/* 统计项:轻量文本 + 竖分隔(去掉灰底块,降低视觉噪音) */
|
||||
.summary-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: #f4f4f5;
|
||||
padding: 0 12px;
|
||||
border-left: 1px solid #ebeef5;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
line-height: 20px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
|
||||
&:first-child {
|
||||
padding-left: 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
@ -1288,7 +1280,8 @@ async function handleDeleteProhibited(id: number) {
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
width: 100%;
|
||||
padding: 10px 10px 8px;
|
||||
/* 左右留白由宿主 .detail-container 的 10px 承担,组件内只留上下间距 */
|
||||
padding: 10px 0 8px;
|
||||
box-sizing: border-box;
|
||||
|
||||
/* 隐藏滚动条 */
|
||||
@ -1299,12 +1292,14 @@ async function handleDeleteProhibited(id: number) {
|
||||
scrollbar-width: none; /* Firefox */
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
/* 标签左对齐、12px 灰字(对齐 task-panel 字段行) */
|
||||
:deep(.el-form-item__label) {
|
||||
padding-right: 12px;
|
||||
font-size: 13px;
|
||||
justify-content: flex-start;
|
||||
padding-right: 8px;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
@ -1323,77 +1318,50 @@ async function handleDeleteProhibited(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
/* 分组区块:无边框,靠小标题 + 细分隔线分区(对齐 task-panel__sub-head) */
|
||||
.info-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.info-group {
|
||||
padding: 10px 12px 2px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
.info-block {
|
||||
min-width: 0;
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
color: #303133;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 3px;
|
||||
height: 12px;
|
||||
border-radius: 2px;
|
||||
background: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
&__hint {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
& + & {
|
||||
margin-top: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 一行两个表单项,标签在左、控件在右 */
|
||||
.info-fields,
|
||||
.info-fields--3,
|
||||
.info-fields--4 {
|
||||
/* 分组标题:单行 + 细分隔线,去掉重复的灰说明文字 */
|
||||
.info-stack .task-panel__sub-head {
|
||||
margin: 0 0 10px;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid #f2f3f5;
|
||||
}
|
||||
|
||||
/* 字段横向排开:宽屏一行多列(auto-fit),窄屏自动降为单列 */
|
||||
.info-stack .task-panel__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0 20px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||||
column-gap: 16px;
|
||||
row-gap: 8px;
|
||||
|
||||
@media (max-width: 720px) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
/* 作业要求:文本域需要更宽的列 */
|
||||
.info-stack .task-panel__grid--wide {
|
||||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
||||
}
|
||||
|
||||
.info-field--full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.info-fields,
|
||||
.info-fields--3,
|
||||
.info-fields--4 {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.select-with-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -1406,13 +1374,14 @@ async function handleDeleteProhibited(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
.footer-actions {
|
||||
/* 底部:左提示 / 右操作(对齐 task-panel__foot) */
|
||||
.task-panel__foot.info-foot {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 10px 8px;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 8px 0;
|
||||
border-top: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
|
||||
@ -6,58 +6,53 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column prop="created_at" label="时间" width="250" />
|
||||
<el-table-column prop="operator_name" label="操作人" width="120" />
|
||||
<el-table-column prop="operation_name" label="操作名称" />
|
||||
<el-table-column prop="platform_name" label="操作平台" />
|
||||
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@click="viewData(scope.row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.external_log_id"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="backData(scope.row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.operation_code === 'UPDATE'"
|
||||
>
|
||||
修改前快照
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
<!-- 表格:对齐 storage/receiving 商品明细/操作日志(UpperTable + 多选 + 分页) -->
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
table-id="stock-management-logs"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
:row-key="resolveLogRowKey"
|
||||
empty-text="暂无日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="fetchStockInfo"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-actions="{ row }">
|
||||
<div class="log-row-actions">
|
||||
<el-button
|
||||
v-if="row.external_log_id"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="viewData(row)"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.operation_code === 'UPDATE'"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="backData(row)"
|
||||
>
|
||||
修改前快照
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
@ -103,12 +98,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { ref, reactive, watch, onMounted, nextTick } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
id?: number
|
||||
@ -120,38 +114,55 @@ const showRequestData = ref(false)
|
||||
const requestId = ref(0)
|
||||
const requestType = ref('')
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
/* 表格高度由 UpperTable 自适应;分页器对齐 storage/receiving 入库记录 */
|
||||
const tableRef = ref<any>(null)
|
||||
const queryTime = ref(0)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
/** 列配置(UpperTable) */
|
||||
const columns = [
|
||||
{ prop: 'created_at', label: '时间', width: '250' },
|
||||
{ prop: 'operator_name', label: '操作人', width: '120' },
|
||||
{ prop: 'operation_name', label: '操作名称', minWidth: '160', showOverflowTooltip: true },
|
||||
{ prop: 'platform_name', label: '操作平台', minWidth: '140', showOverflowTooltip: true },
|
||||
{ prop: 'actions', label: '操作', width: '150', fixed: 'right' }
|
||||
]
|
||||
|
||||
/** 日志行唯一键:优先记录 ID,回退到外部日志 ID / 时间+操作 */
|
||||
function resolveLogRowKey(row: Record<string, any>) {
|
||||
return (
|
||||
row?.id ??
|
||||
row?.external_log_id ??
|
||||
`${row?.created_at ?? ''}-${row?.operation_code ?? ''}-${row?.operator_name ?? ''}`
|
||||
)
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.getTableRef?.()?.setScrollTop?.(0)
|
||||
})
|
||||
}
|
||||
|
||||
watch(() => props.id, (newVal) => {
|
||||
selectedRows.value = []
|
||||
nextTick(() => tableRef.value?.clearSelection?.())
|
||||
if (newVal) {
|
||||
pagination.currentPage = 1
|
||||
fetchStockInfo()
|
||||
} else {
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const el = tableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@ -161,13 +172,15 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
async function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
pagination.currentPage = page
|
||||
resetTableScroll()
|
||||
await fetchStockInfo()
|
||||
}
|
||||
|
||||
async function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
resetTableScroll()
|
||||
await fetchStockInfo()
|
||||
}
|
||||
|
||||
@ -175,10 +188,11 @@ async function fetchStockInfo() {
|
||||
if (!props.id) return
|
||||
|
||||
loading.value = true
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const params: any = {
|
||||
id: props.id,
|
||||
page: pagination.page,
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
}
|
||||
|
||||
@ -200,7 +214,7 @@ async function fetchStockInfo() {
|
||||
|
||||
const resPage = Number(data?.pagination?.page)
|
||||
const resPageSize = Number(data?.pagination?.pageSize)
|
||||
if (resPage > 0) pagination.page = resPage
|
||||
if (resPage > 0) pagination.currentPage = resPage
|
||||
if (resPageSize > 0) pagination.pageSize = resPageSize
|
||||
} else {
|
||||
throw new Error('请求失败')
|
||||
@ -209,6 +223,7 @@ async function fetchStockInfo() {
|
||||
console.error('获取商品信息失败:', error)
|
||||
ElMessage.error('获取商品信息失败')
|
||||
} finally {
|
||||
queryTime.value = Date.now() - startedAt
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
@ -282,27 +297,53 @@ function backData(row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
/* 与 storage/receiving 商品明细/操作日志一致:UpperTable 自适应高度 + 左下角「已选 N 项」 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
.table-host :deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
/* 行内操作:两个链接按钮等距 */
|
||||
.log-row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 2px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<!-- 工具栏:左侧操作 + 右侧概要统计(对齐 stock/pickingShortage 页面 toolbar) -->
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<!-- 工具栏:左侧操作 + 右侧概要统计(与 storage/receiving 入库记录 .header-actions 一致,无边框不外框) -->
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadData">刷新</el-button>
|
||||
<!-- 「数量」数值默认遮挡,点此切换显示/隐藏(仅影响展示) -->
|
||||
<el-button size="small" type="primary" plain @click="quantityVisible = !quantityVisible">
|
||||
@ -10,7 +10,7 @@
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<div class="right-actions">
|
||||
<span v-if="stockItem" class="summary-chip summary-chip--name" :title="stockItemTitle">
|
||||
<strong>{{ stockItem.item_name || '-' }}</strong>
|
||||
<em>{{ stockItem.item_code || '-' }}</em>
|
||||
@ -36,132 +36,64 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 明细表格 -->
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
size="small"
|
||||
>
|
||||
<el-table-column
|
||||
prop="space"
|
||||
label="库位"
|
||||
width="160"
|
||||
<!-- 明细表格:对齐 storage/receiving 入库记录(UpperTable + 多选 + 分页) -->
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
table-id="stock-management-storage-records"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
:row-key="resolveStockRowKey"
|
||||
empty-text="暂无库存记录"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadData"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-space="{ row }">
|
||||
<span v-if="row.space">
|
||||
{{ row.space.space_code }}
|
||||
<span v-if="row.space.custom_name" class="custom-name">({{ row.space.custom_name }})</span>
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="batch_no"
|
||||
label="批次"
|
||||
width="120"
|
||||
>
|
||||
<template #default="{ row }">{{ row.batch_no ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="inventory_type"
|
||||
label="库存类型"
|
||||
width="90"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="quantity"
|
||||
label="数量"
|
||||
width="80"
|
||||
>
|
||||
<!-- 数量:默认遮挡具体数值,点上方「显示数量」可查看 -->
|
||||
<template #default="{ row }">
|
||||
|
||||
<template #column-batch_no="{ row }">{{ row.batch_no ?? '-' }}</template>
|
||||
|
||||
<template #column-quantity="{ row }">
|
||||
<span>{{ quantityVisible ? (row.quantity ?? '-') : QUANTITY_MASK }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="locked_quantity"
|
||||
label="锁定数量"
|
||||
width="80"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="available_quantity"
|
||||
label="可用数量"
|
||||
width="80"
|
||||
/>
|
||||
<el-table-column
|
||||
label="实物数"
|
||||
width="80"
|
||||
>
|
||||
<template #default="{ row }">{{ resolvePhysicalQuantity(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="production_date"
|
||||
label="生产日期"
|
||||
width="110"
|
||||
>
|
||||
<template #default="{ row }">{{ row.production_date ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="expiry_date"
|
||||
label="到期日期"
|
||||
width="110"
|
||||
>
|
||||
<template #default="{ row }">{{ row.expiry_date ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="inbound_order_no"
|
||||
label="入库单号"
|
||||
width="160"
|
||||
>
|
||||
<template #default="{ row }">{{ row.inbound_order_no ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="supplier_batch_no"
|
||||
label="供应商批次"
|
||||
width="120"
|
||||
>
|
||||
<template #default="{ row }">{{ row.supplier_batch_no ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="inbound_time"
|
||||
label="入库时间"
|
||||
min-width="160"
|
||||
>
|
||||
<template #default="{ row }">{{ row.inbound_time ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无库存记录</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
<template #column-physical_quantity="{ row }">{{ resolvePhysicalQuantity(row) }}</template>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div v-if="pagination.total > 0" class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
<template #column-production_date="{ row }">{{ row.production_date ?? '-' }}</template>
|
||||
|
||||
<template #column-expiry_date="{ row }">{{ row.expiry_date ?? '-' }}</template>
|
||||
|
||||
<template #column-inbound_order_no="{ row }">{{ row.inbound_order_no ?? '-' }}</template>
|
||||
|
||||
<template #column-supplier_batch_no="{ row }">{{ row.supplier_batch_no ?? '-' }}</template>
|
||||
|
||||
<template #column-inbound_time="{ row }">{{ row.inbound_time ?? '-' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch, nextTick } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
id?: number | string | null
|
||||
@ -171,15 +103,38 @@ const loading = ref(false)
|
||||
const tableData = ref<any[]>([])
|
||||
const stockItem = ref<any>(null)
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
/* 表格高度由 UpperTable 自适应;分页器对齐 storage/receiving 入库记录 */
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHeight = ref(320)
|
||||
const queryTime = ref(0)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
useResizeObserver(tableHostRef, () => {
|
||||
const height = tableHostRef.value?.clientHeight ?? 0
|
||||
if (height > 0) tableHeight.value = height
|
||||
})
|
||||
/** 列配置(UpperTable) */
|
||||
const columns = [
|
||||
{ prop: 'space', label: '库位', width: '160' },
|
||||
{ prop: 'batch_no', label: '批次', width: '120' },
|
||||
{ prop: 'inventory_type', label: '库存类型', width: '90' },
|
||||
{ prop: 'quantity', label: '数量', width: '80' },
|
||||
{ prop: 'locked_quantity', label: '锁定数量', width: '80' },
|
||||
{ prop: 'available_quantity', label: '可用数量', width: '80' },
|
||||
{ prop: 'physical_quantity', label: '实物数', width: '80' },
|
||||
{ prop: 'production_date', label: '生产日期', width: '110' },
|
||||
{ prop: 'expiry_date', label: '到期日期', width: '110' },
|
||||
{ prop: 'inbound_order_no', label: '入库单号', width: '160' },
|
||||
{ prop: 'supplier_batch_no', label: '供应商批次', width: '120' },
|
||||
{ prop: 'inbound_time', label: '入库时间', minWidth: '160' }
|
||||
]
|
||||
|
||||
/** 库存行唯一键:优先记录 ID,回退到库位+批次+库存类型+入库单号 */
|
||||
function resolveStockRowKey(row: Record<string, any>) {
|
||||
return (
|
||||
row?.id ??
|
||||
`${row?.space?.space_code ?? ''}-${row?.batch_no ?? ''}-${row?.inventory_type ?? ''}-${row?.inbound_order_no ?? ''}`
|
||||
)
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 「数量」数值是否可见:默认隐藏(只遮挡数值,列仍在;不影响数据与分页/刷新) */
|
||||
const quantityVisible = ref(false)
|
||||
@ -205,7 +160,7 @@ function resolvePhysicalQuantity(row: any): number {
|
||||
}
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
@ -217,9 +172,10 @@ async function loadData() {
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const res = await stockApi.getStockDetail(Number(props.id), {
|
||||
page: pagination.page,
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
if (res && res.data) {
|
||||
@ -232,32 +188,36 @@ async function loadData() {
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
queryTime.value = Date.now() - startedAt
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
pagination.currentPage = page
|
||||
loadData()
|
||||
nextTick(() => tableRef.value?.setScrollTop?.(0))
|
||||
nextTick(() => tableRef.value?.getTableRef?.()?.setScrollTop?.(0))
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
nextTick(() => tableRef.value?.setScrollTop?.(0))
|
||||
nextTick(() => tableRef.value?.getTableRef?.()?.setScrollTop?.(0))
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
selectedRows.value = []
|
||||
nextTick(() => tableRef.value?.clearSelection?.())
|
||||
if (val) {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
} else {
|
||||
tableData.value = []
|
||||
stockItem.value = null
|
||||
pagination.total = 0
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
@ -265,33 +225,29 @@ watch(
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 库存:对齐 order/orderManagement 商品明细面板(概要条 + 按钮行 + 自适应表格 + 分页) */
|
||||
/* 库存:对齐 storage/receiving 入库记录(按钮行 + 自适应表格 + 分页) */
|
||||
.container {
|
||||
height: 100%;
|
||||
padding: 6px 10px 8px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 工具栏:左操作 + 右统计(对齐 stock/pickingShortage) */
|
||||
.toolbar {
|
||||
flex-shrink: 0;
|
||||
/* 按钮行:与入库记录 .header-actions 完全一致(无边框/圆角/底色,不额外撑高) */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.toolbar-left {
|
||||
.left-actions {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -303,7 +259,7 @@ watch(
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
.right-actions {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
@ -311,17 +267,23 @@ watch(
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
/* 首个统计项不要左侧分隔线 */
|
||||
> .summary-chip:first-child {
|
||||
padding-left: 0;
|
||||
border-left: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 统计项:轻量文本 + 竖分隔(与商品明细头部一致,去掉灰底块/圆角,不撑高行高) */
|
||||
.summary-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: #f4f4f5;
|
||||
padding: 0 10px;
|
||||
border-left: 1px solid #ebeef5;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
line-height: 20px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
|
||||
@ -378,37 +340,44 @@ watch(
|
||||
}
|
||||
}
|
||||
|
||||
/* 与 storage/receiving 商品明细/操作日志一致:UpperTable 自适应高度 + 左下角「已选 N 项」 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.custom-name {
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
padding: 24px 0;
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -35,6 +35,9 @@
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@page-change="handlePageChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧,仅可移除时启用多选) -->
|
||||
<template v-if="canRemove" #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-inbound_type="{ row }">
|
||||
{{ formatDirectInboundType(row.inbound_type) }}
|
||||
</template>
|
||||
@ -336,18 +339,33 @@ defineExpose({
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
/* 分页区与「操作日志」保持一致:去掉 UpperTable 默认的底部分隔线/内边距,
|
||||
右对齐,仅保留 6px 上间距;左侧「已选 N 条 / 查询用时」文案一并去掉 */
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:与 storage/receiving 商品明细/操作日志一致(左「已选 N 项」右分页) */
|
||||
:deep(.pagination-container) {
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,9 +8,6 @@
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadBindingData">刷新</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="summary-text selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
<span class="summary-text">已绑定收货单 {{ receivingBindings.length }} 个</span>
|
||||
<span class="summary-text">明细绑定 {{ itemBindingRows.length }} 条</span>
|
||||
</div>
|
||||
@ -34,6 +31,9 @@
|
||||
@refresh="loadBindingData"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
link
|
||||
@ -480,10 +480,6 @@ defineExpose({
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.selection-text {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 表格容器:撑满剩余高度(与「商品明细」Product.vue 的 UpperTable 一致) */
|
||||
@ -508,17 +504,18 @@ defineExpose({
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:去掉 UpperTable 默认底部分隔线/内边距,右对齐,仅保留 6px 上间距 */
|
||||
/* 分页区:与 storage/receiving 商品明细/操作日志一致(左「已选 N 项」右分页) */
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,9 @@
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@page-change="handlePageChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-operation="{ row }">
|
||||
<el-button
|
||||
link
|
||||
@ -444,18 +447,33 @@ onMounted(() => {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
/* 分页区与「操作日志」保持一致:去掉 UpperTable 默认的底部分隔线/内边距,
|
||||
右对齐,仅保留 6px 上间距;左侧「已选 N 条 / 查询用时」文案一并去掉 */
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:与 storage/receiving 商品明细/操作日志一致(左「已选 N 项」右分页) */
|
||||
:deep(.pagination-container) {
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-host">
|
||||
@ -36,6 +31,9 @@
|
||||
@refresh="handleRefresh"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-operator_name="{ row }">{{ row.operator_name ?? '—' }}</template>
|
||||
<template #column-operation_label="{ row }">{{ formatOperationLabel(row) }}</template>
|
||||
<template #column-platform_label="{ row }">
|
||||
@ -255,17 +253,6 @@ function viewData(row: any) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-host {
|
||||
@ -289,17 +276,18 @@ function viewData(row: any) {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:与「商品明细」一致(去掉底部分隔线/内边距,右对齐,仅保留 6px 上间距) */
|
||||
/* 分页区:与 storage/receiving 商品明细/操作日志一致(左「已选 N 项」右分页) */
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:queryTime="queryTime"
|
||||
row-key="id"
|
||||
@current-change="handleRowClick"
|
||||
@sort-change="handleSortChange"
|
||||
@page-change="handlePageChange"
|
||||
@ -695,10 +696,10 @@ async function handleExportSelected() {
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(各详情组件自带
|
||||
padding: 6px 10px 8px),只保留左右 10px,避免与组件内边距叠加 */
|
||||
padding: 6px 10px 8px),只保留左右 10px;溢出交给面板自己处理,避免双重滚动条 */
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
padding: 0 10px;
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
|
||||
@ -7,47 +7,43 @@
|
||||
-->
|
||||
<template>
|
||||
<div class="log-panel">
|
||||
<div v-if="apiLoading" v-loading="true" class="log-empty">加载中…</div>
|
||||
<template v-else>
|
||||
<el-table
|
||||
v-if="logs.length"
|
||||
:data="pagedLogs"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
height="100%"
|
||||
class="log-table"
|
||||
>
|
||||
<el-table-column prop="time" label="时间" width="175" />
|
||||
<el-table-column prop="operator" label="操作人" width="120" />
|
||||
<el-table-column prop="action" label="操作类型" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="结果" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="resultTagType(row)">{{ row.result }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.detail || '—' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div v-else class="log-empty">暂无操作日志</div>
|
||||
|
||||
<div v-if="logs.length > pageSize" class="log-pagination">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="logs.length"
|
||||
layout="total, prev, pager, next"
|
||||
background
|
||||
size="small"
|
||||
/>
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button size="small" type="primary" :loading="apiLoading" @click="loadLogs">刷新</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
:table-id="`${tableIdPrefix}-logs`"
|
||||
:data="pagedLogs"
|
||||
:columns="logColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="apiLoading"
|
||||
:row-key="(row: LogItem) => row.__key"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-result="{ row }">
|
||||
<el-tag size="small" :type="resultTagType(row)">{{ row.result }}</el-tag>
|
||||
</template>
|
||||
<template #column-detail="{ row }">{{ row.detail || '—' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -58,34 +54,69 @@ interface LogItem {
|
||||
detail?: string
|
||||
time: string
|
||||
level: 'success' | 'info' | 'warning' | 'error'
|
||||
/** 本地行 key(日志无 id) */
|
||||
__key?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 当前选中行数据(用于生成关联日志) */
|
||||
row: Record<string, any> | null
|
||||
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||
apiMethod?: (...args: any[]) => Promise<any>
|
||||
}>()
|
||||
/** 列配置持久化前缀(区分不同页面) */
|
||||
tableIdPrefix?: string
|
||||
}>(), {
|
||||
tableIdPrefix: 'storage-generalreport'
|
||||
})
|
||||
|
||||
/** 通过 API 获取的真实日志列表 */
|
||||
const apiLogs = ref<LogItem[] | null>(null)
|
||||
const apiLoading = ref(false)
|
||||
|
||||
/** 表格本地分页(对齐 order/orderManagement 的 log.vue 体验) */
|
||||
/** 日志列配置(UpperTable) */
|
||||
const logColumns = [
|
||||
{ prop: 'time', label: '时间', width: '175' },
|
||||
{ prop: 'operator', label: '操作人', width: '120' },
|
||||
{ prop: 'action', label: '操作类型', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'result', label: '结果', width: '90' },
|
||||
{ prop: 'detail', label: '说明', minWidth: '220', showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
/** 表格本地分页(对齐 storage/receiving 操作日志体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 10
|
||||
const pageSize = ref(10)
|
||||
const pagination = computed(() => ({
|
||||
currentPage: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
total: logs.value.length
|
||||
}))
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize
|
||||
return logs.value.slice(start, start + pageSize)
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return logs.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
function resultTagType(row: LogItem): string {
|
||||
if (row.result === '成功') return 'success'
|
||||
if (row.result === '失败') return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
watch(() => props.row, async (newRow) => {
|
||||
watch(() => props.row, () => {
|
||||
void loadLogs()
|
||||
}, { immediate: true })
|
||||
|
||||
/** 拉取日志(按钮「刷新」也走这个函数) */
|
||||
async function loadLogs() {
|
||||
const newRow = props.row
|
||||
currentPage.value = 1
|
||||
if (newRow && props.apiMethod) {
|
||||
apiLoading.value = true
|
||||
@ -119,7 +150,7 @@ watch(() => props.row, async (newRow) => {
|
||||
} else {
|
||||
apiLogs.value = null
|
||||
}
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
/** 基于 row 生成模拟日志(无 apiMethod 时使用) */
|
||||
const mockLogs = computed<LogItem[]>(() => {
|
||||
@ -150,17 +181,16 @@ const mockLogs = computed<LogItem[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志(附本地行 key) */
|
||||
const logs = computed<LogItem[]>(() => {
|
||||
if (apiLogs.value !== null) {
|
||||
return apiLogs.value
|
||||
}
|
||||
return mockLogs.value
|
||||
const list = apiLogs.value !== null ? apiLogs.value : mockLogs.value
|
||||
return list.map((item, index) => ({ ...item, __key: `log-${index}` }))
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 对齐 order/orderManagement 的 log.vue(el-table 表格 + 本地分页) */
|
||||
/* 样式对齐 storage/receiving「操作日志」:
|
||||
header-actions(按钮行) + table-host(自适应剩余高度) + 左下角已选 / 右下分页 */
|
||||
.log-panel {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@ -169,26 +199,64 @@ const logs = computed<LogItem[]>(() => {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.log-table {
|
||||
flex: 1;
|
||||
.header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.log-empty {
|
||||
flex: 1;
|
||||
.left-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
padding: 40px 0;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.log-pagination {
|
||||
flex-shrink: 0;
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 10px;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -311,6 +311,9 @@
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<!-- 生产日期:单元格可直接点击打开维护弹窗并展开对应日历 -->
|
||||
<template #column-production_date="{ row }">
|
||||
<el-link
|
||||
@ -1145,8 +1148,38 @@ watch(targetSpace, (val) => {
|
||||
|
||||
.detail-table-wrap {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
/* 与 storage/receiving 商品明细/操作日志一致:容器撑满 + 左下角「已选 N 项」 */
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
|
||||
@ -68,122 +68,75 @@
|
||||
</div>
|
||||
|
||||
<div class="table-wrapper">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
<upper-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
row-key="stock_id"
|
||||
:default-sort="defaultTableSort"
|
||||
:columns="replenishmentColumns"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
table-size="small"
|
||||
default-align="center"
|
||||
:show-selection="true"
|
||||
selection-mode="native"
|
||||
:show-expand="true"
|
||||
:row-key="replenishmentRowKey"
|
||||
:pagination="tablePagination"
|
||||
:page-sizes="pageSizeOptions"
|
||||
empty-text="暂无补货需求数据,可调整排序后重新查询"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="handleTableSortChange"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<el-table-column type="selection" width="48" fixed="left" />
|
||||
<el-table-column type="expand" width="48">
|
||||
<template #default="{ row }">
|
||||
<div v-if="row.replenishment_locations?.length" class="expand-content">
|
||||
<div class="expand-title">补货库位明细</div>
|
||||
<el-table :data="row.replenishment_locations" border size="small">
|
||||
<el-table-column prop="space_code" label="库位编码" min-width="160" />
|
||||
<el-table-column prop="space_name" label="库位名称" min-width="140" />
|
||||
<el-table-column prop="available_quantity" label="可用数量" min-width="100" align="right" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div v-else class="expand-empty">无可用补货库位(存货区与分拣区均无库存)</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stock_id" label="SKU ID" min-width="100" align="right" sortable="custom" />
|
||||
<el-table-column prop="stock_code" label="SKU编码" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="stock_name" label="商品名称" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="store_name" label="货主名称" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="条码" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<template v-if="row.barcodes?.length">
|
||||
<div class="barcode-list">
|
||||
<el-tag
|
||||
v-for="bc in row.barcodes"
|
||||
:key="bc.id ?? bc.barcode"
|
||||
size="small"
|
||||
type="info"
|
||||
class="barcode-tag"
|
||||
>
|
||||
{{ bc.barcode }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
<span v-else class="no-location-text">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="pick_zone_quantity"
|
||||
label="分拣区库存"
|
||||
min-width="110"
|
||||
align="right"
|
||||
sortable="custom"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="storage_zone_quantity"
|
||||
label="存货区库存"
|
||||
min-width="110"
|
||||
align="right"
|
||||
sortable="custom"
|
||||
/>
|
||||
<el-table-column prop="total_demand" label="总需求量" min-width="100" align="right" sortable="custom" />
|
||||
<el-table-column prop="shortage" label="缺口数量" min-width="100" align="right" sortable="custom">
|
||||
<template #default="{ row }">
|
||||
<span :class="{ 'shortage-text': Number(row.shortage) > 0 }">{{ row.shortage ?? '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="replenishment_needed"
|
||||
label="建议补货量"
|
||||
min-width="110"
|
||||
align="right"
|
||||
sortable="custom"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(Number(row.replenishment_needed) > 0 ? 'warning' : 'success')">
|
||||
{{ row.replenishment_needed ?? 0 }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="replenishment_status" label="补货状态" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(statusTagType(row.replenishment_status))">
|
||||
{{ statusLabel(row.replenishment_status) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="补货库位" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<span
|
||||
v-if="row.replenishment_locations?.length"
|
||||
:class="getStatusTextClass('success')"
|
||||
>
|
||||
{{ row.replenishment_locations.length }}个
|
||||
</span>
|
||||
<span v-else class="no-location-text">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无补货需求数据,可调整排序后重新查询</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="queryForm.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="pageSizeOptions"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
<!-- 展开行:补货库位明细 -->
|
||||
<template #expand="{ row }">
|
||||
<div v-if="row.replenishment_locations?.length" class="expand-content">
|
||||
<div class="expand-title">补货库位明细</div>
|
||||
<el-table :data="row.replenishment_locations" border size="small">
|
||||
<el-table-column prop="space_code" label="库位编码" min-width="160" />
|
||||
<el-table-column prop="space_name" label="库位名称" min-width="140" />
|
||||
<el-table-column prop="available_quantity" label="可用数量" min-width="100" align="right" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div v-else class="expand-empty">无可用补货库位(存货区与分拣区均无库存)</div>
|
||||
</template>
|
||||
|
||||
<template #column-barcodes="{ row }">
|
||||
<div v-if="row.barcodes?.length" class="barcode-list">
|
||||
<el-tag
|
||||
v-for="bc in row.barcodes"
|
||||
:key="bc.id ?? bc.barcode"
|
||||
size="small"
|
||||
type="info"
|
||||
class="barcode-tag"
|
||||
>
|
||||
{{ bc.barcode }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<span v-else class="no-location-text">-</span>
|
||||
</template>
|
||||
<template #column-shortage="{ row }">
|
||||
<span :class="{ 'shortage-text': Number(row.shortage) > 0 }">{{ row.shortage ?? '-' }}</span>
|
||||
</template>
|
||||
<template #column-replenishment_needed="{ row }">
|
||||
<span :class="getStatusTextClass(Number(row.replenishment_needed) > 0 ? 'warning' : 'success')">
|
||||
{{ row.replenishment_needed ?? 0 }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-replenishment_status="{ row }">
|
||||
<span :class="getStatusTextClass(statusTagType(row.replenishment_status))">
|
||||
{{ statusLabel(row.replenishment_status) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-replenishment_locations="{ row }">
|
||||
<span v-if="row.replenishment_locations?.length" :class="getStatusTextClass('success')">
|
||||
{{ row.replenishment_locations.length }}个
|
||||
</span>
|
||||
<span v-else class="no-location-text">-</span>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -191,6 +144,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, type FormInstance } from 'element-plus'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { getReplenishmentDemand } from '@/api/storage.management/management'
|
||||
import { loadStores } from '@/api/index/index'
|
||||
import { extractStoreListFromResponse, mapStoreListToSelectOptions } from '@/utils/storeScanOptions'
|
||||
@ -211,7 +165,6 @@ import {
|
||||
|
||||
const pageSizeOptions = [20, 50, 100, 200]
|
||||
const queryFormRef = ref<FormInstance>()
|
||||
const tableRef = ref()
|
||||
const loading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
const tableData = ref<ReplenishmentDemandListItem[]>([])
|
||||
@ -226,11 +179,32 @@ const pagination = reactive({
|
||||
total: 0,
|
||||
})
|
||||
|
||||
const defaultTableSort = computed(() => ({
|
||||
prop: queryForm.sortField,
|
||||
order: queryForm.sortOrder === 'ASC' ? 'ascending' : 'descending',
|
||||
/** UpperTable 分页(字段名与后端分页状态映射) */
|
||||
const tablePagination = computed(() => ({
|
||||
currentPage: pagination.page,
|
||||
pageSize: queryForm.pageSize,
|
||||
total: pagination.total,
|
||||
}))
|
||||
|
||||
/** 行 key:补货需求按库存 ID 唯一 */
|
||||
const replenishmentRowKey = (row: ReplenishmentDemandListItem & { stock_id?: number | string }) => row.stock_id
|
||||
|
||||
/** 补货需求列配置(对齐 storage/receiving 表格标准;可排序列保留 custom 排序) */
|
||||
const replenishmentColumns = [
|
||||
{ prop: 'stock_id', label: 'SKU ID', minWidth: '100', align: 'right', sortable: 'custom' },
|
||||
{ prop: 'stock_code', label: 'SKU编码', minWidth: '140', showOverflowTooltip: true },
|
||||
{ prop: 'stock_name', label: '商品名称', minWidth: '160', showOverflowTooltip: true },
|
||||
{ prop: 'store_name', label: '货主名称', minWidth: '140', showOverflowTooltip: true },
|
||||
{ prop: 'barcodes', label: '条码', minWidth: '180' },
|
||||
{ prop: 'pick_zone_quantity', label: '分拣区库存', minWidth: '110', align: 'right', sortable: 'custom' },
|
||||
{ prop: 'storage_zone_quantity', label: '存货区库存', minWidth: '110', align: 'right', sortable: 'custom' },
|
||||
{ prop: 'total_demand', label: '总需求量', minWidth: '100', align: 'right', sortable: 'custom' },
|
||||
{ prop: 'shortage', label: '缺口数量', minWidth: '100', align: 'right', sortable: 'custom' },
|
||||
{ prop: 'replenishment_needed', label: '建议补货量', minWidth: '110', align: 'right', sortable: 'custom' },
|
||||
{ prop: 'replenishment_status', label: '补货状态', minWidth: '110' },
|
||||
{ prop: 'replenishment_locations', label: '补货库位', minWidth: '100' },
|
||||
]
|
||||
|
||||
function buildRequestBody() {
|
||||
const body: Record<string, unknown> = {
|
||||
pagination: {
|
||||
@ -498,19 +472,40 @@ onMounted(() => {
|
||||
.table-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
flex-shrink: 0;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 8px 12px;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.shortage-text {
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-host">
|
||||
@ -36,6 +31,8 @@
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
v-if="row.external_log_id"
|
||||
@ -218,17 +215,7 @@ function backData(row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 表格容器:为 UpperTable 提供弹性高度 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
@ -238,7 +225,6 @@ function backData(row: any) {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 与「商品明细」Product.vue 的 UpperTable 完全一致的容器/分页处理 */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
@ -252,16 +238,18 @@ function backData(row: any) {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:与 UpperTable 默认一致(左侧「已选 N 项」),只去掉上下内边距/分隔线 */
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
|
||||
@ -45,6 +45,9 @@
|
||||
@page-change="handlePageChange"
|
||||
@row-contextmenu="handleContextMenu"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-images="{ row }">
|
||||
<div class="image-slot" style="display: flex; gap: 4px; flex-wrap: wrap;">
|
||||
<template v-if="row.images && row.images.length > 0">
|
||||
@ -3885,17 +3888,18 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
/* 分页区与「操作日志」保持一致:去掉 UpperTable 默认的底部分隔线/内边距,
|
||||
右对齐,仅保留 6px 上间距;左侧「已选 N 条 / 查询用时」文案一并去掉 */
|
||||
左侧「已选 N 项」、右侧分页器 */
|
||||
.left-col :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.left-col :deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.product-detail-row-actions {
|
||||
|
||||
@ -20,11 +20,6 @@
|
||||
库存流水
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-host">
|
||||
@ -44,7 +39,10 @@
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadData"
|
||||
@selection-change="handleSelectionChange"
|
||||
/>
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -155,17 +153,6 @@ function goToStorageLog() {
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
@ -189,15 +176,17 @@ function goToStorageLog() {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:与 UpperTable 默认一致(左侧「已选 N 项」),只去掉上下内边距/分隔线 */
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:queryTime="queryTime"
|
||||
row-key="id"
|
||||
@current-change="handleRowClick"
|
||||
@sort-change="handleSortChange"
|
||||
@page-change="handlePageChange"
|
||||
@ -600,10 +601,10 @@ async function handleExportSelected() {
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(操作日志组件自带
|
||||
padding: 6px 10px 8px),只保留左右 10px,避免与组件内边距叠加 */
|
||||
padding: 6px 10px 8px),只保留左右 10px;溢出交给面板自己处理,避免双重滚动条 */
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
padding: 0 10px;
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
|
||||
@ -105,6 +105,9 @@
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<!-- 明细类型:商品行 / 库位行(同一单内由任务 type 决定,显式标注便于核对) -->
|
||||
<template #column-scope_label="{ row }">{{ itemScopeLabel(row) }}</template>
|
||||
<!-- 商品列:仅商品类任务显示(库位类任务不展示商品快照,商品明细看「作业明细」) -->
|
||||
@ -1060,7 +1063,7 @@ watch(
|
||||
}
|
||||
}
|
||||
|
||||
/* 与「商品明细」Product.vue 的 UpperTable 一致:容器撑满、分页右对齐、隐藏左侧「已选/查询用时」 */
|
||||
/* 与「商品明细」Product.vue 的 UpperTable 一致:容器撑满 + 左下角「已选 N 项」 */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
@ -1079,11 +1082,12 @@ watch(
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
/* 库位行内的商品已平铺到主表,无需展开区样式 */
|
||||
|
||||
@ -118,11 +118,16 @@
|
||||
default-align="center"
|
||||
:loading="loading"
|
||||
:show-expand="true"
|
||||
:show-selection="true"
|
||||
selection-mode="native"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #expand="{ row }">
|
||||
<div class="sub-list">
|
||||
<div v-if="!row.goods?.length && !row.unknown?.length" class="hint-text sub-empty">
|
||||
@ -223,11 +228,16 @@
|
||||
default-align="center"
|
||||
:loading="loading"
|
||||
:show-expand="true"
|
||||
:show-selection="true"
|
||||
selection-mode="native"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #expand="{ row }">
|
||||
<div class="sub-list">
|
||||
<div v-if="!row.locations?.length" class="hint-text sub-empty">该商品暂无作业记录</div>
|
||||
@ -291,11 +301,16 @@
|
||||
default-align="center"
|
||||
:loading="loading"
|
||||
:show-expand="true"
|
||||
:show-selection="true"
|
||||
selection-mode="native"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #expand="{ row }">
|
||||
<div class="sub-list">
|
||||
<div v-if="!row.goods?.length" class="hint-text sub-empty">该库位无任务商品</div>
|
||||
@ -947,7 +962,7 @@ watch(
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 与「盘点明细」一致:容器撑满、分页右对齐、隐藏左侧「已选/查询用时」 */
|
||||
/* 与 storage/receiving 商品明细/操作日志一致:容器撑满 + 左下角「已选 N 项」 */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
@ -966,11 +981,12 @@ watch(
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
|
||||
@ -22,52 +22,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
:table-id="`${tableIdPrefix}-logs`"
|
||||
:data="pagedLogs"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
:height="tableHeight"
|
||||
v-loading="apiLoading"
|
||||
class="log-table"
|
||||
:columns="logColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="apiLoading"
|
||||
:row-key="(row: LogItem) => row.__key"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<el-table-column prop="time" label="时间" width="175" />
|
||||
<el-table-column prop="operator" label="操作人" width="120" />
|
||||
<el-table-column prop="action" label="操作类型" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="结果" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.detail || '—' }}</template>
|
||||
</el-table-column>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无操作日志</div>
|
||||
<template #column-result="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div v-if="logs.length > pageSize" class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="logs.length"
|
||||
layout="total, prev, pager, next"
|
||||
background
|
||||
size="small"
|
||||
/>
|
||||
<template #column-detail="{ row }">{{ row.detail || '—' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -78,47 +64,55 @@ interface LogItem {
|
||||
detail?: string
|
||||
time: string
|
||||
level: 'success' | 'info' | 'warning' | 'error'
|
||||
/** 本地行 key(日志无 id) */
|
||||
__key?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 当前选中行数据(用于生成关联日志) */
|
||||
row: Record<string, any> | null
|
||||
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||
apiMethod?: (...args: any[]) => Promise<any>
|
||||
}>()
|
||||
/** 列配置持久化前缀(区分不同页面) */
|
||||
tableIdPrefix?: string
|
||||
}>(), {
|
||||
tableIdPrefix: 'storage-stockcheck'
|
||||
})
|
||||
|
||||
/** 通过 API 获取的真实日志列表 */
|
||||
const apiLogs = ref<LogItem[] | null>(null)
|
||||
const apiLoading = ref(false)
|
||||
|
||||
/** 表格自适应高度:容器 ref + 测高(不要给 el-table 写 height="100%",EP parseHeight('100%') → NaN) */
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
/** 日志列配置(UpperTable) */
|
||||
const logColumns = [
|
||||
{ prop: 'time', label: '时间', width: '175' },
|
||||
{ prop: 'operator', label: '操作人', width: '120' },
|
||||
{ prop: 'action', label: '操作类型', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'result', label: '结果', width: '90' },
|
||||
{ prop: 'detail', label: '说明', minWidth: '220', showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
/** 表格本地分页(对齐 storage/receiving 操作日志体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pagination = computed(() => ({
|
||||
currentPage: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
total: logs.value.length
|
||||
}))
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return logs.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
})
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
}
|
||||
|
||||
/** 表格本地分页(对齐 storage/receiving「操作日志」体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 10
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize
|
||||
return logs.value.slice(start, start + pageSize)
|
||||
})
|
||||
|
||||
watch(currentPage, resetTableScroll)
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
function resultTagType(row: LogItem): string {
|
||||
if (row.result === '成功') return 'success'
|
||||
@ -197,17 +191,15 @@ const mockLogs = computed<LogItem[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志(附本地行 key) */
|
||||
const logs = computed<LogItem[]>(() => {
|
||||
if (apiLogs.value !== null) {
|
||||
return apiLogs.value
|
||||
}
|
||||
return mockLogs.value
|
||||
const list = apiLogs.value !== null ? apiLogs.value : mockLogs.value
|
||||
return list.map((item, index) => ({ ...item, __key: `log-${index}` }))
|
||||
})
|
||||
|
||||
/** 数据变化后页码超出范围时回退到最后一页(必须放在 logs 声明之后,否则 setup 阶段 TDZ 报错) */
|
||||
watch(logs, (list) => {
|
||||
const maxPage = Math.max(1, Math.ceil(list.length / pageSize))
|
||||
const maxPage = Math.max(1, Math.ceil(list.length / pageSize.value))
|
||||
if (currentPage.value > maxPage) currentPage.value = maxPage
|
||||
})
|
||||
</script>
|
||||
@ -256,14 +248,36 @@ watch(logs, (list) => {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
|
||||
@ -12,11 +12,6 @@
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-host">
|
||||
@ -37,6 +32,9 @@
|
||||
@refresh="fetchStockoutLogs"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
v-if="row.external_log_id"
|
||||
@ -223,17 +221,6 @@ function backData(_row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 与「收货单商品明细」Product.vue 的 UpperTable 完全一致的容器/分页处理 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
@ -262,11 +249,12 @@ function backData(_row: any) {
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
|
||||
@ -5,9 +5,6 @@
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadData">刷新</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
<span v-if="orderInfo" class="order-code">出库单号:{{ orderInfo.stockout_order_code }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -29,7 +26,10 @@
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadData"
|
||||
@selection-change="handleSelectionChange"
|
||||
/>
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -157,11 +157,6 @@ watch(() => props.id, loadData, { immediate: true })
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.order-code {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
@ -197,10 +192,11 @@ watch(() => props.id, loadData, { immediate: true })
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,99 +1,115 @@
|
||||
<template>
|
||||
<div class="stockout-details-container">
|
||||
<el-form :model="form" label-width="120px" size="small" class="details-form">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" v-for="field in detailpanel" :key="field.prop">
|
||||
<el-form-item :label="field.label" :prop="field.prop">
|
||||
<!-- 快递编码:下拉(与“修改出库单信息”一致) -->
|
||||
<el-select
|
||||
v-if="field.prop === 'express_code'"
|
||||
v-model="(form as any)[field.prop]"
|
||||
placeholder="请选择快递"
|
||||
clearable
|
||||
filterable
|
||||
style="width:100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in detailExpressOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- 来源平台编码:下拉(与“修改出库单信息”一致) -->
|
||||
<el-select
|
||||
v-else-if="field.prop === 'source_platform_code'"
|
||||
v-model="(form as any)[field.prop]"
|
||||
placeholder="请选择来源平台"
|
||||
clearable
|
||||
filterable
|
||||
style="width:100%"
|
||||
@change="handleDetailPlatformChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in detailPlatformOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- 其他字段 -->
|
||||
<template v-else>
|
||||
<template v-if="field.type === 'select'">
|
||||
<!-- 结构 / 样式对齐「新建波次策略」:分组小标题 + 左标签右控件的字段行 + 底部提示与操作 -->
|
||||
<el-form :model="form" class="task-panel__form details-form" @submit.prevent>
|
||||
<section v-for="group in detailGroups" :key="group.title" class="details-group">
|
||||
<div class="task-panel__sub-head">
|
||||
<span class="task-panel__sub-title">{{ group.title }}</span>
|
||||
</div>
|
||||
|
||||
<div class="task-panel__grid">
|
||||
<div
|
||||
v-for="field in group.fields"
|
||||
:key="field.prop"
|
||||
class="task-panel__field"
|
||||
:class="{
|
||||
'task-panel__field--textarea': field.type === 'textarea',
|
||||
'is-full': field.type === 'textarea'
|
||||
}"
|
||||
>
|
||||
<span class="task-panel__field-label">{{ field.label }}</span>
|
||||
<div class="task-panel__field-form">
|
||||
<el-form-item :prop="field.prop">
|
||||
<!-- 快递编码:下拉(与“修改出库单信息”一致) -->
|
||||
<el-select
|
||||
v-if="field.prop === 'express_code'"
|
||||
v-model="(form as any)[field.prop]"
|
||||
:placeholder="'请选择' + field.label"
|
||||
style="width: 100%"
|
||||
:disabled="field.disabled"
|
||||
placeholder="请选择快递"
|
||||
clearable
|
||||
filterable
|
||||
style="width:100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in availableFields.find(f => f.value === field.prop)?.options || []"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
v-for="opt in detailExpressOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else-if="field.type === 'textarea'">
|
||||
<el-input
|
||||
<!-- 来源平台编码:下拉(与“修改出库单信息”一致) -->
|
||||
<el-select
|
||||
v-else-if="field.prop === 'source_platform_code'"
|
||||
v-model="(form as any)[field.prop]"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
:disabled="field.disabled"
|
||||
:placeholder="'请输入' + field.label"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input
|
||||
v-model="(form as any)[field.prop]"
|
||||
:disabled="field.disabled"
|
||||
:placeholder="'请输入' + field.label"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
placeholder="请选择来源平台"
|
||||
clearable
|
||||
filterable
|
||||
style="width:100%"
|
||||
@change="handleDetailPlatformChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in detailPlatformOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- 其他字段 -->
|
||||
<template v-else>
|
||||
<template v-if="field.type === 'select'">
|
||||
<el-select
|
||||
v-model="(form as any)[field.prop]"
|
||||
:placeholder="'请选择' + field.label"
|
||||
style="width: 100%"
|
||||
:disabled="field.disabled"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in availableFields.find(f => f.value === field.prop)?.options || []"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else-if="field.type === 'textarea'">
|
||||
<el-input
|
||||
v-model="(form as any)[field.prop]"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
:disabled="field.disabled"
|
||||
:placeholder="'请输入' + field.label"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-input
|
||||
v-model="(form as any)[field.prop]"
|
||||
:disabled="field.disabled"
|
||||
:placeholder="'请输入' + field.label"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</el-form>
|
||||
|
||||
<div class="bottom">
|
||||
<el-button-group class="toolbar-btn-group">
|
||||
<el-button type="primary" size="small" icon="Check" @click="handleSave" :loading="saveLoading">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="danger" size="small" icon="Refresh" @click="handleReset">
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<footer class="task-panel__foot details-foot">
|
||||
<span class="task-panel__hint">
|
||||
修改后点击「保存」生效 · 当前出库单:{{ form.stockout_order_code || '—' }}
|
||||
</span>
|
||||
<div class="task-panel__actions">
|
||||
<el-button size="small" @click="handleReset">重置</el-button>
|
||||
<el-button size="small" type="primary" :loading="saveLoading" @click="handleSave">保存</el-button>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { computed, ref, watch, onMounted } from 'vue'
|
||||
import { availableFields, detailpanel } from '../stockout-config'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Check, Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockoutApi from '@/api/storage.stockout/stockout'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
|
||||
@ -110,6 +126,29 @@ const form = ref<any>({})
|
||||
|
||||
const saveLoading = ref(false)
|
||||
|
||||
/** 详情字段分组(对齐「新建波次策略」的分组布局,按业务含义归并字段)
|
||||
* 出库单号 / 出库状态已在列表与底部提示中展示,不再重复放只读框,避免灰底字段堆叠 */
|
||||
const DETAIL_FIELD_GROUPS: Array<{ title: string; props: string[] }> = [
|
||||
{
|
||||
title: '收件信息',
|
||||
props: ['name', 'mobile', 'tel', 'company', 'email', 'zipCode', 'countryCode', 'receiver_id']
|
||||
},
|
||||
{ title: '收货地址', props: ['province', 'city', 'area', 'town', 'detailAddress'] },
|
||||
{
|
||||
title: '快递与平台',
|
||||
props: ['express_code', 'source_platform_code', 'source_platform_name']
|
||||
}
|
||||
]
|
||||
|
||||
const detailGroups = computed(() =>
|
||||
DETAIL_FIELD_GROUPS.map((group) => ({
|
||||
...group,
|
||||
fields: group.props
|
||||
.map((prop) => detailpanel.find((field) => field.prop === prop))
|
||||
.filter(Boolean) as typeof detailpanel
|
||||
})).filter((group) => group.fields.length > 0)
|
||||
)
|
||||
|
||||
// ── 快递 / 来源平台下拉选项(与“修改出库单信息”一致)──
|
||||
const detailExpressOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
const detailPlatformOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
@ -226,6 +265,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 出库详情:面板语言对齐「新建波次策略」(waveOrder/WaveStrategyListPanel)
|
||||
分组小标题 + 字段行(左标签 / 右控件)+ 底部提示与操作 */
|
||||
.stockout-details-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
@ -236,9 +277,10 @@ onMounted(() => {
|
||||
|
||||
.details-form {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
/* 面板自带内边距(对齐 stock/external_stock),宿主 .detail-container 只留左右 10px */
|
||||
padding: 6px 10px 8px;
|
||||
/* 左右留白由宿主 .detail-container 的 10px 承担,组件内只留上下间距 */
|
||||
padding: 4px 0 8px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
@ -249,12 +291,126 @@ onMounted(() => {
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
.details-group {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* -------- task-panel 字段行(页面内嵌精简版) -------- */
|
||||
.task-panel__sub-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 0 0 10px;
|
||||
padding-bottom: 6px;
|
||||
border-bottom: 1px solid #f2f3f5;
|
||||
}
|
||||
|
||||
.details-group + .details-group {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.task-panel__sub-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.task-panel__form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
/* 字段横向排开:宽屏一行多列,窄屏自动折行 */
|
||||
.task-panel__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
||||
column-gap: 16px;
|
||||
row-gap: 6px;
|
||||
|
||||
@media (max-width: 720px) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.task-panel__field {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
|
||||
&.is-full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
.task-panel__field-label {
|
||||
flex: 0 0 84px;
|
||||
width: 84px;
|
||||
box-sizing: border-box;
|
||||
font-size: 12px;
|
||||
line-height: 32px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.task-panel__field-form {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
margin-left: 0 !important;
|
||||
width: 100%;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
:deep(.el-input),
|
||||
:deep(.el-select),
|
||||
:deep(.el-textarea) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* 多行文本:标签与文本域首行对齐 */
|
||||
.task-panel__field--textarea .task-panel__field-label {
|
||||
padding-top: 2px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.task-panel__foot.details-foot {
|
||||
flex-shrink: 0;
|
||||
text-align: right;
|
||||
padding: 6px 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 8px 0;
|
||||
border-top: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.task-panel__hint {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task-panel__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -231,8 +231,14 @@
|
||||
table-size="small"
|
||||
:loading="balanceLogLoading"
|
||||
:virtual-threshold="100000"
|
||||
:show-pagination="false"
|
||||
:pagination="balanceLogPagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
@page-change="handleBalanceLogPageChange"
|
||||
@page-size-change="handleBalanceLogSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-created_at="{ row }">
|
||||
{{ formatDate(getBalanceLogTime(row)) || '—' }}
|
||||
</template>
|
||||
@ -266,21 +272,6 @@
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<!-- 分页与「商品明细」面板一致:独立在表格下方、右下对齐 -->
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="balanceLogPagination.currentPage"
|
||||
v-model:page-size="balanceLogPagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="balanceLogPagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handleBalanceLogSizeChange"
|
||||
@current-change="handleBalanceLogPageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<KeepAlive v-else>
|
||||
<component
|
||||
@ -3397,13 +3388,40 @@ onMounted(() => {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
/* 对齐「商品明细」:表格自带 border,不需要卡片阴影/圆角 */
|
||||
/* 对齐「商品明细」:表格自带 border,不需要卡片阴影/圆角;
|
||||
UpperTable 行内分页需要确定高度 */
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:左侧「已选 N 项」+ 右侧分页器,无分隔线 */
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
/* 表格内部空态(#empty 插槽):交给 el-table 自身居中 */
|
||||
.empty-tip {
|
||||
height: auto;
|
||||
@ -3412,23 +3430,6 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 分页与「商品明细」面板一致:右下对齐、无分隔线、每页条数下拉 80px */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.open-account-form-grid {
|
||||
.el-row {
|
||||
width: 100%;
|
||||
|
||||
@ -7,48 +7,44 @@
|
||||
-->
|
||||
<template>
|
||||
<div class="log-panel">
|
||||
<div v-if="apiLoading" v-loading="true" class="log-empty">加载中…</div>
|
||||
<template v-else>
|
||||
<el-table
|
||||
v-if="logs.length"
|
||||
:data="pagedLogs"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
height="100%"
|
||||
class="log-table"
|
||||
>
|
||||
<el-table-column prop="time" label="时间" width="175" />
|
||||
<el-table-column prop="operator" label="操作人" width="120" />
|
||||
<el-table-column prop="action" label="操作类型" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="结果" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.detail || '—' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div v-else class="log-empty">暂无操作日志</div>
|
||||
|
||||
<div v-if="logs.length > pageSize" class="log-pagination">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="logs.length"
|
||||
layout="total, prev, pager, next"
|
||||
background
|
||||
size="small"
|
||||
/>
|
||||
<div class="header-actions">
|
||||
<div class="left-actions">
|
||||
<el-button size="small" type="primary" :loading="apiLoading" @click="loadLogs">刷新</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
:table-id="`${tableIdPrefix}-logs`"
|
||||
:data="pagedLogs"
|
||||
:columns="logColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="apiLoading"
|
||||
:row-key="(row: LogItem) => row.__key"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-result="{ row }">
|
||||
<span :class="getStatusTextClass(resultTagType(row))">{{ row.result }}</span>
|
||||
</template>
|
||||
<template #column-detail="{ row }">{{ row.detail || '—' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -59,34 +55,69 @@ interface LogItem {
|
||||
detail?: string
|
||||
time: string
|
||||
level: 'success' | 'info' | 'warning' | 'error'
|
||||
/** 本地行 key(日志无 id) */
|
||||
__key?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 当前选中行数据(用于生成关联日志) */
|
||||
row: Record<string, any> | null
|
||||
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||
apiMethod?: (...args: any[]) => Promise<any>
|
||||
}>()
|
||||
/** 列配置持久化前缀(区分不同页面) */
|
||||
tableIdPrefix?: string
|
||||
}>(), {
|
||||
tableIdPrefix: 'log-panel'
|
||||
})
|
||||
|
||||
/** 通过 API 获取的真实日志列表 */
|
||||
const apiLogs = ref<LogItem[] | null>(null)
|
||||
const apiLoading = ref(false)
|
||||
|
||||
/** 表格本地分页(对齐 order/orderManagement 的 log.vue 体验) */
|
||||
/** 日志列配置(UpperTable) */
|
||||
const logColumns = [
|
||||
{ prop: 'time', label: '时间', width: '175' },
|
||||
{ prop: 'operator', label: '操作人', width: '120' },
|
||||
{ prop: 'action', label: '操作类型', minWidth: '180', showOverflowTooltip: true },
|
||||
{ prop: 'result', label: '结果', width: '90' },
|
||||
{ prop: 'detail', label: '说明', minWidth: '220', showOverflowTooltip: true }
|
||||
]
|
||||
|
||||
/** 表格本地分页(对齐 storage/receiving 操作日志体验) */
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 10
|
||||
const pageSize = ref(10)
|
||||
const pagination = computed(() => ({
|
||||
currentPage: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
total: logs.value.length
|
||||
}))
|
||||
const pagedLogs = computed<LogItem[]>(() => {
|
||||
const start = (currentPage.value - 1) * pageSize
|
||||
return logs.value.slice(start, start + pageSize)
|
||||
const start = (currentPage.value - 1) * pageSize.value
|
||||
return logs.value.slice(start, start + pageSize.value)
|
||||
})
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
function resultTagType(row: LogItem): string {
|
||||
if (row.result === '成功') return 'success'
|
||||
if (row.result === '失败') return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
watch(() => props.row, async (newRow) => {
|
||||
watch(() => props.row, () => {
|
||||
void loadLogs()
|
||||
}, { immediate: true })
|
||||
|
||||
/** 拉取日志(按钮「刷新」也走这个函数) */
|
||||
async function loadLogs() {
|
||||
const newRow = props.row
|
||||
currentPage.value = 1
|
||||
if (newRow && props.apiMethod) {
|
||||
apiLoading.value = true
|
||||
@ -120,7 +151,7 @@ watch(() => props.row, async (newRow) => {
|
||||
} else {
|
||||
apiLogs.value = null
|
||||
}
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
/** 基于 row 生成模拟日志(无 apiMethod 时使用) */
|
||||
const mockLogs = computed<LogItem[]>(() => {
|
||||
@ -151,18 +182,17 @@ const mockLogs = computed<LogItem[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志(附本地行 key) */
|
||||
const logs = computed<LogItem[]>(() => {
|
||||
if (apiLogs.value !== null) {
|
||||
return apiLogs.value
|
||||
}
|
||||
return mockLogs.value
|
||||
const list = apiLogs.value !== null ? apiLogs.value : mockLogs.value
|
||||
return list.map((item, index) => ({ ...item, __key: `log-${index}` }))
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "@/styles/status-text.scss";
|
||||
/* 对齐 order/orderManagement 的 log.vue(el-table 表格 + 本地分页) */
|
||||
/* 样式对齐 storage/receiving「操作日志」:
|
||||
header-actions(按钮行) + table-host(自适应剩余高度) + 左下角已选 / 右下分页 */
|
||||
.log-panel {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@ -171,26 +201,64 @@ const logs = computed<LogItem[]>(() => {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.log-table {
|
||||
flex: 1;
|
||||
.header-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
flex-shrink: 0;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.log-empty {
|
||||
flex: 1;
|
||||
.left-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
padding: 40px 0;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.log-pagination {
|
||||
flex-shrink: 0;
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 10px;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -202,49 +202,30 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="logTableHostRef" class="table-host">
|
||||
<el-table
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
table-id="warehouses-store-logs"
|
||||
:data="logList"
|
||||
v-loading="logLoading"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
:height="logTableHeight"
|
||||
>
|
||||
<el-table-column prop="id" label="ID" width="70" />
|
||||
<el-table-column prop="business_type" label="业务类型" min-width="100">
|
||||
<template #default="{ row }">{{ row.business_type || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="change_quantity" label="变更数量" width="100" />
|
||||
<el-table-column prop="before_quantity" label="变更前面单余额" width="130" />
|
||||
<el-table-column prop="after_quantity" label="变更后面单余额" width="130" />
|
||||
<el-table-column prop="reason" label="变更原因" min-width="140">
|
||||
<template #default="{ row }">{{ row.reason || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operator_name" label="操作人" width="100">
|
||||
<template #default="{ row }">{{ row.operator_name || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="created_at" label="操作时间" width="170">
|
||||
<template #default="{ row }">{{ row.created_at || '—' }}</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无操作日志</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="logPagination.currentPage"
|
||||
v-model:page-size="logPagination.pageSize"
|
||||
:total="logPagination.total"
|
||||
:columns="logColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:loading="logLoading"
|
||||
row-key="id"
|
||||
empty-text="暂无操作日志"
|
||||
:pagination="logPagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@current-change="loadLogs"
|
||||
@size-change="handleLogSizeChange"
|
||||
/>
|
||||
@page-change="handleLogPageChange"
|
||||
@page-size-change="handleLogSizeChange"
|
||||
>
|
||||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||||
|
||||
<template #column-business_type="{ row }">{{ row.business_type || '—' }}</template>
|
||||
<template #column-reason="{ row }">{{ row.reason || '—' }}</template>
|
||||
<template #column-operator_name="{ row }">{{ row.operator_name || '—' }}</template>
|
||||
<template #column-created_at="{ row }">{{ row.created_at || '—' }}</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -543,7 +524,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import {
|
||||
warehouseList,
|
||||
storeWarehouseSign,
|
||||
@ -723,27 +703,17 @@ const logLoading = ref(false)
|
||||
const logList = ref<any[]>([])
|
||||
const logPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const logTableHostRef = ref<HTMLElement | null>(null)
|
||||
const logTableHeight = ref(220)
|
||||
|
||||
useResizeObserver(logTableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
logTableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
|
||||
/** 切 tab / 切行后用 rAF 兜底测高 */
|
||||
function syncLogTableHeight() {
|
||||
requestAnimationFrame(() => {
|
||||
const el = logTableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) logTableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
}
|
||||
/** 操作日志列配置(UpperTable) */
|
||||
const logColumns = [
|
||||
{ prop: 'id', label: 'ID', width: '70' },
|
||||
{ prop: 'business_type', label: '业务类型', minWidth: '100' },
|
||||
{ prop: 'change_quantity', label: '变更数量', width: '100' },
|
||||
{ prop: 'before_quantity', label: '变更前面单余额', width: '130' },
|
||||
{ prop: 'after_quantity', label: '变更后面单余额', width: '130' },
|
||||
{ prop: 'reason', label: '变更原因', minWidth: '140' },
|
||||
{ prop: 'operator_name', label: '操作人', width: '100' },
|
||||
{ prop: 'created_at', label: '操作时间', width: '170' }
|
||||
]
|
||||
|
||||
// ─── 导出日志(异步任务) ──────────────────────────────────────────────────
|
||||
const {
|
||||
@ -1212,9 +1182,15 @@ async function loadLogs() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleLogSizeChange() {
|
||||
function handleLogPageChange(page: number) {
|
||||
logPagination.currentPage = page
|
||||
void loadLogs()
|
||||
}
|
||||
|
||||
function handleLogSizeChange(size: number) {
|
||||
logPagination.pageSize = size
|
||||
logPagination.currentPage = 1
|
||||
loadLogs()
|
||||
void loadLogs()
|
||||
}
|
||||
|
||||
// 监听 tab 切换,切换到操作日志时自动加载
|
||||
@ -1222,7 +1198,6 @@ watch(activeTab, (val) => {
|
||||
if (val === 'logs' && selectedRow.value) {
|
||||
logPagination.currentPage = 1
|
||||
loadLogs()
|
||||
syncLogTableHeight()
|
||||
}
|
||||
})
|
||||
|
||||
@ -1230,7 +1205,6 @@ watch(selectedRow, (row) => {
|
||||
if (row && activeTab.value === 'logs') {
|
||||
logPagination.currentPage = 1
|
||||
loadLogs()
|
||||
syncLogTableHeight()
|
||||
}
|
||||
})
|
||||
|
||||
@ -1337,22 +1311,37 @@ onMounted(() => {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
flex-direction: column;
|
||||
|
||||
/* 每页条数下拉框与 UpperTable(列表页)的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
/* UpperTable 需要确定高度;表格自带 border,不需要卡片阴影/圆角 */
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:左侧「已选 N 项」+ 右侧分页器,无分隔线 */
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user