This commit is contained in:
yin 2026-10-21 18:00:05 +08:00
parent 52536bb9e3
commit 0d57e2d04a
52 changed files with 3478 additions and 650 deletions

View File

@ -248,6 +248,72 @@ export function orderDeliveryOrderDetail(data: DeliveryOrderDetailParams): Promi
* order.deliveryOrder.quickSearch:按关键词跨表联合搜索(运单号/发货单号/外部订单号/平台交易单号)
* 工单页「发起售后单-关联订单-选择订单」使用;联合查询较慢,超时时间延长至 20 秒(axios 默认 10 秒)
*/
/**
* order.deliveryOrder.summary:配送订单每日汇总
*
* - 以自然日为维度统计订单量 / 迁入配送表订单量 / 发货量 / 拦截 / 取消
* - 仓库取自登录上下文;可选 store_id 按货主过滤
* - 默认最近 7 个自然日(含今天),单次最多 90 天,区间内无数据的日期补 0
*/
export type DeliveryOrderSummaryParams = {
/** 开始日期 yyyy-MM-dd,缺省为结束日往前 6 天 */
start_date?: string
/** 结束日期 yyyy-MM-dd,缺省为今天 */
end_date?: string
/** 货主ID过滤,不传或 <=0 表示不按货主过滤 */
store_id?: number
}
/** 每日汇总中的一天统计行 */
export type DeliveryOrderSummaryItem = {
/** 统计日期 yyyy-MM-dd */
date: string
/** 当日订单量 */
order_count: number
/** 当日迁入配送表订单量 */
dispatch_count: number
/** 当日发货订单数 */
shipped_count: number
/** 当日发货商品件数 */
shipped_items_total: number
/** 当日发货金额 */
shipped_amount: number
/** 当日拦截数量 */
intercepted_count: number
/** 当日库内确定拦截数量 */
intercepted_at_warehouse_count: number
/** 当日取消数量 */
cancelled_count: number
}
/** 区间合计(字段口径与 list 中对应字段相同) */
export type DeliveryOrderSummaryTotals = Omit<DeliveryOrderSummaryItem, 'date'>
/** order.deliveryOrder.summary 响应(data 位于顶层) */
export type DeliveryOrderSummaryPayload = {
warehouse_id: number
store_id: number | null
start_date: string
end_date: string
day_count: number
list: DeliveryOrderSummaryItem[]
summary: DeliveryOrderSummaryTotals
}
export function orderDeliveryOrderSummary(data: DeliveryOrderSummaryParams = {}): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'order.deliveryOrder.summary',
v,
timestamp: Date.now()
},
data,
isSystemApi: true
} as any)
}
export function orderDeliveryOrderQuickSearch(keyword: string): Promise<any> {
return request({
url: '/system',
@ -268,4 +334,5 @@ export const orderDeliveryOrder = {
list: orderDeliveryOrderList,
detail: orderDeliveryOrderDetail,
quickSearch: orderDeliveryOrderQuickSearch,
summary: orderDeliveryOrderSummary,
}

View File

@ -58,6 +58,12 @@ export type WavePickTaskListParams = {
keyword?: string
start_time_start?: string
start_time_end?: string
/** 完成时间范围(时间筛选模式为「完成时间」时传递) */
finish_time_start?: string
finish_time_end?: string
/** 创建时间范围(时间筛选模式为「创建时间」时传递) */
create_time_start?: string
create_time_end?: string
/** 兼容历史 where 结构(当存在顶层同名参数时顶层优先);本页仅用于承载文档未列出的 operator_name(操作人) */
where?: Record<string, any>
/** 接口文档标注:当前主表未存该字段、会被忽略,建议勿使用 */

View File

@ -38,7 +38,7 @@
<slot name="filter-header" />
<!-- 所有字段配置的表单 -->
<div class="field-forms">
<template v-for="(field, fieldIndex) in availableFields" :key="field.value">
<template v-for="(field, fieldIndex) in effectiveFields" :key="field.value">
<div
v-if="resolveFieldGroupLabel(field, fieldIndex)"
class="field-group-divider"
@ -239,7 +239,7 @@
:placeholder="field.placeholder || '请选择查询模式'"
size="small"
style="width: 100%;"
@change="handleCustomChange"
@change="handleModeTimeChange(field, false)"
>
<el-option
v-for="option in field.options"
@ -250,13 +250,14 @@
</el-select>
<el-date-picker
v-model="customConditions[field.value].value"
type="datetimerange"
:key="`${field.value}-${getModeTimeRangeType(field)}`"
:type="getModeTimeRangeType(field)"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm:ss"
:default-time="modeTimeRangeDefaultTime"
:start-placeholder="getModeTimeRangeStartPlaceholder(field)"
:end-placeholder="getModeTimeRangeEndPlaceholder(field)"
:format="getModeTimeRangeFormat(field)"
:value-format="getModeTimeRangeValueFormat(field)"
:default-time="getModeTimeRangeDefaultTime(field)"
size="small"
style="width: 100%;"
@change="handleCustomChange"
@ -459,7 +460,7 @@
<!-- 紧凑模式 -->
<div v-if="isCompact" class="compact-filter">
<div class="compact-fields">
<template v-for="field in availableFields" :key="field.value">
<template v-for="field in effectiveFields" :key="field.value">
<!-- 下拉选择类型 -->
<div v-if="field.type === 'select'" class="compact-field-item">
<el-select
@ -694,7 +695,7 @@
:placeholder="field.placeholder || '请选择查询模式'"
size="small"
class="compact-operator-select"
@change="handleCompactChange"
@change="handleModeTimeChange(field, true)"
>
<el-option
v-for="option in field.options"
@ -705,13 +706,14 @@
</el-select>
<el-date-picker
v-model="customConditions[field.value].value"
type="datetimerange"
:key="`${field.value}-${getModeTimeRangeType(field)}`"
:type="getModeTimeRangeType(field)"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm:ss"
:default-time="modeTimeRangeDefaultTime"
:start-placeholder="getModeTimeRangeStartPlaceholder(field)"
:end-placeholder="getModeTimeRangeEndPlaceholder(field)"
:format="getModeTimeRangeFormat(field)"
:value-format="getModeTimeRangeValueFormat(field)"
:default-time="getModeTimeRangeDefaultTime(field)"
size="small"
style="width: 100%"
@change="handleCompactChange"
@ -931,7 +933,7 @@ function handleCompactRangeInput(field: any, key: 'min' | 'max', v: string) {
// 紧凑模式下字段变更时自动设置默认操作符
function handleCompactChange() {
// 为有值的字段设置默认操作符
props.availableFields.forEach((field: any) => {
effectiveFields.value.forEach((field: any) => {
// 时间模式字段的 operator 固定为 between,不参与默认操作符推导
if (isModeTimeRangeField(field)) return
const condition = customConditions[field.value]
@ -964,6 +966,71 @@ function handleCompactChange() {
// Data
const activeTab = ref('custom')
const customConditions = reactive<any>({})
/** 自动合并后的时间范围字段内部键(请求参数键 = 所选时间字段的 value) */
const AUTO_MERGED_TIME_FIELD_VALUE = '__time_range__'
/**
* 实际渲染/提交使用的字段列表。
*
* 页面只需按业务声明各自的时间字段(daterange / datetimerange),ScanBox 会把它们
* 自动合并成一个「时间」控件(type = modetimerange):
* - 下拉选项 = 页面已声明的这些时间字段(label / value)→ 页面有什么时间项就有什么选项;
* - 提交时按所选字段输出条件键(如 start_time),值格式沿用该字段的 daterange / datetimerange;
* - 只有一个时间字段的页面,下拉就只有一项(如拣货任务页只有「开始时间」)。
*
* 兼容与退出:
* - 页面已显式声明 modetimerange 字段时不再自动合并(沿用原配置);
* - 字段设置 `mergeTimeRange: false` 可不参与合并。
*/
const effectiveFields = computed<any[]>(() => {
const fields = (props.availableFields || []) as any[]
if (!fields.length) return fields
if (fields.some((field) => isModeTimeRangeField(field))) return fields
const timeFields = fields.filter(
(field) => isRangePickerFieldType(String(field?.type || '')) && field?.mergeTimeRange !== false
)
if (!timeFields.length) return fields
/** 每种查询模式对应的原始字段配置(决定 picker 类型与值格式) */
const modeMeta: Record<string, Record<string, any>> = {}
timeFields.forEach((field) => {
modeMeta[String(field.value)] = {
type: String(field.type || ''),
format: field.format,
valueFormat: field.valueFormat,
startPlaceholder: field.startPlaceholder,
endPlaceholder: field.endPlaceholder
}
})
const mergedField = {
label: '时间',
value: AUTO_MERGED_TIME_FIELD_VALUE,
type: 'modetimerange',
placeholder: '请选择查询模式',
group: timeFields[0]?.group,
options: timeFields.map((field) => ({ label: field.label, value: field.value })),
defaultMode: timeFields[0]?.value,
modeMeta,
autoMergedTimeRange: true
}
const result: any[] = []
let inserted = false
fields.forEach((field) => {
if (timeFields.includes(field)) {
if (!inserted) {
result.push(mergedField)
inserted = true
}
return
}
result.push(field)
})
return result
})
const presetSearchText = ref('')
const filteredPresetTree = ref<any[]>([])
const activeCondition = ref<any>(null)
@ -1031,6 +1098,28 @@ function hasAnyCondition() {
return Object.keys(buildConditionsObject() || {}).length > 0
}
/**
* 兼容旧缓存:自动合并时间字段前,各时间字段以独立键保存(如 start_time)。
* 若合并控件还没有值,则把第一个有值的旧时间键迁移为合并控件的查询模式。
*/
function restoreLegacyTimeConditions(snapshot: any) {
const mergedField = effectiveFields.value.find((field: any) => field?.autoMergedTimeRange)
if (!mergedField) return
const target = customConditions[mergedField.value]
if (!target) return
if (Array.isArray(target.value) && target.value.length >= 2) return
const options = Array.isArray(mergedField.options) ? mergedField.options : []
for (const option of options) {
const legacy = snapshot?.customConditions?.[option.value]
if (legacy && Array.isArray(legacy.value) && legacy.value.length >= 2) {
target.mode = option.value
target.value = legacy.value
return
}
}
}
function restoreSnapshotIfExists() {
const routePath = getRouteCacheKey()
if (!routePath) return
@ -1048,6 +1137,9 @@ function restoreSnapshotIfExists() {
Object.assign(customConditions[fieldKey], snapshot.customConditions[fieldKey])
})
// 旧缓存(时间字段独立保存)迁移到自动合并后的「时间」控件
restoreLegacyTimeConditions(snapshot)
nextTick(() => {
if (hasAnyCondition()) {
emit('condition-change', activeCondition.value)
@ -1070,7 +1162,7 @@ watch(() => props.presetTree, (val) => {
}
}, { immediate: true })
watch(() => props.availableFields, (fields) => {
watch(effectiveFields, (fields) => {
initCustomConditions(fields)
}, { immediate: true })
@ -1080,12 +1172,12 @@ watch(activeTab, () => {
// Computed
const fieldValues = computed(() => {
return props.availableFields.map((field: any) => field.value)
return effectiveFields.value.map((field: any) => field.value)
})
// Lifecycle
onMounted(() => {
initCustomConditions(props.availableFields)
initCustomConditions(effectiveFields.value)
restoreSnapshotIfExists()
if (filterScroll.value) {
filterScroll.value.addEventListener('scroll', handleScroll)
@ -1252,6 +1344,55 @@ function isModeTimeRangeField(field: any) {
return String(field?.type || '') === 'modetimerange'
}
/** 时间模式字段当前所选模式对应的原始字段配置(自动合并时写入 modeMeta,决定 picker 类型与值格式) */
function getModeTimeRangeMeta(field: any) {
const condition = customConditions[field.value]
const mode = String(condition?.mode || field?.defaultMode || field?.options?.[0]?.value || '')
const metaMap = field?.modeMeta
return metaMap && typeof metaMap === 'object' ? metaMap[mode] || {} : {}
}
function getModeTimeRangeType(field: any) {
return getModeTimeRangeMeta(field).type === 'daterange' ? 'daterange' : 'datetimerange'
}
function getModeTimeRangeFormat(field: any) {
const meta = getModeTimeRangeMeta(field)
if (meta.format) return meta.format
return meta.type === 'daterange' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm'
}
function getModeTimeRangeValueFormat(field: any) {
const meta = getModeTimeRangeMeta(field)
if (meta.valueFormat) return meta.valueFormat
return meta.type === 'daterange' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'
}
function getModeTimeRangeStartPlaceholder(field: any) {
const meta = getModeTimeRangeMeta(field)
return meta.startPlaceholder || (meta.type === 'daterange' ? '开始日期' : '开始时间')
}
function getModeTimeRangeEndPlaceholder(field: any) {
const meta = getModeTimeRangeMeta(field)
return meta.endPlaceholder || (meta.type === 'daterange' ? '结束日期' : '结束时间')
}
function getModeTimeRangeDefaultTime(field: any) {
return getModeTimeRangeType(field) === 'daterange' ? undefined : modeTimeRangeDefaultTime
}
/** 切换查询模式时清空已选时间(daterange / datetimerange 的值格式不同,避免脏值) */
function handleModeTimeChange(field: any, compact: boolean) {
const condition = customConditions[field.value]
if (condition) condition.value = []
if (compact) {
handleCompactChange()
return
}
handleCustomChange()
}
function isRangePickerField(field: any) {
return isRangePickerFieldType(String(field?.type || ''))
}
@ -1319,13 +1460,14 @@ function buildModeTimeRangeCondition(field: any): { key: string; condition: Reco
const start = rangeValue[0]
const end = rangeValue[1]
if (!start || !end) return null
const conditionType = getModeTimeRangeType(field)
return {
key: mode,
condition: {
value: [start, end],
operator: 'between',
field: mode,
type: 'datetimerange'
type: conditionType
}
}
}
@ -1412,6 +1554,24 @@ function loadInitialConditions(conditions: any) {
Object.keys(conditions.conditions).forEach(field => {
if (customConditions[field]) {
Object.assign(customConditions[field], conditions.conditions[field])
return
}
// 自动合并的时间字段:外部仍按原时间字段名传条件时,写入「时间」控件
const mergedField = effectiveFields.value.find(
(item: any) =>
item?.autoMergedTimeRange &&
Array.isArray(item.options) &&
item.options.some((option: any) => option.value === field)
)
const mergedCondition = mergedField ? customConditions[mergedField.value] : null
if (!mergedCondition) return
const raw = conditions.conditions[field]
const value = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw.value : raw
if (Array.isArray(value) && value.length >= 2) {
mergedCondition.mode = field
mergedCondition.value = value
}
})
}
@ -1442,7 +1602,7 @@ function resolveFieldGroupLabel(field: any, index: number | string): string | nu
const group = field?.group
if (!group || typeof group !== 'string') return null
if (fieldIndex === 0) return group
const prev = props.availableFields[fieldIndex - 1] as any
const prev = effectiveFields.value[fieldIndex - 1] as any
return prev?.group === group ? null : group
}
@ -1492,7 +1652,7 @@ function buildAndEmitCustomCondition() {
const conditions: any = {}
let hasCondition = false
props.availableFields.forEach((field: any) => {
effectiveFields.value.forEach((field: any) => {
// 时间模式字段:条件键 = 所选 mode(真实表字段)
if (isModeTimeRangeField(field)) {
const modeTimeResult = buildModeTimeRangeCondition(field)
@ -1598,7 +1758,7 @@ function filterNode(value: string, data: any) {
/** 仅重置内部 UI 状态,不向外 emit(供 defineExpose 与父组件二次调用,避免与 @reset 形成递归) */
function applyResetState() {
initCustomConditions(props.availableFields, true, true)
initCustomConditions(effectiveFields.value, true, true)
activeCondition.value = null
presetSearchText.value = ''
filterPresetTree('')
@ -1685,7 +1845,7 @@ function getConditions() {
function buildConditionsObject() {
const conditions: any = {}
props.availableFields.forEach((field: any) => {
effectiveFields.value.forEach((field: any) => {
// 时间模式字段:条件键 = 所选 mode(真实表字段)
if (isModeTimeRangeField(field)) {
const modeTimeResult = buildModeTimeRangeCondition(field)

View File

@ -23,6 +23,7 @@
:tooltip-effect="tooltipEffect"
:row-class-name="getRowClassName"
:row-style="getRowStyle"
:span-method="spanMethod"
height="100%"
>
<!-- 自定义选择列 -->
@ -550,6 +551,11 @@ const props = defineProps({
default: 'left',
validator: (value: string) => ['left', 'center', 'right'].includes(value),
},
// 合并单元格(透传给 el-table,部分页面按明细合并多行)
spanMethod: {
type: Function,
default: undefined,
},
})
const emit = defineEmits([

View File

@ -87,6 +87,7 @@ export default {
'inbox_auto_reply':'Inbox Auto Reply',
'InboxAutoReply':'Inbox Auto Reply',
'StockCheck':'Stock Check',
'OrderSummary':'Order Summary',
},
"login": {
"title": "Login",

View File

@ -90,6 +90,7 @@ export default {
'inbox_auto_reply':'回信规则配置',
'InboxAutoReply':'回信规则配置',
'StockCheck':'库存盘点',
'OrderSummary':'订单汇总',
},
"login": {
"title": "登录",

View File

@ -72,6 +72,8 @@ export const componentMap: Record<string, any> = {
'video/cameraServer/index': () => import('@/views/video/newcamaraserver/index.vue'),
'video/camera/index': () => import('@/views/video/newcamara/index.vue'),
'data/packingflow': () => import('@/views/data/packingflow/index.vue'),
/** 订单汇总(order.deliveryOrder.summary 每日汇总) */
'data/ordersummary': () => import('@/views/data/ordersummary/index.vue'),
/** 退回记录:退回拆包单 + 退回收件登记(tab 合并) */
'data/returnrecord': () => import('@/views/data/returnrecord/index.vue'),
'system/setting/printcomputer/index':() => import('@/views/system/setting/printcomputer/index.vue'),

View File

@ -13,9 +13,9 @@
<template v-if="detail">
<!-- 操作按钮 -->
<div class="detail-actions-bar">
<el-button size="small" @click="fetchDetail" :loading="loading"><el-icon><Refresh /></el-icon></el-button>
<el-button v-if="detail.status === 'pending' || detail.status === 'processing'" size="small" type="warning" @click="showTransferDialog">转单</el-button>
<el-button v-if="detail" size="small" type="success" @click="showClaimDialog">登记理赔</el-button>
<el-button size="small" type="primary" :loading="loading" @click="fetchDetail">刷新</el-button>
<el-button v-if="detail.status === 'pending' || detail.status === 'processing'" size="small" type="primary" plain @click="showTransferDialog">转单</el-button>
<el-button v-if="detail" size="small" type="primary" plain @click="showClaimDialog">登记理赔</el-button>
</div>
<!-- 左右分栏 -->
@ -247,7 +247,7 @@
<script setup lang="ts">
import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { Plus, Refresh } from '@element-plus/icons-vue'
import { Plus } from '@element-plus/icons-vue'
import {
afterSaleDetail,
afterSaleHandleWorkOrder,
@ -475,7 +475,9 @@ async function submitHandle() {
<style scoped>
.detail-dialog-body { display: flex; flex-direction: column; min-height: 40vh; max-height: 70vh; }
.detail-actions-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-shrink: 0; }
.detail-actions-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-shrink: 0; }
/* 间距只由 gap 控制(对齐 toolbar 的 6px),清掉 EP 默认 .el-button + .el-button 的 12px 左边距 */
.detail-actions-bar :deep(.el-button) { margin-left: 0; margin-right: 0; }
.detail-split {
display: flex; gap: 12px; flex: 1; min-height: 0;
@ -527,6 +529,7 @@ h4 { margin: 0 0 10px; font-size: 14px; }
border-top: 1px solid #ebeef5; padding: 10px 0 0; margin-top: 10px; flex-shrink: 0;
}
.handle-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.handle-row :deep(.el-button) { margin-left: 0; margin-right: 0; }
.remark-input { flex: 1; min-width: 80px; }
.handle-files-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.file-thumb {

View File

@ -360,12 +360,23 @@ export const afterSaleColumns = [
// -------------------- 工具栏按钮 --------------------
export const afterSaleToolbarButtons: ToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'refresh' },
{
key: 'export',
label: '导出',
category: 'setting',
size: 'small',
loadingKey: 'exportLoading',
action: 'handleExportSelected',
buttonType: 'dropdown',
dropdownOptions: [
{ label: '导出选中', action: 'handleExportSelected' },
{ label: '导出全部', action: 'handleExportAll', divided: true },
],
},
{ key: 'columnConfig', label: '字段设置', category: 'setting', size: 'small', action: 'openColumnConfigPanel' },
{ key: 'batchPendingFeedback', label: '设为待反馈', category: 'action', size: 'small', type: 'warning', loadingKey: 'batchPendingFeedbackLoading', action: 'batchSetPendingFeedback' },
{ key: 'batchComplete', label: '批量完成', category: 'action', size: 'small', type: 'warning', loadingKey: 'batchCompleteLoading', action: 'batchComplete' },
{ key: 'batchClose', label: '批量关闭', category: 'action', size: 'small', type: 'danger', loadingKey: 'batchCloseLoading', action: 'batchClose' },
{ key: 'export', label: '导出', category: 'action', size: 'small', type: 'success', loadingKey: 'exportLoading', action: 'handleExport' },
{ key: 'batchPendingFeedback', label: '设为待反馈', category: 'action', size: 'small', loadingKey: 'batchPendingFeedbackLoading', action: 'batchSetPendingFeedback' },
{ key: 'batchComplete', label: '批量完成', category: 'action', size: 'small', loadingKey: 'batchCompleteLoading', action: 'batchComplete' },
{ key: 'batchClose', label: '批量关闭', category: 'cancel', size: 'small', loadingKey: 'batchCloseLoading', action: 'batchClose' },
]

View File

@ -358,7 +358,8 @@ const toolbarActionMap: Record<string, () => void> = {
batchSetPendingFeedback: () => handleBatchSetPendingFeedback(),
batchComplete: () => handleBatchStatus('completed', '批量完成', batchCompleteLoading),
batchClose: () => handleBatchStatus('closed', '批量关闭', batchCloseLoading),
handleExport: () => handleExport(),
handleExportSelected: () => handleExportSelected(),
handleExportAll: () => handleExportAll(),
openColumnConfigPanel: () => { upperTable.value?.openColumnConfig?.() },
}
@ -401,11 +402,20 @@ const {
queryProgress: (params) => afterSaleExportTaskProgress(params as any),
})
function handleExport() {
function handleExportAll() {
const where = buildWhereFromConditions(currentConditions.value)
submitExportTask({ where, sort: {} })
}
function handleExportSelected() {
const ids = selectedRows.value.map((row: any) => row.id)
if (!ids.length) {
ElMessage.warning('请先勾选要导出的售后单')
return
}
submitExportTask({ where: { id: { operator: 'in', value: ids } }, sort: {} })
}
// ==================== ScanBox 事件 ====================
function handleConditionChange(conditions: Record<string, any>) {

View File

@ -630,25 +630,6 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
loadingKey: 'loading',
action: 'loadData'
},
// ===== 功能按钮 =====
createType: {
key: 'createType',
label: '新增类型',
category: 'function',
type: 'primary',
size: 'small',
action: 'createType',
onlyForTabs: ['type']
},
createSubType: {
key: 'createSubType',
label: '新增子类型',
category: 'function',
type: 'primary',
size: 'small',
action: 'createSubType',
onlyForTabs: ['subType']
},
// ===== 基础操作 =====
columnConfig: {
key: 'columnConfig',
@ -664,7 +645,29 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
dynamicLabelKey: 'detailToggleLabel',
size: 'small',
action: 'toggleDetailVisible'
}
},
// ===== 功能按钮 =====
createType: {
key: 'createType',
label: '新增类型',
category: 'function',
type: 'primary',
plain: true,
size: 'small',
action: 'createType',
onlyForTabs: ['type']
},
createSubType: {
key: 'createSubType',
label: '新增子类型',
category: 'function',
type: 'primary',
plain: true,
size: 'small',
action: 'createSubType',
onlyForTabs: ['subType']
},
}
/** 按标签页名称获取工具栏按钮列表(自动根据 PAGE_CONFIG 过滤) */

View File

@ -0,0 +1,72 @@
<!--
ColumnCellRenderer — 通用表格列渲染器
根据传入的 ColumnSlotConfig 决定如何渲染单元格:
- type='tag' → 状态文字颜色(ut-status-text,替代 el-tag;支持 tagResolver / tagType 颜色映射)
- type='text' → 纯文本(支持 datetime 格式化)
- type='default' → 默认插槽渲染
- type='operation' → 操作列(由 OperationCellRenderer 处理)
-->
<template>
<template v-if="!config || config.type === 'default'">
<slot />
</template>
<template v-else-if="config.type === 'tag'">
<span :class="getStatusTextClass(resolvedTagType)">
{{ displayValue }}
</span>
</template>
<template v-else>
<span>{{ displayValue }}</span>
</template>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import type { ColumnSlotConfig } from '../config/template-config'
import { TAG_RESOLVERS, translate, formatTime } from '../config/template-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
defineOptions({ name: 'ColumnCellRenderer' })
const props = defineProps<{
/** 列插槽渲染配置 */
config: ColumnSlotConfig | undefined
/** 单元格值 */
value: any
}>()
/** 显示文本:translateField 翻译 > format 格式化 > 原始值 */
const displayValue = computed(() => {
const v = props.value
if (props.config?.translateField) {
return translate(props.config.translateField, v)
}
if (props.config?.format === 'datetime') {
return formatTime(v)
}
return v ?? '—'
})
const resolvedTagType = computed(() => {
if (!props.config || props.config.type !== 'tag') return ''
const { tagType, tagResolver } = props.config
// 优先使用 tagResolver(函数名映射)
if (tagResolver && TAG_RESOLVERS[tagResolver]) {
return TAG_RESOLVERS[tagResolver](props.value)
}
// 其次使用 tagType 映射表(用原始值查找)
if (tagType && typeof tagType === 'object') {
return tagType[String(props.value)] ?? 'info'
}
// 最后使用固定值
return (typeof tagType === 'string' ? tagType : 'info')
})
</script>
<style lang="scss" scoped>
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入)
路径:src/views/data/ordersummary/components → src/views/order/orderManagement/styles */
@use "../../../order/orderManagement/styles/order-sub.scss";
</style>

View File

@ -0,0 +1,175 @@
<!--
OperationCellRenderer — 表格操作列渲染组件
根据 operationButtons 配置渲染按钮列表。
支持的行为类型:
- actionType='action' → 触发 @operation-action 事件(可选配置 confirmMessage 弹确认框)
- actionType='form' → 打开 COMPONENT_REGISTRY 中注册的表单组件
使用方式:在 index.vue 中通过插槽 column-operation 引入:
<OperationCellRenderer
:buttons="currentTabConfig?.operationButtons"
:row="row"
@operation-action="handleOperationAction"
/>
-->
<template>
<div class="operation-cell">
<template v-for="btn in buttons" :key="btn.key">
<!-- action 按钮:支持确认弹窗 -->
<el-button
v-if="btn.actionType === 'action'"
link
:type="btn.type || 'primary'"
size="small"
:loading="actionLoadingMap[btn.key]"
:disabled="isDisabled(btn)"
@click.stop="handleActionClick(btn)"
>
{{ btn.label }}
</el-button>
<!-- form 按钮:打开表单弹窗 -->
<template v-else-if="btn.actionType === 'form'">
<el-button
link
:type="btn.type || 'primary'"
size="small"
:disabled="isDisabled(btn)"
@click.stop="openForm(btn)"
>
{{ btn.label }}
</el-button>
<!-- 表单弹窗 -->
<component
:is="resolvedFormComponents[btn.key]"
v-if="resolvedFormComponents[btn.key] && activeFormKey === btn.key"
v-model:visible="formVisibleMap[btn.key]"
v-bind="buildFormProps(btn)"
@success="handleFormSuccess(btn.key)"
/>
</template>
</template>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, markRaw, type Component } from 'vue'
import { ElMessageBox } from 'element-plus'
import { COMPONENT_REGISTRY } from '../config/template-config'
import type { OperationButtonConfig } from '../config/template-config'
defineOptions({ name: 'OperationCellRenderer' })
const props = defineProps<{
/** 操作按钮配置列表(来自 TabPageConfig.operationButtons) */
buttons?: OperationButtonConfig[]
/** 当前行数据 */
row: Record<string, any>
}>()
const emit = defineEmits<{
/** action 按钮点击事件(key: 按钮标识, row: 行数据) */
(e: 'operation-action', key: string, row: Record<string, any>): void
}>()
// ===== form 弹窗管理 =====
const activeFormKey = ref('')
const formVisibleMap = reactive<Record<string, boolean>>({})
const resolvedFormComponents = ref<Record<string, Component>>({})
const actionLoadingMap = reactive<Record<string, boolean>>({})
// ============================================================
// action 按钮:支持确认弹窗
// ============================================================
async function handleActionClick(btn: OperationButtonConfig) {
if (btn.confirmMessage) {
try {
await ElMessageBox.confirm(
btn.confirmMessage,
btn.confirmTitle || '确认操作',
{
confirmButtonText: btn.confirmButtonText || '确定',
cancelButtonText: '取消',
type: (btn.confirmType || 'warning') as any
}
)
} catch {
return // 取消
}
}
actionLoadingMap[btn.key] = true
try {
emit('operation-action', btn.key, props.row)
} finally {
actionLoadingMap[btn.key] = false
}
}
// ============================================================
// form 按钮:打开表单弹窗
// ============================================================
function openForm(btn: OperationButtonConfig) {
if (!btn.formKey) return
const comp = COMPONENT_REGISTRY[btn.formKey]
if (!comp) {
console.warn(`[OperationCellRenderer] 未注册的表单组件: ${btn.formKey}`)
return
}
activeFormKey.value = btn.key
resolvedFormComponents.value[btn.key] = markRaw(comp)
formVisibleMap[btn.key] = true
}
function buildFormProps(btn: OperationButtonConfig): Record<string, any> {
const result: Record<string, any> = {}
// paramMap: { formProp: rowField } → 从行数据取值注入表单
if (btn.paramMap) {
for (const [formProp, rowField] of Object.entries(btn.paramMap)) {
result[formProp] = props.row[rowField]
}
}
// extraParams: 固定参数直接注入
if (btn.extraParams) {
Object.assign(result, btn.extraParams)
}
return result
}
function handleFormSuccess(key: string) {
emit('operation-action', key, props.row)
}
// ============================================================
// 按钮禁用判断
// ============================================================
function isDisabled(btn: OperationButtonConfig): boolean {
if (btn.disabledOnField) {
const val = props.row[btn.disabledOnField]
if (val === undefined || val === null || val === '' || val === false) {
return true
}
}
return false
}
</script>
<style lang="scss" scoped>
.operation-cell {
display: flex;
flex-wrap: wrap;
gap: 2px;
justify-content: center;
}
</style>

View File

@ -0,0 +1,132 @@
<template>
<div class="tab-area-wrapper">
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-click="handleTabClick"
>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineOptions({ name: 'TabArea' })
interface TabItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
tabs?: TabItem[]
defaultActive?: string
}>(),
{
tabs: () => [],
defaultActive: ''
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
const handleTabClick = (pane: any) => {
const name = pane?.name ?? pane?.props?.name ?? ''
if (name) {
activeTab.value = name
emit('tab-change', name)
}
}
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
flex-shrink: 0;
}
.tab-container {
display: flex;
flex-direction: column;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0;
background: #f8fbff;
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
color: #606266;
font-size: 14px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
border-bottom: none;
margin-right: 4px;
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
z-index: 1;
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
}
:deep(.el-tabs__content) {
display: none;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -0,0 +1,185 @@
<!--
DetailPanel — 明细面板(通用)
根据 detailConfig 配置的 sections 渲染 el-descriptions 分区。
支持 text、tag、pre 三种渲染类型。
支持 translateField + tagResolver 集中式翻译。
支持 apiMethod 自动获取详情数据。
-->
<template>
<div class="detail-panel">
<div v-if="!row" class="empty-tip">请从上方列表中选择一项查看明细</div>
<template v-else>
<div v-for="(section, si) in detailConfig" :key="si" class="section">
<div class="section-title">{{ section.title }}</div>
<el-descriptions :column="section.columnCount" border size="small" class="detail-descriptions">
<el-descriptions-item
v-for="(field, fi) in section.fields"
:key="fi"
:label="field.label"
:span="field.span ?? 1"
>
<!-- 状态文字颜色(ut-status-text,替代 el-tag) -->
<template v-if="field.renderType === 'tag'">
<span :class="getStatusTextClass(resolveTagType(field, getRowData()?.[field.key]))">
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
</span>
</template>
<!-- pre 渲染 -->
<template v-else-if="field.renderType === 'pre'">
<pre class="order-list-pre">{{ formatPre(getRowData()?.[field.key]) }}</pre>
</template>
<!-- 默认文本渲染 -->
<template v-else>
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
</template>
</el-descriptions-item>
</el-descriptions>
</div>
</template>
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { TAG_RESOLVERS, translate } from '../template-config'
import type { DetailSectionConfig, DetailFieldConfig } from '../template-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
defineOptions({ name: 'DetailPanel' })
const props = defineProps<{
row: Record<string, any> | null
detailConfig: DetailSectionConfig[]
/** 可选的 detail API 方法,传入后自动调用获取完整明细数据 */
apiMethod?: (...args: any[]) => Promise<any>
}>()
/** 通过 API 获取的增强数据(与 row 合并) */
const enrichedData = ref<Record<string, any> | null>(null)
watch(() => props.row, async (newRow) => {
if (newRow && props.apiMethod) {
try {
const res = await props.apiMethod({
id: newRow.id,
code: newRow.code
})
if (res && (res.code === 1 || res.code === 200)) {
enrichedData.value = res.data ?? res
} else {
enrichedData.value = null
}
} catch {
enrichedData.value = null
}
} else {
enrichedData.value = null
}
}, { immediate: true })
/** 合并 row + API 增强数据 */
function getRowData(): Record<string, any> | null {
if (!props.row) return null
if (enrichedData.value) {
return { ...props.row, ...enrichedData.value }
}
return props.row
}
/** 解析显示值:优先使用 translateField 翻译,否则显示原始值 */
function resolveDisplayValue(field: DetailFieldConfig, value: any): string {
if (field.translateField) {
return translate(field.translateField, value)
}
return value ?? '—'
}
/** 格式化 pre 渲染值:数组/对象转 JSON 字符串 */
function formatPre(value: any): string {
if (value === undefined || value === null || value === '') return '—'
if (Array.isArray(value) && value.length === 0) return '—'
if (typeof value === 'object') {
try {
return JSON.stringify(value, null, 2)
} catch {
return String(value)
}
}
return String(value)
}
/** 解析 tag 颜色 */
function resolveTagType(field: DetailFieldConfig, value: any): string {
if (field.tagResolver) {
const resolver = TAG_RESOLVERS[field.tagResolver]
if (resolver) return resolver(value)
}
if (field.tagType) {
if (typeof field.tagType === 'object') {
return field.tagType[String(value)] ?? 'info'
}
return field.tagType
}
return 'info'
}
</script>
<style lang="scss" scoped>
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入)
路径:src/views/data/ordersummary/config/components → src/views/order/orderManagement/styles */
@use "../../../../order/orderManagement/styles/order-sub.scss";
/* 面板自带内边距 8px 0(左右由宿主 .detail-container 的 padding: 0 10px 提供),
合计内容缩进 10px,对齐 express/waybill 的 DetailPanel / stock/external_stock「基本信息」 */
.detail-panel {
flex: 1;
min-height: 0;
height: 100%;
padding: 8px 0;
box-sizing: border-box;
overflow: auto;
}
.empty-tip {
text-align: center;
font-size: 13px;
color: #909399;
padding: 40px 0;
}
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
}
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 120px;
background: #fafbfc;
font-weight: 500;
}
}
.order-list-pre {
margin: 0;
font-family: inherit;
font-size: 13px;
line-height: 1.8;
white-space: pre-wrap;
color: #606266;
}
</style>

View File

@ -0,0 +1,274 @@
<!--
LogPanel — 操作日志面板(通用)
支持两种数据来源:
- apiMethod 传入 → 调用真实接口获取日志
- 无 apiMethod → 基于 row 生成模拟日志(开发调试用)
-->
<template>
<div class="log-panel">
<!-- 按钮行(间距 6px 对齐 toolbar),对齐 stock/external_stock 面板新样式 -->
<div class="header-actions">
<div class="left-actions">
<el-button
size="small"
type="primary"
:loading="apiLoading"
:disabled="!row || !apiMethod"
@click="loadLogs"
>
刷新
</el-button>
</div>
</div>
<div ref="tableHostRef" class="table-host">
<el-table
ref="tableRef"
:data="pagedLogs"
border
stripe
size="small"
:height="tableHeight"
v-loading="apiLoading"
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>
<template #empty>
<div class="empty-tip">暂无操作日志</div>
</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"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, nextTick, ref, watch } from 'vue'
import { useResizeObserver } from '@vueuse/core'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
defineOptions({ name: 'LogPanel' })
interface LogItem {
operator: string
action: string
result: string
detail?: string
time: string
level: 'success' | 'info' | 'warning' | 'error'
}
const props = defineProps<{
/** 当前选中行数据(用于生成关联日志) */
row: Record<string, any> | null
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
apiMethod?: (...args: any[]) => Promise<any>
}>()
/** 通过 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)
useResizeObserver(tableHostRef, (entries) => {
const h = entries[0]?.contentRect.height ?? 0
if (h >= 100) {
tableHeight.value = Math.floor(h)
}
})
/** 切页后把表格滚动位置归零 */
function resetTableScroll() {
nextTick(() => {
tableRef.value?.setScrollTop?.(0)
})
}
/** 表格本地分页(对齐 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 resultTagType(row: LogItem): string {
if (row.result === '成功') return 'success'
if (row.result === '失败') return 'danger'
return 'info'
}
watch(() => props.row, () => {
void loadLogs()
}, { immediate: true })
/** 拉取日志(按钮「刷新」也走这个函数) */
async function loadLogs() {
const newRow = props.row
currentPage.value = 1
if (newRow && props.apiMethod) {
apiLoading.value = true
try {
const res = await props.apiMethod({
id: newRow.id,
code: newRow.code,
page: 1,
pageSize: 100
})
if (res && (res.code === 1 || res.code === 200)) {
const list = res.data?.list ?? res.data?.logs ?? res.list ?? res.logs ?? []
apiLogs.value = Array.isArray(list) ? list.map((item: any) => ({
operator: item.operator ?? item.creator ?? '—',
action: item.action ?? item.operation ?? '—',
result: item.result ?? item.status ?? '—',
detail: item.detail ?? item.description ?? '',
time: item.time ?? item.create_time ?? '—',
level: (item.result === '成功' || item.status === 'success') ? 'success'
: (item.result === '失败' || item.status === 'error') ? 'error'
: 'info'
})) : []
} else {
apiLogs.value = []
}
} catch {
apiLogs.value = []
} finally {
apiLoading.value = false
}
} else {
apiLogs.value = null
}
}
/** 基于 row 生成模拟日志(无 apiMethod 时使用) */
const mockLogs = computed<LogItem[]>(() => {
if (!props.row) return []
const rowName = props.row.name ?? props.row.code ?? '—'
const now = new Date()
const pad = (n: number) => String(n).padStart(2, '0')
const fmt = (d: Date) =>
`${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
return [
{
operator: '系统',
action: `创建了「${rowName}」`,
result: '成功',
time: fmt(new Date(now.getTime() - 3600000 * 3)),
level: 'success'
},
{
operator: props.row.creator ?? '管理员',
action: `更新了「${rowName}」`,
result: '成功',
detail: `修改了状态和相关配置`,
time: fmt(new Date(now.getTime() - 3600000)),
level: 'success'
}
]
})
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
const logs = computed<LogItem[]>(() => {
if (apiLogs.value !== null) {
return apiLogs.value
}
return mockLogs.value
})
/** 数据变化后页码超出范围时回退到最后一页(必须放在 logs 声明之后,否则 setup 阶段 TDZ 报错) */
watch(logs, (list) => {
const maxPage = Math.max(1, Math.ceil(list.length / pageSize))
if (currentPage.value > maxPage) currentPage.value = maxPage
})
</script>
<style lang="scss" scoped>
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入)
路径:src/views/data/ordersummary/config/components → src/views/order/orderManagement/styles */
@use "../../../../order/orderManagement/styles/order-sub.scss";
/* 日志面板:按钮行 + 自适应高度表格 + 右对齐分页(对齐 stock/external_stock 面板列表新样式) */
.log-panel {
flex: 1;
min-height: 0;
width: 100%;
height: 100%;
padding: 8px 0;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden;
}
.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;
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制间距 */
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
.table-host {
flex: 1;
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;
}
.empty-tip {
color: #909399;
font-size: 13px;
}
</style>

View File

@ -0,0 +1,692 @@
/**
* 【页面模板】配置文件 v2 — 基于 waveOrder2 架构设计
*
* ===== 核心设计 =====
*
* 1. FIELD_DICT — 全局字段预设表,每个字段拥有唯一翻译(label)和完整元数据
* 2. VALUE_MAPS — 值翻译映射表(select options 和 tag 翻译共用)
* 3. TAG_RESOLVERS — 状态文字颜色解析器(集中管理 ut-status-text 颜色逻辑,比 el-tag 轻量)
* 4. 各标签页通过 key 引用所需字段(scanBoxFieldKeys / tableColumnKeys)
* 5. resolveTabConfig() — 加载时将 key 列表展开为完整配置
*
* ===== 快速上手 =====
* 1. 复制整个 views/mode/ 文件夹,重命名为你的页面名
* 2. 在 FIELD_DICT 中添加你需要的字段定义
* 3. 在 tabPages 中配置标签页(引用 FIELD_DICT 的 key)
* 4. 在 TabPageApiConfig 中接入真实接口
* 5. 在 router/map.ts 中添加路由
*/
import type { Component } from 'vue'
import DetailPanel from './components/DetailPanel.vue'
import LogPanel from './components/LogPanel.vue'
import { orderDeliveryOrderSummary } from '@/api/order.deliveryorder/orderdeliveryOrder'
// ============================================================
// 〇、全局页面配置
// ============================================================
export const PAGE_CONFIG = {
/** 是否显示顶部多标签栏 */
showTabArea: false,
/** 单页模式:不显示标签栏,仅一个标签页内容 */
singlePage: true,
/** 是否启用详情面板(底部分栏 + 显示/隐藏详情按钮),false 时表格占满全高 */
enableDetailPanel: false
}
// ============================================================
// 〇-A、组件注册表 — 所有可复用组件在此注册
// ============================================================
export const COMPONENT_REGISTRY: Record<string, Component> = {
DetailPanel,
LogPanel
}
// ============================================================
// 〇-B、SCANBOX_GROUPS — ScanBox 分组名称
// ============================================================
export const SCANBOX_GROUPS = {
basic: '基础信息',
process: '流程状态',
time: '时间范围',
custom: '自定义字段'
} as const
// ============================================================
// 一、FIELD_DICT — 全局字段预设表(唯一真相来源)
// ============================================================
// 每个字段拥有:
// label — 唯一翻译文本
// scanBox — ScanBox 渲染配置(type/options/group)
// table — 表格列配置(minWidth/fixed/align/sortable)
// slot — 单元格渲染配置(tag/tagResolver/translateField)
// detailLabel — 明细面板中的标签文本(可选,默认用 label)
// filterParamMap — ScanBox 筛选值 → API 传参值映射
export interface FieldDefinition {
key: string
label: string
scanBox: {
type: 'text' | 'select' | 'daterange' | 'number'
group?: string
options?: { label: string; value: any }[]
} | null
table: {
minWidth?: number
width?: number
fixed?: 'left' | 'right' | boolean
align?: 'left' | 'center' | 'right'
sortable?: boolean
showOverflowTooltip?: boolean
copyAction?: 'copy' | 'copyQr'
copyValue?: (row: any) => any
} | null
slot: {
type: 'tag' | 'text' | 'default' | 'operation'
tagType?: string | Record<string, string>
tagResolver?: string
translateField?: string
format?: 'datetime'
} | null
detailLabel?: string
filterParamMap?: Record<string, string>
}
// ============================================================
// VALUE_MAPS — 值翻译映射(select options 和 tag 翻译共用)
// ============================================================
export const VALUE_MAPS: Record<string, Record<string, string>> = {
status: { 'pending': '待处理', 'processing': '处理中', 'done': '已完成', '待处理': '待处理', '处理中': '处理中', '已完成': '已完成' },
type: { 'A': '类型A', 'B': '类型B', 'C': '类型C', '类型A': '类型A', '类型B': '类型B', '类型C': '类型C' },
bool: { '1': '是', '0': '否', '是': '是', '否': '否' }
}
/** 从 VALUE_MAPS 衍生 options(优先取中文值作为 option value) */
export function getOptions(field: string): { label: string; value: string }[] {
const map = VALUE_MAPS[field]
if (!map) return []
const seen = new Set<string>()
const opts: { label: string; value: string }[] = []
const chineseKeys: [string, string][] = []
const otherKeys: [string, string][] = []
for (const [v, l] of Object.entries(map)) {
if (/^[\u4e00-\u9fa5]/.test(v)) {
chineseKeys.push([v, l])
} else {
otherKeys.push([v, l])
}
}
for (const [v, l] of [...chineseKeys, ...otherKeys]) {
if (!seen.has(l)) {
seen.add(l)
opts.push({ label: l, value: v })
}
}
return opts
}
/** 翻译 value → label */
export function translate(field: string, value: any): string {
const map = VALUE_MAPS[field]
if (!map) return String(value ?? '—')
return map[String(value)] ?? String(value ?? '—')
}
/** 格式化时间戳为 YYYY-MM-DD HH:mm:ss */
export function formatTime(value: any): string {
if (!value) return '—'
try {
const d = new Date(value)
if (isNaN(d.getTime())) return String(value)
const pad = (n: number) => String(n).padStart(2, '0')
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
} catch {
return String(value)
}
}
// ============================================================
// TAG_RESOLVERS — 状态文字颜色解析器
// ============================================================
// 颜色规则:未xx=info(灰) 已xx=success(绿) xx中/部分xx=warning(黄) 错误=danger(红)
export const TAG_RESOLVERS: Record<string, (val: any) => string> = {
resolveStatusTag(v) {
if (!v) return 'info'
if (v === '已完成' || v === 'done') return 'success'
if (v === '处理中' || v === 'processing') return 'warning'
return 'info'
},
resolveBoolTag(v) {
if (v === undefined || v === null) return 'info'
if (v === '是' || v === true || v === 1 || v === '1') return 'success'
return 'info'
}
}
// ============================================================
// 二、FIELD_DICT 实例 — 在此定义页面所需的所有字段
// ============================================================
export const FIELD_DICT: Record<string, FieldDefinition> = {
/** 筛选:统计日期区间(yyyy-MM-dd)→ 请求参数 start_date / end_date */
date_range: {
key: 'date_range',
label: '统计日期',
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
table: null,
slot: null,
detailLabel: '统计日期'
},
date: {
key: 'date',
label: '日期',
scanBox: null,
table: { minWidth: 120, fixed: 'left', align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '日期'
},
order_count: {
key: 'order_count',
label: '订单量',
scanBox: null,
table: { minWidth: 100, align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '订单量(create_at,排除取消单)'
},
dispatch_count: {
key: 'dispatch_count',
label: '迁入配送单量',
scanBox: null,
table: { minWidth: 130, align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '迁入配送单量(dispath_time)'
},
shipped_count: {
key: 'shipped_count',
label: '发货订单数',
scanBox: null,
table: { minWidth: 120, align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '发货订单数(delivery_time,排除取消单)'
},
shipped_items_total: {
key: 'shipped_items_total',
label: '发货商品件数',
scanBox: null,
table: { minWidth: 130, align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '发货商品件数'
},
shipped_amount: {
key: 'shipped_amount',
label: '发货金额(元)',
scanBox: null,
table: { minWidth: 130, align: 'right', showOverflowTooltip: true },
slot: null,
detailLabel: '发货金额(元)'
},
intercepted_count: {
key: 'intercepted_count',
label: '拦截数量',
scanBox: null,
table: { minWidth: 110, align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '拦截数量(intercept_time,intercept_status != none)'
},
intercepted_at_warehouse_count: {
key: 'intercepted_at_warehouse_count',
label: '库内确定拦截数',
scanBox: null,
table: { minWidth: 140, align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '库内确定拦截数(intercept_status = intercepted_at_warehouse)'
},
cancelled_count: {
key: 'cancelled_count',
label: '取消数量',
scanBox: null,
table: { minWidth: 110, align: 'center', showOverflowTooltip: true },
slot: null,
detailLabel: '取消数量(updated_at,status = cancel)'
}
}
// ============================================================
// 三、ColumnSlotConfig — 列单元格渲染配置
// ============================================================
export interface ColumnSlotConfig {
type: 'tag' | 'text' | 'default' | 'operation'
tagType?: string | Record<string, string>
tagResolver?: string
translateField?: string
format?: 'datetime'
}
// ============================================================
// 三-A、OperationButtonConfig — 操作列按钮配置
// ============================================================
export interface OperationButtonConfig {
key: string
label: string
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | ''
actionType: 'form' | 'action'
formKey?: string
formTitle?: string
formWidth?: string
paramMap?: Record<string, string>
extraParams?: Record<string, any>
disabledOnField?: string
confirmMessage?: string
confirmTitle?: string
confirmType?: 'warning' | 'danger' | 'info'
confirmButtonText?: string
}
// ============================================================
// 四、DetailFieldConfig / DetailSectionConfig — 明细面板配置
// ============================================================
export interface DetailFieldConfig {
key: string
label?: string
span?: number
renderType?: 'text' | 'tag' | 'pre'
tagType?: string | Record<string, string>
tagResolver?: string
translateField?: string
}
export interface DetailSectionConfig {
title: string
columnCount: number
fields: DetailFieldConfig[]
}
export interface DetailTabConfig {
name: string
label: string
componentKey: string
component?: Component
}
// ============================================================
// 五、TabPageApiConfig — 标签页接口插槽配置
// ============================================================
export type ApiMethod = (...args: any[]) => Promise<any>
export type ApiSource = 'api' | 'list'
export type ComponentApiConfig = { source: 'list' } | ApiMethod
export interface TabPageApiConfig {
/** 列表查询接口 */
list: ApiMethod
/** 明细面板接口(可选,不配则用 row 数据) */
detail?: ComponentApiConfig
/** 操作日志接口(可选) */
log?: ComponentApiConfig
/** 导出接口(可选) */
export?: ApiMethod
/** 导出进度查询接口(可选) */
exportProgress?: ApiMethod
/** ScanBox 下拉选项数据源接口(可选) */
scanBoxOptions?: Record<string, ApiMethod>
/** 工具栏按钮 → API 方法映射(可选) */
toolbar?: Record<string, ApiMethod>
/** 列表响应解析器 */
parseListResponse?: (res: any) => { list: any[]; total: number }
/**
* 前端分页:接口一次返回全量数据(如每日汇总),由页面按 pagination 切片展示
* (此时 buildListParams 返回的 page/pageSize 不会被使用)
*/
clientPagination?: boolean
/** 构建列表请求参数 */
buildListParams?: (params: {
pagination: { page: number; pageSize: number }
conditions: Record<string, any>
sort?: { prop: string; order: string }
}) => Record<string, any>
}
// ============================================================
// 六、TabPageRawConfig — 标签页声明配置(仅用 key 引用)
// ============================================================
export interface TabPageRawConfig {
name: string
label: string
scanBoxCacheKey: string
/** ScanBox 需要的字段 key 列表(从 FIELD_DICT 中查找) */
scanBoxFieldKeys: string[]
/** 表格需要的列 key 列表(从 FIELD_DICT 中查找) */
tableColumnKeys: string[]
upperTableDefaults: {
title: string
enableColumnConfig?: boolean
showIndex?: boolean
showSelection?: boolean
emptyText?: string
}
/** 明细面板标签页配置 */
detailTabs?: { name: string; label: string; componentKey: string }[]
/** 明细面板分区配置(字段 key 列表,resolveTabConfig 展开) */
detailSections: {
title: string
columnCount: number
fieldKeys: string[]
}[]
/** 接口配置(有 api 时启用真实接口) */
api?: TabPageApiConfig
/** 操作列按钮配置(需 tableColumnKeys 包含 'operation') */
operationButtons?: OperationButtonConfig[]
}
// ============================================================
// 七、TabPageConfig — 展开后的完整配置(给 index.vue 使用)
// ============================================================
export interface TabPageConfig {
name: string
label: string
scanBoxCacheKey: string
scanBoxFields: Record<string, any>[]
upperTable: {
title: string
enableColumnConfig: boolean
showIndex: boolean
showSelection: boolean
emptyText: string
columns: Record<string, any>[]
}
columnSlots: Record<string, ColumnSlotConfig>
detailConfig: DetailSectionConfig[]
detailTabs: DetailTabConfig[]
api?: TabPageApiConfig
operationButtons?: OperationButtonConfig[]
}
// ============================================================
// 八、resolveTabConfig — 加载时将 RawConfig 展开为完整配置
// ============================================================
export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
// 展开 ScanBox 字段
const scanBoxFields: Record<string, any>[] = []
for (const key of raw.scanBoxFieldKeys) {
const def = FIELD_DICT[key]
if (!def || !def.scanBox) continue
scanBoxFields.push({
label: def.label,
value: def.key,
type: def.scanBox.type,
options: def.scanBox.options ? [...def.scanBox.options] : undefined,
group: def.scanBox.group,
required: (def.scanBox as any).required
})
}
// 展开表格列
const columns: Record<string, any>[] = []
for (const key of raw.tableColumnKeys) {
const def = FIELD_DICT[key]
if (!def || !def.table) continue
columns.push({
prop: def.key,
label: def.label,
...def.table
})
}
// 展开列插槽
const columnSlots: Record<string, ColumnSlotConfig> = {}
for (const key of raw.tableColumnKeys) {
const def = FIELD_DICT[key]
if (!def || !def.slot) continue
columnSlots[def.key] = { ...def.slot }
}
// 展开明细面板配置
const detailConfig: DetailSectionConfig[] = raw.detailSections.map((sec) => ({
title: sec.title,
columnCount: sec.columnCount,
fields: sec.fieldKeys
.map((key): DetailFieldConfig | null => {
const def = FIELD_DICT[key]
if (!def) return null
return {
key: def.key,
label: def.detailLabel ?? def.label,
translateField: def.slot?.translateField,
tagResolver: def.slot?.tagResolver,
tagType: def.slot?.tagType,
renderType: def.slot?.type === 'tag' ? 'tag' : 'text'
}
})
.filter((f): f is DetailFieldConfig => f !== null)
}))
// 展开明细标签页(解析 componentKey → Component)
const detailTabs: DetailTabConfig[] = raw.detailTabs
? raw.detailTabs.map((tab) => ({
name: tab.name,
label: tab.label,
componentKey: tab.componentKey,
component: COMPONENT_REGISTRY[tab.componentKey]
}))
: [{ name: 'detail', label: '明细', componentKey: 'DetailPanel', component: COMPONENT_REGISTRY['DetailPanel'] }]
return {
name: raw.name,
label: raw.label,
scanBoxCacheKey: raw.scanBoxCacheKey,
scanBoxFields,
upperTable: {
title: raw.upperTableDefaults.title,
enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true,
showIndex: raw.upperTableDefaults.showIndex ?? true,
showSelection: raw.upperTableDefaults.showSelection ?? true,
emptyText: raw.upperTableDefaults.emptyText ?? '暂无数据',
columns
},
columnSlots,
detailConfig,
detailTabs,
api: raw.api,
operationButtons: raw.operationButtons
}
}
// ============================================================
// 九、buildWhereConditions — 将 ScanBox 条件转为 API where 参数
// ============================================================
export function buildWhereConditions(rawConditions: Record<string, any>): Record<string, any> {
const where: Record<string, any> = {}
for (const [key, cond] of Object.entries(rawConditions || {})) {
let value: any = undefined
if (cond && typeof cond === 'object' && 'operator' in cond) {
value = (cond as any).value
} else if (cond !== undefined && cond !== null && cond !== '') {
value = Array.isArray(cond) ? cond[0] ?? '' : cond
}
if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) {
continue
}
const def = FIELD_DICT[key]
if (def?.filterParamMap) {
const mapped = def.filterParamMap[String(value)]
if (mapped !== undefined) {
where[key] = mapped
continue
}
}
where[key] = value
}
return where
}
// ============================================================
// 十、工具栏按钮系统
// ============================================================
// 按钮分为三类:
// common — 公共按钮(刷新、导出)
// function — 功能按钮(打开表单/确认窗口)
// basic — 基础操作(字段设置、隐藏详情)
export interface ToolbarButtonConfig {
key: string
label: string
category: 'common' | 'function' | 'basic'
size?: '' | 'default' | 'small' | 'large'
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
plain?: boolean
loadingKey?: string
disabledKey?: string
action: string
dynamicLabelKey?: string
onlyForTabs?: string[]
buttonType?: 'default' | 'dropdown'
dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }>
formKey?: string
}
export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
// ===== 公共按钮 =====
refresh: {
key: 'refresh',
label: '刷新',
category: 'common',
type: 'primary',
size: 'small',
loadingKey: 'loading',
action: 'loadData'
},
export: {
key: 'export',
label: '导出',
category: 'common',
size: 'small',
loadingKey: 'exportLoading',
action: 'handleExport',
buttonType: 'dropdown',
dropdownOptions: [
{ label: '不含明细', action: 'handleExport' },
{ label: '含明细', action: 'handleExportItem', divided: true }
],
/** 订单汇总暂未接导出接口,先隐藏,避免出现点了没反应的按钮(接入后删除本行) */
onlyForTabs: ['__disabled__']
},
// ===== 基础操作 =====
columnConfig: {
key: 'columnConfig',
label: '字段设置',
category: 'basic',
size: 'small',
action: 'openColumnConfigPanel'
},
toggleDetail: {
key: 'toggleDetail',
label: '显示详情',
category: 'basic',
dynamicLabelKey: 'detailToggleLabel',
size: 'small',
action: 'toggleDetailVisible'
}
// ★ 在此添加功能按钮(如批量操作)★
}
/** 按标签页名称获取工具栏按钮列表(自动根据 PAGE_CONFIG 过滤) */
export function getTabToolbarButtons(tabName: string): ToolbarButtonConfig[] {
return Object.values(TOOLBAR_BUTTONS).filter((btn) => {
if (btn.onlyForTabs && !btn.onlyForTabs.includes(tabName)) return false
// 详情面板禁用时,隐藏「显示/隐藏详情」按钮
if (!PAGE_CONFIG.enableDetailPanel && btn.key === 'toggleDetail') return false
return true
})
}
// ============================================================
// 十一、批量操作配置(可选,接入 BatchOperationForm 时使用)
// ============================================================
export interface BatchOperationConfig {
action: string
title: string
confirmText: string
confirmType?: 'warning' | 'error' | 'info' | 'success'
confirmButtonText: string
successText: string
failText: string
apiMethod: (...args: any[]) => Promise<any>
payloadKey?: string
idField?: string | string[]
payloadBuilder?: (rows: Record<string, any>[]) => Record<string, any>
useProgress?: boolean
progressApiMethod?: (...args: any[]) => Promise<any>
}
/** ★ 在此配置批量操作 */
export const BATCH_OPERATION_CONFIGS: Record<string, BatchOperationConfig> = {
// batchExample: {
// action: 'batchExample',
// title: '批量操作示例',
// confirmText: '确定对选中的 {count} 项执行操作吗?',
// confirmType: 'warning',
// confirmButtonText: '确认操作',
// successText: '批量操作成功',
// failText: '批量操作失败',
// apiMethod: yourBatchApi,
// payloadKey: 'ids',
// idField: 'id'
// }
}
// ============================================================
// 十二、标签页注册表 — 在此定义你的页面标签页
// ============================================================
export const tabPages: TabPageRawConfig[] = [
// ===== 订单汇总(order.deliveryOrder.summary) =====
{
name: 'daily',
label: '每日汇总',
scanBoxCacheKey: 'data-ordersummary-daily',
scanBoxFieldKeys: ['date_range'],
tableColumnKeys: [
'date',
'order_count',
'dispatch_count',
'shipped_count',
'shipped_items_total',
'shipped_amount',
'intercepted_count',
'intercepted_at_warehouse_count',
'cancelled_count'
],
upperTableDefaults: {
title: '订单每日汇总',
showIndex: false,
showSelection: false,
emptyText: '所选日期范围内暂无数据'
},
detailSections: [],
api: {
list: orderDeliveryOrderSummary,
/** 接口一次返回区间内全部自然日,前端按分页切片 */
clientPagination: true,
parseListResponse(res) {
// summary 接口的 payload 在响应顶层(无 data 包装)
const payload = res?.data ?? res ?? {}
const list = Array.isArray(payload.list) ? payload.list : []
const total = Number(payload.day_count ?? list.length)
return { list, total: Number.isFinite(total) && total > 0 ? total : list.length }
},
buildListParams({ conditions }) {
const raw = conditions?.date_range
const range: any[] = Array.isArray(raw) ? raw : Array.isArray((raw as any)?.value) ? (raw as any).value : []
const params: Record<string, any> = {}
if (range.length === 2 && range[0] && range[1]) {
params.start_date = range[0]
params.end_date = range[1]
}
return params
}
}
}
]
// ============================================================
// 十三、向后兼容导出
// ============================================================
export const templateTabs = tabPages.map((t) => ({ name: t.name, label: t.label, scanBoxCacheKey: t.scanBoxCacheKey }))

View File

@ -0,0 +1,724 @@
<!--
╔══════════════════════════════════════════════════════════════╗
║ 【页面模板 v2】— 基于 waveOrder2 架构设计 ║
╚══════════════════════════════════════════════════════════════╝
===== 快速复制使用 =====
1. 复制整个 views/mode/ 文件夹 → 重命名为你的页面名(如 views/order/myPage/)
2. 修改 defineOptions name(如 'MyPage')
3. 编辑 config/template-config.ts:
a. 在 FIELD_DICT 中添加页面字段
b. 在 tabPages 中配置标签页(引用 FIELD_DICT 的 key)
c. 在 TabPageApiConfig 中接入真实接口
4. 在 router/map.ts 中添加路由
===== 页面结构 =====
┌─────────────────────────────────────────────────────────┐
│ TabArea(多标签页切换,可关闭) │
├──────────┬──────────────────────────────────────────────┤
│ ScanBox │ OrderToolbarButtonGroup(工具栏按钮组) │
│ 筛选面板 │ ┌──────────────────────────────────────────┐│
│ │ │ UpperTable(表格) ││
│ │ │ - OperationCellRenderer(操作列) ││
│ │ ├──────────────────────────────────────────┤│
│ │ │ 分隔条(可拖拽) ││
│ │ ├──────────────────────────────────────────┤│
│ │ │ DetailPanel / LogPanel(明细/日志面板) ││
│ │ └──────────────────────────────────────────┘│
└──────────┴──────────────────────────────────────────────┘
-->
<template>
<div class="page-wrapper" :style="{ height: containerHeight }">
<!-- ===== 多标签模式:显示顶部标签栏 ===== -->
<template v-if="PAGE_CONFIG.showTabArea && !PAGE_CONFIG.singlePage">
<div class="tab-section">
<TabArea
:tabs="tabList"
:default-active="activeTabName"
@tab-change="handleTabChange"
/>
</div>
</template>
<!-- ===== 主内容区 ===== -->
<div class="main-container">
<div class="order-sub-container">
<!-- 左侧:ScanBox 筛选面板 -->
<ScanBox
ref="scanBoxRef"
:cache-key="currentScanBoxCacheKey"
width="220px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="currentScanBoxFields"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<!-- 右侧:内容区 -->
<div class="main-content">
<transition name="tab-fade" mode="out-in">
<div :key="activeTabName" class="tab-content-inner">
<!-- 工具栏按钮组 -->
<div class="toolbar">
<div class="toolbar-left">
<OrderToolbarButtonGroup
:buttons="currentToolbarButtons"
:resolve-disabled="resolveButtonDisabled"
:resolve-loading="resolveButtonLoading"
:resolve-label="resolveButtonLabel"
:layout-key="toolbarLayoutKey"
@action="handleToolbarButtonClick"
/>
</div>
</div>
<!-- 上下分栏区域:详情面板启用时才显示分栏 + 详情 -->
<template v-if="PAGE_CONFIG.enableDetailPanel">
<div class="split-stack" ref="splitStackRef">
<!-- 上半:表格 -->
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
<UpperTable
ref="upperTableRef"
:title="currentTabConfig?.upperTable.title ?? '列表'"
default-align="center"
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
:column-config-schema-version="1"
:table-id="`template-table-${activeTabName}`"
:data="listData"
:row-key="'id'"
:columns="currentColumns"
table-size="small"
:pagination="pagination"
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
:loading="loading"
:query-time="queryTime"
@current-change="handleRowClick"
@row-click="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@sort-change="handleSortChange"
@selection-change="handleSelectionChange"
>
<!-- 动态列插槽:根据 columnSlots 配置自动渲染 -->
<template
v-for="(slotConfig, colProp) in currentColumnSlots"
:key="`columnSlots-${colProp}`"
#[`column-${colProp}`]="{ row }"
>
<!-- 操作列:渲染操作按钮 -->
<OperationCellRenderer
v-if="slotConfig.type === 'operation'"
:buttons="currentTabConfig?.operationButtons"
:row="row"
@operation-action="handleOperationAction"
/>
<!-- 其他列:标签/文本渲染 -->
<ColumnCellRenderer
v-else
:config="slotConfig"
:value="row[colProp]"
/>
</template>
<template #empty>
<div class="empty-tip">{{ currentTabConfig?.upperTable.emptyText ?? '暂无数据' }}</div>
</template>
</UpperTable>
</div>
<!-- 分隔条(可拖拽) -->
<template v-if="detailVisible">
<div
class="pane-resizer"
title="拖动调整列表与详情区域高度"
@mousedown="beginSplitDrag"
/>
<!-- 下半:明细面板 -->
<div v-if="selectedRow" class="lower-level" :style="lowerPaneStyle">
<div class="detail-header">
<el-tabs v-model="activeDetailTab" class="detail-tab">
<el-tab-pane
v-for="tab in currentDetailTabs"
:key="tab.name"
:label="tab.label"
:name="tab.name"
/>
</el-tabs>
</div>
<div class="detail-container">
<component
:is="activeDetailTabComponent"
:row="selectedDetail"
:detail-config="currentDetailConfig"
:api-method="currentDetailTabApiMethod"
/>
</div>
</div>
<!-- 未选中行时的占位 -->
<div v-else class="no-selection" :style="lowerPaneStyle">
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</template>
</div>
</template>
<!-- 详情面板禁用:表格占满全高 -->
<template v-else>
<div class="upper-wrapper upper-wrapper--full">
<UpperTable
ref="upperTableRef"
:title="currentTabConfig?.upperTable.title ?? '列表'"
default-align="center"
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
:column-config-schema-version="1"
:table-id="`template-table-${activeTabName}`"
:data="listData"
:row-key="'id'"
:columns="currentColumns"
table-size="small"
:pagination="pagination"
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
:loading="loading"
:query-time="queryTime"
@current-change="handleRowClick"
@row-click="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@sort-change="handleSortChange"
@selection-change="handleSelectionChange"
>
<template
v-for="(slotConfig, colProp) in currentColumnSlots"
:key="`columnSlots-${colProp}`"
#[`column-${colProp}`]="{ row }"
>
<OperationCellRenderer
v-if="slotConfig.type === 'operation'"
:buttons="currentTabConfig?.operationButtons"
:row="row"
@operation-action="handleOperationAction"
/>
<ColumnCellRenderer
v-else
:config="slotConfig"
:value="row[colProp]"
/>
</template>
<template #empty>
<div class="empty-tip">{{ currentTabConfig?.upperTable.emptyText ?? '暂无数据' }}</div>
</template>
</UpperTable>
</div>
</template>
</div>
</transition>
</div>
</div>
</div>
<!-- ===== 功能按钮表单(pages/ 目录下的组件) ===== -->
<!-- ★ 在此添加表单弹窗组件,如:
<YourFormDialog
v-model:visible="yourFormVisible"
@success="handleFormSuccess"
/>
-->
</div>
</template>
<script setup lang="ts">
// ============================================================
// ★★★ 第一步:修改组件名 ★★★
// ============================================================
defineOptions({ name: 'DataOrderSummary' })
import { ref, computed, onMounted, reactive } from 'vue'
import { ElMessage } from 'element-plus'
import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import TabArea from './components/TabArea.vue'
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
import OperationCellRenderer from './components/OperationCellRenderer.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import {
PAGE_CONFIG,
tabPages,
resolveTabConfig,
getTabToolbarButtons,
type TabPageConfig,
type DetailTabConfig,
type ToolbarButtonConfig,
} from './config/template-config'
// ============================================================
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
)
// ============================================================
// 标签页
// ============================================================
const tabList = computed(() =>
tabPages.map((t) => ({ name: t.name, label: t.label }))
)
const activeTabName = ref(tabPages[0]?.name ?? 'tab1')
/** 当前激活标签页的完整配置 */
const currentTabConfig = computed<TabPageConfig | undefined>(() => {
const raw = tabPages.find((t) => t.name === activeTabName.value)
if (!raw) return undefined
return resolveTabConfig(raw)
})
/** 当前 ScanBox 缓存 key */
const currentScanBoxCacheKey = computed(
() => currentTabConfig.value?.scanBoxCacheKey ?? 'template-default'
)
/** 当前 ScanBox 筛选字段 */
const currentScanBoxFields = computed(
() => currentTabConfig.value?.scanBoxFields ?? []
)
/** 当前表格列 */
const currentColumns = computed(
() => currentTabConfig.value?.upperTable.columns ?? []
)
/** 当前列插槽配置 */
const currentColumnSlots = computed(
() => currentTabConfig.value?.columnSlots ?? {}
)
/** 当前明细面板配置 */
const currentDetailConfig = computed(
() => currentTabConfig.value?.detailConfig ?? []
)
/** 当前明细标签页列表 */
const currentDetailTabs = computed<DetailTabConfig[]>(
() => currentTabConfig.value?.detailTabs ?? []
)
/** 当前激活的明细标签页组件 */
const activeDetailTabComponent = computed(() => {
const tab = currentDetailTabs.value.find(
(t) => t.name === activeDetailTab.value
)
return tab?.component ?? null
})
/** 当前激活明细标签页对应的 API 方法 */
const currentDetailTabApiMethod = computed(() => {
const cfg = currentTabConfig.value
if (!cfg?.api) return undefined
const tab = currentDetailTabs.value.find((t) => t.name === activeDetailTab.value)
if (!tab) return undefined
let componentCfg: unknown
switch (tab.componentKey) {
case 'DetailPanel':
componentCfg = cfg.api.detail
break
case 'LogPanel':
componentCfg = cfg.api.log
break
default:
return undefined
}
if (typeof componentCfg === 'function') {
return componentCfg
}
return undefined
})
// ============================================================
// 工具栏按钮系统
// ============================================================
/** 当前标签页的工具栏按钮列表 */
const currentToolbarButtons = computed<OrderToolbarButtonConfig[]>(() => {
const btns = getTabToolbarButtons(activeTabName.value)
return btns.map((btn: ToolbarButtonConfig) => ({
key: btn.key,
label: btn.label,
size: btn.size,
type: btn.type,
plain: btn.plain,
loadingKey: btn.loadingKey,
disabledKey: btn.disabledKey,
action: btn.action,
dynamicLabelKey: btn.dynamicLabelKey,
buttonType: btn.buttonType,
dropdownOptions: btn.dropdownOptions
}))
})
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
noSelection: selectedRows.value.length === 0
}))
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
loading: loading.value,
exportLoading: false
}))
const buttonLabelMap = computed<Record<string, string>>(() => ({
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
}))
const toolbarLayoutKey = computed(() =>
JSON.stringify({
loading: buttonLoadingMap.value,
disabled: buttonDisabledMap.value,
labels: buttonLabelMap.value
})
)
function resolveButtonLoading(loadingKey?: string) {
if (!loadingKey) return false
return Boolean(buttonLoadingMap.value[loadingKey])
}
function resolveButtonDisabled(disabledKey?: string) {
if (!disabledKey) return false
return Boolean(buttonDisabledMap.value[disabledKey])
}
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
if (!dynamicLabelKey) return defaultLabel
return buttonLabelMap.value[dynamicLabelKey] || defaultLabel
}
// ============================================================
// 工具栏动作分发
// ============================================================
const toolbarActionMap: Record<string, () => void> = {
loadData: () => { void loadData() },
openColumnConfigPanel: () => { upperTableRef.value?.openColumnConfig?.() },
toggleDetailVisible: () => { detailVisible.value = !detailVisible.value },
handleExport: () => { console.log('[PageTemplate] 导出(不含明细)', activeTabName.value) },
handleExportItem: () => { console.log('[PageTemplate] 导出(含明细)', activeTabName.value) }
}
function handleToolbarButtonClick(action: string) {
const handler = toolbarActionMap[action]
if (handler) {
handler()
return
}
// ★ 在此添加功能按钮分发
console.warn('[PageTemplate] 未处理的工具栏动作:', action)
}
// ============================================================
// 操作列按钮事件处理
// ============================================================
async function handleOperationAction(key: string, row: Record<string, any>) {
// ★ 在此添加操作列按钮回调
console.log('[PageTemplate] 操作列按钮:', key, row)
switch (key) {
case 'viewDetail':
// 已经通过行点击处理
break
case 'edit':
ElMessage.info(`编辑「${row.name ?? row.code ?? row.id}」`)
break
default:
console.warn('[PageTemplate] 未处理的操作按钮:', key)
}
}
// ============================================================
// ★★★ 第二步:接入真实接口 ★★★
// ============================================================
const listData = ref<Record<string, any>[]>([])
const loading = ref(false)
const queryTime = ref(0)
const pagination = reactive({
currentPage: 1,
pageSize: 20,
total: 0
})
const currentSort = reactive({ prop: '', order: '' })
const loadData = async () => {
const cfg = currentTabConfig.value
if (!cfg) return
loading.value = true
const startTime = performance.now()
try {
if (cfg.api) {
// 使用真实接口
const conditions = scanBoxRef.value?.getConditions?.() || {}
const params = cfg.api.buildListParams
? cfg.api.buildListParams({
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
conditions,
sort: currentSort.prop ? { prop: currentSort.prop, order: currentSort.order } : undefined
})
: {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
where: conditions
}
const res = await cfg.api.list(params)
if (res && (res.code === 1 || res.code === 200)) {
const parsed = cfg.api.parseListResponse
? cfg.api.parseListResponse(res)
: { list: res.data?.list ?? res.list ?? [], total: res.data?.pagination?.total ?? res.total ?? 0 }
// 每日汇总等「一次返回全量」的接口:前端按分页切片
listData.value = cfg.api.clientPagination
? parsed.list.slice(
(pagination.currentPage - 1) * pagination.pageSize,
pagination.currentPage * pagination.pageSize
)
: parsed.list
pagination.total = parsed.total
} else {
throw new Error(res?.message || '接口返回异常')
}
} else {
// ★ 未配置 API 时使用模拟数据(替换为真实接口后删除)
console.log('[PageTemplate] 未配置 API,使用空数据。请在 tabPages 中配置 api 字段。')
listData.value = []
pagination.total = 0
}
} catch (e: any) {
console.error('[PageTemplate] 加载列表失败:', e)
ElMessage.error(e?.message || '获取列表数据失败')
listData.value = []
pagination.total = 0
} finally {
loading.value = false
queryTime.value = Math.round(performance.now() - startTime)
}
}
// ============================================================
// ScanBox 筛选事件
// ============================================================
const scanBoxRef = ref<any>(null)
const presetTree = ref<any[]>([])
const handleConditionChange = () => {
pagination.currentPage = 1
loadData()
}
const handleConditionReset = () => {
pagination.currentPage = 1
loadData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadData()
}
// ============================================================
// UpperTable 事件
// ============================================================
const upperTableRef = ref<any>(null)
const selectedRows = ref<Record<string, any>[]>([])
const handleSortChange = ({ prop, order }: any) => {
currentSort.prop = prop
currentSort.order = order
pagination.currentPage = 1
loadData()
}
const handlePageChange = (page: number) => {
pagination.currentPage = page
loadData()
}
const handlePageSizeChange = (size: number) => {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
const handleSelectionChange = (rows: Record<string, any>[]) => {
selectedRows.value = rows
}
// ============================================================
// 明细面板
// ============================================================
const detailVisible = ref(PAGE_CONFIG.enableDetailPanel)
const selectedRow = ref<Record<string, any> | null>(null)
const selectedDetail = ref<Record<string, any> | null>(null)
const activeDetailTab = ref('detail')
const handleRowClick = async (row: Record<string, any>) => {
if (!PAGE_CONFIG.enableDetailPanel) return
const cfg = currentTabConfig.value
if (!cfg) return
selectedRow.value = row
// 根据 DetailPanel 的 api 配置决定数据来源
const detailCfg = cfg.api?.detail
if (typeof detailCfg === 'function') {
try {
const detailRes = await detailCfg({ id: row.id, code: row.code })
if (detailRes && (detailRes.code === 1 || detailRes.code === 200)) {
selectedDetail.value = detailRes.data ?? detailRes
} else {
selectedDetail.value = { ...row }
}
} catch {
selectedDetail.value = { ...row }
}
} else {
// source='list' 或未配置:直接用行数据
selectedDetail.value = { ...row }
}
}
// ============================================================
// 标签页切换
// ============================================================
const handleTabChange = (tabName: string) => {
if (activeTabName.value === tabName) return
activeTabName.value = tabName
pagination.currentPage = 1
currentSort.prop = ''
currentSort.order = ''
selectedRow.value = null
selectedDetail.value = null
selectedRows.value = []
activeDetailTab.value = 'detail'
loadData()
}
// ============================================================
// 分栏拖拽
// ============================================================
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } =
useVerticalSplitPane({ defaultLowerPercent: 38 })
const upperPaneFullStyle = computed(() => ({
flex: '1 1 auto',
minHeight: '0',
overflow: 'hidden' as const
}))
// ============================================================
// 初始化
// ============================================================
onMounted(() => {
loadData()
})
</script>
<style lang="scss" scoped>
/* 布局样式对齐 order/orderManagement(order-sub.scss)
路径:src/views/data/ordersummary → src/views/order/orderManagement/styles */
@use "../../order/orderManagement/styles/order-sub.scss";
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px,
由各详情面板自身 padding 控制上下留白 */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
}
/* ================================================================
整体布局
================================================================ */
.page-wrapper {
position: relative;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* ================================================================
1. 顶部多标签页
================================================================ */
.tab-section {
flex-shrink: 0;
background: #fff;
border: 1px solid #e8eef7;
border-bottom: none;
border-radius: 6px 6px 0 0;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
/* ================================================================
2. 主内容区
================================================================ */
.main-container {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
background: #fff;
border: 1px solid #e8eef7;
border-radius: 0 0 6px 6px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.tab-content-inner {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
/* 分栏区域:布局样式由 order/orderManagement/styles/order-sub.scss 提供,此处仅补充模板特有规则 */
.split-stack {
:deep(.el-card__header) {
padding: 2px 12px;
font-size: 13px;
}
}
/* ================================================================
6. 过渡动画
================================================================ */
.tab-fade-enter-active,
.tab-fade-leave-active {
transition: opacity 0.2s ease;
opacity: 1;
}
.tab-fade-enter-from,
.tab-fade-leave-to {
opacity: 0;
}
/* ================================================================
7. 空状态
================================================================ */
.empty-tip {
font-size: 13px;
color: #909399;
}
</style>

View File

@ -0,0 +1,107 @@
<!--
ExampleFormDialog — 示例表单弹窗(模板)
功能按钮对应的表单组件放在 pages/ 目录下。
使用方式:
1. 在 template-config.ts 的 COMPONENT_REGISTRY 中注册
2. 在 template-config.ts 的 TOOLBAR_BUTTONS 中添加功能按钮,设置 formKey
3. index.vue 中通过工具栏按钮触发打开
-->
<template>
<el-dialog
:model-value="visible"
title="示例操作"
width="500px"
align-center
destroy-on-close
:close-on-click-modal="false"
@closed="handleClosed"
>
<div class="form-body">
<el-form ref="formRef" :model="form" label-width="100px" size="small">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input
v-model="form.description"
type="textarea"
:rows="3"
placeholder="请输入描述"
/>
</el-form-item>
</el-form>
</div>
<template #footer>
<el-button size="small" @click="handleClosed">取消</el-button>
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">
确认
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
defineOptions({ name: 'ExampleFormDialog' })
const props = defineProps<{
visible: boolean
/** 从行数据注入的初始值(由 OperationCellRenderer 的 paramMap 传递) */
id?: string | number
code?: string
name?: string
}>()
const emit = defineEmits<{
(e: 'update:visible', v: boolean): void
(e: 'success'): void
}>()
const formRef = ref<any>(null)
const submitting = ref(false)
const form = reactive({
name: '',
description: ''
})
// 重置表单
watch(() => props.visible, (v) => {
if (v) {
form.name = props.name ?? ''
form.description = ''
}
})
function handleClosed() {
emit('update:visible', false)
}
async function handleSubmit() {
submitting.value = true
try {
// ★ 替换为真实 API 调用
// const res = await yourApi.submit({ id: props.id, ...form })
await new Promise((r) => setTimeout(r, 500))
ElMessage.success('操作成功')
emit('update:visible', false)
emit('success')
} catch (e: any) {
ElMessage.error(e?.message || '操作失败')
} finally {
submitting.value = false
}
}
</script>
<style lang="scss" scoped>
.form-body {
padding: 12px 0;
}
</style>

View File

@ -75,7 +75,7 @@ export const returnReceivedTaskColumns = [
// ============================================================
export const returnReceivedTaskToolbarButtons: ToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'loadData' },
{ key: 'create', label: '新建任务', category: 'action', type: 'primary', size: 'small', loadingKey: 'createLoading', action: 'openCreateDialog' },
{ key: 'batchDelete', label: '批量删除', category: 'cancel', size: 'small', disabledKey: 'hasNoSelection', loadingKey: 'batchDeleteLoading', action: 'handleBatchDelete' },
{ key: 'columnConfig', label: '字段设置', category: 'setting', size: 'small', action: 'openColumnConfigPanel' },
{ key: 'create', label: '新建任务', category: 'action', size: 'small', loadingKey: 'createLoading', action: 'openCreateDialog' },
{ key: 'batchDelete', label: '批量删除', category: 'cancel', size: 'small', disabledKey: 'hasNoSelection', loadingKey: 'batchDeleteLoading', action: 'handleBatchDelete' },
]

View File

@ -550,7 +550,9 @@ const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
hasNoSelection: selectionRows.value.length === 0,
}))
const buttonLabelMap = computed<Record<string, string>>(() => ({}))
const buttonLabelMap = computed<Record<string, string>>(() => ({
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情',
}))
const toolbarLayoutKey = computed(() =>
JSON.stringify({
loading: buttonLoadingMap.value,
@ -576,6 +578,7 @@ const toolbarActionMap: Record<string, () => void> = {
openColumnConfigPanel: () => openColumnConfigPanel(),
handleExportSelected: () => { void handleExportSelected() },
handleExportAll: () => { void handleExportAll() },
toggleDetailVisible: () => { detailVisible.value = !detailVisible.value },
}
function openColumnConfigPanel() {
@ -596,6 +599,7 @@ const loading = ref(false)
const queryTime = ref(0)
const tableData = ref<any[]>([])
const selectionRows = ref<any[]>([])
const detailVisible = ref(true)
const currentConditions = ref<Record<string, any>>({})
const currentSort = ref<{ prop: string; order: string }>({ prop: '', order: '' })
@ -830,7 +834,6 @@ const upperPaneFullStyle = computed(() => ({
overflow: 'hidden',
}))
const detailVisible = ref(true)
const selectedRecord = ref<any>(null)
const detailLoading = ref(false)
const detailActiveTab = ref('detail')

View File

@ -124,4 +124,12 @@ export const returnUnpackToolbarButtons: ToolbarButtonConfig[] = [
],
},
{ key: 'columnConfig', label: '字段设置', category: 'setting', size: 'small', action: 'openColumnConfigPanel' },
{
key: 'toggleDetail',
label: '显示详情',
dynamicLabelKey: 'detailToggleLabel',
category: 'setting',
size: 'small',
action: 'toggleDetailVisible',
},
]

View File

@ -840,16 +840,6 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
{ label: '导出全部', action: 'handleExportAll', divided: true }
]
},
transferByWaybills: {
key: 'transferByWaybills',
label: '转入退件登记',
category: 'function',
size: 'small',
type: 'primary',
plain: true,
disabledKey: 'noSelection',
action: 'openTransferByWaybillsDialog'
},
columnConfig: {
key: 'columnConfig',
label: '字段设置',
@ -864,7 +854,17 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
dynamicLabelKey: 'detailToggleLabel',
size: 'small',
action: 'toggleDetailVisible'
}
},
transferByWaybills: {
key: 'transferByWaybills',
label: '转入退件登记',
category: 'function',
size: 'small',
type: 'primary',
plain: true,
disabledKey: 'noSelection',
action: 'openTransferByWaybillsDialog'
},
}
export function getTabToolbarButtons(tabName: string): ToolbarButtonConfig[] {

View File

@ -24,10 +24,10 @@
:value="item.id"
/>
</el-select>
<el-button size="small" type="primary" :disabled="!writable || !pendingFunctionId" @click="handleAddRow">
<el-button size="small" type="primary" plain :disabled="!writable || !pendingFunctionId" @click="handleAddRow">
添加
</el-button>
<el-button size="small" :loading="loading" @click="handleRefresh">刷新</el-button>
<el-button size="small" type="primary" :loading="loading" @click="handleRefresh">刷新</el-button>
<el-button
size="small"
type="primary"

View File

@ -34,12 +34,13 @@
<el-button
size="small"
type="primary"
plain
:disabled="!writable || !pendingGroupType || !pendingSubGroup"
@click="handleAddRow"
>
添加
</el-button>
<el-button size="small" :loading="loading" @click="handleRefresh">刷新</el-button>
<el-button size="small" type="primary" :loading="loading" @click="handleRefresh">刷新</el-button>
<el-button size="small" type="primary" :loading="saving" :disabled="!writable || !dirty" @click="handleSave">
保存白名单
</el-button>

View File

@ -7,8 +7,8 @@
</span>
</div>
<div class="ar-panel-toolbar-right">
<el-button size="small" :loading="loading" @click="loadList">刷新</el-button>
<el-button size="small" type="primary" @click="openCreate">新增关键词</el-button>
<el-button size="small" type="primary" :loading="loading" @click="loadList">刷新</el-button>
<el-button size="small" type="primary" plain @click="openCreate">新增关键词</el-button>
</div>
</div>

View File

@ -23,10 +23,10 @@
:value="item.id"
/>
</el-select>
<el-button size="small" type="primary" :disabled="!writable || !pendingRuleId" @click="handleAddRow">
<el-button size="small" type="primary" plain :disabled="!writable || !pendingRuleId" @click="handleAddRow">
添加
</el-button>
<el-button size="small" :loading="loading" @click="handleRefresh">刷新</el-button>
<el-button size="small" type="primary" :loading="loading" @click="handleRefresh">刷新</el-button>
<el-button size="small" type="primary" :loading="saving" :disabled="!writable || !dirty" @click="handleSave">
保存关联
</el-button>

View File

@ -5,7 +5,7 @@
<el-button size="small" type="primary" :loading="submitting" @click="handleSave">
保存配置
</el-button>
<el-button size="small" type="danger" :disabled="submitting" @click="handleRestore">
<el-button size="small" type="danger" plain :disabled="submitting" @click="handleRestore">
还原配置
</el-button>
</div>

View File

@ -5,8 +5,8 @@
<div class="ar-tree-header">
<span class="ar-tree-title">回信规则配置</span>
<div class="ar-tree-actions">
<el-button size="small" type="primary" @click="openTypeCreate">新增类型</el-button>
<el-button size="small" :loading="treeLoading" @click="handleTreeRefresh">刷新</el-button>
<el-button size="small" type="primary" plain @click="openTypeCreate">新增类型</el-button>
<el-button size="small" type="primary" :loading="treeLoading" @click="handleTreeRefresh">刷新</el-button>
</div>
</div>
@ -68,6 +68,7 @@
<el-button
size="small"
type="danger"
plain
:disabled="isTypeReadOnly"
@click="handleDeleteType"
>
@ -115,7 +116,7 @@
</span>
</span>
<div class="ar-block-actions">
<el-button size="small" type="primary" @click="openSubTypeCreate">
<el-button size="small" type="primary" plain @click="openSubTypeCreate">
新增子类型
</el-button>
</div>
@ -204,6 +205,7 @@
<el-button
size="small"
type="danger"
plain
:disabled="isSubTypeReadOnly"
@click="handleDeleteSubType(currentSubType)"
>

View File

@ -73,5 +73,5 @@ export const groupColumns = [
// ============================================================
export const groupToolbarButtons: ToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'loadData' },
{ key: 'showBindDialog', label: '生成绑群码', category: 'action', size: 'small', type: 'primary', action: 'showBindDialog' },
{ key: 'showBindDialog', label: '生成绑群码', category: 'action', size: 'small', action: 'showBindDialog' },
]

View File

@ -23,12 +23,12 @@
:layout-key="toolbarLayoutKey"
@action="handleToolbarButtonClick"
/>
<template v-if="statsData">
<div v-if="statsData" class="toolbar-stats">
<!-- <el-divider direction="vertical" /> -->
<el-tag size="small" type="primary">收件 {{ statsInbound }} | 回信 {{ statsOutbound }}</el-tag>
<el-tag size="small" type="success">24h 新增 {{ statsData.recent_24h_count ?? 0 }}</el-tag>
<el-tag v-for="s in statsStatusTags" :key="s.status" size="small" :type="s.type">{{ s.label }} {{ s.count }}</el-tag>
</template>
</div>
</div>
</div>
@ -590,6 +590,16 @@ onMounted(() => {
<style scoped lang="scss">
@use "../../order/orderManagement/styles/order-sub.scss";
/* 工具栏右侧统计标签:与左侧按钮组垂直居中(toolbar-left 默认 align-items:flex-start) */
.toolbar-stats {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
align-self: center;
min-width: 0;
}
.wave-operation-actions {
display: flex;
align-items: center;

View File

@ -1,22 +1,14 @@
<template>
<el-dialog
v-model="visible"
title="建单"
class="create-order-dialog"
width="92%"
align-center
append-to-body
:close-on-click-modal="false"
:before-close="handleBeforeClose"
>
<template #header>
<div class="create-order-dialog-header">
<span class="create-order-dialog-title">建单</span>
<div class="create-order-dialog-actions">
<!-- <el-button link type="primary" @click="handleMinimize">
收起后台
</el-button> -->
</div>
</div>
</template>
<!-- <el-alert
type="info"
:closable="false"
@ -25,6 +17,7 @@
title="支持 Excel 导入或手动添加明细。点击「添加商品」选择订单商品;勾选左侧订单行后,在右侧粘贴地址进行智能识别(仅填充已勾选行);相同订单号多行合并为一个订单,头信息取首行;省份、城市、区/县为必填项。"
/> -->
<div class="create-order-form-body">
<div class="batch-import-toolbar">
<input
ref="importFileInputRef"
@ -33,11 +26,14 @@
style="display: none"
@change="handleImportFileChange"
/>
<el-button size="small" @click="triggerImportFileSelect">选择Excel</el-button>
<el-button size="small" :loading="downloadTemplateLoading" @click="handleDownloadCreateTemplate">下载模板</el-button>
<el-button size="small" :disabled="parseImportFileLoading" @click="addImportPreviewRow()">添加明细</el-button>
<div class="import-actions">
<el-button size="small" type="primary" plain @click="triggerImportFileSelect">选择Excel</el-button>
<el-button size="small" type="primary" plain :loading="downloadTemplateLoading" @click="handleDownloadCreateTemplate">下载模板</el-button>
<el-button size="small" type="primary" plain :disabled="parseImportFileLoading" @click="addImportPreviewRow()">添加明细</el-button>
<el-button
size="small"
type="primary"
plain
:loading="checkDeliveryCodeLoading"
:disabled="!importPreviewRows.length || parseImportFileLoading || importOrderLoading || reRecognizeAddressLoading"
@click="handleCheckDeliveryOrderCodes"
@ -46,29 +42,25 @@
</el-button>
<el-button
size="small"
type="primary"
plain
:loading="reRecognizeAddressLoading"
:disabled="!importPreviewRows.length || parseImportFileLoading || importOrderLoading || checkDeliveryCodeLoading"
@click="handleReRecognizeAddresses"
>
地址重识
</el-button>
<el-button size="small" @click="clearImportData">清除数据</el-button>
<el-button size="small" type="primary" plain @click="clearImportData">清除数据</el-button>
<el-button
size="small"
type="danger"
type="primary"
plain
:disabled="!selectedPreviewRowCount"
@click="removeSelectedPreviewRows"
>
删除选中{{ selectedPreviewRowCount ? `(${selectedPreviewRowCount})` : '' }}
</el-button>
<el-button
size="small"
:loading="exportSelectedLoading"
:disabled="!selectedPreviewRowCount"
@click="handleExportSelectedPreviewRows"
>
导出选中{{ selectedPreviewRowCount ? `(${selectedPreviewRowCount})` : '' }}
导出选中
</el-button>
<el-button
size="small"
@ -79,6 +71,18 @@
>
确认创建
</el-button>
<el-button
size="small"
type="danger"
plain
:disabled="!selectedPreviewRowCount"
@click="removeSelectedPreviewRows"
>
删除选中
</el-button>
</div>
<div class="import-options">
<el-select
v-model="defaultStoreId"
filterable
@ -110,6 +114,7 @@
/>
</el-select>
<span class="picker-hint">已选文件:{{ importOrderFileName || '未选择' }}</span>
</div>
</div>
<div class="create-order-body">
@ -124,6 +129,7 @@
:loading="parseImportFileLoading"
:pagination="previewPagination"
:page-sizes="[50, 100, 200, 500]"
:show-pagination="false"
:columns="importPreviewColumns"
row-key="_rowKey"
:current-row-key="activePreviewRowKey"
@ -369,7 +375,7 @@
:disabled="isPreviewRowLocked(row)"
@click.stop="openSelectProductDialog(row)"
>
添加商品{{ row.selected_items.length ? `(${row.selected_items.length})` : '' }}
添加商品
</el-button>
</div>
</template>
@ -426,6 +432,8 @@
</el-button>
<el-button
size="small"
type="primary"
plain
:loading="parseAddressLoading"
:disabled="!selectedPreviewRowsForAddress.length || !addressPasteText.trim()"
@click="handleParseAddress"
@ -434,6 +442,8 @@
</el-button>
<el-button
size="small"
type="primary"
plain
:disabled="!addressPasteText.trim()"
@click="addressPasteText = ''"
>
@ -443,6 +453,29 @@
</div>
</div>
<!-- 底栏:分页器右对齐到表格右边,操作按钮在右栏下方 -->
<div class="create-order-bottom-bar">
<div class="create-order-bottom-left">
<span class="create-order-selected-info">已选 {{ selectedPreviewRowCount }} 条</span>
<el-pagination
:current-page="previewPagination.currentPage"
:page-size="previewPagination.pageSize"
:page-sizes="[50, 100, 200, 500]"
:total="previewPagination.total"
layout="total, sizes, prev, pager, next, jumper"
background
size="small"
@current-change="handlePreviewPageChange"
@size-change="handlePreviewPageSizeChange"
/>
</div>
<div class="create-order-dialog-footer">
<el-button size="small" @click="handleMinimize">收起后台</el-button>
<el-button size="small" @click="handleCloseSession">关闭并清空</el-button>
</div>
</div>
</div>
<SelectProductDialog
v-model="selectProductDialogVisible"
:store-id="selectProductTargetRow?.store_id"
@ -462,10 +495,6 @@
<template v-else>请选择 Excel 或点击「添加明细」录入订单数据</template>
</div> -->
<template #footer>
<el-button size="small" @click="handleMinimize">收起后台</el-button>
<el-button size="small" @click="handleCloseSession">关闭并清空</el-button>
</template>
</el-dialog>
</template>
@ -2528,23 +2557,9 @@ async function handleParseAddress() {
</script>
<style scoped lang="scss">
.create-order-dialog-header {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 28px;
}
.create-order-dialog-title {
font-size: 16px;
font-weight: 600;
color: #303133;
}
.create-order-dialog-actions {
display: flex;
align-items: center;
gap: 8px;
/* 内容区:对齐「新增投递计划」表单的 .form-body 内边距(顶部压缩,减少空白) */
.create-order-form-body {
padding: 4px 4px 0 0;
}
.import-order-tip {
@ -2556,9 +2571,85 @@ async function handleParseAddress() {
.batch-import-toolbar {
display: flex;
align-items: center;
gap: 10px;
justify-content: space-between;
gap: 6px 12px;
flex-wrap: wrap;
margin-bottom: 10px;
margin-bottom: 6px;
/* 间距只由 gap 控制(对齐 toolbar 的 6px),清掉 EP 默认按钮左边距 */
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
.import-actions {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.import-options {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
margin-left: auto;
}
/* 禁用态对齐订单列表工具栏(OrderToolbarButtonGroup):
默认按钮 → 灰字浅灰底;primary 实心 → 浅蓝底蓝字;
primary plain → 白底蓝字蓝边;danger plain → 白底红字红边 */
.batch-import-toolbar,
.address-panel-actions {
:deep(.el-button.is-disabled),
:deep(.el-button.is-disabled:hover),
:deep(.el-button.is-disabled:focus),
:deep(.el-button.is-disabled:active) {
color: #606266;
background-color: #fafbfc;
border-color: #ebeef5;
}
:deep(.el-button--primary.is-disabled),
:deep(.el-button--primary.is-disabled:hover),
:deep(.el-button--primary.is-disabled:focus),
:deep(.el-button--primary.is-disabled:active) {
color: #409eff;
background-color: #f5faff;
border-color: #e4efff;
}
:deep(.el-button--primary.is-plain.is-disabled),
:deep(.el-button--primary.is-plain.is-disabled:hover),
:deep(.el-button--primary.is-plain.is-disabled:focus),
:deep(.el-button--primary.is-plain.is-disabled:active) {
color: #409eff;
background-color: #fff;
border-color: #409eff;
}
:deep(.el-button--danger.is-plain.is-disabled),
:deep(.el-button--danger.is-plain.is-disabled:hover),
:deep(.el-button--danger.is-plain.is-disabled:focus),
:deep(.el-button--danger.is-plain.is-disabled:active) {
color: #f56c6c;
background-color: #fff;
border-color: #f56c6c;
}
}
/* 「识别建单」虽是实心主按钮,禁用态也统一为白底 + 蓝边 + 蓝字(与动作类按钮一致) */
.address-panel-actions {
:deep(.el-button--primary.is-disabled:not(.is-plain)),
:deep(.el-button--primary.is-disabled:not(.is-plain):hover),
:deep(.el-button--primary.is-disabled:not(.is-plain):focus),
:deep(.el-button--primary.is-disabled:not(.is-plain):active) {
color: #409eff;
background-color: #fff;
border-color: #409eff;
}
}
.import-default-store {
@ -2626,8 +2717,9 @@ async function handleParseAddress() {
.create-order-body {
display: flex;
gap: 12px;
height: 520px;
min-height: 420px;
/* 随视口自适应,避免小屏幕下弹窗溢出 */
height: min(520px, calc(100vh - 320px));
min-height: 360px;
}
.create-order-left {
@ -2658,7 +2750,7 @@ async function handleParseAddress() {
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 10px;
background: #fafafa;
background: #fff;
}
.address-panel-header {
@ -2669,12 +2761,15 @@ async function handleParseAddress() {
font-size: 14px;
font-weight: 600;
color: #303133;
line-height: 1.4;
padding-left: 8px;
border-left: 3px solid #409eff;
}
.address-panel-meta {
margin-top: 4px;
margin-top: 6px;
font-size: 12px;
color: #606266;
color: #909399;
line-height: 1.5;
}
@ -2683,20 +2778,73 @@ async function handleParseAddress() {
}
.address-paste-input {
flex: 1 1 auto;
flex: 0 0 auto;
width: 100%;
}
.address-panel-actions {
display: flex;
gap: 8px;
gap: 6px;
margin-top: 10px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
.address-panel-hint {
margin-top: 12px;
/* 底部栏:分页器右对齐到左侧表格右边缘,操作按钮占右侧 360px(与右栏同宽) */
.create-order-bottom-bar {
display: flex;
align-items: center;
gap: 12px;
margin-top: 6px;
flex-wrap: wrap;
min-height: 24px;
/* 压缩分页器高度并垂直居中 */
:deep(.el-pagination) {
height: 24px;
line-height: 24px;
align-items: center;
}
:deep(.el-select--small) {
width: 90px;
}
}
.create-order-bottom-left {
flex: 1 1 auto;
min-width: 0;
height: 24px;
display: flex;
align-items: center;
justify-content: space-between;
}
.create-order-selected-info {
font-size: 12px;
color: #909399;
line-height: 1.6;
color: #606266;
white-space: nowrap;
}
.create-order-bottom-left :deep(.el-pagination) {
display: inline-flex;
align-items: center;
}
.create-order-dialog-footer {
flex: 0 0 360px;
width: 360px;
display: flex;
justify-content: flex-end;
gap: 6px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
.batch-import-summary {
@ -2706,3 +2854,14 @@ async function handleParseAddress() {
line-height: 1.6;
}
</style>
<style lang="scss">
/* 建单弹窗:el-dialog 被 teleport,scoped 样式够不到,用专用类名压缩标题栏留白 */
.create-order-dialog {
--el-dialog-padding-primary: 12px;
.el-dialog__header {
padding-bottom: 8px;
}
}
</style>

View File

@ -1477,34 +1477,9 @@ export const placeOrderTimeRangeScanField = scanBasicField({ label: '下单时
/** ScanBox:复核时间(订单表 recheck_time),区间查询输出 { operator: 'between', type: 'datetimerange', value: [start, end] } */
export const recheckTimeRangeScanField = scanBasicField({ label: '复核时间', value: 'recheck_time', type: 'datetimerange' })
/**
* 「下单时间 / 创建时间 / 复核时间」时间查询模式(value = 订单表真实列名)。
* 对应 order.*.list 的 where 条件键(统一 where 无字段白名单,可直接传订单表列名)。
*/
export const ORDER_TIME_MODE_OPTIONS = [
{ label: '下单时间', value: 'place_order_time' },
{ label: '创建时间', value: 'create_at' },
{ label: '复核时间', value: 'recheck_time' }
]
/**
* ScanBox:时间查询模式字段(modetimerange)。
* 把「下单时间 / 创建时间 / 复核时间」等多个时间区间筛选项合并为一个控件:
* 先选查询模式(options 的 value 即真实表字段名),再设置时间范围;
* 提交时按所选模式输出 where,如 { place_order_time: { operator: 'between', value: [start, end] } }。
*/
export function createOrderTimeRangeScanField(
modes: Array<{ label: string; value: string }> = ORDER_TIME_MODE_OPTIONS
) {
return scanBasicField({
label: '时间',
value: '__order_time_range__',
type: 'modetimerange',
placeholder: '请选择查询模式',
options: modes,
defaultMode: modes[0]?.value
})
}
// 注:时间筛选项不再手工拼「查询模式」控件。各页只需在 availableFields 中声明自己的时间字段
// (如 place_order_time / create_at / recheck_time / pay_time / delivery_time),
// ScanBox 会自动把它们合并成一个「时间」控件,下拉选项 = 本页声明的时间字段。
export const isUrgencyScanField = scanBasicField({ label: '是否紧急', value: 'is_urgency', type: 'select', options: isUrgencyFilterOptions })
export const buyerMessageHasScanField = scanBasicField({ label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions })
@ -1744,9 +1719,10 @@ export const deliveryAvailableFields = [
{ ...receiverMobileScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
// 时间
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
// 时间:下单时间/创建时间/复核时间/支付时间/配送时间,由 ScanBox 自动合并为「时间」控件(下拉选项 = 此处字段)
{ ...placeOrderTimeRangeScanField, group: SCAN_TIME_GROUP },
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
{ ...payTimeRangeScanField, group: SCAN_TIME_GROUP },
{ ...deliveryTimeRangeScanField, group: SCAN_TIME_GROUP },
]
@ -1937,8 +1913,10 @@ export const reviewAvailableFields = [
{ ...receiverMobileScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
// 时间:下单时间/创建时间/复核时间,由 ScanBox 自动合并为「时间」控件
{ ...placeOrderTimeRangeScanField, group: SCAN_TIME_GROUP },
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
]
export const reviewColums = applyOrderListCopyActions([
@ -2117,8 +2095,10 @@ export const pendingAvailableFields = [
{ ...receiverAreaScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
// 时间:下单时间/创建时间/复核时间,由 ScanBox 自动合并为「时间」控件
{ ...placeOrderTimeRangeScanField, group: SCAN_TIME_GROUP },
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
]
export const pendingCloums = [
@ -2509,8 +2489,10 @@ export const expectionOrderAvailableFields = [
// 收货信息
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
// 时间:下单时间/创建时间/复核时间,由 ScanBox 自动合并为「时间」控件
{ ...placeOrderTimeRangeScanField, group: SCAN_TIME_GROUP },
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
]
export const expectionColumns = [
@ -2632,8 +2614,10 @@ export const archiveAvailableFields = [
{ ...receiverMobileScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
// 时间:下单时间/创建时间/复核时间,由 ScanBox 自动合并为「时间」控件
{ ...placeOrderTimeRangeScanField, group: SCAN_TIME_GROUP },
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
]
export const archiveColumns = applyOrderListCopyActions([

View File

@ -497,6 +497,30 @@ function buildPickTaskScanFilters(rawConditions: Record<string, any>) {
return out
}
/**
* 时间查询模式 → wavePickTaskList 顶层时间参数前缀。
* 模式值 = 页面 `pickTaskWaveAvailableFields` 中时间字段的 value;
* ScanBox 会把页面时间字段自动合并为「时间」控件,新增时间字段时在此登记映射即可。
*/
const PICK_TASK_TIME_FILTER_PREFIXES = ['start_time', 'finish_time', 'create_time'] as const
type PickTaskTimeFilterPrefix = (typeof PICK_TASK_TIME_FILTER_PREFIXES)[number]
/**
* 解析 ScanBox「时间」合并筛选(modetimerange)当前选中的模式与时间范围。
* 条件键 = 所选模式(start_time / finish_time / create_time)。
*/
function resolvePickTaskTimeRange(
flat: Record<string, any>
): { mode: PickTaskTimeFilterPrefix; range: [string, string] } | null {
for (const mode of PICK_TASK_TIME_FILTER_PREFIXES) {
const range = flat[mode]
if (Array.isArray(range) && range.length >= 2 && range[0] && range[1]) {
return { mode, range: [String(range[0]), String(range[1])] }
}
}
return null
}
/** 兼容 ScanBox 多种返回形态,按候选键提取首个有效值 */
function resolveScanFilterValue(
flat: Record<string, any>,
@ -918,7 +942,11 @@ async function loadData() {
const pickUserId = toIdFilterValue(resolveScanFilterValue(flat, ['pick_user_id', 'picker_id'], rawConditions))
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 timeRange = resolvePickTaskTimeRange(flat)
const timeMode = timeRange?.mode
const timeStart = timeRange?.range[0]
const timeEnd = timeRange?.range[1]
/** 顶层文本筛选(波次号/车编码/拣货人/领料人/复核人):文档只支持 like/notlike/eq,脏缓存回退 like */
const pickUserNameOp = resolvePickTaskTextOperator(rawConditions, 'pick_user_name')
const claimOperatorNameOp = resolvePickTaskTextOperator(rawConditions, 'claim_operator')
@ -959,8 +987,12 @@ async function loadData() {
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,
start_time_start: timeMode === 'start_time' ? timeStart : undefined,
start_time_end: timeMode === 'start_time' ? timeEnd : undefined,
finish_time_start: timeMode === 'finish_time' ? timeStart : undefined,
finish_time_end: timeMode === 'finish_time' ? timeEnd : undefined,
create_time_start: timeMode === 'create_time' ? timeStart : undefined,
create_time_end: timeMode === 'create_time' ? timeEnd : undefined,
sort
})

View File

@ -1202,6 +1202,8 @@ export const pickTaskStatusFilterOptions = [
* 文档支持: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)。
* 时间筛选:本页只声明「开始时间」(start_time) 一个时间字段,ScanBox 合并控件下拉即只有这一项,
* 面板将其映射为顶层 start_time_start/end。若后续新增时间字段(如 finish_time),需同步在面板补充参数映射。
* 注意:where 仅兼容历史结构且会校验白名单(如 operator_name 会被拒绝),故不再放置筛选字段。
*/
export const pickTaskWaveAvailableFields = [
@ -1220,7 +1222,9 @@ export const pickTaskWaveAvailableFields = [
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 会自动把本页所有 daterange/datetimerange 合并为「时间」控件,
// 下拉选项 = 这里声明的时间字段(当前只有「开始时间」,新增独有时间项时在此追加一行即可)
pickTaskScanBasicField({ label: '开始时间', value: 'start_time', type: 'datetimerange' }),
// ===== 流程状态(合并为一组,对齐波次列表 ScanBox) =====
{ ...scanWorkflowField({

View File

@ -76,12 +76,12 @@ export const comboGoodsColumns = [
/**
* 组合商品列表主工具栏按钮
* 样式 / 顺序对齐「商品明细」(stock/stock 的 stockToolbarButtons):
* 刷新(primary)→ 字段设置(default)→ 新增组合商品(primary)→ 快速搜索(primary + plain)
* 刷新(primary)→ 字段设置(default)→ 新增组合商品(primary + plain)→ 快速搜索(primary + plain)
*/
export const comboGoodsToolbarButtons: ToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', type: 'primary', size: 'small', loadingKey: 'loading', action: 'loadList' },
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
{ key: 'create', label: '新增组合商品', type: 'primary', size: 'small', action: 'openCreate' },
{ key: 'create', label: '新增组合商品', type: 'primary', plain: true, size: 'small', action: 'openCreate' },
{ key: 'quickSearch', label: '快速搜索', type: 'primary', plain: true, size: 'small', action: 'openSearchDialog' }
]

View File

@ -29,9 +29,10 @@
<el-dropdown
v-if="hasPermission('stock.warehouse.saveWarehouseStock')"
:disabled="!hasSelection"
@command="handleBatchChange"
>
<el-button type="primary" :disabled="!hasSelection" size="small">
<el-button class="batch-change-btn" type="primary" plain :disabled="!hasSelection" size="small">
批量修改<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
@ -53,9 +54,9 @@
<div class="toolbar-right">
<el-button
v-if="hasPermission('warehouseRecycle')"
type="warning"
type="primary"
plain
size="small"
:icon="DeleteFilled"
@click="handleRecycleBin"
title="回收站"
>
@ -242,7 +243,7 @@
import { ref, reactive, computed, onMounted, shallowRef, markRaw } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
DeleteFilled, ArrowDown, User
ArrowDown, User
} from '@element-plus/icons-vue'
// Components
@ -856,6 +857,16 @@ const loadStockUnits = async () => {
overflow: auto;
}
/* 批量修改(不在按钮组内):禁用态对齐团购波次「批量发货」——白底蓝字 */
:deep(.batch-change-btn.is-disabled),
:deep(.batch-change-btn.is-disabled:hover),
:deep(.batch-change-btn.is-disabled:focus),
:deep(.batch-change-btn.is-disabled:active) {
color: #409eff;
background-color: #fff;
border-color: #409eff;
}
.empty-tip {
text-align: center;
font-size: 13px;

View File

@ -609,23 +609,6 @@ export type StockToolbarButtonConfig = ToolbarButtonConfig & {
export const stockToolbarButtons: StockToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', type: 'primary', size: 'small', loadingKey: 'loading', action: 'loadData' },
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
{
key: 'toggleDetail',
label: '显示详情',
dynamicLabelKey: 'detailToggleLabel',
size: 'small',
action: 'toggleDetailVisible'
},
{
key: 'add',
label: '添加',
type: 'primary',
size: 'small',
permissionKey: 'stock.warehouse.saveWarehouseStock',
action: 'handleAdd'
},
{ key: 'import', label: '导入', type: 'primary', plain: true, size: 'small', action: 'openImportDialog' },
{
key: 'export',
label: '导出',
@ -639,10 +622,29 @@ export const stockToolbarButtons: StockToolbarButtonConfig[] = [
{ label: '导出全部', action: 'handleExportAll', divided: true }
]
},
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
{
key: 'toggleDetail',
label: '显示详情',
dynamicLabelKey: 'detailToggleLabel',
size: 'small',
action: 'toggleDetailVisible'
},
{
key: 'add',
label: '添加',
type: 'primary',
plain: true,
size: 'small',
permissionKey: 'stock.warehouse.saveWarehouseStock',
action: 'handleAdd'
},
{ key: 'import', label: '导入', type: 'primary', plain: true, size: 'small', action: 'openImportDialog' },
{
key: 'batchDelete',
label: '批量删除',
type: 'danger',
plain: true,
size: 'small',
permissionKey: 'stock.warehouse.saveWarehouseStock',
disabledKey: 'hasNoSelection',

View File

@ -209,76 +209,72 @@
</template>
</el-dialog>
<div ref="tableWrapRef" class="detail-table-wrap">
<el-table
<upper-table
ref="detailTableRef"
table-id="inventory-stock-detail"
:data="pagedDetailList"
border
stripe
size="small"
v-loading="loading"
:height="tableHeight"
:row-key="(row: any) => row.storage_id ?? `${row.space_id}-${row.stock_id}`"
:columns="detailColumns"
:row-key="detailRowKey"
table-size="small"
default-align="center"
:loading="loading"
:show-selection="true"
:virtual-threshold="100000"
:pagination="tablePagination"
:page-sizes="[10, 20, 50, 100]"
@selection-change="handleDetailSelectionChange"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
>
<el-table-column type="selection" width="40" />
<el-table-column
v-for="col in detailColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
show-overflow-tooltip
>
<!-- 生产日期 / 到期日期:单元格可直接点击打开维护弹窗并展开对应日历 -->
<template v-if="isExpiryDateColumn(col.prop)" #default="{ row }">
<el-link
v-if="getRowStorageId(row)"
type="primary"
:underline="false"
:title="`点击快捷维护${col.label}`"
@click.stop="openExpiryDialog(row, col.prop === 'production_date' ? 'production' : 'expiry')"
>
{{ row[col.prop] || '--' }}
</el-link>
<span v-else>{{ row[col.prop] || '--' }}</span>
</template>
<!-- 生产日期:单元格可直接点击打开维护弹窗并展开对应日历 -->
<template #column-production_date="{ row }">
<el-link
v-if="getRowStorageId(row)"
type="primary"
:underline="false"
title="点击快捷维护生产日期"
@click.stop="openExpiryDialog(row, 'production')"
>
{{ row.production_date || '--' }}
</el-link>
<span v-else>{{ row.production_date || '--' }}</span>
</template>
<!-- 到期日期:同上 -->
<template #column-expiry_date="{ row }">
<el-link
v-if="getRowStorageId(row)"
type="primary"
:underline="false"
title="点击快捷维护到期日期"
@click.stop="openExpiryDialog(row, 'expiry')"
>
{{ row.expiry_date || '--' }}
</el-link>
<span v-else>{{ row.expiry_date || '--' }}</span>
</template>
<!-- 总数量:默认遮挡具体数值,点右上「显示数量」可查看 -->
<template v-else-if="col.prop === 'quantity'" #default="{ row }">
<span>{{ quantityVisible ? (row[col.prop] ?? '--') : QUANTITY_MASK }}</span>
</template>
</el-table-column>
<!-- 总数量:默认遮挡具体数值,点右上「显示数量」可查看 -->
<template #column-quantity="{ row }">
<span>{{ quantityVisible ? (row.quantity ?? '--') : QUANTITY_MASK }}</span>
</template>
<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>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
import { computed, nextTick, reactive, ref, watch } from 'vue'
import * as inventoryApi from '@/api/storage.inventory/inventory'
import type { InventoryUpdateExpiryParams } from '@/api/storage.inventory/inventory'
import * as warehouseApi from '@/api/warehouse/warehouse'
import * as indexApi from '@/api/index/index'
import { ElMessage } from 'element-plus'
import UpperTable from '@/components/UpperTable/index.vue'
import { formatInventorySpaceLabel } from '../inventory-config'
type TransferMode = 'location' | 'product'
@ -313,7 +309,7 @@ const pagedDetailList = computed(() => {
/** 切页后把表格滚动位置归零 */
function resetTableScroll() {
nextTick(() => {
detailTableRef.value?.setScrollTop?.(0)
detailTableRef.value?.getTableRef?.()?.setScrollTop?.(0)
})
}
@ -327,8 +323,18 @@ function handlePageSizeChange(pageSize: number) {
pagination.page = 1
resetTableScroll()
}
const tableHeight = ref<number | undefined>(undefined)
let tableResizeObserver: ResizeObserver | null = null
/** UpperTable 分页入参(数据仍由前端切片) */
const tablePagination = computed(() => ({
currentPage: pagination.page,
pageSize: pagination.pageSize,
total: pagination.total
}))
/** 行唯一键:库存记录 ID 优先,汇总视图按库位+商品 */
function detailRowKey(row: any) {
return row?.storage_id ?? `${row?.space_id}-${row?.stock_id}`
}
const dialogVisible = ref(false)
const transferMode = ref<TransferMode | null>(null)
const targetSpace = ref<string | number>('')
@ -354,31 +360,32 @@ function handleDetailSelectionChange(rows: any[]) {
}
const detailColumns = computed(() => {
if (isSpaceView.value) {
return [
{ prop: 'space_code', label: '库位', width: '160' },
{ prop: 'physical_quantity', label: '实物数', width: '100' },
{ prop: 'quantity', label: '总数量', width: '100' },
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' },
{ prop: 'batch_count', label: '批次数', width: '80' },
{ prop: 'first_inbound_time', label: '首次入库时间', width: '160' },
{ prop: 'last_inbound_time', label: '最后入库时间', width: '160' }
]
}
return [
{ prop: 'storage_id', label: '库存记录ID', width: '110' },
{ prop: 'stock_id', label: '商品ID', width: '100' },
{ prop: 'item_code', label: '商品编码', width: '140' },
{ prop: 'item_name', label: '商品名称', width: '200' },
{ prop: 'batch_no', label: '批次号', width: '140' },
{ prop: 'space_code', label: '库位', width: '140' },
{ prop: 'production_date', label: '生产日期', width: '140' },
{ prop: 'expiry_date', label: '到期日期', width: '140' },
{ prop: 'quantity', label: '总数量', width: '100' },
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' }
]
const cols = isSpaceView.value
? [
{ prop: 'space_code', label: '库位', width: '160' },
{ prop: 'physical_quantity', label: '实物数', width: '100' },
{ prop: 'quantity', label: '总数量', width: '100' },
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' },
{ prop: 'batch_count', label: '批次数', width: '80' },
{ prop: 'first_inbound_time', label: '首次入库时间', width: '160' },
{ prop: 'last_inbound_time', label: '最后入库时间', width: '160' }
]
: [
{ prop: 'storage_id', label: '库存记录ID', width: '110' },
{ prop: 'stock_id', label: '商品ID', width: '100' },
{ prop: 'item_code', label: '商品编码', width: '140' },
{ prop: 'item_name', label: '商品名称', width: '200' },
{ prop: 'batch_no', label: '批次号', width: '140' },
{ prop: 'space_code', label: '库位', width: '140' },
{ prop: 'production_date', label: '生产日期', width: '140' },
{ prop: 'expiry_date', label: '到期日期', width: '140' },
{ prop: 'quantity', label: '总数量', width: '100' },
{ prop: 'available_quantity', label: '可用数量', width: '100' },
{ prop: 'locked_quantity', label: '锁定数量', width: '100' }
]
// UpperTable 默认不开启溢出 tooltip,这里保持与旧 el-table 一致
return cols.map((col) => ({ ...col, showOverflowTooltip: true }))
})
/** 「总数量」数值是否可见:默认隐藏(只隐藏数值,列仍在;不影响数据与移库/维护日期逻辑) */
@ -688,13 +695,6 @@ function getRowStorageId(row: any): number | null {
return Number.isFinite(id) && id > 0 ? id : null
}
/** 可点击快捷维护的日期列(与明细表列配置中的 prop 对应) */
const EXPIRY_DATE_COLUMN_PROPS = ['production_date', 'expiry_date']
function isExpiryDateColumn(prop: string): boolean {
return EXPIRY_DATE_COLUMN_PROPS.includes(prop)
}
/** 是否可维护日期:需要有一条含库存记录 ID 的库存明细行 */
const canEditExpiry = computed(() => getRowStorageId(activeRow.value) !== null)
@ -867,25 +867,6 @@ watch(detailViewMode, () => {
watch(() => [props.id, props.row, props.groupByBatch], loadData, { immediate: true })
onMounted(() => {
const updateTableHeight = () => {
const el = tableWrapRef.value
if (!el) return
const h = el.clientHeight
if (h > 0) tableHeight.value = h
}
updateTableHeight()
if (typeof ResizeObserver !== 'undefined') {
tableResizeObserver = new ResizeObserver(updateTableHeight)
if (tableWrapRef.value) tableResizeObserver.observe(tableWrapRef.value)
}
})
onBeforeUnmount(() => {
tableResizeObserver?.disconnect()
tableResizeObserver = null
})
watch(targetSpace, (val) => {
if (spaceInfoTimer) clearTimeout(spaceInfoTimer)
spaceName.value = ''
@ -965,6 +946,16 @@ watch(targetSpace, (val) => {
margin-left: 0;
margin-right: 0;
}
/* primary plain 禁用:白底 + 蓝边 + 蓝字(对齐工具栏既有规则) */
:deep(.el-button--primary.is-plain.is-disabled),
:deep(.el-button--primary.is-plain.is-disabled:hover),
:deep(.el-button--primary.is-plain.is-disabled:focus),
:deep(.el-button--primary.is-plain.is-disabled:active) {
color: #409eff;
background-color: #fff;
border-color: #409eff;
}
}
.right-actions {
@ -979,23 +970,6 @@ watch(targetSpace, (val) => {
overflow: hidden;
}
.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;
}
}
.empty-tip {
color: #909399;
font-size: 13px;

View File

@ -223,7 +223,7 @@ const {
beginSplitDrag,
lowerPaneStyle,
upperPaneStyle
} = useVerticalSplitPane({ defaultLowerPercent: 55 })
} = useVerticalSplitPane({ defaultLowerPercent: 40 })
const upperPaneFullStyle = computed(() => ({
flex: '1 1 auto',

View File

@ -83,7 +83,6 @@ export const columns = [
/** 商品流水主工具栏按钮 */
export const productflowToolbarButtons: ToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', type: 'primary', size: 'small', loadingKey: 'loading', action: 'loadList' },
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
{
key: 'export',
label: '导出',
@ -95,6 +94,7 @@ export const productflowToolbarButtons: ToolbarButtonConfig[] = [
{ label: '导出选中', action: 'handleExportSelected', divided: true }
]
},
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
{
key: 'toggleDetail',
label: '显示详情',

View File

@ -3,7 +3,7 @@
<div class="header-actions">
<div class="left-actions">
<el-button size="small" type="primary" @click="loadProductData">刷新</el-button>
<el-button size="small" @click="openBatchImportDialog">批量导入商品</el-button>
<el-button size="small" type="primary" plain @click="openBatchImportDialog">批量导入商品</el-button>
<el-button size="small" type="primary" plain @click="openAddItemDialog">新增商品</el-button>
<el-button
@ -17,16 +17,14 @@
批量删除
</el-button>
<!-- <el-button size="small" disabled>导出</el-button> -->
</div>
<div class="right-actions">
<el-radio-group v-model="matchFilter" size="small" class="match-filter-group">
<el-radio-button value="all">全部</el-radio-button>
<el-radio-button value="matched">已匹配</el-radio-button>
<el-radio-button value="unmatched">未匹配</el-radio-button>
</el-radio-group>
<!-- <el-button size="small" disabled>导出</el-button> -->
</div>
<div class="right-actions">
<!-- 可以在这里添加搜索框或其他操作 -->
</div>
</div>
@ -2731,7 +2729,7 @@ onUnmounted(() => {
}
.match-filter-group {
margin: 0 8px;
margin: 0;
}
.required-mark {
@ -2959,6 +2957,23 @@ onUnmounted(() => {
margin-left: 0;
margin-right: 0;
}
/* danger 禁用:白底红字(对齐工具栏按钮组规则) */
:deep(.el-button--danger.is-plain.is-disabled),
:deep(.el-button--danger.is-plain.is-disabled:hover),
:deep(.el-button--danger.is-plain.is-disabled:focus),
:deep(.el-button--danger.is-plain.is-disabled:active) {
color: #f56c6c;
background-color: #fff;
border-color: #f56c6c;
}
}
.right-actions {
display: flex;
align-items: center;
gap: 6px;
margin-left: auto;
}
.left-col {

View File

@ -16,7 +16,7 @@
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" @click="loadData">刷新</el-button>
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<ExportModeDropdown
:loading="exportLoading"
label="导出"
@ -552,6 +552,17 @@ onMounted(() => {
}
}
/* 工具栏按钮间距对齐 storage/receiving 商品明细:gap 6px,去掉 EP 默认 12px 左边距 */
.order-sub-container .main-content .toolbar .toolbar-left {
align-items: center;
gap: 6px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
.detail-page {
height: 100%;
overflow: auto;

View File

@ -48,11 +48,11 @@
size="small"
type="primary"
plain
:disabled="!dirtyRows.length"
:disabled="!selectedReportTargets.length"
:loading="reporting"
@click="reportDirty"
@click="reportSelected"
>
批量上报{{ dirtyRows.length ? `(${dirtyRows.length})` : '' }}
批量上报
</el-button>
<el-button
v-if="canReport"
@ -84,157 +84,119 @@
</div>
<div ref="tableHostRef" class="table-host">
<el-table
<upper-table
ref="tableRef"
v-loading="loading"
table-id="stockcheck-items"
:data="pagedRows"
:columns="tableColumns"
row-key="flat_key"
border
stripe
size="small"
:height="tableHeight"
table-size="small"
:loading="loading"
:show-selection="true"
:selectable="isReportableRow"
:span-method="spanMethod"
:virtual-threshold="100000"
:pagination="pagination"
:page-sizes="[10, 20, 50, 100]"
:show-pagination="flatRows.length > pageSize"
@selection-change="handleSelectionChange"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
>
<el-table-column type="index" label="#" width="56" align="center" :index="indexMethod" />
<!-- 明细类型:商品行 / 库位行(同一单内由任务 type 决定,显式标注便于核对) -->
<el-table-column label="明细类型" width="90" align="center">
<template #default="{ row }">{{ itemScopeLabel(row) }}</template>
</el-table-column>
<template #column-scope_label="{ row }">{{ itemScopeLabel(row) }}</template>
<!-- 商品列:仅商品类任务显示(库位类任务不展示商品快照,商品明细看「作业明细」) -->
<el-table-column v-if="!isLocationTask" label="商品编码" min-width="130" show-overflow-tooltip>
<template #default="{ row }">{{ row.item_code || '—' }}</template>
</el-table-column>
<el-table-column v-if="!isLocationTask" label="商品名称" min-width="160" show-overflow-tooltip>
<template #default="{ row }">
<span>{{ row.item_name || '—' }}</span>
<!-- 商品行的聚合值已含未知商品(result 的 unknown_items),此处仅提示数量,不再平铺(避免重复) -->
<el-tag v-if="row.unknown_count" type="warning" size="small" class="unknown-tag">
含未知商品 {{ row.unknown_count }} 项
</el-tag>
</template>
</el-table-column>
<el-table-column v-if="!isLocationTask" label="规格" min-width="110" show-overflow-tooltip>
<template #default="{ row }">{{ row.spec || '—' }}</template>
</el-table-column>
<el-table-column v-if="!isLocationTask" label="批次号" min-width="110" show-overflow-tooltip>
<template #default="{ row }">{{ row.batch_no || '—' }}</template>
</el-table-column>
<el-table-column label="库位" min-width="130" show-overflow-tooltip>
<template #default="{ row }">
<!-- 库位行:库位以明细自身库位为准,只读(同明细的行合并单元格);商品行可填库位 -->
<span v-if="isLocationTask">{{ formatLocationCodes(row) }}</span>
<el-input
v-else-if="canReport"
v-model="locationMap[row.item.id]"
size="small"
placeholder="库位编码(可留空=无库位)"
/>
<span v-else>{{ formatLocationCodes(row) }}</span>
</template>
</el-table-column>
<template #column-item_code="{ row }">{{ row.item_code || '—' }}</template>
<template #column-item_name="{ row }">
<span>{{ row.item_name || '—' }}</span>
<!-- 商品行的聚合值已含未知商品(result 的 unknown_items),此处仅提示数量,不再平铺(避免重复) -->
<el-tag v-if="row.unknown_count" type="warning" size="small" class="unknown-tag">
含未知商品 {{ row.unknown_count }} 项
</el-tag>
</template>
<template #column-spec="{ row }">{{ row.spec || '—' }}</template>
<template #column-batch_no="{ row }">{{ row.batch_no || '—' }}</template>
<template #column-location="{ row }">
<!-- 库位行:库位以明细自身库位为准,只读(同明细的行合并单元格);商品行可填库位 -->
<span v-if="isLocationTask">{{ formatLocationCodes(row) }}</span>
<el-input
v-else-if="canReport"
v-model="locationMap[row.item.id]"
size="small"
placeholder="库位编码(可留空=无库位)"
/>
<span v-else>{{ formatLocationCodes(row) }}</span>
</template>
<!-- 库位类任务:商品 / 条码(已知商品取 result 的 stocks 快照;未知商品行显示条码) -->
<el-table-column v-if="isLocationTask" label="商品 / 条码" min-width="180" show-overflow-tooltip>
<template #default="{ row }">
<el-tag v-if="row.item?.is_empty" type="info" size="small" class="unknown-tag">空库位</el-tag>
<el-tag v-else-if="row.is_unknown" type="warning" size="small" class="unknown-tag">未知</el-tag>
<template v-if="row.item_name || row.item_code">
{{ row.item_name || '—' }}
<span v-if="row.item_code" class="hint-text">{{ row.item_code }}</span>
</template>
<span v-else-if="!row.item?.is_empty" class="hint-text">—</span>
<template #column-item_display="{ row }">
<el-tag v-if="row.item?.is_empty" type="info" size="small" class="unknown-tag">空库位</el-tag>
<el-tag v-else-if="row.is_unknown" type="warning" size="small" class="unknown-tag">未知</el-tag>
<template v-if="row.item_name || row.item_code">
{{ row.item_name || '—' }}
<span v-if="row.item_code" class="hint-text">{{ row.item_code }}</span>
</template>
</el-table-column>
<span v-else-if="!row.item?.is_empty" class="hint-text">—</span>
</template>
<!-- 账面/实盘输入列:仅商品类任务(库位类任务的实盘数量在「上报」弹窗里填) -->
<el-table-column v-if="!isLocationTask" label="账面数量" width="100" align="center">
<template #default="{ row }">{{ maskQuantity(row.system_quantity) }}</template>
</el-table-column>
<el-table-column v-if="!isLocationTask" label="本库位数量" width="140" align="center">
<template #default="{ row }">
<el-input-number
v-if="isReportableRow(row)"
:model-value="rowQuantity(row)"
size="small"
:min="0"
:step="1"
step-strictly
controls-position="right"
class="quantity-input"
@update:model-value="onRowQuantityChange(row, $event)"
/>
<span v-else class="hint-text">—</span>
</template>
</el-table-column>
<el-table-column label="已盘合计" width="100" align="center">
<template #default="{ row }">{{ row.checked_quantity ?? '—' }}</template>
</el-table-column>
<el-table-column label="差异" width="90" align="center">
<template #default="{ row }">
<span v-if="isQuantityMasked" class="hint-text">—</span>
<span v-else :class="diffClass(row.diff_quantity)">{{ formatDiff(row.diff_quantity) }}</span>
</template>
</el-table-column>
<el-table-column label="盘点状态" width="100" align="center">
<template #default="{ row }">
<span :class="getStatusTextClass(itemStatusTag(row.status))">
{{ translate('check_item_status', row.status) }}
</span>
</template>
</el-table-column>
<el-table-column label="盘点人" width="110" show-overflow-tooltip>
<template #default="{ row }">{{ formatCheckers(row) }}</template>
</el-table-column>
<el-table-column label="最近上报" width="160">
<template #default="{ row }">{{ formatTime(row.last_checked_at) }}</template>
</el-table-column>
<template #column-system_quantity="{ row }">{{ maskQuantity(row.system_quantity) }}</template>
<template #column-row_quantity="{ row }">
<el-input-number
v-if="isReportableRow(row)"
:model-value="rowQuantity(row)"
size="small"
:min="0"
:step="1"
step-strictly
controls-position="right"
class="quantity-input"
@update:model-value="onRowQuantityChange(row, $event)"
/>
<span v-else class="hint-text">—</span>
</template>
<template #column-checked_quantity="{ row }">{{ row.checked_quantity ?? '—' }}</template>
<template #column-diff_quantity="{ row }">
<span v-if="isQuantityMasked" class="hint-text">—</span>
<span v-else :class="diffClass(row.diff_quantity)">{{ formatDiff(row.diff_quantity) }}</span>
</template>
<template #column-status="{ row }">
<span :class="getStatusTextClass(itemStatusTag(row.status))">
{{ translate('check_item_status', row.status) }}
</span>
</template>
<template #column-checkers="{ row }">{{ formatCheckers(row) }}</template>
<template #column-last_checked_at="{ row }">{{ formatTime(row.last_checked_at) }}</template>
<!-- 作业图片:result 的 records[].images(业务类型 stock_check_record) -->
<el-table-column label="作业图片" width="110" align="center">
<template #default="{ row }">
<RecordImages :images="rowImages(row)" :max="2" />
</template>
</el-table-column>
<template #column-images="{ row }">
<RecordImages :images="rowImages(row)" :max="2" />
</template>
<!-- 操作列:商品行/库位行的商品 → 上报;**无商品的库位行 → 标记为空** -->
<el-table-column label="操作" width="110" align="center" fixed="right">
<template #default="{ row }">
<el-button
v-if="isReportableRow(row)"
link
type="primary"
size="small"
@click="openReportDialog(row)"
>
上报
</el-button>
<el-button
v-else-if="canMarkEmpty(row)"
link
type="warning"
size="small"
:loading="markingEmptyId === Number(row.item?.id)"
@click="handleMarkEmpty(row)"
>
标记为空
</el-button>
<span v-else class="hint-text">—</span>
</template>
</el-table-column>
<template #column-actions="{ row }">
<el-button
v-if="isReportableRow(row)"
link
type="primary"
size="small"
@click="openReportDialog(row)"
>
上报
</el-button>
<el-button
v-else-if="canMarkEmpty(row)"
link
type="warning"
size="small"
:loading="markingEmptyId === Number(row.item?.id)"
@click="handleMarkEmpty(row)"
>
标记为空
</el-button>
<span v-else class="hint-text">—</span>
</template>
<template #empty>
<div class="empty-tip">{{ emptyText }}</div>
</template>
</el-table>
</div>
<div v-if="flatRows.length > pageSize" class="pagination-container">
<el-pagination
v-model:current-page="page"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="flatRows.length"
layout="total, sizes, prev, pager, next"
background
size="small"
@current-change="handlePageChange"
/>
</upper-table>
</div>
<!-- 上报弹窗(stock.check.report,支持「未匹配条码」→ 未知商品) -->
@ -253,9 +215,9 @@
<script setup lang="ts">
import { computed, nextTick, reactive, ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useResizeObserver } from '@vueuse/core'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { formatTime, isCheckApiSuccess, isLocationScopeType, translate } from '../template-config'
import UpperTable from '@/components/UpperTable/index.vue'
import RecordImages from './RecordImages.vue'
import CheckReportDialog from './CheckReportDialog.vue'
import {
@ -437,11 +399,6 @@ const flatRows = computed<Record<string, any>[]>(() => {
return list
})
function hasQuantity(value: unknown): boolean {
if (value === undefined || value === null || (value as any) === '') return false
return Number.isFinite(Number(value))
}
/** 本次上报目标:商品行只带明细;库位行还需带 stock_id */
type ReportTarget = { item: Record<string, any>; stock?: Record<string, any> }
@ -451,46 +408,72 @@ const emptyText = computed(() =>
: '暂无盘点明细'
)
/** 已填写实盘数量的行(库位行按明细+商品 / 商品行按明细) */
const dirtyRows = computed<ReportTarget[]>(() => {
const list: ReportTarget[] = []
for (const row of flatRows.value) {
// 未知商品行是「已产生的作业记录」,不作为上报目标
if (row.is_unknown) continue
if (row.stock) {
if (hasQuantity(stockQuantityMap[stockKey(row.item.id, row.stock.stock_id)])) {
list.push({ item: row.item, stock: row.stock })
}
} else if (!isLocationTask.value && hasQuantity(quantityMap[String(row.item.id)])) {
list.push({ item: row.item })
}
}
return list
})
/** 表格勾选行(UpperTable selection-change) */
const selectedRows = ref<Record<string, any>[]>([])
/** 已勾选且可上报的行(库位行按明细+商品 / 商品行按明细) */
const selectedReportTargets = computed<ReportTarget[]>(() =>
selectedRows.value
.filter((row) => isReportableRow(row))
.map((row) => (row.stock ? { item: row.item, stock: row.stock } : { item: row.item }))
)
// ============================================================
// 表格高度 / 分页
// 表格列配置 / 分页
// ============================================================
const tableRef = ref<any>(null)
const tableHostRef = ref<HTMLElement | null>(null)
const tableHeight = ref(260)
const page = ref(1)
const pageSize = ref(20)
useResizeObserver(tableHostRef, (entries) => {
const h = entries[0]?.contentRect.height ?? 0
if (h >= 120) tableHeight.value = Math.floor(h)
/** 表格列(与上方 slot 名对应,库位类任务隐藏商品快照列) */
const tableColumns = computed<Record<string, any>[]>(() => {
const cols: Record<string, any>[] = [
{ prop: 'scope_label', label: '明细类型', width: 90, align: 'center' },
]
if (!isLocationTask.value) {
cols.push(
{ prop: 'item_code', label: '商品编码', minWidth: 130, showOverflowTooltip: true },
{ prop: 'item_name', label: '商品名称', minWidth: 160, showOverflowTooltip: true },
{ prop: 'spec', label: '规格', minWidth: 110, showOverflowTooltip: true },
{ prop: 'batch_no', label: '批次号', minWidth: 110, showOverflowTooltip: true },
{ prop: 'location', label: '库位', minWidth: 130, showOverflowTooltip: true },
)
} else {
cols.push(
{ prop: 'location', label: '库位', minWidth: 130, showOverflowTooltip: true },
{ prop: 'item_display', label: '商品 / 条码', minWidth: 180, showOverflowTooltip: true },
)
}
if (!isLocationTask.value) {
cols.push(
{ prop: 'system_quantity', label: '账面数量', width: 100, align: 'center' },
{ prop: 'row_quantity', label: '本库位数量', width: 140, align: 'center' },
)
}
cols.push(
{ prop: 'checked_quantity', label: '已盘合计', width: 100, align: 'center' },
{ prop: 'diff_quantity', label: '差异', width: 90, align: 'center' },
{ prop: 'status', label: '盘点状态', width: 100, align: 'center' },
{ prop: 'checkers', label: '盘点人', width: 110, showOverflowTooltip: true },
{ prop: 'last_checked_at', label: '最近上报', width: 160 },
{ prop: 'images', label: '作业图片', width: 110, align: 'center' },
{ prop: 'actions', label: '操作', width: 110, align: 'center', fixed: 'right' },
)
return cols
})
const pagination = computed(() => ({
currentPage: page.value,
pageSize: pageSize.value,
total: flatRows.value.length
}))
const pagedRows = computed(() => {
const start = (page.value - 1) * pageSize.value
return flatRows.value.slice(start, start + pageSize.value)
})
function indexMethod(index: number) {
return (page.value - 1) * pageSize.value + index + 1
}
/**
* 平铺后按明细合并「明细类型 / 库位」单元格(仅库位类任务、仅当前页内)
* 首个同明细行返回 [跨行数, 1],其余返回 [0, 0](不渲染)
@ -512,8 +495,18 @@ function spanMethod({ rowIndex, column }: any): number[] | undefined {
return [count, 1]
}
function handlePageChange() {
nextTick(() => tableRef.value?.setScrollTop?.(0))
function handleSelectionChange(rows: Record<string, any>[]) {
selectedRows.value = rows
}
function handlePageChange(nextPage: number) {
page.value = nextPage
nextTick(() => tableRef.value?.getTableRef?.()?.setScrollTop?.(0))
}
function handlePageSizeChange(size: number) {
pageSize.value = size
page.value = 1
}
/** 该行是否可上报(库位行需有对应商品库存且非未知商品行;商品行直接可报) */
@ -563,6 +556,7 @@ async function loadItems() {
stats.checked = Number(check.checked_items ?? 0) || 0
stats.diff = Number(check.diff_items ?? 0) || 0
resetInputs()
selectedRows.value = []
page.value = 1
} catch (e: any) {
console.error('[stockcheck] 加载盘点明细失败', e)
@ -815,18 +809,29 @@ async function handleMarkEmpty(row: Record<string, any>) {
}
}
/** 批量上报:逐行串行提交,避免并发写同一盘点单 */
async function reportDirty() {
const targets = [...dirtyRows.value]
/**
* 批量上报:上报表格中**勾选**的行(逐行串行提交,避免并发写同一盘点单)。
* 已勾选但未填写实盘数量的行会被跳过并提示。
*/
async function reportSelected() {
const targets = [...selectedReportTargets.value]
if (!targets.length) {
ElMessage.warning('请先填写实盘数量')
ElMessage.warning('请先勾选要上报的盘点明细')
return
}
const ready = targets.filter((target) => resolveQuantity(target) !== null)
if (!ready.length) {
ElMessage.warning('请先填写已勾选明细的实盘数量')
return
}
if (ready.length < targets.length) {
ElMessage.warning(`已勾选 ${targets.length} 行,其中 ${targets.length - ready.length} 行未填写实盘数量,将跳过`)
}
reporting.value = true
let success = 0
let failed = 0
try {
for (const target of targets) {
for (const target of ready) {
const ok = await doReport(target, true)
if (ok) success += 1
else failed += 1
@ -954,6 +959,16 @@ watch(
margin-left: 0;
margin-right: 0;
}
/* 动作类按钮(含「批量上报」)禁用:白底 + 蓝边 + 蓝字(对齐 storage/receiving「批量审核」) */
:deep(.el-button--primary.is-plain.is-disabled),
:deep(.el-button--primary.is-plain.is-disabled:hover),
:deep(.el-button--primary.is-plain.is-disabled:focus),
:deep(.el-button--primary.is-plain.is-disabled:active) {
color: #409eff;
background-color: #fff;
border-color: #409eff;
}
}
}
@ -1001,21 +1016,4 @@ watch(
font-size: 13px;
color: #909399;
}
/* 分页器:右对齐 + 「每页条数」下拉与 UpperTable 同宽 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;
}
}
</style>

View File

@ -904,6 +904,16 @@ watch(
margin-left: 0;
margin-right: 0;
}
/* 「刷新」禁用:白底 + 蓝边 + 蓝字(对齐 storage/receiving「批量审核」) */
:deep(.el-button--primary.is-disabled),
:deep(.el-button--primary.is-disabled:hover),
:deep(.el-button--primary.is-disabled:focus),
:deep(.el-button--primary.is-disabled:active) {
color: #409eff;
background-color: #fff;
border-color: #409eff;
}
}
}

View File

@ -981,6 +981,23 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
loadingKey: 'loading',
action: 'loadData'
},
/**
* 导出(stock.check.export):下拉按钮,与 storage/receiving 的「导出」同款(拆分按钮)。
* 主按钮与「导出选中」选项都走 handleExport(导出勾选的盘点单,单次上限 50);
* 无勾选时不置灰,点击后提示先勾选。
*/
export: {
key: 'export',
label: '导出',
category: 'basic',
size: 'small',
loadingKey: 'exportLoading',
action: 'handleExport',
buttonType: 'dropdown',
dropdownOptions: [
{ label: '导出选中', action: 'handleExport' }
]
},
// ===== 基础操作 =====
columnConfig: {
key: 'columnConfig',
@ -1022,22 +1039,7 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
size: 'small',
action: 'openPatternCreate'
},
/**
* 导出选中(stock.check.export):导出表格中勾选的盘点单(单次上限 50)。
* 无勾选时不置灰,点击后提示先勾选;
* ⚠️ 未勾选时由 index.vue 的 currentToolbarButtons 把 type 降级为 default,
* 避免 primary 样式的浅蓝底色(勾选后恢复 primary + plain)。
*/
export: {
key: 'export',
label: '导出选中',
category: 'function',
type: 'primary',
plain: true,
size: 'small',
loadingKey: 'exportLoading',
action: 'handleExport'
},
/**
* 批量删除(stock.check.batchDelete):仅「已作废」任务会被删除,其余状态后端自动跳过。
* 无勾选时置灰(disabledKey: noSelection)。

View File

@ -418,8 +418,8 @@ const currentToolbarButtons = computed<OrderToolbarButtonConfig[]>(() => {
key: btn.key,
label: btn.label,
size: btn.size,
// 「导出选中」在未勾选数据时不显示主色(避免 primary 的浅蓝底色),勾选后恢复 primary
type: btn.key === 'export' && selectedRows.value.length === 0 ? '' : btn.type,
// 类型 / 样式直接透传配置(「导出」为下拉按钮)
type: btn.type,
plain: btn.plain,
loadingKey: btn.loadingKey,
disabledKey: btn.disabledKey,

View File

@ -26,7 +26,13 @@
:layout-key="toolbarLayoutKey"
@action="handleToolbarButtonClick"
/>
<el-tag v-if="currentSubject.company_name" size="small" type="primary" effect="plain" style="margin-left:8px">
<el-tag
v-if="currentSubject.company_name"
size="small"
type="primary"
effect="plain"
class="current-subject-tag"
>
当前仓库:{{ currentSubject.company_name }}
</el-tag>
</div>
@ -535,6 +541,12 @@ onMounted(() => {
<style scoped lang="scss">
@use "../../order/orderManagement/styles/order-sub.scss";
/* 工具栏「当前仓库」标签:与左侧按钮组垂直居中对齐(toolbar-left 默认 align-items:flex-start) */
.current-subject-tag {
align-self: center;
margin-left: 8px;
}
/* 详情区外壳与 storage/entry_owner 一致:不留上/下间距,左右 10px,
面板自身 padding: 6px 10px 8px(合计内容缩进 20px) */
.order-sub-container .main-content .lower-level .detail-container {

View File

@ -222,81 +222,51 @@
</div>
</div>
<div ref="balanceLogTableHostRef" class="table-host">
<el-table
ref="balanceLogTableRef"
v-loading="balanceLogLoading"
:data="balanceLogList"
border
stripe
size="small"
:height="balanceLogTableHeight"
class="balance-log-table"
>
<el-table-column type="index" label="#" width="58" :index="computeBalanceLogIndex" align="center" />
<el-table-column prop="created_at" label="变动时间" min-width="160">
<template #default="{ row }">
<upper-table
ref="balanceLogTableRef"
table-id="store-balance-logs"
:data="balanceLogList"
:columns="balanceLogColumns"
table-size="small"
:loading="balanceLogLoading"
:virtual-threshold="100000"
:pagination="balanceLogTablePagination"
:page-sizes="[10, 20, 50, 100]"
@page-change="handleBalanceLogPageChange"
@page-size-change="handleBalanceLogSizeChange"
>
<template #column-created_at="{ row }">
{{ formatDate(getBalanceLogTime(row)) || '—' }}
</template>
</el-table-column>
<el-table-column label="变动前" min-width="90" align="right">
<template #default="{ row }">
<template #column-before_quantity="{ row }">
{{ getBalanceLogBefore(row) ?? '—' }}
</template>
</el-table-column>
<el-table-column label="变动后" min-width="90" align="right">
<template #default="{ row }">
<template #column-after_quantity="{ row }">
{{ getBalanceLogAfter(row) ?? '—' }}
</template>
</el-table-column>
<el-table-column label="变动值" min-width="90" align="right">
<template #default="{ row }">
<template #column-delta="{ row }">
<span :class="getBalanceLogDeltaClass(getBalanceLogDelta(row))">{{ formatBalanceLogDelta(getBalanceLogDelta(row)) }}</span>
</template>
</el-table-column>
<el-table-column label="变动类型" min-width="120">
<template #default="{ row }">
<template #column-change_type_label="{ row }">
{{ row.change_type_label || getBalanceLogChangeType(row) || '—' }}
</template>
</el-table-column>
<el-table-column label="业务类型" min-width="120">
<template #default="{ row }">
<template #column-business_type_label="{ row }">
{{ row.business_type_label || getBalanceLogBusinessType(row) || '—' }}
</template>
</el-table-column>
<el-table-column label="业务ID" min-width="100" align="right">
<template #default="{ row }">
<template #column-business_id="{ row }">
{{ getBalanceLogBusinessId(row) ?? '—' }}
</template>
</el-table-column>
<el-table-column label="操作人" min-width="120">
<template #default="{ row }">
<template #column-operator="{ row }">
{{ getBalanceLogOperator(row) || '—' }}
</template>
</el-table-column>
<el-table-column label="原因" min-width="220" show-overflow-tooltip>
<template #default="{ row }">
<template #column-reason="{ row }">
{{ getBalanceLogReason(row) || '—' }}
</template>
</el-table-column>
<template #empty>
<div class="empty-tip">暂无余额变动记录</div>
</template>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
background
size="small"
layout="total, sizes, prev, pager, next, jumper"
:total="balanceLogPagination.total"
:current-page="balanceLogPagination.currentPage"
:page-size="balanceLogPagination.pageSize"
:page-sizes="[10, 20, 50, 100]"
@current-change="handleBalanceLogPageChange"
@size-change="handleBalanceLogSizeChange"
/>
<template #empty>
<div class="empty-tip">暂无余额变动记录</div>
</template>
</upper-table>
</div>
</div>
<KeepAlive v-else>
@ -1051,7 +1021,6 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed, watch, nextTick } from 'vue'
import { useResizeObserver } from '@vueuse/core'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Refresh, QuestionFilled, Link } from '@element-plus/icons-vue'
import { storeWarehouseList, storeWarehouseUnbind,
@ -1113,19 +1082,11 @@ const selectedRow = ref<any>(null)
const tableRef = ref<any>(null)
const balanceLogTableRef = ref<any>(null)
const balanceLogTableHostRef = ref<HTMLElement | null>(null)
const balanceLogTableHeight = ref(280)
useResizeObserver(balanceLogTableHostRef, (entries) => {
const h = entries[0]?.contentRect.height ?? 0
if (h >= 100) {
balanceLogTableHeight.value = Math.floor(h)
}
})
/** 切页后把表格滚动位置归零 */
function resetBalanceLogScroll() {
nextTick(() => {
balanceLogTableRef.value?.setScrollTop?.(0)
balanceLogTableRef.value?.getTableRef?.()?.setScrollTop?.(0)
})
}
const scanBox = ref<any>(null)
@ -1145,6 +1106,26 @@ const balanceLogPagination = reactive({
total: 0
})
/** UpperTable 分页入参(服务端分页) */
const balanceLogTablePagination = computed(() => ({
currentPage: balanceLogPagination.currentPage,
pageSize: balanceLogPagination.pageSize,
total: balanceLogPagination.total
}))
/** 余额变动表格列(序号列已移除) */
const balanceLogColumns = [
{ prop: 'created_at', label: '变动时间', minWidth: 160, showOverflowTooltip: true },
{ prop: 'before_quantity', label: '变动前', minWidth: 90, align: 'right' },
{ prop: 'after_quantity', label: '变动后', minWidth: 90, align: 'right' },
{ prop: 'delta', label: '变动值', minWidth: 90, align: 'right' },
{ prop: 'change_type_label', label: '变动类型', minWidth: 120 },
{ prop: 'business_type_label', label: '业务类型', minWidth: 120 },
{ prop: 'business_id', label: '业务ID', minWidth: 100, align: 'right' },
{ prop: 'operator', label: '操作人', minWidth: 120 },
{ prop: 'reason', label: '原因', minWidth: 220, showOverflowTooltip: true }
]
/** 余额变动筛选:''=无, 'recharge'=充值(增加), 'consumption'=消费(减少) */
const balanceLogFilter = ref('')
@ -1554,10 +1535,6 @@ function formatBalanceLogDelta(delta: number | undefined): string {
return String(delta)
}
function computeBalanceLogIndex(index: number): number {
return (balanceLogPagination.currentPage - 1) * balanceLogPagination.pageSize + index + 1
}
async function loadBalanceLogs() {
if (!selectedRow.value) {
balanceLogList.value = []
@ -2884,23 +2861,6 @@ onMounted(() => {
overflow: hidden;
}
.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;
}
}
.open-account-form-grid {
.el-row {
width: 100%;

View File

@ -256,14 +256,6 @@ export const storeToolbarButtons: ToolbarButtonConfig[] = [
{ label: '导出全部', action: 'handleExportAll', divided: true }
]
},
{
key: 'toggleBalance',
label: '显示余额',
dynamicLabelKey: 'balanceToggleLabel',
category: 'setting',
size: 'small',
action: 'toggleBalance'
},
{
key: 'toggleDetail',
label: '显示详情',
@ -272,6 +264,15 @@ export const storeToolbarButtons: ToolbarButtonConfig[] = [
size: 'small',
action: 'toggleDetailVisible'
},
{
key: 'toggleBalance',
label: '显示余额',
dynamicLabelKey: 'balanceToggleLabel',
category: 'setting',
size: 'small',
action: 'toggleBalance'
},
{ key: 'openAccount', label: '代开户', category: 'action', size: 'small', action: 'openOpenAccountDialog' },
]

View File

@ -577,7 +577,6 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
key: 'addCamera',
label: '新增摄像头',
category: 'action',
type: 'success',
size: 'small',
action: 'openAddCameraDialog',
formKey: 'CameraFormDialog'

View File

@ -592,7 +592,6 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
key: 'addServer',
label: '新增录像服务器',
category: 'action',
type: 'success',
size: 'small',
action: 'openAddServerDialog',
formKey: 'ServerFormDialog'