1
This commit is contained in:
parent
690737c1b4
commit
af204d3c70
BIN
dist.tar.gz
BIN
dist.tar.gz
Binary file not shown.
@ -2,6 +2,8 @@ import request from "@/utils/request";
|
||||
import {
|
||||
orderModulePendingOrderDownloadCreateTemplate,
|
||||
orderModulePendingOrderManualWaybill,
|
||||
orderModulePendingOrderAllocateSubOrderNumber,
|
||||
orderModulePendingOrderAllocateSubOrderNumberProgress,
|
||||
} from "@/api/order/order";
|
||||
|
||||
const v = "1.0";
|
||||
@ -11,10 +13,16 @@ export type {
|
||||
PendingOrderDownloadCreateTemplateResponse,
|
||||
PendingOrderManualWaybillParams,
|
||||
PendingOrderManualWaybillResponse,
|
||||
PendingOrderAllocateSubOrderNumberParams,
|
||||
PendingOrderAllocateSubOrderNumberData,
|
||||
PendingOrderAllocateSubOrderNumberProgressParams,
|
||||
PendingOrderAllocateSubOrderNumberProgressData,
|
||||
} from '@/api/order/order'
|
||||
|
||||
export const orderPendingOrderDownloadCreateTemplate = orderModulePendingOrderDownloadCreateTemplate;
|
||||
export const orderPendingOrderManualWaybill = orderModulePendingOrderManualWaybill;
|
||||
export const orderPendingOrderAllocateSubOrderNumber = orderModulePendingOrderAllocateSubOrderNumber;
|
||||
export const orderPendingOrderAllocateSubOrderNumberProgress = orderModulePendingOrderAllocateSubOrderNumberProgress;
|
||||
|
||||
export type OrderWhere = Record<string, any>;
|
||||
export type OrderSort = {
|
||||
@ -754,6 +762,8 @@ export type OrderPendingOrderApi = {
|
||||
batchLockTaskProgress: typeof orderPendingOrderBatchLockTaskProgress;
|
||||
batchUnlock: typeof orderPendingOrderBatchUnlock;
|
||||
batchUnlockTaskProgress: typeof orderPendingOrderBatchUnlockTaskProgress;
|
||||
allocateSubOrderNumber: typeof orderPendingOrderAllocateSubOrderNumber;
|
||||
allocateSubOrderNumberProgress: typeof orderPendingOrderAllocateSubOrderNumberProgress;
|
||||
};
|
||||
|
||||
export const orderPendingOrder: OrderPendingOrderApi = {
|
||||
@ -787,4 +797,6 @@ export const orderPendingOrder: OrderPendingOrderApi = {
|
||||
batchLockTaskProgress: orderPendingOrderBatchLockTaskProgress,
|
||||
batchUnlock: orderPendingOrderBatchUnlock,
|
||||
batchUnlockTaskProgress: orderPendingOrderBatchUnlockTaskProgress,
|
||||
allocateSubOrderNumber: orderPendingOrderAllocateSubOrderNumber,
|
||||
allocateSubOrderNumberProgress: orderPendingOrderAllocateSubOrderNumberProgress,
|
||||
};
|
||||
|
||||
@ -93,3 +93,24 @@ export function getOrderPrintData(data: GetOrderPrintDataParams) {
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export type GetPrintDataByWaybillCodesParams = {
|
||||
/** 运单号数组(字符串数组,内部自动去重与归一化,必须为非空数组) */
|
||||
waybill_codes: string[]
|
||||
}
|
||||
|
||||
/** 按运单号数组拉取平台打印中间态数据(order.print.getPrintDataByWaybillCodes)
|
||||
* 返回结构与 getOrderPrintData 一致 */
|
||||
export function getPrintDataByWaybillCodes(data: GetPrintDataByWaybillCodesParams) {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.print.getPrintDataByWaybillCodes',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
@ -320,11 +320,45 @@ export function orderModulePendingOrderAllocateSubOrderNumberProgress(
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** order.pendingOrder.batchMarkPrinted 请求参数 */
|
||||
export type PendingOrderBatchMarkPrintedParams = {
|
||||
/** 订单ID数组;优先级 order_ids > orderIds > ids */
|
||||
order_ids?: number[]
|
||||
orderIds?: number[]
|
||||
ids?: number[]
|
||||
}
|
||||
|
||||
/** order.pendingOrder.batchMarkPrinted 响应 data */
|
||||
export type PendingOrderBatchMarkPrintedData = {
|
||||
/** 实际更新的订单数量(已打印的订单会被静默跳过,不计入) */
|
||||
updated_count: number
|
||||
/** 请求的订单ID列表(原样回传) */
|
||||
ids: number[]
|
||||
}
|
||||
|
||||
/** order.pendingOrder.batchMarkPrinted:批量设置订单为已打印状态 */
|
||||
export function orderModulePendingOrderBatchMarkPrinted(
|
||||
data: PendingOrderBatchMarkPrintedParams
|
||||
): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.pendingOrder.batchMarkPrinted',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export const orderModule = {
|
||||
waveBatchList: orderModuleWaveBatchList,
|
||||
pendingOrderDownloadCreateTemplate: orderModulePendingOrderDownloadCreateTemplate,
|
||||
pendingOrderManualWaybill: orderModulePendingOrderManualWaybill,
|
||||
bindExpressPackageMaterialByWaybill: orderBindExpressPackageMaterialByWaybill,
|
||||
pendingOrderAllocateSubOrderNumber: orderModulePendingOrderAllocateSubOrderNumber,
|
||||
pendingOrderAllocateSubOrderNumberProgress: orderModulePendingOrderAllocateSubOrderNumberProgress
|
||||
pendingOrderAllocateSubOrderNumberProgress: orderModulePendingOrderAllocateSubOrderNumberProgress,
|
||||
pendingOrderBatchMarkPrinted: orderModulePendingOrderBatchMarkPrinted
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ export function setRecording(data: {
|
||||
id: number
|
||||
recording_size_value: number
|
||||
recording_size_unit: string
|
||||
remote_play_url?: string
|
||||
recording_directory: string
|
||||
}) {
|
||||
return request({
|
||||
|
||||
166
src/api/waybill.warehouse/index.ts
Normal file
166
src/api/waybill.warehouse/index.ts
Normal file
@ -0,0 +1,166 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
// ============ waybill.warehouse.list ============
|
||||
|
||||
/** waybill.warehouse.list 的 where 筛选条件 */
|
||||
export type WaybillWarehouseListWhere = {
|
||||
/** 运单号(模糊搜索) */
|
||||
waybillCode?: string
|
||||
/** 主单号(精确匹配),与 waybillCode 互斥,同时传入时 mainWaybillCode 优先 */
|
||||
mainWaybillCode?: string
|
||||
/** 订单ID(等值匹配) */
|
||||
orderId?: number
|
||||
/** 订单号(模糊搜索,匹配 delivery_order_code 快照列) */
|
||||
orderNo?: string
|
||||
/** 物流公司编码(等值匹配),如 SF/YT/STO/ZTO 等 */
|
||||
logisticsCode?: string
|
||||
/** 物流接口ID(等值匹配) */
|
||||
logisticsInterfaceId?: number
|
||||
/** 平台编码(等值匹配),如 PDD/DY/KS/JD/CAINIAO/SPH/XHS */
|
||||
platformCode?: string
|
||||
/** 运单状态:0=未分配,1=已分配 */
|
||||
status?: number
|
||||
/** 是否退回:Y/N */
|
||||
isBack?: string
|
||||
/** 是否拦截:Y/N */
|
||||
isIntercept?: string
|
||||
/** 是否星河签收:Y/N */
|
||||
isGalaxyReceive?: string
|
||||
/** 包材ID(等值匹配) */
|
||||
packageMaterialId?: number
|
||||
/** 是否已称重:true=weighing_weight>0,false=weighing_weight=0 */
|
||||
hasWeighingWeight?: boolean
|
||||
/** 关键词搜索:同时匹配运单号、主单号、订单号 */
|
||||
keyword?: string
|
||||
/** 创建时间起始,格式 YYYY-MM-DD */
|
||||
createdAtStart?: string
|
||||
/** 创建时间截止,格式 YYYY-MM-DD */
|
||||
createdAtEnd?: string
|
||||
}
|
||||
|
||||
/** waybill.warehouse.list 排序参数 */
|
||||
export type WaybillWarehouseListSort = {
|
||||
/** 排序字段:create_at / weighing_weight / id */
|
||||
field?: string
|
||||
/** 排序方向:asc / desc,默认 desc */
|
||||
order?: 'asc' | 'desc'
|
||||
}
|
||||
|
||||
/** waybill.warehouse.list 请求参数 */
|
||||
export type WaybillWarehouseListParams = {
|
||||
pagination?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
where?: WaybillWarehouseListWhere
|
||||
sort?: WaybillWarehouseListSort
|
||||
}
|
||||
|
||||
/** waybill.warehouse.list:运单列表-仓库侧 */
|
||||
export function waybillWarehouseList(
|
||||
data: WaybillWarehouseListParams = {}
|
||||
): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'waybill.warehouse.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
// ============ waybill.warehouse.detail ============
|
||||
|
||||
/** waybill.warehouse.detail 请求参数 */
|
||||
export type WaybillWarehouseDetailParams = {
|
||||
/** 运单记录ID(wms_order_express.id),与 waybillCode 二选一,waybillCode 优先 */
|
||||
id?: number
|
||||
/** 运单号,与 id 二选一,waybillCode 优先 */
|
||||
waybillCode?: string
|
||||
}
|
||||
|
||||
/** waybill.warehouse.detail:运单详情-仓库侧 */
|
||||
export function waybillWarehouseDetail(
|
||||
data: WaybillWarehouseDetailParams
|
||||
): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'waybill.warehouse.detail',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
// ============ waybill.warehouse.export ============
|
||||
|
||||
/** waybill.warehouse.export 请求参数 */
|
||||
export type WaybillWarehouseExportParams = {
|
||||
where?: WaybillWarehouseListWhere
|
||||
sort?: WaybillWarehouseListSort
|
||||
/** 需要导出的字段列表,不传则导出全部字段 */
|
||||
exportFields?: string[]
|
||||
}
|
||||
|
||||
/** waybill.warehouse.export:运单导出-仓库侧(异步任务模式) */
|
||||
export function waybillWarehouseExport(
|
||||
data: WaybillWarehouseExportParams = {}
|
||||
): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'waybill.warehouse.export',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
// ============ waybill.warehouse.exportTaskProgress ============
|
||||
|
||||
/** waybill.warehouse.exportTaskProgress 请求参数 */
|
||||
export type WaybillWarehouseExportTaskProgressParams = {
|
||||
/** 异步导出任务ID(前缀 waybill_export_)。与 taskId 二选一,taskId 优先 */
|
||||
task_id?: string
|
||||
/** 异步导出任务ID(别名,优先使用)。至少传入 taskId 或 task_id 之一 */
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
/** waybill.warehouse.exportTaskProgress:运单导出进度查询-仓库侧 */
|
||||
export function waybillWarehouseExportTaskProgress(
|
||||
data: WaybillWarehouseExportTaskProgressParams
|
||||
): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'waybill.warehouse.exportTaskProgress',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
// ============ 模块导出 ============
|
||||
|
||||
export const waybillWarehouseModule = {
|
||||
list: waybillWarehouseList,
|
||||
detail: waybillWarehouseDetail,
|
||||
export: waybillWarehouseExport,
|
||||
exportTaskProgress: waybillWarehouseExportTaskProgress
|
||||
}
|
||||
@ -73,6 +73,16 @@ export default {
|
||||
// 'OwnerReceiving':'Owner Receiving',
|
||||
'PackingFlow':'Packing Flow',
|
||||
'printcomputer':'Print Computer',
|
||||
'waybill':'waybill',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
},
|
||||
"login": {
|
||||
"title": "Login",
|
||||
|
||||
@ -76,6 +76,16 @@ export default {
|
||||
'WmsCameraServer':'录像服务器',
|
||||
'PackingFlow':'打包流水',
|
||||
'printcomputer':'打印电脑',
|
||||
'waybill':'运单',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
'':'',
|
||||
},
|
||||
"login": {
|
||||
"title": "登录",
|
||||
|
||||
@ -67,4 +67,5 @@ export const componentMap: Record<string, any> = {
|
||||
'video/camera/index': () => import('@/views/video/newcamara/index.vue'),
|
||||
'data/packingflow': () => import('@/views/data/packingflow/index.vue'),
|
||||
'system/setting/printcomputer/index':() => import('@/views/system/setting/printcomputer/index.vue'),
|
||||
'express/index':() => import('@/views/express/waybill/index.vue'),
|
||||
};
|
||||
65
src/views/express/waybill/components/ColumnCellRenderer.vue
Normal file
65
src/views/express/waybill/components/ColumnCellRenderer.vue
Normal file
@ -0,0 +1,65 @@
|
||||
<!--
|
||||
ColumnCellRenderer — 通用表格列渲染器
|
||||
|
||||
根据传入的 ColumnSlotConfig 决定如何渲染单元格:
|
||||
- type='tag' → 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'">
|
||||
<el-tag size="small" :type="resolvedTagType">
|
||||
{{ displayValue }}
|
||||
</el-tag>
|
||||
</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'
|
||||
|
||||
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>
|
||||
|
||||
175
src/views/express/waybill/components/OperationCellRenderer.vue
Normal file
175
src/views/express/waybill/components/OperationCellRenderer.vue
Normal 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, 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] = comp
|
||||
formVisibleMap[btn.key] = true
|
||||
}
|
||||
|
||||
function buildFormProps(btn: OperationButtonConfig): Record<string, any> {
|
||||
const props: Record<string, any> = {}
|
||||
|
||||
// paramMap: { formProp: rowField } → 从行数据取值注入表单
|
||||
if (btn.paramMap) {
|
||||
for (const [formProp, rowField] of Object.entries(btn.paramMap)) {
|
||||
props[formProp] = props.row[rowField]
|
||||
}
|
||||
}
|
||||
|
||||
// extraParams: 固定参数直接注入
|
||||
if (btn.extraParams) {
|
||||
Object.assign(props, btn.extraParams)
|
||||
}
|
||||
|
||||
return props
|
||||
}
|
||||
|
||||
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>
|
||||
132
src/views/express/waybill/components/TabArea.vue
Normal file
132
src/views/express/waybill/components/TabArea.vue
Normal 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>
|
||||
159
src/views/express/waybill/config/components/DetailPanel.vue
Normal file
159
src/views/express/waybill/config/components/DetailPanel.vue
Normal file
@ -0,0 +1,159 @@
|
||||
<!--
|
||||
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"
|
||||
>
|
||||
<!-- tag 渲染 -->
|
||||
<template v-if="field.renderType === 'tag'">
|
||||
<el-tag size="small" :type="resolveTagType(field, getRowData()?.[field.key])">
|
||||
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<!-- pre 渲染 -->
|
||||
<template v-else-if="field.renderType === 'pre'">
|
||||
<pre class="order-list-pre">{{ 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'
|
||||
|
||||
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 ?? '—'
|
||||
}
|
||||
|
||||
/** 解析 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>
|
||||
.detail-panel {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.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>
|
||||
227
src/views/express/waybill/config/components/LogPanel.vue
Normal file
227
src/views/express/waybill/config/components/LogPanel.vue
Normal file
@ -0,0 +1,227 @@
|
||||
<!--
|
||||
LogPanel — 操作日志面板(通用)
|
||||
|
||||
支持两种数据来源:
|
||||
- apiMethod 传入 → 调用真实接口获取日志
|
||||
- 无 apiMethod → 基于 row 生成模拟日志(开发调试用)
|
||||
-->
|
||||
<template>
|
||||
<div class="log-panel">
|
||||
<div class="section-title">操作日志</div>
|
||||
<div v-if="apiLoading" v-loading="true" class="empty-tip">加载中…</div>
|
||||
<div v-else-if="!logs.length" class="empty-tip">暂无操作日志</div>
|
||||
<div v-else class="log-timeline">
|
||||
<div v-for="(log, i) in logs" :key="i" class="log-item">
|
||||
<div class="log-dot" :class="log.level" />
|
||||
<div class="log-content">
|
||||
<div class="log-header">
|
||||
<span class="log-operator">{{ log.operator }}</span>
|
||||
<span class="log-action">{{ log.action }}</span>
|
||||
<el-tag v-if="log.result === '成功'" size="small" type="success">成功</el-tag>
|
||||
<el-tag v-else-if="log.result === '失败'" size="small" type="danger">失败</el-tag>
|
||||
<el-tag v-else size="small" type="info">{{ log.result }}</el-tag>
|
||||
</div>
|
||||
<div v-if="log.detail" class="log-detail">{{ log.detail }}</div>
|
||||
<div class="log-time">{{ log.time }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
|
||||
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)
|
||||
|
||||
watch(() => props.row, async (newRow) => {
|
||||
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
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
/** 基于 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
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.log-panel {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
padding: 40px 0;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 12px;
|
||||
padding-left: 4px;
|
||||
border-left: 3px solid #409eff;
|
||||
}
|
||||
|
||||
.log-timeline {
|
||||
padding-left: 8px;
|
||||
|
||||
.log-item {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px dashed #ebeef5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.log-dot {
|
||||
flex-shrink: 0;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-top: 6px;
|
||||
border-radius: 50%;
|
||||
background: #c0c4cc;
|
||||
|
||||
&.success {
|
||||
background: #67c23a;
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background: #e6a23c;
|
||||
}
|
||||
|
||||
&.error {
|
||||
background: #f56c6c;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
.log-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.log-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.log-operator {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.log-action {
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.log-detail {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.log-time {
|
||||
margin-top: 2px;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
910
src/views/express/waybill/config/template-config.ts
Normal file
910
src/views/express/waybill/config/template-config.ts
Normal file
@ -0,0 +1,910 @@
|
||||
/**
|
||||
* 【运单模块(仓库侧)】配置文件 — 基于 waveOrder2 架构设计
|
||||
*
|
||||
* ===== 数据来源 =====
|
||||
* API: src/api/waybill.warehouse/index.ts
|
||||
* - waybillWarehouseList → waybill.warehouse.list 运单列表
|
||||
* - waybillWarehouseDetail → waybill.warehouse.detail 运单详情
|
||||
* - waybillWarehouseExport → waybill.warehouse.export 运单导出
|
||||
*/
|
||||
|
||||
import type { Component } from 'vue'
|
||||
import DetailPanel from './components/DetailPanel.vue'
|
||||
import LogPanel from './components/LogPanel.vue'
|
||||
import {
|
||||
waybillWarehouseList,
|
||||
waybillWarehouseExport,
|
||||
waybillWarehouseExportTaskProgress,
|
||||
} from '@/api/waybill.warehouse'
|
||||
|
||||
// ============================================================
|
||||
// 〇、全局页面配置
|
||||
// ============================================================
|
||||
export const PAGE_CONFIG = {
|
||||
showTabArea: false,
|
||||
singlePage: true,
|
||||
enableDetailPanel: true
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 〇-A、组件注册表
|
||||
// ============================================================
|
||||
export const COMPONENT_REGISTRY: Record<string, Component> = {
|
||||
DetailPanel,
|
||||
LogPanel
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 〇-B、SCANBOX_GROUPS
|
||||
// ============================================================
|
||||
export const SCANBOX_GROUPS = {
|
||||
basic: '基础信息',
|
||||
logistics: '物流信息',
|
||||
status: '状态筛选',
|
||||
time: '时间范围'
|
||||
} as const
|
||||
|
||||
// ============================================================
|
||||
// 一、FIELD_DICT — 运单字段预设表
|
||||
// ============================================================
|
||||
|
||||
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 — 值翻译映射
|
||||
// ============================================================
|
||||
export const VALUE_MAPS: Record<string, Record<string, string>> = {
|
||||
waybillStatus: {
|
||||
'0': '未分配', '1': '已分配',
|
||||
'未分配': '未分配', '已分配': '已分配'
|
||||
},
|
||||
waybillType: {
|
||||
'主单号': '主单号', '子单号': '子单号'
|
||||
},
|
||||
yesNo: {
|
||||
'Y': '是', 'N': '否',
|
||||
'是': '是', '否': '否'
|
||||
},
|
||||
bool: {
|
||||
'1': '是', '0': '否',
|
||||
'是': '是', '否': '否',
|
||||
'true': '是', 'false': '否'
|
||||
},
|
||||
packStatus: {
|
||||
'未打包': '未打包', '已打包': '已打包', '打包中': '打包中'
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
export function translate(field: string, value: any): string {
|
||||
const map = VALUE_MAPS[field]
|
||||
if (!map) return String(value ?? '—')
|
||||
return map[String(value)] ?? String(value ?? '—')
|
||||
}
|
||||
|
||||
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 — 标签颜色解析器
|
||||
// ============================================================
|
||||
export const TAG_RESOLVERS: Record<string, (val: any) => string> = {
|
||||
resolveWaybillStatusTag(v) {
|
||||
if (v === undefined || v === null) return 'info'
|
||||
const s = String(v)
|
||||
if (s === '1' || s === '已分配') return 'success'
|
||||
return 'info'
|
||||
},
|
||||
resolveYesNoTag(v) {
|
||||
if (v === undefined || v === null) return 'info'
|
||||
if (v === 'Y' || v === '是' || v === true || v === 1 || v === '1') return 'warning'
|
||||
return 'info'
|
||||
},
|
||||
resolveWaybillTypeTag(v) {
|
||||
if (v === undefined || v === null) return 'info'
|
||||
if (v === '主单号') return 'primary'
|
||||
if (v === '子单号') return 'warning'
|
||||
return 'info'
|
||||
},
|
||||
resolvePackStatusTag(v) {
|
||||
if (v === undefined || v === null) return 'info'
|
||||
if (v === '已打包') return 'success'
|
||||
if (v === '打包中') return 'warning'
|
||||
return 'info'
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 二、FIELD_DICT 实例 — 运单字段定义
|
||||
// ============================================================
|
||||
export const FIELD_DICT: Record<string, FieldDefinition> = {
|
||||
// —— 基础信息 ——
|
||||
waybill_code: {
|
||||
key: 'waybill_code',
|
||||
label: '运单号',
|
||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||
table: { minWidth: 170, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '运单号'
|
||||
},
|
||||
main_waybill_code: {
|
||||
key: 'main_waybill_code',
|
||||
label: '主单号',
|
||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||
table: { minWidth: 170, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '主单号'
|
||||
},
|
||||
waybill_type: {
|
||||
key: 'waybill_type',
|
||||
label: '运单类型',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('waybillType') },
|
||||
table: { minWidth: 90, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolveWaybillTypeTag', translateField: 'waybillType' },
|
||||
detailLabel: '运单类型'
|
||||
},
|
||||
order_no: {
|
||||
key: 'order_no',
|
||||
label: '订单号',
|
||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||
table: { minWidth: 160, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '订单号'
|
||||
},
|
||||
order_id: {
|
||||
key: 'order_id',
|
||||
label: '订单ID',
|
||||
scanBox: null,
|
||||
table: { minWidth: 90, align: 'center' },
|
||||
slot: null,
|
||||
detailLabel: '订单ID'
|
||||
},
|
||||
business_key: {
|
||||
key: 'business_key',
|
||||
label: '业务键',
|
||||
scanBox: null,
|
||||
table: { minWidth: 80, align: 'center' },
|
||||
slot: null,
|
||||
detailLabel: '业务键'
|
||||
},
|
||||
warehouse_name: {
|
||||
key: 'warehouse_name',
|
||||
label: '仓库',
|
||||
scanBox: null,
|
||||
table: { minWidth: 120, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '仓库名称'
|
||||
},
|
||||
store_name: {
|
||||
key: 'store_name',
|
||||
label: '货主',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: [] },
|
||||
table: { minWidth: 120, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '货主名称'
|
||||
},
|
||||
order_type: {
|
||||
key: 'order_type',
|
||||
label: '订单类型',
|
||||
scanBox: null,
|
||||
table: null,
|
||||
slot: null,
|
||||
detailLabel: '订单类型'
|
||||
},
|
||||
wave_no: {
|
||||
key: 'wave_no',
|
||||
label: '波次号',
|
||||
scanBox: null,
|
||||
table: null,
|
||||
slot: null,
|
||||
detailLabel: '波次号'
|
||||
},
|
||||
pack_quantity: {
|
||||
key: 'pack_quantity',
|
||||
label: '打包数量',
|
||||
scanBox: null,
|
||||
table: null,
|
||||
slot: null,
|
||||
detailLabel: '打包数量'
|
||||
},
|
||||
pack_at: {
|
||||
key: 'pack_at',
|
||||
label: '打包时间',
|
||||
scanBox: null,
|
||||
table: null,
|
||||
slot: { type: 'text', format: 'datetime' },
|
||||
detailLabel: '打包时间'
|
||||
},
|
||||
packer_name: {
|
||||
key: 'packer_name',
|
||||
label: '打包人',
|
||||
scanBox: null,
|
||||
table: null,
|
||||
slot: null,
|
||||
detailLabel: '打包人'
|
||||
},
|
||||
// —— 物流信息 ——
|
||||
logistics_code: {
|
||||
key: 'logistics_code',
|
||||
label: '物流编码',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.logistics, options: [] },
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: null,
|
||||
detailLabel: '物流公司编码'
|
||||
},
|
||||
logistics_name: {
|
||||
key: 'logistics_name',
|
||||
label: '物流公司',
|
||||
scanBox: null,
|
||||
table: { minWidth: 120, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '物流公司'
|
||||
},
|
||||
logistics_interface_id: {
|
||||
key: 'logistics_interface_id',
|
||||
label: '物流接口ID',
|
||||
scanBox: null,
|
||||
table: { minWidth: 110, align: 'center' },
|
||||
slot: null,
|
||||
detailLabel: '物流接口ID'
|
||||
},
|
||||
logistics_interface_name: {
|
||||
key: 'logistics_interface_name',
|
||||
label: '物流接口',
|
||||
scanBox: null,
|
||||
table: { minWidth: 120, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '物流接口'
|
||||
},
|
||||
platform_code: {
|
||||
key: 'platform_code',
|
||||
label: '平台',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.logistics, options: [] },
|
||||
table: { minWidth: 90, align: 'center' },
|
||||
slot: null,
|
||||
detailLabel: '平台编码'
|
||||
},
|
||||
// —— 包裹信息 ——
|
||||
package_material_id: {
|
||||
key: 'package_material_id',
|
||||
label: '包材ID',
|
||||
scanBox: null,
|
||||
table: { minWidth: 90, align: 'center' },
|
||||
slot: null,
|
||||
detailLabel: '包材ID'
|
||||
},
|
||||
package_material_name: {
|
||||
key: 'package_material_name',
|
||||
label: '包材名称',
|
||||
scanBox: null,
|
||||
table: { minWidth: 110, showOverflowTooltip: true },
|
||||
slot: null,
|
||||
detailLabel: '包材名称'
|
||||
},
|
||||
pack_status: {
|
||||
key: 'pack_status',
|
||||
label: '打包状态',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.status, options: getOptions('packStatus') },
|
||||
table: { minWidth: 90, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolvePackStatusTag', translateField: 'packStatus' },
|
||||
detailLabel: '打包状态'
|
||||
},
|
||||
// —— 状态信息 ——
|
||||
status: {
|
||||
key: 'status',
|
||||
label: '运单状态',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.status, options: getOptions('waybillStatus') },
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolveWaybillStatusTag', translateField: 'waybillStatus' },
|
||||
detailLabel: '运单状态',
|
||||
filterParamMap: { '未分配': '0', '已分配': '1' }
|
||||
},
|
||||
status_text: {
|
||||
key: 'status_text',
|
||||
label: '状态说明',
|
||||
scanBox: null,
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolveWaybillStatusTag', translateField: 'waybillStatus' },
|
||||
detailLabel: '状态说明'
|
||||
},
|
||||
is_back: {
|
||||
key: 'is_back',
|
||||
label: '是否退回',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.status, options: getOptions('yesNo') },
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolveYesNoTag', translateField: 'yesNo' },
|
||||
detailLabel: '是否退回'
|
||||
},
|
||||
is_intercept: {
|
||||
key: 'is_intercept',
|
||||
label: '是否拦截',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.status, options: getOptions('yesNo') },
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolveYesNoTag', translateField: 'yesNo' },
|
||||
detailLabel: '是否拦截'
|
||||
},
|
||||
is_galaxy_receive: {
|
||||
key: 'is_galaxy_receive',
|
||||
label: '揽收',
|
||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.status, options: getOptions('yesNo') },
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: { type: 'tag', tagResolver: 'resolveYesNoTag', translateField: 'yesNo' },
|
||||
detailLabel: '是否揽收'
|
||||
},
|
||||
// —— 重量与打印 ——
|
||||
weighing_weight: {
|
||||
key: 'weighing_weight',
|
||||
label: '称重(g)',
|
||||
scanBox: null,
|
||||
table: { minWidth: 90, align: 'center', sortable: true },
|
||||
slot: null,
|
||||
detailLabel: '称重重量(g)'
|
||||
},
|
||||
weighing_weight_display: {
|
||||
key: 'weighing_weight_display',
|
||||
label: '称重',
|
||||
scanBox: null,
|
||||
table: { minWidth: 100, align: 'center' },
|
||||
slot: null,
|
||||
detailLabel: '称重重量'
|
||||
},
|
||||
print_count: {
|
||||
key: 'print_count',
|
||||
label: '打印次数',
|
||||
scanBox: null,
|
||||
table: { minWidth: 90, align: 'center', sortable: true },
|
||||
slot: null,
|
||||
detailLabel: '打印次数'
|
||||
},
|
||||
last_print_at: {
|
||||
key: 'last_print_at',
|
||||
label: '最后打印',
|
||||
scanBox: null,
|
||||
table: { minWidth: 170, sortable: true },
|
||||
slot: { type: 'text', format: 'datetime' },
|
||||
detailLabel: '最后打印时间'
|
||||
},
|
||||
// —— 时间信息 ——
|
||||
create_at: {
|
||||
key: 'create_at',
|
||||
label: '创建时间',
|
||||
scanBox: null,
|
||||
table: { minWidth: 170, sortable: true },
|
||||
slot: { type: 'text', format: 'datetime' },
|
||||
detailLabel: '创建时间'
|
||||
},
|
||||
createdAtStart: {
|
||||
key: 'createdAtStart',
|
||||
label: '创建时间',
|
||||
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
||||
table: null,
|
||||
slot: null
|
||||
},
|
||||
// —— 操作列 ——
|
||||
operation: {
|
||||
key: 'operation',
|
||||
label: '操作',
|
||||
scanBox: null,
|
||||
table: { minWidth: 120, fixed: 'right', align: 'center' },
|
||||
slot: { type: 'operation' }
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 三、ColumnSlotConfig / OperationButtonConfig / Detail 类型
|
||||
// ============================================================
|
||||
export interface ColumnSlotConfig {
|
||||
type: 'tag' | 'text' | 'default' | 'operation'
|
||||
tagType?: string | Record<string, string>
|
||||
tagResolver?: string
|
||||
translateField?: string
|
||||
format?: 'datetime'
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
detail?: ComponentApiConfig
|
||||
log?: ComponentApiConfig
|
||||
export?: ApiMethod
|
||||
exportProgress?: ApiMethod
|
||||
scanBoxOptions?: Record<string, ApiMethod>
|
||||
toolbar?: Record<string, ApiMethod>
|
||||
parseListResponse?: (res: any) => { list: any[]; total: number }
|
||||
buildListParams?: (params: {
|
||||
pagination: { page: number; pageSize: number }
|
||||
conditions: Record<string, any>
|
||||
sort?: { prop: string; order: string }
|
||||
}) => Record<string, any>
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 五、TabPageRawConfig / TabPageConfig
|
||||
// ============================================================
|
||||
export interface TabPageRawConfig {
|
||||
name: string
|
||||
label: string
|
||||
scanBoxCacheKey: string
|
||||
scanBoxFieldKeys: string[]
|
||||
tableColumnKeys: string[]
|
||||
upperTableDefaults: {
|
||||
title: string
|
||||
enableColumnConfig?: boolean
|
||||
showIndex?: boolean
|
||||
showSelection?: boolean
|
||||
emptyText?: string
|
||||
}
|
||||
detailTabs?: { name: string; label: string; componentKey: string }[]
|
||||
detailSections: {
|
||||
title: string
|
||||
columnCount: number
|
||||
fieldKeys: string[]
|
||||
}[]
|
||||
api?: TabPageApiConfig
|
||||
operationButtons?: OperationButtonConfig[]
|
||||
}
|
||||
|
||||
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
|
||||
// ============================================================
|
||||
export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
||||
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)
|
||||
}))
|
||||
|
||||
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
|
||||
// ============================================================
|
||||
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
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 八、工具栏按钮系统
|
||||
// ============================================================
|
||||
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: 'handleExportSelected',
|
||||
buttonType: 'dropdown',
|
||||
dropdownOptions: [
|
||||
{ label: '导出选中', action: 'handleExportSelected' },
|
||||
{ label: '导出全部', action: 'handleExportAll', divided: true }
|
||||
]
|
||||
},
|
||||
columnConfig: {
|
||||
key: 'columnConfig',
|
||||
label: '字段设置',
|
||||
category: 'basic',
|
||||
size: 'small',
|
||||
action: 'openColumnConfigPanel'
|
||||
},
|
||||
toggleDetail: {
|
||||
key: 'toggleDetail',
|
||||
label: '显示详情',
|
||||
category: 'basic',
|
||||
dynamicLabelKey: 'detailToggleLabel',
|
||||
size: 'small',
|
||||
action: 'toggleDetailVisible'
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 九、tabPages — 运单列表标签页
|
||||
// ============================================================
|
||||
export const tabPages: TabPageRawConfig[] = [
|
||||
{
|
||||
name: 'waybill-list',
|
||||
label: '运单列表',
|
||||
scanBoxCacheKey: 'waybill-warehouse-list',
|
||||
scanBoxFieldKeys: [
|
||||
'waybill_code',
|
||||
'main_waybill_code',
|
||||
'waybill_type',
|
||||
'store_name',
|
||||
'logistics_code',
|
||||
'platform_code',
|
||||
'status',
|
||||
'pack_status',
|
||||
'is_back',
|
||||
'is_intercept',
|
||||
'is_galaxy_receive',
|
||||
'createdAtStart'
|
||||
],
|
||||
tableColumnKeys: [
|
||||
'waybill_code',
|
||||
'main_waybill_code',
|
||||
'waybill_type',
|
||||
'order_no',
|
||||
'order_id',
|
||||
'business_key',
|
||||
'warehouse_name',
|
||||
'logistics_code',
|
||||
'logistics_name',
|
||||
'logistics_interface_name',
|
||||
'platform_code',
|
||||
'package_material_name',
|
||||
'pack_status',
|
||||
'status',
|
||||
'status_text',
|
||||
'is_back',
|
||||
'is_intercept',
|
||||
'is_galaxy_receive',
|
||||
'weighing_weight',
|
||||
'weighing_weight_display',
|
||||
'print_count',
|
||||
'last_print_at',
|
||||
'create_at',
|
||||
'operation'
|
||||
],
|
||||
upperTableDefaults: {
|
||||
title: '运单列表(仓库侧)',
|
||||
showSelection: true
|
||||
},
|
||||
detailTabs: [
|
||||
{ name: 'detail', label: '运单明细', componentKey: 'DetailPanel' }
|
||||
],
|
||||
detailSections: [
|
||||
{
|
||||
title: '运单基础信息',
|
||||
columnCount: 3,
|
||||
fieldKeys: [
|
||||
'waybill_code', 'main_waybill_code', 'waybill_type',
|
||||
'order_id', 'order_no', 'business_key',
|
||||
'order_type', 'wave_no'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '仓库/货主',
|
||||
columnCount: 2,
|
||||
fieldKeys: ['warehouse_name', 'store_name']
|
||||
},
|
||||
{
|
||||
title: '物流信息',
|
||||
columnCount: 3,
|
||||
fieldKeys: [
|
||||
'logistics_code', 'logistics_name', 'logistics_interface_id',
|
||||
'logistics_interface_name', 'platform_code'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '包裹信息',
|
||||
columnCount: 3,
|
||||
fieldKeys: [
|
||||
'package_material_id', 'package_material_name', 'pack_status',
|
||||
'pack_quantity', 'pack_at', 'packer_name'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '重量与打印',
|
||||
columnCount: 3,
|
||||
fieldKeys: [
|
||||
'weighing_weight', 'weighing_weight_display',
|
||||
'print_count', 'last_print_at'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '运单状态',
|
||||
columnCount: 3,
|
||||
fieldKeys: [
|
||||
'status', 'status_text', 'is_back',
|
||||
'is_intercept', 'is_galaxy_receive'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '时间信息',
|
||||
columnCount: 2,
|
||||
fieldKeys: ['create_at']
|
||||
}
|
||||
],
|
||||
api: {
|
||||
list: waybillWarehouseList as ApiMethod,
|
||||
detail: { source: 'list' } as ComponentApiConfig,
|
||||
export: waybillWarehouseExport as ApiMethod,
|
||||
exportProgress: waybillWarehouseExportTaskProgress as ApiMethod,
|
||||
parseListResponse(res: any) {
|
||||
const data = res?.data ?? res
|
||||
return {
|
||||
list: data?.list ?? data?.data ?? [],
|
||||
total: data?.pagination?.total ?? data?.total ?? 0
|
||||
}
|
||||
},
|
||||
buildListParams({ pagination, conditions, sort }) {
|
||||
const where = buildWhereConditions(conditions)
|
||||
if (conditions?.createdAtStart && Array.isArray(conditions.createdAtStart)) {
|
||||
const [start, end] = conditions.createdAtStart
|
||||
if (start) where.createdAtStart = start
|
||||
if (end) where.createdAtEnd = end
|
||||
}
|
||||
const params: Record<string, any> = {
|
||||
pagination: { page: pagination.page, pageSize: pagination.pageSize },
|
||||
where
|
||||
}
|
||||
if (sort?.prop) {
|
||||
params.sort = {
|
||||
field: sort.prop,
|
||||
order: sort.order === 'ascending' ? 'asc' : 'desc'
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
},
|
||||
operationButtons: [
|
||||
{
|
||||
key: 'viewDetail',
|
||||
label: '查看详情',
|
||||
actionType: 'action',
|
||||
type: 'primary'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
// ============================================================
|
||||
// 十、向后兼容导出
|
||||
// ============================================================
|
||||
export const templateTabs = tabPages.map((t) => ({
|
||||
name: t.name,
|
||||
label: t.label,
|
||||
scanBoxCacheKey: t.scanBoxCacheKey
|
||||
}))
|
||||
1013
src/views/express/waybill/index.vue
Normal file
1013
src/views/express/waybill/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
107
src/views/express/waybill/pages/ExampleFormDialog.vue
Normal file
107
src/views/express/waybill/pages/ExampleFormDialog.vue
Normal 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>
|
||||
@ -387,6 +387,26 @@ export const ORDER_TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
||||
loadingKey: 'resolveExceptionLoading',
|
||||
disabledKey: 'hasNoSelection',
|
||||
action: 'openResolveExceptionDialog'
|
||||
},
|
||||
allocateSubOrderNumber: {
|
||||
key: 'allocateSubOrderNumber',
|
||||
label: '分配子单号',
|
||||
size: 'small',
|
||||
type: 'primary',
|
||||
plain: true,
|
||||
loadingKey: 'allocateSubOrderNumberLoading',
|
||||
disabledKey: 'notSingleSelection',
|
||||
action: 'openAllocateSubOrderNumberDialog'
|
||||
},
|
||||
subWaybillPrint: {
|
||||
key: 'subWaybillPrint',
|
||||
label: '子单号打印',
|
||||
size: 'small',
|
||||
type: 'success',
|
||||
plain: true,
|
||||
loadingKey: 'subWaybillPrintLoading',
|
||||
disabledKey: 'hasNoSelection',
|
||||
action: 'handleSubWaybillPrint'
|
||||
}
|
||||
}
|
||||
|
||||
@ -1468,6 +1488,7 @@ export const deliverybuttonList: any[] = [
|
||||
export const deliveryOrderToolbarButtonKeys = [
|
||||
...simpleListToolbarButtonKeys,
|
||||
'batchPrint',
|
||||
'allocateSubOrderNumber',
|
||||
]
|
||||
export const deliveryOrderToolbarButtons = pickToolbarButtons(deliveryOrderToolbarButtonKeys)
|
||||
|
||||
@ -1859,7 +1880,9 @@ export const pendingToolbarButtonKeys = [
|
||||
'batchLock',
|
||||
'batchUnlock',
|
||||
'batchPrint',
|
||||
'resolveException'
|
||||
'resolveException',
|
||||
'allocateSubOrderNumber',
|
||||
'subWaybillPrint'
|
||||
]
|
||||
|
||||
/** 页面级按钮列表:pendingOrder 直接消费,避免页面内重复拼装 */
|
||||
|
||||
@ -204,6 +204,16 @@
|
||||
@print-success="onBatchPrintSuccess"
|
||||
/>
|
||||
|
||||
<allocate-sub-order-number-form
|
||||
v-model="allocateSubOrderNumberDialogVisible"
|
||||
v-model:sub-order-count="allocateSubOrderNumberCount"
|
||||
:loading="allocateSubOrderNumberLoading"
|
||||
:order-id="allocateSubOrderNumberOrderId"
|
||||
:order-code="allocateSubOrderNumberOrderCode"
|
||||
@closed="resetAllocateSubOrderNumberDialog"
|
||||
@submit="submitAllocateSubOrderNumber"
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
@ -224,6 +234,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { orderDeliveryOrder } from '@/api/order.deliveryorder/orderdeliveryOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
|
||||
import {
|
||||
deliveryAvailableFields,
|
||||
@ -250,6 +261,7 @@ import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useOrderBatchPrint } from './utils/use-order-batch-print'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import { createSimpleListToolbarController } from './utils/toolbar-actions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
const scanBox = ref<any>(null)
|
||||
@ -486,11 +498,13 @@ function openColumnConfigPanel() {
|
||||
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||
exportLoading: exportLoading.value,
|
||||
exportSelectionLoading: exportSelectionLoading.value,
|
||||
batchPrintLoading: batchPrintLoading.value
|
||||
batchPrintLoading: batchPrintLoading.value,
|
||||
allocateSubOrderNumberLoading: allocateSubOrderNumberLoading.value
|
||||
}))
|
||||
|
||||
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
|
||||
hasNoSelection: selectionRows.value.length === 0
|
||||
hasNoSelection: selectionRows.value.length === 0,
|
||||
notSingleSelection: selectionRows.value.length !== 1
|
||||
}))
|
||||
|
||||
const buttonLabelMap = computed<Record<string, string>>(() => ({
|
||||
@ -517,6 +531,70 @@ const { actionMap: toolbarActionMap } = createSimpleListToolbarController({
|
||||
|
||||
toolbarActionMap.handleBatchPrint = handleBatchPrint
|
||||
|
||||
// 分配子单号
|
||||
const allocateSubOrderNumberDialogVisible = ref(false)
|
||||
const allocateSubOrderNumberLoading = ref(false)
|
||||
const allocateSubOrderNumberOrderId = ref<number | null>(null)
|
||||
const allocateSubOrderNumberOrderCode = ref('')
|
||||
const allocateSubOrderNumberCount = ref(1)
|
||||
|
||||
function openAllocateSubOrderNumberDialog() {
|
||||
const rows = selectionRows.value
|
||||
if (rows.length !== 1) {
|
||||
ElMessage.warning('请选择 1 条订单进行子单号分配')
|
||||
return
|
||||
}
|
||||
const row = rows[0] || {}
|
||||
const orderId = Number(row?.order_id ?? row?.id)
|
||||
if (!orderId || !Number.isInteger(orderId) || orderId <= 0) {
|
||||
ElMessage.error('未识别到有效订单ID')
|
||||
return
|
||||
}
|
||||
allocateSubOrderNumberOrderId.value = orderId
|
||||
allocateSubOrderNumberOrderCode.value = String(row?.delivery_order_code || '')
|
||||
allocateSubOrderNumberCount.value = 1
|
||||
allocateSubOrderNumberDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function submitAllocateSubOrderNumber() {
|
||||
if (!allocateSubOrderNumberOrderId.value || allocateSubOrderNumberLoading.value) return
|
||||
const sub_order_count = Math.max(1, Number(allocateSubOrderNumberCount.value) || 1)
|
||||
allocateSubOrderNumberLoading.value = true
|
||||
try {
|
||||
const res = await orderPendingOrder.allocateSubOrderNumber({
|
||||
order_id: allocateSubOrderNumberOrderId.value,
|
||||
sub_order_count
|
||||
})
|
||||
const ok = res && (res.code === 1 || res.code === 200 || res.flag === 'success')
|
||||
if (!ok) {
|
||||
ElMessage.error(res?.message || '分配子单号失败')
|
||||
return
|
||||
}
|
||||
const taskId = res?.data?.task_id || res?.task_id
|
||||
ElMessage.success(
|
||||
taskId
|
||||
? `分配子单号任务已受理(任务ID: ${taskId})`
|
||||
: (res?.message || '分配子单号成功')
|
||||
)
|
||||
allocateSubOrderNumberDialogVisible.value = false
|
||||
upperTable.value?.clearSelection?.()
|
||||
selectionRows.value = []
|
||||
await loadData()
|
||||
} catch {
|
||||
ElMessage.error('分配子单号失败')
|
||||
} finally {
|
||||
allocateSubOrderNumberLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllocateSubOrderNumberDialog() {
|
||||
allocateSubOrderNumberOrderId.value = null
|
||||
allocateSubOrderNumberOrderCode.value = ''
|
||||
allocateSubOrderNumberCount.value = 1
|
||||
}
|
||||
|
||||
toolbarActionMap.openAllocateSubOrderNumberDialog = openAllocateSubOrderNumberDialog
|
||||
|
||||
function resolveButtonLoading(loadingKey?: string) {
|
||||
if (!loadingKey) return false
|
||||
return Boolean(buttonLoadingMap.value[loadingKey])
|
||||
|
||||
@ -361,6 +361,15 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<allocate-sub-order-number-form
|
||||
v-model="allocateSubOrderNumberDialogVisible"
|
||||
:loading="allocateSubOrderNumberLoading"
|
||||
:order-id="allocateSubOrderNumberOrderId"
|
||||
:order-code="allocateSubOrderNumberOrderCode"
|
||||
@closed="resetAllocateSubOrderNumberDialog"
|
||||
@submit="submitAllocateSubOrderNumber"
|
||||
/>
|
||||
|
||||
<wave-platform-print-preview-dialog
|
||||
v-model="batchPrintDialogVisible"
|
||||
:error-message="batchPrintErrorMessage"
|
||||
@ -424,6 +433,7 @@ import BatchQuickRecheckForm from './form/BatchQuickRecheckForm.vue'
|
||||
import UpdateAddressForm from './form/UpdateAddressForm.vue'
|
||||
import UpdateRemarkForm from './form/UpdateRemarkForm.vue'
|
||||
import BatchAsyncTaskForm from './form/BatchAsyncTaskForm.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from './utils/order-index-helpers'
|
||||
@ -931,7 +941,11 @@ const {
|
||||
batchAsyncTaskOrderIds,
|
||||
batchAsyncTaskPhase,
|
||||
batchAsyncTaskProgress,
|
||||
waveSingleFetchLoading
|
||||
waveSingleFetchLoading,
|
||||
allocateSubOrderNumberDialogVisible,
|
||||
allocateSubOrderNumberLoading,
|
||||
allocateSubOrderNumberOrderId,
|
||||
allocateSubOrderNumberOrderCode
|
||||
},
|
||||
submitStorageAllocate,
|
||||
submitUpdateOrderMeta,
|
||||
@ -942,6 +956,7 @@ const {
|
||||
submitUpdateAddress,
|
||||
submitUpdateRemark,
|
||||
submitBatchAsyncTask,
|
||||
submitAllocateSubOrderNumber,
|
||||
handleBatchQuickRecheckSuccess,
|
||||
closeAllocateExpressProgress,
|
||||
resetAllocateDialog,
|
||||
@ -953,7 +968,8 @@ const {
|
||||
resetBatchQuickRecheckDialog,
|
||||
resetUpdateAddressDialog,
|
||||
resetUpdateRemarkDialog,
|
||||
resetBatchAsyncTaskDialog
|
||||
resetBatchAsyncTaskDialog,
|
||||
resetAllocateSubOrderNumberDialog
|
||||
} = createPendingToolbarController({
|
||||
loadData,
|
||||
handleExport,
|
||||
@ -997,7 +1013,8 @@ const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||
batchAsyncTaskLoading: batchAsyncTaskLoading.value,
|
||||
resolveExceptionLoading: resolveExceptionLoading.value,
|
||||
waveSingleFetchLoading: waveSingleFetchLoading.value,
|
||||
batchPrintLoading: batchPrintLoading.value
|
||||
batchPrintLoading: batchPrintLoading.value,
|
||||
allocateSubOrderNumberLoading: allocateSubOrderNumberLoading.value
|
||||
}))
|
||||
|
||||
const toolbarLayoutKey = computed(() =>
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="分配子单号"
|
||||
width="520px"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formModel"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
class="allocate-sub-order-form"
|
||||
@submit.prevent
|
||||
>
|
||||
<el-form-item label="订单 ID">
|
||||
<span class="readonly-value">{{ orderId ?? '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单号">
|
||||
<span class="readonly-value">{{ orderCode || '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="子单号数量" prop="sub_order_count">
|
||||
<el-input-number
|
||||
v-model="formModel.sub_order_count"
|
||||
:min="1"
|
||||
:max="999"
|
||||
:step="1"
|
||||
placeholder="请输入子单号数量"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleSubmit">确认分配</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
const subOrderCount = defineModel<number>('subOrderCount', { default: 1 })
|
||||
|
||||
defineProps<{
|
||||
loading: boolean
|
||||
orderId: number | null
|
||||
orderCode: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'submit'): void
|
||||
(e: 'closed'): void
|
||||
}>()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
const formModel = reactive({
|
||||
sub_order_count: subOrderCount.value
|
||||
})
|
||||
|
||||
watch(
|
||||
() => subOrderCount.value,
|
||||
(value) => {
|
||||
formModel.sub_order_count = value
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => formModel.sub_order_count,
|
||||
(value) => {
|
||||
if (subOrderCount.value !== value) {
|
||||
subOrderCount.value = value
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const rules: FormRules = {
|
||||
sub_order_count: [
|
||||
{ required: true, message: '请输入子单号数量', trigger: 'blur' },
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
const n = Number(value)
|
||||
if (!Number.isInteger(n) || n < 1) {
|
||||
callback(new Error('子单号数量必须为不小于 1 的整数'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
emit('submit')
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
formRef.value?.resetFields()
|
||||
formModel.sub_order_count = 1
|
||||
emit('closed')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.allocate-sub-order-form {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.readonly-value {
|
||||
color: #606266;
|
||||
}
|
||||
</style>
|
||||
@ -326,6 +326,15 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<allocate-sub-order-number-form
|
||||
v-model="allocateSubOrderNumberDialogVisible"
|
||||
:loading="allocateSubOrderNumberLoading"
|
||||
:order-id="allocateSubOrderNumberOrderId"
|
||||
:order-code="allocateSubOrderNumberOrderCode"
|
||||
@closed="resetAllocateSubOrderNumberDialog"
|
||||
@submit="submitAllocateSubOrderNumber"
|
||||
/>
|
||||
|
||||
<wave-platform-print-preview-dialog
|
||||
v-model="batchPrintDialogVisible"
|
||||
:error-message="batchPrintErrorMessage"
|
||||
@ -334,6 +343,14 @@
|
||||
@refresh="handleBatchPrintRefresh"
|
||||
@print-success="onBatchPrintSuccess"
|
||||
/>
|
||||
<wave-platform-print-preview-dialog
|
||||
v-model="subWaybillPrintDialogVisible"
|
||||
:error-message="subWaybillPrintErrorMessage"
|
||||
:payload="subWaybillPrintPayload"
|
||||
:request-meta="subWaybillPrintRequestMeta"
|
||||
@refresh="handleSubWaybillPrintRefresh"
|
||||
@print-success="onSubWaybillPrintSuccess"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<order-export-progress-dialog
|
||||
@ -389,12 +406,14 @@ import BatchQuickRecheckForm from './form/BatchQuickRecheckForm.vue'
|
||||
import UpdateAddressForm from './form/UpdateAddressForm.vue'
|
||||
import UpdateRemarkForm from './form/UpdateRemarkForm.vue'
|
||||
import BatchAsyncTaskForm from './form/BatchAsyncTaskForm.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderInterceptStatus, resolveOrderRecheckStatus } from './utils/order-index-helpers'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useOrderBatchPrint } from './utils/use-order-batch-print'
|
||||
import { useSubWaybillPrint } from './utils/use-sub-waybill-print'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createPendingToolbarController } from './utils/toolbar-actions'
|
||||
@ -509,11 +528,29 @@ const {
|
||||
onPrintSuccess: () => loadData()
|
||||
})
|
||||
|
||||
const {
|
||||
dialogVisible: subWaybillPrintDialogVisible,
|
||||
loading: subWaybillPrintLoading,
|
||||
errorMessage: subWaybillPrintErrorMessage,
|
||||
payload: subWaybillPrintPayload,
|
||||
requestMeta: subWaybillPrintRequestMeta,
|
||||
resetState: resetSubWaybillPrintState,
|
||||
handlePrint: handleSubWaybillPrint,
|
||||
handleRefresh: handleSubWaybillPrintRefresh,
|
||||
onPrintSuccess: onSubWaybillPrintSuccess
|
||||
} = useSubWaybillPrint({
|
||||
getSelectionRows: () => selectionRows.value,
|
||||
onPrintSuccess: () => loadData()
|
||||
})
|
||||
|
||||
useOrderListPageCleanup({
|
||||
list,
|
||||
selectionRows,
|
||||
selectedOrderId,
|
||||
onCleanup: resetBatchPrintState
|
||||
onCleanup: () => {
|
||||
resetBatchPrintState()
|
||||
resetSubWaybillPrintState()
|
||||
}
|
||||
})
|
||||
|
||||
async function loadData() {
|
||||
@ -778,7 +815,11 @@ const {
|
||||
batchAsyncTaskOrderIds,
|
||||
batchAsyncTaskPhase,
|
||||
batchAsyncTaskProgress,
|
||||
waveSingleFetchLoading
|
||||
waveSingleFetchLoading,
|
||||
allocateSubOrderNumberDialogVisible,
|
||||
allocateSubOrderNumberLoading,
|
||||
allocateSubOrderNumberOrderId,
|
||||
allocateSubOrderNumberOrderCode
|
||||
},
|
||||
submitStorageAllocate,
|
||||
submitUpdateOrderMeta,
|
||||
@ -789,6 +830,7 @@ const {
|
||||
submitUpdateAddress,
|
||||
submitUpdateRemark,
|
||||
submitBatchAsyncTask,
|
||||
submitAllocateSubOrderNumber,
|
||||
handleBatchQuickRecheckSuccess,
|
||||
closeAllocateExpressProgress,
|
||||
resetAllocateDialog,
|
||||
@ -800,7 +842,8 @@ const {
|
||||
resetBatchQuickRecheckDialog,
|
||||
resetUpdateAddressDialog,
|
||||
resetUpdateRemarkDialog,
|
||||
resetBatchAsyncTaskDialog
|
||||
resetBatchAsyncTaskDialog,
|
||||
resetAllocateSubOrderNumberDialog
|
||||
} = createPendingToolbarController({
|
||||
loadData,
|
||||
handleExport,
|
||||
@ -825,6 +868,7 @@ const {
|
||||
|
||||
toolbarActionMap['openResolveExceptionDialog'] = openResolveExceptionDialog
|
||||
toolbarActionMap['handleBatchPrint'] = handleBatchPrint
|
||||
toolbarActionMap['handleSubWaybillPrint'] = handleSubWaybillPrint
|
||||
|
||||
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||
exportLoading: exportLoading.value,
|
||||
@ -841,7 +885,9 @@ const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||
batchAsyncTaskLoading: batchAsyncTaskLoading.value,
|
||||
resolveExceptionLoading: resolveExceptionLoading.value,
|
||||
waveSingleFetchLoading: waveSingleFetchLoading.value,
|
||||
batchPrintLoading: batchPrintLoading.value
|
||||
batchPrintLoading: batchPrintLoading.value,
|
||||
allocateSubOrderNumberLoading: allocateSubOrderNumberLoading.value,
|
||||
subWaybillPrintLoading: subWaybillPrintLoading.value
|
||||
}))
|
||||
|
||||
const toolbarLayoutKey = computed(() =>
|
||||
|
||||
@ -618,6 +618,71 @@ export function createPendingToolbarController(params: {
|
||||
|
||||
const waveSingleFetchLoading = ref(false)
|
||||
|
||||
// 分配子单号
|
||||
const allocateSubOrderNumberDialogVisible = ref(false)
|
||||
const allocateSubOrderNumberLoading = ref(false)
|
||||
const allocateSubOrderNumberOrderId = ref<number | null>(null)
|
||||
const allocateSubOrderNumberOrderCode = ref('')
|
||||
const allocateSubOrderNumberForm = reactive({ sub_order_count: 1 })
|
||||
|
||||
function openAllocateSubOrderNumberDialog() {
|
||||
const rows = params.getSelectedRows()
|
||||
if (rows.length !== 1) {
|
||||
ElMessage.warning('请选择 1 条订单进行子单号分配')
|
||||
return
|
||||
}
|
||||
const row = rows[0] || {}
|
||||
const orderId = normalizePositiveIntId(row?.order_id ?? row?.id)
|
||||
if (!orderId) {
|
||||
ElMessage.error('未识别到有效订单ID')
|
||||
return
|
||||
}
|
||||
allocateSubOrderNumberOrderId.value = orderId
|
||||
allocateSubOrderNumberOrderCode.value = String(row?.delivery_order_code || '')
|
||||
allocateSubOrderNumberForm.sub_order_count = 1
|
||||
allocateSubOrderNumberDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function submitAllocateSubOrderNumber() {
|
||||
if (!allocateSubOrderNumberOrderId.value || allocateSubOrderNumberLoading.value) return
|
||||
const sub_order_count = Number(allocateSubOrderNumberForm.sub_order_count) || 1
|
||||
if (sub_order_count < 1) {
|
||||
ElMessage.warning('子单号数量不能小于 1')
|
||||
return
|
||||
}
|
||||
allocateSubOrderNumberLoading.value = true
|
||||
try {
|
||||
const res = await params.pendingApi.allocateSubOrderNumber({
|
||||
order_id: allocateSubOrderNumberOrderId.value,
|
||||
sub_order_count
|
||||
})
|
||||
const ok = res && (res.code === 1 || res.code === 200 || res.flag === 'success')
|
||||
if (!ok) {
|
||||
ElMessage.error(res?.message || '分配子单号失败')
|
||||
return
|
||||
}
|
||||
const taskId = res?.data?.task_id || res?.task_id
|
||||
ElMessage.success(
|
||||
taskId
|
||||
? `分配子单号任务已受理(任务ID: ${taskId})`
|
||||
: (res?.message || '分配子单号成功')
|
||||
)
|
||||
allocateSubOrderNumberDialogVisible.value = false
|
||||
params.clearSelection()
|
||||
await params.loadData()
|
||||
} catch {
|
||||
ElMessage.error('分配子单号失败')
|
||||
} finally {
|
||||
allocateSubOrderNumberLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllocateSubOrderNumberDialog() {
|
||||
allocateSubOrderNumberOrderId.value = null
|
||||
allocateSubOrderNumberOrderCode.value = ''
|
||||
allocateSubOrderNumberForm.sub_order_count = 1
|
||||
}
|
||||
|
||||
async function handleWaveSingleFetchByIds() {
|
||||
const ids = params.getSelectedIds()
|
||||
if (!ids.length) {
|
||||
@ -701,7 +766,8 @@ export function createPendingToolbarController(params: {
|
||||
openCloneOrderDialog,
|
||||
openSyncOrderIdsDialog,
|
||||
openBatchQuickRecheckDialog,
|
||||
handleWaveSingleFetchByIds
|
||||
handleWaveSingleFetchByIds,
|
||||
openAllocateSubOrderNumberDialog
|
||||
},
|
||||
getSelectedIds: params.getSelectedIds,
|
||||
pendingApi: params.pendingApi,
|
||||
@ -1452,7 +1518,11 @@ export function createPendingToolbarController(params: {
|
||||
batchAsyncTaskOrderIds,
|
||||
batchAsyncTaskPhase,
|
||||
batchAsyncTaskProgress,
|
||||
waveSingleFetchLoading
|
||||
waveSingleFetchLoading,
|
||||
allocateSubOrderNumberDialogVisible,
|
||||
allocateSubOrderNumberLoading,
|
||||
allocateSubOrderNumberOrderId,
|
||||
allocateSubOrderNumberOrderCode
|
||||
},
|
||||
submitStorageAllocate,
|
||||
submitUpdateOrderMeta,
|
||||
@ -1463,6 +1533,7 @@ export function createPendingToolbarController(params: {
|
||||
submitUpdateAddress,
|
||||
submitUpdateRemark,
|
||||
submitBatchAsyncTask,
|
||||
submitAllocateSubOrderNumber,
|
||||
handleBatchQuickRecheckSuccess,
|
||||
closeAllocateExpressProgress,
|
||||
resetAllocateDialog,
|
||||
@ -1474,7 +1545,8 @@ export function createPendingToolbarController(params: {
|
||||
resetBatchQuickRecheckDialog,
|
||||
resetUpdateAddressDialog,
|
||||
resetUpdateRemarkDialog,
|
||||
resetBatchAsyncTaskDialog
|
||||
resetBatchAsyncTaskDialog,
|
||||
resetAllocateSubOrderNumberDialog
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
157
src/views/order/orderManagement/utils/use-sub-waybill-print.ts
Normal file
157
src/views/order/orderManagement/utils/use-sub-waybill-print.ts
Normal file
@ -0,0 +1,157 @@
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
getPrintDataByWaybillCodes,
|
||||
type WavePlatformPrintDataPayload
|
||||
} from '@/api/order.print/orderprint'
|
||||
import { unwrapWavePlatformPrintPayload } from '@/views/order/waveOrder/config/wave-config'
|
||||
import { orderDetail } from '@/api/order.index/orderindex'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '../utils/order-index-helpers'
|
||||
|
||||
type SubWaybillPrintRequestMeta = {
|
||||
waybill_codes: string[]
|
||||
order_ids: Array<number | string>
|
||||
}
|
||||
|
||||
type UseSubWaybillPrintOptions = {
|
||||
getSelectionRows: () => any[]
|
||||
onPrintSuccess?: () => void
|
||||
emptySelectionMessage?: string
|
||||
}
|
||||
|
||||
function isPrintApiSuccess(code: unknown) {
|
||||
return code === undefined || code === null || code === 1 || code === 200 || code === 0
|
||||
}
|
||||
|
||||
function collectOrderIds(rows: any[]): number[] {
|
||||
const ids: number[] = []
|
||||
const seen = new Set<number>()
|
||||
for (const row of rows) {
|
||||
const id = Number(row?.id)
|
||||
if (Number.isInteger(id) && id > 0 && !seen.has(id)) {
|
||||
seen.add(id)
|
||||
ids.push(id)
|
||||
}
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
export function useSubWaybillPrint(options: UseSubWaybillPrintOptions) {
|
||||
const dialogVisible = ref(false)
|
||||
const loading = ref(false)
|
||||
const errorMessage = ref('')
|
||||
const payload = ref<any>(null)
|
||||
const requestMeta = ref<SubWaybillPrintRequestMeta | null>(null)
|
||||
|
||||
function resetState() {
|
||||
payload.value = null
|
||||
requestMeta.value = null
|
||||
errorMessage.value = ''
|
||||
}
|
||||
|
||||
/** 根据订单 ID 查询运单号(使用快递信息接口 orderDetail) */
|
||||
async function fetchWaybillCodes(orderIds: number[]): Promise<string[]> {
|
||||
const waybillCodes: string[] = []
|
||||
const seen = new Set<string>()
|
||||
|
||||
for (const id of orderIds) {
|
||||
try {
|
||||
const res: any = await orderDetail({
|
||||
id,
|
||||
ids: [id],
|
||||
tableType: 'order'
|
||||
})
|
||||
if (!isOrderIndexApiSuccess(res)) continue
|
||||
const data = parseOrderDetailPayload(res)
|
||||
const expressList = normalizeOrderExpressList(data)
|
||||
for (const item of expressList) {
|
||||
const code = item?.waybill_code
|
||||
if (code && !seen.has(code)) {
|
||||
seen.add(code)
|
||||
waybillCodes.push(code)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// 单个订单查询失败继续
|
||||
}
|
||||
}
|
||||
return waybillCodes
|
||||
}
|
||||
|
||||
async function handlePrint() {
|
||||
const rows = options.getSelectionRows()
|
||||
if (!rows.length) {
|
||||
ElMessage.warning(options.emptySelectionMessage || '请先勾选需要打印子单号的订单')
|
||||
return
|
||||
}
|
||||
if (loading.value) return
|
||||
|
||||
const orderIds = collectOrderIds(rows)
|
||||
if (!orderIds.length) {
|
||||
ElMessage.warning('当前勾选记录缺少可用的订单 ID')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
errorMessage.value = ''
|
||||
payload.value = null
|
||||
|
||||
try {
|
||||
// 1. 通过快递信息接口查询运单号
|
||||
const waybillCodes = await fetchWaybillCodes(orderIds)
|
||||
if (!waybillCodes.length) {
|
||||
throw new Error('未查询到选中订单的运单号,请确认订单已分配快递号')
|
||||
}
|
||||
|
||||
// 2. 获取打印数据
|
||||
const res: any = await getPrintDataByWaybillCodes({ waybill_codes: waybillCodes })
|
||||
if (!isPrintApiSuccess(res?.code)) {
|
||||
throw new Error(res?.message || '获取打印数据失败')
|
||||
}
|
||||
payload.value = unwrapWavePlatformPrintPayload(res)
|
||||
requestMeta.value = { waybill_codes: waybillCodes, order_ids: orderIds }
|
||||
dialogVisible.value = true
|
||||
ElMessage.success(res?.message || `已获取 ${waybillCodes.length} 个运单的打印数据`)
|
||||
} catch (error: any) {
|
||||
payload.value = null
|
||||
errorMessage.value = error?.message || '获取打印数据失败'
|
||||
dialogVisible.value = true
|
||||
ElMessage.error(errorMessage.value)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRefresh() {
|
||||
const meta = requestMeta.value
|
||||
if (!meta || !meta.waybill_codes.length) return
|
||||
try {
|
||||
const res: any = await getPrintDataByWaybillCodes({ waybill_codes: meta.waybill_codes })
|
||||
if (!isPrintApiSuccess(res?.code)) {
|
||||
throw new Error(res?.message || '刷新打印数据失败')
|
||||
}
|
||||
payload.value = unwrapWavePlatformPrintPayload(res)
|
||||
errorMessage.value = ''
|
||||
} catch (error: any) {
|
||||
payload.value = null
|
||||
errorMessage.value = error?.message || '刷新打印数据失败'
|
||||
ElMessage.error(errorMessage.value)
|
||||
}
|
||||
}
|
||||
|
||||
function onPrintSuccess() {
|
||||
options.onPrintSuccess?.()
|
||||
}
|
||||
|
||||
return {
|
||||
dialogVisible,
|
||||
loading,
|
||||
errorMessage,
|
||||
payload,
|
||||
requestMeta,
|
||||
resetState,
|
||||
handlePrint,
|
||||
handleRefresh,
|
||||
onPrintSuccess
|
||||
}
|
||||
}
|
||||
@ -241,6 +241,7 @@ import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
|
||||
import { unlockWavePlatformPrintDataByGroup } from '@/api/order.print/orderprint'
|
||||
import * as stationApi from '@/api/print/print'
|
||||
import type { PrintSendParams } from '@/api/print/print'
|
||||
import { orderModule } from '@/api/order/order'
|
||||
import {
|
||||
getBrowserPrintUsageHint,
|
||||
getLoopbackPrinterAccessHint
|
||||
@ -1035,6 +1036,40 @@ async function notifyLockAfterBrowserPrint(
|
||||
}
|
||||
}
|
||||
|
||||
/** 精简 waveGroups 数据,移除 print.send 不需要的字段 */
|
||||
function stripRedundantPrintFields(waveGroups: unknown[]): unknown[] {
|
||||
return waveGroups.map((wg: any) => {
|
||||
if (!wg || typeof wg !== 'object') return wg
|
||||
const platforms = Array.isArray(wg.platforms)
|
||||
? wg.platforms.map((p: any) => {
|
||||
if (!p || typeof p !== 'object') return p
|
||||
const orders = Array.isArray(p.orders)
|
||||
? p.orders.map((o: any) => {
|
||||
if (!o || typeof o !== 'object') return o
|
||||
const contents = Array.isArray(o.contents)
|
||||
? o.contents.map((c: any) => {
|
||||
if (!c || typeof c !== 'object') return c
|
||||
const { config, ...rest } = c
|
||||
return rest
|
||||
})
|
||||
: o.contents
|
||||
return { ...o, contents }
|
||||
})
|
||||
: p.orders
|
||||
const {
|
||||
platform_name: _pn,
|
||||
sys_logistics_name: _sln,
|
||||
order_count: _oc,
|
||||
order_ids: _oi,
|
||||
...restPlatform
|
||||
} = p
|
||||
return { ...restPlatform, orders }
|
||||
})
|
||||
: wg.platforms
|
||||
return { ...wg, platforms }
|
||||
})
|
||||
}
|
||||
|
||||
async function printToStation() {
|
||||
if (!printSettings.station) {
|
||||
ElMessage.warning('请选择打印台')
|
||||
@ -1063,7 +1098,7 @@ async function printToStation() {
|
||||
type: 'express',
|
||||
printStationId: sid,
|
||||
requestCode,
|
||||
data: { waveGroups }
|
||||
data: { waveGroups: stripRedundantPrintFields(waveGroups as unknown[]) }
|
||||
}
|
||||
const res: any = await stationApi.sendPrint(printPayload)
|
||||
if (res && (res.code === 0 || res.code === 200 || res.flag === 'success' || res.status === 'success')) {
|
||||
@ -1104,6 +1139,42 @@ function clearSavedStationId() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 从浏览器打印结果中提取成功打印的订单 ID 列表 */
|
||||
function collectPrintedOrderIds(
|
||||
waveGroups: unknown[],
|
||||
items: BrowserWavePrintItemResult[],
|
||||
): number[] {
|
||||
const successKeys = new Set(
|
||||
items
|
||||
.filter((item) => item.flag === 'success')
|
||||
.map((item) => `${item.wave_id}::${item.platform}::${item.platform_name}`),
|
||||
)
|
||||
if (!successKeys.size) return []
|
||||
|
||||
const orderIds: number[] = []
|
||||
for (const rawWave of waveGroups) {
|
||||
const wave = rawWave as AnyRecord | null
|
||||
if (!wave) continue
|
||||
const wave_id = String(wave.wave_id ?? '')
|
||||
const rawPlatforms = Array.isArray(wave.platforms) ? wave.platforms : []
|
||||
for (const rawPlatform of rawPlatforms) {
|
||||
const p = rawPlatform as AnyRecord | null
|
||||
if (!p) continue
|
||||
const platform = String(p.platform ?? '').trim()
|
||||
const platform_name = String(p.platform_name ?? platform).trim() || platform
|
||||
if (!successKeys.has(`${wave_id}::${platform}::${platform_name}`)) continue
|
||||
const ids = Array.isArray(p.order_ids) ? p.order_ids : []
|
||||
ids.forEach((id: any) => {
|
||||
const num = Number(id)
|
||||
if (Number.isFinite(num) && !orderIds.includes(num)) {
|
||||
orderIds.push(num)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return orderIds
|
||||
}
|
||||
|
||||
async function printReport() {
|
||||
console.log('[wave browser print] printReport: 用户点击浏览器打印')
|
||||
|
||||
@ -1185,7 +1256,20 @@ async function printReport() {
|
||||
const lockResult = await notifyLockAfterBrowserPrint(waveGroups, result.items)
|
||||
console.log('[wave browser print] printReport: notifyLock 返回', lockResult)
|
||||
|
||||
// 锁定成功后,标记已打印订单
|
||||
if (lockResult.ok) {
|
||||
const printedOrderIds = collectPrintedOrderIds(waveGroups, result.items)
|
||||
if (printedOrderIds.length > 0) {
|
||||
try {
|
||||
const markRes: any = await orderModule.pendingOrderBatchMarkPrinted({ order_ids: printedOrderIds })
|
||||
console.log('[wave browser print] printReport: batchMarkPrinted 返回', {
|
||||
requested: printedOrderIds.length,
|
||||
updated: markRes?.data?.updated_count ?? markRes?.updated_count ?? '?',
|
||||
})
|
||||
} catch (markErr) {
|
||||
console.warn('[wave browser print] printReport: batchMarkPrinted 失败', markErr)
|
||||
}
|
||||
}
|
||||
if (isPartial) {
|
||||
ElMessage.warning(`${result.message};${lockResult.message || '已成功分组订单已锁定'}`)
|
||||
console.warn('[wave browser print] failed groups:', result.items.filter((item) => item.flag === 'failure'))
|
||||
|
||||
@ -152,6 +152,7 @@ type ReceivingBindingRow = {
|
||||
receiving_id?: number
|
||||
receiving_number: string
|
||||
status_label: string
|
||||
storage_status_label: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@
|
||||
size="small"
|
||||
@click.stop="handleReviewEntry(row)"
|
||||
>
|
||||
开始入库
|
||||
推送到仓库
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canQuickInbound(row.order_status, row.hasReceiving, row.receivingBindings)"
|
||||
|
||||
@ -243,7 +243,7 @@ export function downloadDirectInboundImportTemplate(
|
||||
) {
|
||||
const exportData = entryItems.map((item) => {
|
||||
const mapped: Record<string, unknown> = {}
|
||||
entrydetail.forEach((column) => {
|
||||
entrydetail.forEach((column: any) => {
|
||||
const prop = String(column.prop)
|
||||
const label = column.label || prop
|
||||
const rawValue = item[prop]
|
||||
|
||||
@ -1492,7 +1492,6 @@ async function handleQuickPutaway() {
|
||||
}
|
||||
}
|
||||
|
||||
// 导出相关 —— 使用异步任务模式
|
||||
function buildExportPayload() {
|
||||
if (currentCondition.value && currentCondition.value !== 'reset') {
|
||||
return { where: normalizeToWhere(currentCondition.value) }
|
||||
|
||||
@ -552,7 +552,7 @@ export const receivingToolbarButtons: ToolbarButtonConfig[] = [
|
||||
buttonType: 'dropdown',
|
||||
dropdownOptions: [
|
||||
{ label: '导出选中', action: 'handleExportSelected' },
|
||||
{ label: '导出全部', action: 'handleExportAll', divided: true }
|
||||
{ label: '导出全部', action: 'handleExportAll', divided: true },
|
||||
]
|
||||
},
|
||||
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user