This commit is contained in:
yin 2026-09-11 17:59:33 +08:00
parent 1b4107c437
commit abf03a901f
23 changed files with 545 additions and 141 deletions

View File

@ -10,6 +10,16 @@ export { unwrapWaveBatchListResponse } from '@/api/order/order'
/** order.wave 系列 RPC 列表统一排序结构(对齐 stock.warehouse.list / order.wave.batchList) */
export type WaveListRpcSort = WaveBatchListSort
/**
* 拣货任务文本筛选支持的操作符(接口文档:like / notlike / eq,默认 like)
*/
export type WavePickTaskTextOperator = 'like' | 'notlike' | 'eq'
/**
* 拣货任务文本筛选值:顶层参数支持纯字符串,或文档约定的 { operator, value }(默认 like)
*/
export type WavePickTaskTextFilter = string | { operator?: WavePickTaskTextOperator; value: string }
export type WavePickTaskListParams = {
warehouse_id: number
pagination?: {
@ -20,24 +30,52 @@ export type WavePickTaskListParams = {
}
page_no?: number
page_size?: number
/** 拣货任务状态:建议数组,也兼容单值/逗号分隔字符串 */
status?: number | string | Array<number | string>
review_status?: number
pick_mode?: number
/** 任务来源标识(字符串) */
source?: string
/** 拣货执行人ID(兼容旧字段) */
pick_user_id?: number
/** 拣货人姓名;支持模糊匹配,也支持 { operator: 'like'|'notlike'|'eq', value }(默认 like) */
pick_user_name?: WavePickTaskTextFilter
/** 复核人ID */
review_user_id?: number
/** 复核人姓名;支持模糊匹配,也支持 { operator, value }(默认 like) */
review_user_name?: WavePickTaskTextFilter
/** 领料人姓名;支持模糊匹配,也支持 { operator, value }(默认 like) */
claim_operator?: WavePickTaskTextFilter
/** 任务编号(模糊匹配) */
task_no?: string
/** 波次号:模糊匹配任务主表 batch_no_array,也支持 { operator, value }(默认 like) */
wave_no?: WavePickTaskTextFilter
/** 拣货车/作业车ID */
cart_id?: number
/** 拣货车编码:匹配任务主表快照 current_cart_code_snapshot,也支持 { operator, value }(默认 like) */
cart_code?: WavePickTaskTextFilter
/** 关键字搜索:task_no / batch_no / current_cart_code_snapshot 等字段的模糊匹配 */
keyword?: string
start_time_start?: string
start_time_end?: string
/** 人员名称(operator_name 操作人/pick_user_name/review_user_name/claim_operator)、关联波次号 wave_no、车编码 cart_code 通过 where 传 { operator, value },由后端按 operator 处理(默认模糊 like) */
/** 兼容历史 where 结构(当存在顶层同名参数时顶层优先);本页仅用于承载文档未列出的 operator_name(操作人) */
where?: Record<string, any>
/** 接口文档标注:当前主表未存该字段、会被忽略,建议勿使用 */
strategy_id?: number
/** 后端排序:sortField 取列 prop(如 order_count),结构对齐 stock.warehouse.list */
sort?: WaveListRpcSort
}
/** order.wave.wavePickTaskList 列表项中的关联波次明细(wave_list) */
export type WavePickTaskWaveItem = {
wave_id?: number | string
wave_no?: string
box_no?: number | string
status?: number | string
bind_time?: string | null
pick_time?: string | null
}
/** order.wave.wavePickTaskList 列表项(与 wms_wave_pick_task 主表字段对齐) */
export type WavePickTaskListItem = {
task_id?: number | string
@ -76,6 +114,8 @@ export type WavePickTaskListItem = {
created_at?: string
create_time?: string
update_time?: string
/** 关联波次明细(列表「波次号」列由 wave_list[].wave_no 派生) */
wave_list?: WavePickTaskWaveItem[]
[key: string]: unknown
}

View File

@ -13,13 +13,13 @@ export interface ReportGenerateParams {
store_id?: number
/** 货主ID驼峰别名(兼容,优先级高于 store_id) */
storeId?: number
/** 查询器业务参数(透传) */
/** 查询器业务参数(透传给内置查询器) */
params?: {
/** 数据日期(YYYY-MM-DD),用于导出文件名 file_name 模板的 {date} 占位 */
/** 数据日期(YYYY-MM-DD):用于导出文件名 {date} 占位(缺省取服务器当天);同时是 interceptOrder 查询器的统计日覆盖(按该日自然日整天统计,缺省昨日,且不得晚于昨天,传今天/未来一律回落昨日) */
bizDate?: string
/** 窗口数量覆盖(缺省 7,<=0 视为 7) */
/** 窗口数量覆盖(仅 stockFlow 查询器生效,缺省 7,<=0 视为 7) */
dayCount?: number
/** 切点小时覆盖(缺省 7,错制到 0-23) */
/** 切点小时覆盖(仅 stockFlow 查询器生效,缺省 7,钳制到 0-23) */
cutoverHour?: number
}
}
@ -404,7 +404,7 @@ export interface ReportDefinitionTypeItem {
}
export interface ReportDefinitionTypeListResult {
/** 注册类型清单(当前仅 stockFlow) */
/** 注册类型清单(当前 stockFlow、interceptOrder,按注册顺序) */
list: ReportDefinitionTypeItem[]
code?: number
}
@ -431,7 +431,7 @@ export interface ReportDefinitionSaveParams {
name: string
/** 报表类型(注册 key,如 stockFlow;新增必填,须命中注册表;更新时未传不覆盖既有值) */
type?: string
/** 导出文件名模板(支持 {date} 占位;新增必填,≤200 字符;更新时未传不覆盖既有值) */
/** 导出文件名模板(占位:{date} 数据日期 / {time} 生成时刻 HHmmss / {datetime} 数据日期_生成时刻 / {timestamp} 生成时刻毫秒时间戳;新增必填,≤200 字符;更新时未传不覆盖既有值) */
file_name?: string
/** 导出文件名驼峰别名(兼容,优先级高于 file_name) */
fileName?: string
@ -450,7 +450,7 @@ export interface ReportDefinitionItem {
name: string
/** 报表类型(注册 key,如 stockFlow) */
type: string
/** 导出文件名模板(支持 {date} 占位) */
/** 导出文件名模板(占位:{date} 数据日期 / {time} 生成时刻 HHmmss / {datetime} 数据日期_生成时刻 / {timestamp} 生成时刻毫秒时间戳) */
file_name: string
/** 勾选字段 key 数组(保存后按传入顺序去重) */
fields: string[]

View File

@ -51,11 +51,15 @@ export function shopsDel(data: { id: number }) {
})
}
/** 编辑店铺(仅允许修改 platform_code / custom_name) */
/**
* 编辑店铺。仅允许修改 platform_code / custom_name / shop_name,至少传入其中一个。
* shop_name 为平台真实店铺名:传入需非空且 <=100 字符,且同仓库同平台下不可重复(冲突返回 409)。
*/
export function shopsEdit(data: {
id: number
platform_code?: string
custom_name?: string
shop_name?: string
}) {
return request({
url: '/system',

View File

@ -114,6 +114,22 @@
</div>
<span v-else style="color:#909399">—</span>
</template>
<template v-else-if="shouldCollapseTextCell(scope.row, column, scope.$index)">
<div class="text-collapse-cell">
<span
class="text-collapse-text"
:title="isTextCellExpanded(scope.row, column) ? '' : getTextCollapseFullText(scope.row, column, scope.$index)"
>{{ getVisibleTextCollapseText(scope.row, column, scope.$index) }}</span>
<button
type="button"
class="text-collapse-toggle"
:title="isTextCellExpanded(scope.row, column) ? '收起' : '展开全部'"
@click.stop="toggleTextCellExpand(scope.row, column)"
>
{{ isTextCellExpanded(scope.row, column) ? '收起' : '展开' }}
</button>
</div>
</template>
<template v-else-if="column.formatter">
<span v-html="getFormattedCell(scope.row, column, scope.row[column.prop], scope.$index)"></span>
</template>
@ -617,6 +633,8 @@ let dragAutoScrollRaf: number | null = null
const waybillQrVisible = ref(false)
const waybillQrCode = ref('')
const expandedMultiCopyCells = ref<Set<string>>(new Set())
/** 超长文本收起:已展开的单元格(key = rowKey::prop) */
const expandedTextCells = ref<Set<string>>(new Set())
type VirtualSpacerRow = {
__virtualSpacer: true
@ -856,6 +874,7 @@ const selectedCount = computed(() => {
watch(() => props.data, () => {
clearSelection()
expandedMultiCopyCells.value = new Set()
expandedTextCells.value = new Set()
syncVirtualViewport()
})
@ -961,6 +980,42 @@ function saveColumnConfig(configs: ColumnConfigItem[]) {
localStorage.setItem(columnConfigStorageKey.value, JSON.stringify(payload))
}
/**
* 在默认列顺序中,从 index 向 step 方向找最近的、已存在 order 的列,返回其 order。
* 用于给「当前 props.columns 中存在、但已保存配置中没有」的列计算插入位置。
*/
function findNeighborColumnOrder(
defaults: ColumnConfigItem[],
index: number,
step: 1 | -1,
knownOrders: Map<string, number>
): number | undefined {
for (let i = index + step; i >= 0 && i < defaults.length; i += step) {
const neighbor = defaults[i]
if (!neighbor) continue
const order = knownOrders.get(neighbor.prop)
if (order !== undefined) return order
}
return undefined
}
/**
* 缺失列插入位置:优先取前后相邻已有列 order 的中间值(用小数占位,后续会被重排为整数),
* 保证列在「临时隐藏 → 重新显示」后回到默认配置的位置,而不是跑到表尾。
*/
function resolveMissingColumnOrder(
defaults: ColumnConfigItem[],
index: number,
knownOrders: Map<string, number>
): number {
const prevOrder = findNeighborColumnOrder(defaults, index, -1, knownOrders)
const nextOrder = findNeighborColumnOrder(defaults, index, 1, knownOrders)
if (prevOrder !== undefined && nextOrder !== undefined) return (prevOrder + nextOrder) / 2
if (prevOrder !== undefined) return prevOrder + 0.5
if (nextOrder !== undefined) return nextOrder - 0.5
return index
}
function buildMergedColumnConfigs(raw?: Partial<ColumnConfigItem>[]) {
const defaults = getDefaultColumnConfigs()
const defaultMap = new Map(defaults.map((item) => [item.prop, item]))
@ -982,10 +1037,15 @@ function buildMergedColumnConfigs(raw?: Partial<ColumnConfigItem>[]) {
})
})
defaults.forEach((item) => {
if (!used.has(item.prop)) {
merged.push({ ...item, order: merged.length })
}
// 已保存配置中缺失的列(例如被页面按开关临时从 props.columns 移除后又恢复的列)
// 按默认列顺序插回相邻位置,避免被追加到表尾
const knownOrders = new Map<string, number>()
merged.forEach((item) => knownOrders.set(item.prop, item.order))
defaults.forEach((item, index) => {
if (used.has(item.prop)) return
const order = resolveMissingColumnOrder(defaults, index, knownOrders)
merged.push({ ...item, order })
knownOrders.set(item.prop, order)
})
merged.sort((a, b) => a.order - b.order)
@ -1128,6 +1188,78 @@ function parseMultiValueCodes(raw: unknown): string[] {
return [text]
}
// ---------------------------------------------------------------------------
// 超长文本收起(列级开关)
// 用法:列上配置 `textCollapse: true`(默认 30 字符)或 `textCollapse: 数字`(自定义阈值)
// 可选 `textCollapseValue: (row, column, index) => unknown` 自定义取值(默认 formatter 结果 → 行字段原值)
// 表现:文本长度 > 阈值时只显示前 N 个字符,并给出「展开 / 收起」按钮(状态按 行+列 记录)
// ---------------------------------------------------------------------------
/** 默认收起阈值(字符数) */
const DEFAULT_TEXT_COLLAPSE_LIMIT = 30
/** 列的收起阈值;返回 0 表示该列未启用 */
function getTextCollapseLimit(column: ColumnItem): number {
const raw = column.textCollapse
if (raw === undefined || raw === null || raw === false) return 0
if (raw === true) return DEFAULT_TEXT_COLLAPSE_LIMIT
const num = Number(raw)
return Number.isFinite(num) && num > 0 ? Math.floor(num) : 0
}
/** 收起列用于判断长度的完整文本:优先 textCollapseValue,其次 formatter(去 HTML 标签),最后行字段原值 */
function getTextCollapseFullText(row: any, column: ColumnItem, index: number): string {
if (typeof column.textCollapseValue === 'function') {
const value = column.textCollapseValue(row, column, index)
return value === undefined || value === null ? '' : String(value)
}
if (typeof column.formatter === 'function') {
return getFormattedCell(row, column, row?.[column.prop || ''], index).replace(/<[^>]*>/g, '')
}
const value = row?.[column.prop || '']
if (value === undefined || value === null) return ''
if (Array.isArray(value)) {
return value.map((item) => String(item ?? '').trim()).filter(Boolean).join('|')
}
return String(value)
}
function getTextCellKey(row: any, column: ColumnItem) {
return `${String(getRowKey(row))}::${String(column.prop || '')}`
}
function isTextCellExpanded(row: any, column: ColumnItem) {
return expandedTextCells.value.has(getTextCellKey(row, column))
}
function toggleTextCellExpand(row: any, column: ColumnItem) {
const key = getTextCellKey(row, column)
const next = new Set(expandedTextCells.value)
if (next.has(key)) {
next.delete(key)
} else {
next.add(key)
}
expandedTextCells.value = next
}
/** 仅当启用收起、文本确实超长(且非自定义 template 列)时才接管渲染,否则退回原有分支 */
function shouldCollapseTextCell(row: any, column: ColumnItem, index: number) {
if (isVirtualSpacerRow(row)) return false
if (typeof column.template === 'function') return false
const limit = getTextCollapseLimit(column)
if (!limit) return false
return getTextCollapseFullText(row, column, index).length > limit
}
/** 收起态只展示前 limit 个字符(不加省略号,靠「展开」按钮提示还有内容),展开态展示全文 */
function getVisibleTextCollapseText(row: any, column: ColumnItem, index: number) {
const text = getTextCollapseFullText(row, column, index)
const limit = getTextCollapseLimit(column)
if (!limit || isTextCellExpanded(row, column) || text.length <= limit) return text
return text.slice(0, limit)
}
async function copyCellText(value: unknown, label: string) {
const text = getCopyableCellText(value)
if (!text) {
@ -2301,6 +2433,43 @@ watch(
}
}
/* 超长文本收起(列级 textCollapse) */
.text-collapse-cell {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
width: 100%;
}
.text-collapse-text {
word-break: break-all;
line-height: 1.4;
max-width: 100%;
}
.text-collapse-toggle {
border: none;
background: none;
padding: 0;
margin: 0;
color: var(--el-color-primary);
font-size: 12px;
line-height: 1.4;
cursor: pointer;
flex-shrink: 0;
&:hover {
color: var(--el-color-primary-dark-2);
}
&:focus-visible {
outline: 2px solid var(--el-color-primary-light-3);
outline-offset: 2px;
border-radius: 2px;
}
}
/* 表格尺寸样式 */
.upper-table-container.small :deep(.el-table) {
font-size: 12px;

View File

@ -140,7 +140,7 @@
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Search, Refresh } from '@element-plus/icons-vue'
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'

View File

@ -48,6 +48,7 @@
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@sort-change="handleSortChange"
@selection-change="handleSelectionChange"
>
<template #column-store_name="{ row }">
@ -141,6 +142,14 @@ const waveStrategyQuickScanTaskPollTimer = ref<ReturnType<typeof setTimeout> | n
const queryTime = ref(0)
const tableSize = ref('small')
const list = ref<WaveStrategyFallbackOrderListRow[]>([])
/** 接口返回的原始顺序数据(未排序),取消排序时用于还原 */
const serverList = ref<WaveStrategyFallbackOrderListRow[]>([])
/**
* 当前排序状态。
* 注意:order.wave.waveStrategyFallbackOrderList 不支持 sort 参数(只有 pagination / where),
* 因此「商品种数」「商品总数」为前端排序(仅当前页数据),切换分页后会重新应用。
*/
const currentSort = reactive({ prop: '', order: '' })
const selectionRows = ref<any[]>([])
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
@ -311,12 +320,14 @@ async function loadData() {
? res.data.list
: []
const responsePagination = res.pagination || res.data?.pagination || {}
list.value = responseList
serverList.value = responseList
applyLocalSort()
pagination.currentPage = responsePagination.page || pagination.currentPage
pagination.pageSize = responsePagination.pageSize || pagination.pageSize
pagination.total = responsePagination.total || 0
} catch (error: any) {
console.error('fetch fallback order list failed:', error)
serverList.value = []
list.value = []
pagination.total = 0
ElMessage.error(error?.message || '获取不符合波次策略订单失败')
@ -326,6 +337,46 @@ async function loadData() {
}
}
/** 支持前端排序的列(接口不支持 sort 参数) */
const LOCAL_SORT_PROPS = new Set(['items_count', 'items_total'])
/** 排序取值的兼容备用字段(与单元格插槽取值保持一致) */
const LOCAL_SORT_FALLBACK_KEYS: Record<string, string> = {
items_count: 'item_count',
items_total: 'item_total'
}
function resolveLocalSortValue(row: any, prop: string): number | null {
const fallbackKey = LOCAL_SORT_FALLBACK_KEYS[prop]
const raw = row?.[prop] ?? (fallbackKey ? row?.[fallbackKey] : undefined)
if (raw === null || raw === undefined || raw === '') return null
const num = Number(raw)
return Number.isFinite(num) ? num : null
}
/** 应用前端排序;无排序或非可排序列时还原接口原始顺序,空值恒排末尾 */
function applyLocalSort() {
const { prop, order } = currentSort
if (!prop || !order || !LOCAL_SORT_PROPS.has(prop)) {
list.value = [...serverList.value]
return
}
const direction = order === 'ascending' ? 1 : -1
list.value = [...serverList.value].sort((a, b) => {
const av = resolveLocalSortValue(a, prop)
const bv = resolveLocalSortValue(b, prop)
if (av === null && bv === null) return 0
if (av === null) return 1
if (bv === null) return -1
return (av - bv) * direction
})
}
function handleSortChange({ prop, order }: any) {
currentSort.prop = prop || ''
currentSort.order = order || ''
applyLocalSort()
}
function handlePageChange(page: number) {
pagination.currentPage = page
void loadData()

View File

@ -88,24 +88,6 @@
</span>
</template>
<template #column-wave_no="{ row }">
<div v-if="getPickTaskWaveNos(row).length" class="click-copy-list">
<span
v-for="(waveNo, wi) in getPickTaskWaveNos(row)"
:key="`${row.task_id || row.id}-wave-${wi}`"
class="click-copy-link"
role="button"
tabindex="0"
title="点击复制波次号"
@click.stop="copyWaveNo(waveNo)"
@keydown.enter.prevent="copyWaveNo(waveNo)"
>
{{ waveNo }}
</span>
</div>
<span v-else style="color:#909399">—</span>
</template>
<template #column-warehouse_id="{ row }">
<span>{{ row.warehouse_id ?? '—' }}</span>
</template>
@ -275,7 +257,8 @@ import {
orderWaveWavePickTaskList,
unwrapWavePickTaskListResponse,
type WaveListRpcSort,
type WavePickTaskListItem
type WavePickTaskListItem,
type WavePickTaskTextOperator
} from '@/api/order.wave/orderwave'
import {
pickTaskWaveAvailableFields,
@ -290,8 +273,7 @@ import {
formatPickTaskSource,
getPickTaskStatusTagType,
getPickTaskReviewStatusTagType,
getPickTaskSourceTagType,
getPickTaskWaveNos
getPickTaskSourceTagType
} from './config/wave-config'
const props = withDefaults(
@ -527,19 +509,24 @@ function resolveScanConditionOperator(
return fallback
}
/** where 文本条件 value 归一化:contains/in/notin 与全站列表页约定一致,以数组下发(逗号/换行分隔,单值也包成数组);其余操作符以字符串下发 */
function toWhereTextValue(raw: unknown, operator: string): string | string[] | undefined {
/** 顶层文本筛选参数支持的操作符(接口文档:like / notlike / eq,默认 like) */
const PICK_TASK_TEXT_FILTER_OPERATORS: WavePickTaskTextOperator[] = ['like', 'notlike', 'eq']
/** 读取顶层文本筛选字段的操作符;ScanBox 缓存中若残留 contains 等未支持操作符则回退 like */
function resolvePickTaskTextOperator(
rawConditions: Record<string, any>,
key: string,
fallback: WavePickTaskTextOperator = 'like'
): WavePickTaskTextOperator {
const op = resolveScanConditionOperator(rawConditions, key, fallback)
return (PICK_TASK_TEXT_FILTER_OPERATORS as string[]).includes(op) ? (op as WavePickTaskTextOperator) : fallback
}
/** ScanBox 文本值归一化为字符串(顶层文本筛选参数只接受字符串,不以数组下发) */
function toScanTextValue(raw: unknown): string | undefined {
if (raw === undefined || raw === null) return undefined
const text = (Array.isArray(raw) ? raw.join(',') : String(raw)).trim()
if (!text) return undefined
if (['contains', 'in', 'notin'].includes(operator)) {
const values = text
.split(',')
.map((v) => v.trim())
.filter(Boolean)
return values.length ? values : undefined
}
return text
return text || undefined
}
/** 有输入即透传:纯数字转 number,其余按字符串传递(避免被过滤成空) */
@ -836,27 +823,27 @@ async function loadData() {
const reviewUserId = toIdFilterValue(resolveScanFilterValue(flat, ['review_user_id', 'recheck_user_id'], rawConditions))
const cartId = toIdFilterValue(resolveScanFilterValue(flat, ['cart_id', 'pick_car_id'], rawConditions))
const startRange = Array.isArray(flat.start_time_range) ? flat.start_time_range : []
const operatorNameOp = resolveScanConditionOperator(rawConditions, 'operator_name')
const pickUserNameOp = resolveScanConditionOperator(rawConditions, 'pick_user_name')
const claimOperatorNameOp = resolveScanConditionOperator(rawConditions, 'claim_operator')
const reviewUserNameOp = resolveScanConditionOperator(rawConditions, 'review_user_name')
const waveNoOp = resolveScanConditionOperator(rawConditions, 'wave_no')
const cartCodeOp = resolveScanConditionOperator(rawConditions, 'cart_code')
/** 人员名称筛选:操作人 / 拣货人 / 领料人 / 复核人;操作符交由后端处理;contains/in/notin 的 value 与全站列表页一致以数组下发(单值也包成数组),其余为字符串 */
const operatorName = toWhereTextValue(resolveScanFilterValue(flat, ['operator_name', 'creator_name', 'creator'], rawConditions), operatorNameOp)
const pickUserName = toWhereTextValue(resolveScanFilterValue(flat, ['pick_user_name', 'picker_name'], rawConditions), pickUserNameOp)
const claimOperatorName = toWhereTextValue(resolveScanFilterValue(flat, ['claim_operator', 'claim_operator_name'], rawConditions), claimOperatorNameOp)
const reviewUserName = toWhereTextValue(resolveScanFilterValue(flat, ['review_user_name', 'recheck_user_name'], rawConditions), reviewUserNameOp)
/** 波次号:固定仅模糊查询(like),value 为字符串 */
const waveNo = toWhereTextValue(resolveScanFilterValue(flat, ['wave_no'], rawConditions), waveNoOp)
/** 车编码(cart_code):默认模糊 like,操作符交由后端处理 */
const cartCode = toWhereTextValue(resolveScanFilterValue(flat, ['cart_code'], rawConditions), cartCodeOp)
/** 顶层文本筛选(波次号/车编码/拣货人/领料人/复核人):文档只支持 like/notlike/eq,脏缓存回退 like */
const pickUserNameOp = resolvePickTaskTextOperator(rawConditions, 'pick_user_name')
const claimOperatorNameOp = resolvePickTaskTextOperator(rawConditions, 'claim_operator')
const reviewUserNameOp = resolvePickTaskTextOperator(rawConditions, 'review_user_name')
const waveNoOp = resolvePickTaskTextOperator(rawConditions, 'wave_no')
const cartCodeOp = resolvePickTaskTextOperator(rawConditions, 'cart_code')
/** 顶层文本筛选值:文档只接受字符串,统一归一化为字符串 */
const pickUserName = toScanTextValue(resolveScanFilterValue(flat, ['pick_user_name', 'picker_name'], rawConditions))
const claimOperatorName = toScanTextValue(resolveScanFilterValue(flat, ['claim_operator', 'claim_operator_name'], rawConditions))
const reviewUserName = toScanTextValue(resolveScanFilterValue(flat, ['review_user_name', 'recheck_user_name'], rawConditions))
/** 波次号:匹配任务主表 batch_no_array(默认 like) */
const waveNo = toScanTextValue(resolveScanFilterValue(flat, ['wave_no'], rawConditions))
/** 车编码 cart_code:匹配当前车编码快照 current_cart_code_snapshot(默认 like) */
const cartCode = toScanTextValue(resolveScanFilterValue(flat, ['cart_code'], rawConditions))
const sort: WaveListRpcSort | undefined = currentSort.prop
? {
sortField: currentSort.prop,
sortOrder: currentSort.order === 'ascending' ? 'ASC' : 'DESC'
}
: undefined
// 顶层筛选参数:与最新接口文档一致(同名顶层参数优先于历史 where)
const res = await orderWaveWavePickTaskList({
warehouse_id: wid,
page_no: pagination.currentPage,
@ -867,24 +854,17 @@ async function loadData() {
source:
flat.source === undefined || flat.source === null || flat.source === '' ? undefined : String(flat.source),
pick_user_id: pickUserId ? Number(pickUserId) : undefined,
pick_user_name: pickUserName ? { operator: pickUserNameOp, value: pickUserName } : undefined,
review_user_id: reviewUserId ? Number(reviewUserId) : undefined,
review_user_name: reviewUserName ? { operator: reviewUserNameOp, value: reviewUserName } : undefined,
claim_operator: claimOperatorName ? { operator: claimOperatorNameOp, value: claimOperatorName } : undefined,
task_no: String(flat.task_no || '').trim() || undefined,
wave_no: waveNo ? { operator: waveNoOp, value: waveNo } : undefined,
cart_id: cartId ? Number(cartId) : undefined,
cart_code: cartCode ? { operator: cartCodeOp, value: cartCode } : undefined,
keyword: String(flat.keyword || '').trim() || undefined,
start_time_start: startRange[0] || undefined,
start_time_end: startRange[1] || undefined,
// 人员名称(操作人/拣货人/领料人/复核人)、关联波次号与车编码仅通过 where 传 { operator, value },由后端按 operator 决定匹配语义(默认模糊 like)
where: {
pick_user_id: pickUserId,
review_user_id: reviewUserId,
cart_id: cartId,
operator_name: operatorName ? { operator: operatorNameOp, value: operatorName } : undefined,
pick_user_name: pickUserName ? { operator: pickUserNameOp, value: pickUserName } : undefined,
review_user_name: reviewUserName ? { operator: reviewUserNameOp, value: reviewUserName } : undefined,
claim_operator: claimOperatorName ? { operator: claimOperatorNameOp, value: claimOperatorName } : undefined,
wave_no: waveNo ? { operator: waveNoOp, value: waveNo } : undefined,
cart_code: cartCode ? { operator: cartCodeOp, value: cartCode } : undefined
},
sort
})
@ -1077,14 +1057,6 @@ onMounted(() => {
color: var(--el-text-color-placeholder);
}
.click-copy-list {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
width: 100%;
}
.click-copy-link {
color: var(--el-color-primary);
cursor: pointer;

View File

@ -39,12 +39,13 @@
<div class="split-stack">
<div class="upper-wrapper" :style="upperPaneFullStyle">
<!-- v3:修复「下一波抓取数量」按开关隐藏再显示后跑到表尾的问题(旧缓存顺序已污染,升版本使其失效一次) -->
<upper-table
ref="upperTable"
title="波次策略列表"
default-align="center"
:enable-column-config="true"
:column-config-schema-version="2"
:column-config-schema-version="3"
:table-id="tableListId"
:data="filteredColumns"
:row-key="getRowIdentity"

View File

@ -277,7 +277,7 @@ export function getPickTaskWaveNos(row: any): string[] {
/** 不符合波次策略订单列表:UpperTable 列配置 */
export const fallbackOrderColumns = applyWaveListCopyActions([
{ prop: 'id', label: 'ID', width: 80, align: 'center', fixed: 'left' },
// { prop: 'id', label: 'ID', width: 80, align: 'center', fixed: 'left' },
{ prop: 'wave_index', label: '序号', width: 70, align: 'center' },
{ prop: 'delivery_no', label: '订单号', minWidth: 180, fixed: 'left' },
{ prop: 'tracking_no', label: '物流单号', minWidth: 160 },
@ -286,8 +286,8 @@ export const fallbackOrderColumns = applyWaveListCopyActions([
{ prop: 'sys_logistics_name', label: '物流公司', minWidth: 130 },
{ prop: 'province', label: '省份', minWidth: 100 },
{ prop: 'weight_type', label: '重量类型', minWidth: 100 },
{ prop: 'items_count', label: '商品种数', minWidth: 100 },
{ prop: 'items_total', label: '商品总数', minWidth: 100 },
{ prop: 'items_count', label: '商品种数', minWidth: 100, sortable: 'custom' as const },
{ prop: 'items_total', label: '商品总数', minWidth: 100, sortable: 'custom' as const },
{ prop: 'items_weight', label: '商品重量(g)', minWidth: 110 },
{ prop: 'item_snapshot', label: '商品快照', minWidth: 260 },
{ prop: 'excluded_reason', label: '排除原因', minWidth: 130 }
@ -333,7 +333,7 @@ export const waveStrategyAvailableFields = [
/** 波次策略:UpperTable 列配置 */
export const waveStrategyColumns = [
{ prop: 'id', label: 'ID', width: 72, align: 'center', fixed: 'left' },
// { prop: 'id', label: 'ID', width: 72, align: 'center', fixed: 'left' },
{ prop: 'strategy_name', label: '策略名称', minWidth: 160, fixed: 'left' },
{ prop: 'wave_prefix', label: '波次前缀', width: 100, align: 'center' },
{ prop: 'matched_order_count_filtered', label: '匹配订单数', width: 110, align: 'center', sortable: true },
@ -349,14 +349,14 @@ export const waveStrategyColumns = [
{ prop: 'batch_max_orders', label: '单波最大订单', width: 120, align: 'center' },
{ prop: 'batch_max_skus', label: '单波最大SKU', width: 120, align: 'center' },
{ prop: 'group_batch_max_orders', label: '团购单波最大', width: 120, align: 'center' },
{ prop: 'warehouse_id', label: '仓库ID', width: 90, align: 'center' },
// { prop: 'warehouse_id', label: '仓库ID', width: 90, align: 'center' },
{ prop: 'creator_name', label: '创建人', width: 100, align: 'center' },
// { prop: 'allowed_expresses', label: '允许快递', minWidth: 130 },
{ prop: 'allowed_provinces', label: '允许省份', minWidth: 130 },
{ prop: 'allowed_platforms', label: '允许平台', minWidth: 130 },
{ prop: 'description', label: '说明', minWidth: 160 },
{ prop: 'create_time', label: '创建时间', minWidth: 168 },
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
{ prop: 'description', label: '说明', minWidth: 160 },
{ prop: 'operation', label: '操作', width: 140, fixed: 'right', align: 'center' }
]
@ -375,7 +375,7 @@ export const waveBatchColumns = applyWaveListCopyActions([
// { prop: 'item_part', label: '商品部位', minWidth: 220 },
{ prop: 'distinguish_express', label: '区分快递', minWidth: 100 },
{ prop: 'source', label: '来源', minWidth: 100 },
{ prop: 'logistics_code', label: '快递编码', minWidth: 110 },
// { prop: 'logistics_code', label: '快递编码', minWidth: 110 },
{ prop: 'storage_assignment_status', label: '库位分配', minWidth: 120 },
{ prop: 'express_assignment_status', label: '快递分配', minWidth: 120 },
{ prop: 'print_assignment_status', label: '打印状态', minWidth: 110 },
@ -384,7 +384,7 @@ export const waveBatchColumns = applyWaveListCopyActions([
{ prop: 'unreviewed_order_count', label: '未复核数', minWidth: 96, sortable: true },
{ prop: 'logistics_name', label: '快递', minWidth: 120 },
{ prop: 'creator', label: '创建人', minWidth: 100 },
{ prop: 'warehouse_id', label: '仓库ID', minWidth: 110 },
// { prop: 'warehouse_id', label: '仓库ID', minWidth: 110 },
{ prop: 'create_time', label: '创建时间', minWidth: 168 },
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
{ prop: 'operation', label: '操作', minWidth: 140, fixed: 'right' }
@ -1049,19 +1049,29 @@ export const pickTaskStatusFilterOptions = [
{ label: '已取消', value: 9 }
] as const
/** 左侧筛选字段(对标波次列表 ScanBox 分组排序) */
/**
* 左侧筛选字段:与 order.wave.wavePickTaskList 最新接口文档的参数一一对应(全部走顶层参数)。
* 文档支持:task_no / keyword / wave_no / cart_code / cart_id / pick_user_name /
* review_user_name / claim_operator / start_time_start+end / status / review_status / pick_mode / source;
* 其中 wave_no / cart_code / 人员姓名支持 { operator: 'like'|'notlike'|'eq', value }(默认 like)。
* 注意:where 仅兼容历史结构且会校验白名单(如 operator_name 会被拒绝),故不再放置筛选字段。
*/
export const pickTaskWaveAvailableFields = [
// ===== 任务信息 =====
pickTaskScanBasicField({ label: '任务编号', value: 'task_no', type: 'text' }),
// 波次号:固定仅模糊查询(like,隐藏操作符下拉)
pickTaskScanBasicField({ label: '波次号', value: 'wave_no', type: 'text', hideOperator: true, operators: ['like'], defaultOperator: 'like' }),
// 车编码(拣货车编码 cart_code):默认模糊查询,可切换等于/包含/模糊排除
pickTaskScanBasicField({ label: '车编码', value: 'cart_code', type: 'text', operators: ['like', 'contains', 'eq', 'notlike'], defaultOperator: 'like' }),
// 人员名字按模糊/包含搜索:左侧操作符下拉可选「模糊匹配/包含/模糊排除」,默认「模糊匹配」
pickTaskScanBasicField({ label: '操作人', value: 'operator_name', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
pickTaskScanBasicField({ label: '拣货人', value: 'pick_user_name', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
pickTaskScanBasicField({ label: '领料人', value: 'claim_operator', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
pickTaskScanBasicField({ label: '复核人', value: 'review_user_name', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
// 任务编号 task_no:顶层纯模糊参数(不支持操作符对象)
pickTaskScanBasicField({ label: '任务编号', value: 'task_no', type: 'text', hideOperator: true, operators: ['like'], defaultOperator: 'like' }),
// 关键字 keyword:覆盖 task_no / batch_no / current_cart_code_snapshot 的模糊匹配
pickTaskScanBasicField({ label: '关键字', value: 'keyword', type: 'text', hideOperator: true, operators: ['like'], defaultOperator: 'like' }),
// 波次号 wave_no:匹配任务主表 batch_no_array;文档支持模糊匹配/模糊排除/等于
pickTaskScanBasicField({ label: '波次号', value: 'wave_no', type: 'text', operators: ['like', 'notlike', 'eq'], defaultOperator: 'like' }),
// 车编码 cart_code:匹配当前车编码快照 current_cart_code_snapshot;文档支持模糊匹配/模糊排除/等于
pickTaskScanBasicField({ label: '车编码', value: 'cart_code', type: 'text', operators: ['like', 'notlike', 'eq'], defaultOperator: 'like' }),
// 拣货车ID cart_id:顶层数字参数(纯等值)
pickTaskScanBasicField({ label: '拣货车ID', value: 'cart_id', type: 'text', hideOperator: true, operators: ['eq'], defaultOperator: 'eq' }),
// 人员姓名(拣货人/领料人/复核人):文档支持模糊匹配/模糊排除/等于,默认模糊匹配
pickTaskScanBasicField({ label: '拣货人', value: 'pick_user_name', type: 'text', operators: ['like', 'notlike', 'eq'], defaultOperator: 'like' }),
pickTaskScanBasicField({ label: '领料人', value: 'claim_operator', type: 'text', operators: ['like', 'notlike', 'eq'], defaultOperator: 'like' }),
pickTaskScanBasicField({ label: '复核人', value: 'review_user_name', type: 'text', operators: ['like', 'notlike', 'eq'], defaultOperator: 'like' }),
pickTaskScanBasicField({ label: '开始时间', value: 'start_time_range', type: 'daterange' }),
// ===== 流程状态(合并为一组,对齐波次列表 ScanBox) =====
@ -1107,16 +1117,30 @@ export const pickTaskWaveAvailableFields = [
}), group: PICK_TASK_SCAN_PROCESS_STATUS_GROUP },
]
/** 拣货任务列表:UpperTable 列配置 */
/** 拣货任务列表:UpperTable 列配置(字段对齐 order.wave.wavePickTaskList 返回;wave_no 由 wave_list[].wave_no 派生) */
export const pickTaskWaveColumns = applyWaveListCopyActions([
{ prop: 'task_id', label: '任务ID', width: 90 },
// { prop: 'task_id', label: '任务ID', width: 90 },
{ prop: 'task_no', label: '任务编号', minWidth: 220 },
{ prop: 'wave_no', label: '波次号', minWidth: 160 },
{
// 波次号:行上无 wave_no 字段,从 wave_list[].wave_no 派生;多值时折叠为「第一个 + +N」
prop: 'wave_no',
label: '波次号',
minWidth: 160,
copyAction: 'copy' as const,
copyValue: (row: any) => getPickTaskWaveNos(row)
},
{
// 批次号:点击复制;值为逗号分隔 / JSON 数组 / 数组时自动折叠为「第一个 + +N」
prop: 'batch_no',
label: '批次号',
minWidth: 160,
copyAction: 'copy' as const
},
{ prop: 'status', label: '任务状态', width: 110 },
{ prop: 'review_status', label: '复核状态', width: 100 },
{ prop: 'pick_mode', label: '拣货模式', width: 100 },
{ prop: 'source', label: '来源', width: 90 },
{ prop: 'warehouse_id', label: '仓库ID', width: 90, align: 'center' },
// { prop: 'warehouse_id', label: '仓库ID', width: 90, align: 'center' },
{ prop: 'wave_count', label: '波次数', width: 90 },
{ prop: 'order_count', label: '订单数', width: 90, sortable: true },
{ prop: 'box_count', label: '箱数', width: 110 },
@ -1124,10 +1148,10 @@ export const pickTaskWaveColumns = applyWaveListCopyActions([
{ prop: 'pick_user_name', label: '拣货员', minWidth: 120 },
{ prop: 'review_user_name', label: '复核人', minWidth: 120 },
{ prop: 'claim_operator', label: '领料人', minWidth: 120 },
{ prop: 'current_cart_id', label: '当前车ID', width: 100 },
// { prop: 'current_cart_id', label: '当前车ID', width: 100 },
{ prop: 'current_cart_code_snapshot', label: '当前车编码', minWidth: 140 },
{ prop: 'cart_name', label: '拣货车', minWidth: 120 },
{ prop: 'device_id', label: '设备ID', minWidth: 140 },
// { prop: 'device_id', label: '设备ID', minWidth: 140 },
{ prop: 'start_at', label: '开始时间', minWidth: 168 },
{ prop: 'finish_at', label: '完成时间', minWidth: 168 },
{ prop: 'pick_duration', label: '拣货用时', minWidth: 110, align: 'center' },

View File

@ -48,7 +48,7 @@ export function formatComboGoodsDateTime(value: unknown): string {
}
export const comboGoodsColumns = [
{ prop: 'id', label: 'ID', width: '72', sortable: true },
// { prop: 'id', label: 'ID', width: '72', sortable: true },
{ prop: 'combo_code', label: '组合编码', minWidth: '130', showOverflowTooltip: true },
{ prop: 'combo_name', label: '组合名称', minWidth: '150', showOverflowTooltip: true },
{ prop: 'status', label: '状态', width: '88' },

View File

@ -69,6 +69,8 @@ export const stockColumns = [
prop: 'barcodes',
label: '商品条码',
width: '120',
// 超长条码(多个条码以 | 拼接)超过 30 字符时收起,提供「展开 / 收起」
textCollapse: 30,
formatter: (row: any) => row.barcodes ? row.barcodes.join("|") : '--'
},
{

View File

@ -221,7 +221,7 @@ export const availableFields: EntryScanFieldConfig[] = [
]
export const entryColums = [
{ prop: 'id', label: 'ID', width: '50' },
// { prop: 'id', label: 'ID', width: '50' },
{ prop: 'entry_order_code', label: '入库单号', width: '160' },
{ prop: 'store_name', label: '货主', width: '140' },
{ prop: 'warehouse_name', label: '仓库', width: '120' },
@ -233,6 +233,7 @@ export const entryColums = [
{ prop: 'order_status', label: '订单状态', width: '100' },
{ prop: 'hasReceiving', label: '收货绑定', width: '100' },
{ prop: 'receivingBindings', label: '绑定收货单', minWidth: '180' },
{ prop: 'source_type', label: '数据来源', width: '100' },
{ prop: 'sync_status', label: '入库状态', width: '100' },
{ prop: 'sync_message', label: '同步信息', minWidth: '220' },
{ prop: 'supplier_code', label: '供应商编码', width: '120' },
@ -243,10 +244,9 @@ export const entryColums = [
{ prop: 'order_create_time', label: '单据创建时间', width: '160' },
{ prop: 'expect_start_time', label: '预计开始时间', width: '160' },
{ prop: 'expect_end_time', label: '预计结束时间', width: '160' },
{ prop: 'remark', label: '备注', width: '160' },
{ prop: 'created_at', label: '创建时间', width: '160' },
{ prop: 'updated_at', label: '更新时间', width: '160' },
{ prop: 'source_type', label: '数据来源', width: '100' },
{ prop: 'remark', label: '备注', width: '160' },
{ prop: 'row_action', label: '操作', width: '300', fixed: 'right' },
]

View File

@ -36,7 +36,7 @@
default-align="center"
table-id="storage-entry-list"
:enable-column-config="true"
:column-config-schema-version="2"
:column-config-schema-version="3"
:data="list"
:columns="columns"
:table-size="tableSize"
@ -997,6 +997,12 @@ function handleConditionReset() {
function onSelectionChange(rows: any[]) {
selectionRows.value = rows || []
hasSelection.value = selectionRows.value.length > 0
// 勾选单行时同步当前行(复选框不会触发 current-change,不补这一步时
// 依赖 selectedEntryId 的操作(导入/收货对照等)会误报「请先选择入库单」)
const onlyRow = selectionRows.value.length === 1 ? selectionRows.value[0] : null
if (onlyRow?.id !== undefined && onlyRow?.id !== null) {
selectedEntryId.value = onlyRow.id
}
}
/** 完成入库/作废等操作的目标行:优先勾选,其次当前高亮行 */
@ -1222,12 +1228,25 @@ async function confirmBatchCancel() {
}
function handleImport() {
if (!selectedEntryId.value) {
// 目标行:优先勾选,其次当前高亮行(与页面其他批量操作一致)
const targetRows = getActionTargetRows()
if (!targetRows.length) {
ElMessage.warning('请先在列表中选择一个入库单')
return
}
if (!isPendingEntryOrderStatus(selectedRow.value?.order_status)) {
ElMessage.warning('仅「待入库」状态可使用批量导入')
if (targetRows.length > 1) {
ElMessage.warning('一次只能导入一个入库单,请只勾选一个')
return
}
const targetRow = targetRows[0]
if (!targetRow?.id) {
ElMessage.warning('请先在列表中选择一个入库单')
return
}
// 目标行可能来自勾选(此时详情面板绑定的 selectedEntryId 还未同步)
selectedEntryId.value = targetRow.id
if (!isPendingEntryOrderStatus(targetRow.order_status)) {
ElMessage.warning('仅「已创建」或「待入库」状态可使用批量导入')
return
}
detailVisible.value = true

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@
<div class="split-stack" ref="splitStackRef">
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
<upper-table ref="upperTable" title="收货单列表" default-align="center" :enable-column-config="true" table-id="storage-receiving-list" :data="list" :columns="columns" :table-size="tableSize"
<upper-table ref="upperTable" title="收货单列表" default-align="center" :enable-column-config="true" table-id="storage-receiving-list" :column-config-schema-version="2" :data="list" :columns="columns" :table-size="tableSize"
:pagination="pagination" :show-index="true" :show-actions="true" :show-selection="true" :loading="loading"
:queryTime="queryTime" @current-change="handleRowClick" @page-change="handlePageChange"
@page-size-change="handlePageSizeChange" @sort-change="handleSortChange" @refresh="loadData"

View File

@ -179,9 +179,9 @@ export const receivingColumns = [
{ prop: 'creator_name', label: '创建人', width: '100' },
{ prop: 'receiving_start_time', label: '收货开始', width: '150', sortable: true, formatter: (row: any) => formatDateTime(row.receiving_start_time) },
{ prop: 'receiving_end_time', label: '收货结束', width: '150', sortable: true, formatter: (row: any) => formatDateTime(row.receiving_end_time) },
{ prop: 'remark', label: '备注', minWidth: '120' },
{ prop: 'created_at', label: '创建时间', width: '150', sortable: true, formatter: (row: any) => formatDateTime(row.created_at) },
{ prop: 'updated_at', label: '更新时间', width: '150', sortable: true, formatter: (row: any) => formatDateTime(row.updated_at) },
{ prop: 'remark', label: '备注', minWidth: '120' },
{ prop: 'actions', label: '操作', width: '120', fixed: 'right' },
]

View File

@ -192,7 +192,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
import { storeWarehouseUnbind, storeWarehouseRename, storeWarehouseConfirmSign } from '@/api/storewarehouse.store/storeWarehouse'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'

View File

@ -175,11 +175,23 @@ export function reportTypeTitle(typeKey: string): string {
export const reportDefinitionOptions = ref<{ value: number; label: string }[]>([])
/** 报表定义 ID → 名称(全量非软删,用于投递计划列表/详情展示关联报表名) */
export const reportDefinitionNameMap = ref<Record<number, string>>({})
/** 报表定义 ID → 类型 key(如 stockFlow / interceptOrder;供导出弹窗按类型做数据日期限制等) */
export const reportDefinitionTypeMap = ref<Record<number, string>>({})
let reportDefinitionLoading = false
/** 报表定义缓存是否已失效(报表定义新增/编辑/删除后置位,下次读取时再拉一次,避免当次多发请求) */
let reportDefinitionCacheStale = false
/** 标记报表定义缓存失效:不立即发请求,下次读取(打开使用下拉的弹窗)时重新调用 report.definition.list */
export function invalidateReportDefinitions() {
reportDefinitionCacheStale = true
}
/** 加载报表定义(force 强制刷新):下拉选项仅取启用项,名称映射取全量非软删 */
export async function loadReportDefinitions(force = false): Promise<{ value: number; label: string }[]> {
if (reportDefinitionOptions.value.length && !force) return reportDefinitionOptions.value
// 缓存失效标记与 force 等效:命中任一时重新拉取
if (reportDefinitionOptions.value.length && !force && !reportDefinitionCacheStale) {
return reportDefinitionOptions.value
}
if (reportDefinitionLoading) return reportDefinitionOptions.value
reportDefinitionLoading = true
try {
@ -189,13 +201,18 @@ export async function loadReportDefinitions(force = false): Promise<{ value: num
pagination: { page: 1, pageSize: 200 }
})
const list: any[] = res?.data?.list ?? res?.list ?? []
// 全量名称映射(列表/详情展示用,含停用报表)
// 全量名称/类型映射(列表/详情展示、导出弹窗类型判断用,含停用报表)
const nameMap: Record<number, string> = {}
const typeMap: Record<number, string> = {}
for (const d of list) {
const id = Number(d?.id)
if (id > 0) nameMap[id] = d?.name ? String(d.name) : `报表 #${id}`
if (id > 0) {
nameMap[id] = d?.name ? String(d.name) : `报表 #${id}`
typeMap[id] = d?.type ? String(d.type) : ''
}
}
reportDefinitionNameMap.value = nameMap
reportDefinitionTypeMap.value = typeMap
// 下拉选项仅取启用项
reportDefinitionOptions.value = list
.filter((d: any) => d && Number(d.id) > 0 && Number(d.is_enabled) === 1)
@ -207,8 +224,11 @@ export async function loadReportDefinitions(force = false): Promise<{ value: num
console.error('加载报表定义选项失败', e)
reportDefinitionOptions.value = []
reportDefinitionNameMap.value = {}
reportDefinitionTypeMap.value = {}
} finally {
reportDefinitionLoading = false
// 无论成功或失败都清掉失效标记(失败时 options 已清空,天然会触发下次重新拉取)
reportDefinitionCacheStale = false
}
return reportDefinitionOptions.value
}

View File

@ -294,6 +294,7 @@ import {
loadStoreOptions,
loadReportTypeList,
loadReportDefinitions,
invalidateReportDefinitions,
type TabPageConfig,
type DetailTabConfig,
type ToolbarButtonConfig,
@ -547,6 +548,10 @@ async function handleOperationAction(key: string, row: Record<string, any>) {
// 投递计划编辑弹窗提交成功后触发,刷新列表
loadData()
break
case 'editDefinition':
// 报表定义编辑弹窗提交成功后触发(OperationCellRenderer 的 form 按钮 success 事件),刷新列表
void refreshReportDefinitionData()
break
case 'copyPlan':
// 投递计划复制成功后刷新列表
loadData()
@ -583,7 +588,17 @@ function handlePlanSaved() {
function handleDefinitionSaved() {
ElMessage.success('报表定义已保存')
loadData()
void refreshReportDefinitionData()
}
/**
* 报表定义变更(新增定义 / 编辑 / 删除)后统一刷新:
* 1) 调用一次 report.definition.list 刷新当前列表数据(当前标签页的列表接口即 report.definition.list,由 loadData 触发);
* 2) 仅标记共享的报表定义下拉/名称缓存失效,不在此处多发请求 —— 下次打开「提交导出」/「投递计划」等使用下拉的弹窗时再拉一次最新数据。
*/
async function refreshReportDefinitionData() {
await loadData()
invalidateReportDefinitions()
}
async function handleRegenerateSecret(row: Record<string, any>) {
@ -628,7 +643,7 @@ async function handleDeleteReportDefinition(row: Record<string, any>) {
const res: any = await deleteReportDefinition({ id })
if (res && (res.code === 1 || res.code === 200)) {
ElMessage.success('已删除')
loadData()
void refreshReportDefinitionData()
} else {
ElMessage.error(res?.message || '删除失败')
}
@ -682,6 +697,12 @@ const loadData = async () => {
: { list: res.data?.list ?? res.list ?? [], total: res.data?.pagination?.total ?? res.total ?? 0 }
listData.value = parsed.list
pagination.total = parsed.total
// 当前页已无数据且不在首页(如删除了末页最后一条):回退一页重新查询,避免停留在空页
if (!listData.value.length && pagination.currentPage > 1) {
pagination.currentPage -= 1
await loadData()
return
}
} else {
throw new Error(res?.message || '接口返回异常')
}

View File

@ -1,7 +1,7 @@
<!--
DefinitionFormDialog — 报表定义(wms_report_definition)新增/编辑 表单弹窗
对接接口:report.definition.save(按 id upsert,未传字段不覆盖)
极简配置:报表类型 type(report.definition.typeList 注册)+ 勾选字段 fields(勾选后支持上移/下移排序,顺序即导出表格列顺序)+ 导出文件名 file_name(支持 {date} 占位)
极简配置:报表类型 type(report.definition.typeList 注册)+ 勾选字段 fields(勾选后支持上移/下移排序,顺序即导出表格列顺序)+ 导出文件名 file_name(占位 {date} 数据日期 / {time} 生成时刻 HHmmss / {datetime} 数据日期_生成时刻 / {timestamp} 生成时刻毫秒时间戳)
-->
<template>
<el-dialog
@ -48,10 +48,12 @@
<el-form-item label="导出文件名" prop="file_name">
<el-input
v-model="form.file_name"
placeholder="导出文件名模板,支持 {date} 占位(≤200 字符)"
placeholder="导出文件名模板,支持 {date}/{time}/{datetime}/{timestamp} 占位(≤200 字符)"
maxlength="200"
/>
<div class="form-tip">如:库存变化报表_{date},{date} 自动替换为数据日期</div>
<div class="form-tip">
如:库存变化报表_{date};{date} 数据日期、{time} 生成时刻 HHmmss、{datetime} 数据日期_生成时刻、{timestamp} 生成时刻毫秒时间戳
</div>
</el-form-item>
<el-form-item label="勾选字段" prop="fields">
@ -142,7 +144,7 @@ const props = defineProps<{
name?: string
/** 报表类型(注册 key,如 stockFlow) */
type?: string
/** 导出文件名模板(支持 {date} 占位) */
/** 导出文件名模板(占位 {date}/{time}/{datetime}/{timestamp}) */
file_name?: string
/** 勾选字段 key 数组 */
fields?: any[]
@ -329,7 +331,8 @@ async function handleSubmit() {
file_name: form.file_name.trim(),
fields: [...form.fields],
is_enabled: form.is_enabled,
...(form.remark ? { remark: form.remark.trim() } : {})
// 备注始终提交(空串也发):接口「未传字段不覆盖」,条件传参会导致清空备注无法生效
remark: form.remark.trim()
})
ElMessage.success(isEdit.value ? '报表定义已更新' : '报表定义已创建')

View File

@ -61,9 +61,11 @@
v-model="form.bizDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="缺省取服务器当天"
:disabled-date="disabledBizDate"
:placeholder="bizDatePlaceholder"
style="width: 100%"
/>
<div class="form-tip">{{ bizDateTip }}</div>
</el-form-item>
</el-form>
</div>
@ -91,11 +93,17 @@
</template>
<script setup lang="ts">
import { reactive, ref, watch, onMounted } from 'vue'
import { reactive, ref, watch, onMounted, computed } from 'vue'
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
import { generate, generateTaskProgress } from '@/api/report/report'
import { storeOptions, loadStoreOptions, reportDefinitionOptions, loadReportDefinitions } from '../config/template-config'
import {
storeOptions,
loadStoreOptions,
reportDefinitionOptions,
reportDefinitionTypeMap,
loadReportDefinitions
} from '../config/template-config'
defineOptions({ name: 'ExportReportDialog' })
@ -121,6 +129,33 @@ const rules = {
report_id: [{ required: true, message: '请选择报表定义', trigger: 'change' }]
}
/** 选中报表定义的类型 key(来自 report.definition.list,供数据日期限制判断) */
const selectedReportType = computed(() => {
const id = Number(form.report_id)
return Number.isFinite(id) && id > 0 ? reportDefinitionTypeMap.value[id] || '' : ''
})
/** interceptOrder(库内确定拦截订单明细):统计日不得晚于昨天,传今天/未来会被后端回落为昨日 */
const isInterceptOrderType = computed(() => selectedReportType.value === 'interceptOrder')
/** 数据日期可选范围:interceptOrder 只能选到昨天,其余类型不限制 */
function disabledBizDate(date: Date): boolean {
if (!isInterceptOrderType.value) return false
const todayStart = new Date()
todayStart.setHours(0, 0, 0, 0)
return date.getTime() >= todayStart.getTime()
}
const bizDatePlaceholder = computed(() =>
isInterceptOrderType.value ? '缺省按昨日统计(不可选今天及以后)' : '缺省取服务器当天'
)
const bizDateTip = computed(() =>
isInterceptOrderType.value
? '该报表按所选日期的自然日整天统计:缺省昨日,且统计日不得晚于昨天'
: '用于导出文件名 {date} 占位;stockFlow 的统计窗口由类型注册的 dayCount / cutoverHour 控制'
)
// 提交导出 + 轮询进度(不传 storageKey → 不写任何本地存储)
const {
exportLoading,
@ -137,6 +172,8 @@ const {
watch(() => props.visible, (v) => {
if (v) {
// 打开时按需拉取报表定义(缓存未失效则直接复用,不产生请求)
void loadReportDefinitions()
form.report_id = props.reportId ?? undefined
form.store_id = undefined
form.bizDate = ''

View File

@ -123,6 +123,21 @@
<el-form-item label="自定义名称" prop="custom_name">
<el-input v-model="formData.custom_name" placeholder="最大 100 字符" maxlength="100" show-word-limit />
</el-form-item>
<!-- 平台真实店铺名:新增时由服务端生成待授权占位名,仅编辑态可改(shops.edit 支持 shop_name) -->
<el-form-item v-if="dialogMode === 'edit'" label="平台真实店铺名" prop="shop_name">
<el-input
v-model="formData.shop_name"
placeholder="与平台后台店铺名保持一致,最大 100 字符"
maxlength="100"
show-word-limit
clearable
/>
</el-form-item>
<el-form-item v-if="dialogMode === 'edit'">
<el-text type="info" size="small">
平台真实店铺名在同一仓库同一平台下不可重复,修改后需重新授权才能同步平台数据。
</el-text>
</el-form-item>
<el-form-item v-if="dialogMode === 'create'">
<el-text type="info" size="small">
店铺名称由服务端生成待授权占位名,完成平台授权后将自动同步真实店铺名。
@ -291,6 +306,8 @@ const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const dialogVisible = ref(false)
const dialogMode = ref<'create' | 'edit'>('create')
/** 打开编辑弹窗时记录的平台真实店铺名原值(用于判断是否真的修改过,避免无改动时下发触发同名冲突校验) */
const originalShopName = ref('')
const formRef = ref<FormInstance>()
const formData = reactive({
id: undefined as number | undefined,
@ -299,6 +316,24 @@ const formData = reactive({
shop_name: ''
})
/** 编辑态:平台真实店铺名不允许清空(shops.edit 传入 shop_name 时要求非空且 <=100) */
function validateShopName(_rule: any, value: any, callback: any) {
if (dialogMode.value !== 'edit') {
callback()
return
}
const text = String(value ?? '').trim()
if (!text) {
callback(new Error('请输入平台真实店铺名'))
return
}
if (text.length > 100) {
callback(new Error('最多 100 个字符'))
return
}
callback()
}
const rules: FormRules = {
platform_code: [{ required: true, message: '请选择平台', trigger: 'change' }],
custom_name: [
@ -306,7 +341,8 @@ const rules: FormRules = {
{ max: 100, message: '最多 100 个字符', trigger: 'blur' }
],
shop_name: [
{ max: 100, message: '最多 100 个字符', trigger: 'blur' }
{ max: 100, message: '最多 100 个字符', trigger: 'blur' },
{ validator: validateShopName, trigger: 'blur' }
]
}
@ -530,6 +566,7 @@ function resetForm() {
formData.platform_code = ''
formData.custom_name = ''
formData.shop_name = ''
originalShopName.value = ''
formRef.value?.clearValidate()
}
@ -546,7 +583,8 @@ function openEdit(row: ShopRecord) {
formData.id = row.id
formData.platform_code = row.platform_code || ''
formData.custom_name = row.custom_name || ''
formData.shop_name = row.shop_name || ''
formData.shop_name = String(row.shop_name || '').trim()
originalShopName.value = formData.shop_name
formRef.value?.clearValidate()
}
@ -576,17 +614,21 @@ async function submitForm() {
if (!formData.id) return
const platformCode = formData.platform_code.trim()
const customName = formData.custom_name.trim()
if (!platformCode && !customName) {
ElMessage.warning('请至少修改平台或自定义名称')
const shopName = formData.shop_name.trim()
if (!platformCode && !customName && !shopName) {
ElMessage.warning('请至少修改平台、自定义名称或平台真实店铺名')
return
}
const payload: {
id: number
platform_code?: string
custom_name?: string
shop_name?: string
} = { id: formData.id }
if (platformCode) payload.platform_code = platformCode
if (customName) payload.custom_name = customName
// 仅在确实修改过时下发,避免无改动也触发「同仓同平台唯一」校验
if (shopName && shopName !== originalShopName.value) payload.shop_name = shopName
const res: any = await shopsEdit(payload)
if (!isSuccess(res)) {

View File

@ -14,7 +14,7 @@ export const shopColumns = [
{ prop: 'platform_code', label: '平台编码', minWidth: '120', showOverflowTooltip: true },
{ prop: 'platform_name', label: '平台名称', minWidth: '140', showOverflowTooltip: true },
{ prop: 'custom_name', label: '自定义名称', minWidth: '160', showOverflowTooltip: true },
{ prop: 'shop_name', label: '店铺名称', minWidth: '160', showOverflowTooltip: true },
{ prop: 'shop_name', label: '平台真实店铺名', minWidth: '160', showOverflowTooltip: true },
{ prop: 'auth_expire_at', label: '授权过期时间', minWidth: '180' },
{ prop: 'access_token', label: '密钥', minWidth: '200', showOverflowTooltip: true },
{ prop: 'status', label: '状态', width: '100' },
@ -26,7 +26,7 @@ export const shopScanFields = [
value: 'quickWhere',
label: '关键词',
type: 'text',
placeholder: '自定义名称/店铺名称',
placeholder: '自定义名称/平台真实店铺名',
operators: ['contains', 'eq'],
defaultOperator: 'eq'
},
@ -66,9 +66,9 @@ export const shopScanFields = [
},
{
value: 'shop_name',
label: '店铺名称',
label: '平台真实店铺名',
type: 'text',
placeholder: '请输入店铺名称',
placeholder: '请输入平台真实店铺名',
operators: ['eq', 'contains', 'like'],
defaultOperator: 'eq'
}