1
This commit is contained in:
parent
8cdc82b4ff
commit
1706b927e7
BIN
dist.tar.gz
BIN
dist.tar.gz
Binary file not shown.
@ -329,6 +329,18 @@ export const ORDER_TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
|||||||
disabledKey: 'hasNoSelection',
|
disabledKey: 'hasNoSelection',
|
||||||
action: 'handleExportSelection'
|
action: 'handleExportSelection'
|
||||||
},
|
},
|
||||||
|
deliveryExport: {
|
||||||
|
key: 'deliveryExport',
|
||||||
|
label: '导出',
|
||||||
|
size: 'small',
|
||||||
|
loadingKey: 'exportLoading',
|
||||||
|
action: 'handleExportWaybill',
|
||||||
|
buttonType: 'dropdown',
|
||||||
|
dropdownOptions: [
|
||||||
|
{ label: '导出选中', action: 'handleExportSelection' },
|
||||||
|
{ label: '导出全部', action: 'handleExportWaybill' }
|
||||||
|
]
|
||||||
|
},
|
||||||
columnConfig: { key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
|
columnConfig: { key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
|
||||||
toggleDetail: { key: 'toggleDetail', label: '显示详情', dynamicLabelKey: 'detailToggleLabel', size: 'small', action: 'toggleDetailVisible' },
|
toggleDetail: { key: 'toggleDetail', label: '显示详情', dynamicLabelKey: 'detailToggleLabel', size: 'small', action: 'toggleDetailVisible' },
|
||||||
reverseReview: { key: 'reverseReview', label: '反审回待审核', size: 'small', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleReverseReview' },
|
reverseReview: { key: 'reverseReview', label: '反审回待审核', size: 'small', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleReverseReview' },
|
||||||
@ -1486,7 +1498,10 @@ export const deliverybuttonList: any[] = [
|
|||||||
|
|
||||||
/** deliveryOrder */
|
/** deliveryOrder */
|
||||||
export const deliveryOrderToolbarButtonKeys = [
|
export const deliveryOrderToolbarButtonKeys = [
|
||||||
...simpleListToolbarButtonKeys,
|
'refresh',
|
||||||
|
'deliveryExport',
|
||||||
|
'columnConfig',
|
||||||
|
'toggleDetail',
|
||||||
'batchPrint',
|
'batchPrint',
|
||||||
'allocateSubOrderNumber',
|
'allocateSubOrderNumber',
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1609,6 +1609,14 @@ function shouldAlignPrinterViaComponent(component: string): boolean {
|
|||||||
return v as Record<string, unknown>;
|
return v as Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function chunkArray<T>(arr: T[], size: number): T[][] {
|
||||||
|
const chunks: T[][] = []
|
||||||
|
for (let i = 0; i < arr.length; i += size) {
|
||||||
|
chunks.push(arr.slice(i, i + size))
|
||||||
|
}
|
||||||
|
return chunks
|
||||||
|
}
|
||||||
|
|
||||||
function createBrowserPrinterListFetcher(printer: string): () => Promise<PrinterInfo[]> {
|
function createBrowserPrinterListFetcher(printer: string): () => Promise<PrinterInfo[]> {
|
||||||
return async () => [{ name: printer, workOffline: 'FALSE' }];
|
return async () => [{ name: printer, workOffline: 'FALSE' }];
|
||||||
}
|
}
|
||||||
@ -1915,7 +1923,8 @@ async function resolveFinalExpressPrinter(
|
|||||||
platformCount: rawPlatforms.length,
|
platformCount: rawPlatforms.length,
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const rawPlatform of rawPlatforms) {
|
for (let platformIndex = 0; platformIndex < rawPlatforms.length; platformIndex++) {
|
||||||
|
const rawPlatform = rawPlatforms[platformIndex];
|
||||||
const platformRec = asRecord(rawPlatform);
|
const platformRec = asRecord(rawPlatform);
|
||||||
if (!platformRec) continue;
|
if (!platformRec) continue;
|
||||||
|
|
||||||
@ -2006,7 +2015,7 @@ async function resolveFinalExpressPrinter(
|
|||||||
|
|
||||||
if (isJingdongComponent(component)) {
|
if (isJingdongComponent(component)) {
|
||||||
const jdPayload = resolveJingdongExpressPayload(platformRec, rawOrders, {
|
const jdPayload = resolveJingdongExpressPayload(platformRec, rawOrders, {
|
||||||
requestCode: requestCode ? `${requestCode}-${platform}-${sys_logistics_code}` : undefined,
|
requestCode: requestCode ? `${requestCode}-${wave_no}-${platform}-${sys_logistics_code}-${platformIndex}` : undefined,
|
||||||
printer: finalPrinter,
|
printer: finalPrinter,
|
||||||
preview,
|
preview,
|
||||||
});
|
});
|
||||||
@ -2090,19 +2099,100 @@ async function resolveFinalExpressPrinter(
|
|||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
orderCount = documents.length;
|
|
||||||
expressPayload = buildExpressComponentPayload({
|
// 快手组件限制单次任务最多 10 个文档,超出需分批下发
|
||||||
|
const KS_MAX_DOCS = 10
|
||||||
|
const documentChunks = component === '快手' && documents.length > KS_MAX_DOCS
|
||||||
|
? chunkArray(documents, KS_MAX_DOCS)
|
||||||
|
: [documents]
|
||||||
|
|
||||||
|
for (let chunkIndex = 0; chunkIndex < documentChunks.length; chunkIndex++) {
|
||||||
|
const chunk = documentChunks[chunkIndex]!
|
||||||
|
const chunkSuffix = documentChunks.length > 1 ? `-c${chunkIndex}` : ''
|
||||||
|
const chunkRequestCode = requestCode
|
||||||
|
? `${requestCode}-${wave_no}-${platform}-${sys_logistics_code}-${platformIndex}${chunkSuffix}`
|
||||||
|
: undefined
|
||||||
|
|
||||||
|
const chunkPayload = buildExpressComponentPayload({
|
||||||
printer: finalPrinter,
|
printer: finalPrinter,
|
||||||
documents,
|
documents: chunk,
|
||||||
requestCode: requestCode ? `${requestCode}-${platform}-${sys_logistics_code}` : undefined,
|
requestCode: chunkRequestCode,
|
||||||
preview,
|
preview,
|
||||||
});
|
});
|
||||||
waveBrowserPrintLog('sendWavePlatformBrowserPrint: 构建 express 载荷', {
|
waveBrowserPrintLog('sendWavePlatformBrowserPrint: 构建 express 载荷', {
|
||||||
wave_no,
|
wave_no,
|
||||||
platform_name,
|
platform_name,
|
||||||
orderCount,
|
orderCount: chunk.length,
|
||||||
requestID: (expressPayload as Record<string, unknown>).requestID,
|
totalDocuments: documents.length,
|
||||||
|
chunkIndex,
|
||||||
|
chunkCount: documentChunks.length,
|
||||||
|
requestID: (chunkPayload as Record<string, unknown>).requestID,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const chunkPrintData = buildPrintTaskData(
|
||||||
|
{
|
||||||
|
printer: finalPrinter,
|
||||||
|
type: 'express',
|
||||||
|
component,
|
||||||
|
computerId: 'browser',
|
||||||
|
data: chunkPayload,
|
||||||
|
},
|
||||||
|
defaultPrintIdGenerator(),
|
||||||
|
chunkPayload,
|
||||||
|
);
|
||||||
|
|
||||||
|
waveBrowserPrintLog('sendWavePlatformBrowserPrint: 下发打印任务', {
|
||||||
|
wave_no,
|
||||||
|
platform_name,
|
||||||
|
component,
|
||||||
|
printer,
|
||||||
|
printId: chunkPrintData.printId,
|
||||||
|
orderCount: chunk.length,
|
||||||
|
chunkIndex,
|
||||||
|
});
|
||||||
|
|
||||||
|
const dispatchResult = await dispatchToPrintComponent(chunkPrintData, {
|
||||||
|
fetchWindowsPrinters: createBrowserPrinterListFetcher(printer),
|
||||||
|
sendToComponent: sendPayloadToComponentWs,
|
||||||
|
skipPrinterValidation: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (dispatchResult.ok) {
|
||||||
|
successCount += 1;
|
||||||
|
waveBrowserPrintLog('sendWavePlatformBrowserPrint: 平台分组下发成功', {
|
||||||
|
wave_no,
|
||||||
|
platform_name,
|
||||||
|
component,
|
||||||
|
chunkIndex,
|
||||||
|
});
|
||||||
|
items.push({
|
||||||
|
...baseItem,
|
||||||
|
component,
|
||||||
|
printer: finalPrinter,
|
||||||
|
order_count: chunk.length,
|
||||||
|
flag: 'success',
|
||||||
|
message: '已发送至本地打印组件',
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
waveBrowserPrintLog('sendWavePlatformBrowserPrint: 平台分组下发失败', {
|
||||||
|
wave_no,
|
||||||
|
platform_name,
|
||||||
|
component,
|
||||||
|
chunkIndex,
|
||||||
|
error: dispatchResult.error,
|
||||||
|
detail: dispatchResult.detail,
|
||||||
|
});
|
||||||
|
items.push({
|
||||||
|
...baseItem,
|
||||||
|
component,
|
||||||
|
printer: finalPrinter,
|
||||||
|
order_count: chunk.length,
|
||||||
|
flag: 'failure',
|
||||||
|
message: dispatchResult.error,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue; // 已在内层循环完成下发,跳过外部 dispatch
|
||||||
}
|
}
|
||||||
|
|
||||||
const printData = buildPrintTaskData(
|
const printData = buildPrintTaskData(
|
||||||
|
|||||||
@ -29,17 +29,13 @@ export const expressInterfaceListFieldOrder = [
|
|||||||
'template_url',
|
'template_url',
|
||||||
'product_type',
|
'product_type',
|
||||||
'brandno',
|
'brandno',
|
||||||
'is_hide_goods',
|
|
||||||
'is_enabled',
|
'is_enabled',
|
||||||
'weight',
|
'weight',
|
||||||
'weight_type',
|
'weight_type',
|
||||||
'viewer',
|
'viewer',
|
||||||
'client_id',
|
'client_id',
|
||||||
'token',
|
|
||||||
'ispickup',
|
'ispickup',
|
||||||
'shipperno',
|
'shipperno',
|
||||||
'can_use_count',
|
|
||||||
'share_id',
|
|
||||||
'is_share',
|
'is_share',
|
||||||
'ext_data'
|
'ext_data'
|
||||||
] as const
|
] as const
|
||||||
@ -56,14 +52,11 @@ export const expressInterfaceFieldLabels: Record<string, string> = {
|
|||||||
sender_tel: '发件电话',
|
sender_tel: '发件电话',
|
||||||
weight: '默认重量',
|
weight: '默认重量',
|
||||||
weight_type: '重量类型',
|
weight_type: '重量类型',
|
||||||
token: 'Token',
|
|
||||||
viewer: '验视人',
|
viewer: '验视人',
|
||||||
client_id: '客户端 ID',
|
client_id: '客户端 ID',
|
||||||
is_share: '是否共享',
|
is_share: '是否共享',
|
||||||
ispickup: '上门取件',
|
ispickup: '上门取件',
|
||||||
shipperno: '电子面单客户号',
|
shipperno: '电子面单客户号',
|
||||||
share_id: '共享记录ID',
|
|
||||||
can_use_count: '可用单量',
|
|
||||||
province_name: '省',
|
province_name: '省',
|
||||||
city_name: '市',
|
city_name: '市',
|
||||||
district_name: '区/县',
|
district_name: '区/县',
|
||||||
@ -74,7 +67,6 @@ export const expressInterfaceFieldLabels: Record<string, string> = {
|
|||||||
template_url: '打印模板',
|
template_url: '打印模板',
|
||||||
product_type: '产品编码',
|
product_type: '产品编码',
|
||||||
brandno: '品牌编码',
|
brandno: '品牌编码',
|
||||||
is_hide_goods: '是否隐藏商品',
|
|
||||||
is_enabled: '是否启用',
|
is_enabled: '是否启用',
|
||||||
is_system_express_code: '是否系统快递编码',
|
is_system_express_code: '是否系统快递编码',
|
||||||
shop_name: '店铺名称',
|
shop_name: '店铺名称',
|
||||||
@ -129,16 +121,9 @@ export const expressInterfaceColumns: ExpressInterfaceColumn[] = [
|
|||||||
{ prop: 'sender_tel', label: '发件电话', minWidth: 120, formatter: (row) => row.sender_tel || '--' },
|
{ prop: 'sender_tel', label: '发件电话', minWidth: 120, formatter: (row) => row.sender_tel || '--' },
|
||||||
{ prop: 'shop_name', label: '店铺', minWidth: 140, formatter: (row) => row.shop_name || '--' },
|
{ prop: 'shop_name', label: '店铺', minWidth: 140, formatter: (row) => row.shop_name || '--' },
|
||||||
{ prop: 'site_code', label: '站点编码', minWidth: 100, formatter: (row) => row.site_code || '--' },
|
{ prop: 'site_code', label: '站点编码', minWidth: 100, formatter: (row) => row.site_code || '--' },
|
||||||
{
|
|
||||||
prop: 'can_use_count',
|
|
||||||
label: '可用单量',
|
|
||||||
width: 96,
|
|
||||||
align: 'right',
|
|
||||||
formatter: (row) => formatExpressInterfaceNumber(row.can_use_count)
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
prop: 'weight',
|
prop: 'weight',
|
||||||
label: '权重',
|
label: '默认重量',
|
||||||
width: 96,
|
width: 96,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
formatter: (row) => formatExpressInterfaceNumber(row.weight)
|
formatter: (row) => formatExpressInterfaceNumber(row.weight)
|
||||||
@ -161,14 +146,6 @@ export const expressInterfaceColumns: ExpressInterfaceColumn[] = [
|
|||||||
/** 按仓库+平台全量列表列(setting.expressInterface.listByWarehousePlatformCode) */
|
/** 按仓库+平台全量列表列(setting.expressInterface.listByWarehousePlatformCode) */
|
||||||
export const expressInterfaceWarehouseColumns: ExpressInterfaceColumn[] = [
|
export const expressInterfaceWarehouseColumns: ExpressInterfaceColumn[] = [
|
||||||
{ prop: 'id', label: 'ID', width: 80, align: 'center', formatter: (row) => formatExpressInterfaceCell(row.id) },
|
{ prop: 'id', label: 'ID', width: 80, align: 'center', formatter: (row) => formatExpressInterfaceCell(row.id) },
|
||||||
{
|
|
||||||
prop: 'weight',
|
|
||||||
label: '权重',
|
|
||||||
width: 80,
|
|
||||||
align: 'right',
|
|
||||||
formatter: (row) => formatExpressInterfaceNumber(row.weight)
|
|
||||||
},
|
|
||||||
|
|
||||||
{ prop: 'name', label: '配置名称', minWidth: 140, formatter: (row) => row.name || '--' },
|
{ prop: 'name', label: '配置名称', minWidth: 140, formatter: (row) => row.name || '--' },
|
||||||
{ prop: 'express_code', label: '快递编码', minWidth: 100, formatter: (row) => row.express_code || '--' },
|
{ prop: 'express_code', label: '快递编码', minWidth: 100, formatter: (row) => row.express_code || '--' },
|
||||||
{
|
{
|
||||||
@ -186,20 +163,49 @@ export const expressInterfaceWarehouseColumns: ExpressInterfaceColumn[] = [
|
|||||||
{
|
{
|
||||||
prop: 'express_platform_label',
|
prop: 'express_platform_label',
|
||||||
label: '快递平台',
|
label: '快递平台',
|
||||||
minWidth: 100,
|
minWidth: 110,
|
||||||
formatter: (row) => row.express?.platform ?? row.express_platform_label ?? '--'
|
formatter: (row) => {
|
||||||
|
const platformCode = row.platform_code
|
||||||
|
if (!platformCode) return '--'
|
||||||
|
const platformExpressCode = row.express?.[platformCode]
|
||||||
|
return platformExpressCode ? `${platformCode}(${platformExpressCode})` : platformCode
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{ prop: 'platform_code', label: '平台编码', minWidth: 100, formatter: (row) => row.platform_code || '--' },
|
|
||||||
{ prop: 'sender_name', label: '发件人', minWidth: 100, formatter: (row) => row.sender_name || '--' },
|
{ prop: 'sender_name', label: '发件人', minWidth: 100, formatter: (row) => row.sender_name || '--' },
|
||||||
{ prop: 'sender_tel', label: '发件电话', minWidth: 110, formatter: (row) => row.sender_tel || '--' },
|
{ prop: 'sender_tel', label: '发件电话', minWidth: 110, formatter: (row) => row.sender_tel || '--' },
|
||||||
{ prop: 'shop_name', label: '店铺', minWidth: 140, formatter: (row) => row.shop_name || '--' },
|
{
|
||||||
|
prop: 'shop_name',
|
||||||
|
label: '店铺',
|
||||||
|
minWidth: 140,
|
||||||
|
formatter: (row) => row.shop?.custom_name || row.shop_name || '--'
|
||||||
|
},
|
||||||
|
{ prop: 'site_code', label: '站点编码', minWidth: 100, formatter: (row) => row.site_code || '--' },
|
||||||
{
|
{
|
||||||
prop: 'can_use_count',
|
prop: 'can_use_count',
|
||||||
label: '可用单量',
|
label: '可用单量',
|
||||||
width: 90,
|
width: 96,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
formatter: (row) => formatExpressInterfaceNumber(row.can_use_count)
|
formatter: (row) => formatExpressInterfaceNumber(row.can_use_count)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'weight',
|
||||||
|
label: '默认重量',
|
||||||
|
width: 88,
|
||||||
|
align: 'right',
|
||||||
|
formatter: (row) => formatExpressInterfaceNumber(row.weight)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'is_enabled',
|
||||||
|
label: '状态',
|
||||||
|
width: 80,
|
||||||
|
align: 'center',
|
||||||
|
formatter: (row) => {
|
||||||
|
const enabled = row.is_enabled === 1 || row.is_enabled === '1'
|
||||||
|
return enabled
|
||||||
|
? '<span style="color:#67c23a;background:#f0f9eb;border:1px solid #c2e7b0;border-radius:4px;padding:2px 8px;font-size:12px;">启用</span>'
|
||||||
|
: '<span style="color:#f56c6c;background:#fef0f0;border:1px solid #fbc4c4;border-radius:4px;padding:2px 8px;font-size:12px;">停用</span>'
|
||||||
|
}
|
||||||
|
},
|
||||||
{ prop: 'actions', label: '操作', width: 140, align: 'center', fixed: 'right' }
|
{ prop: 'actions', label: '操作', width: 140, align: 'center', fixed: 'right' }
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -728,8 +734,7 @@ export function buildExpressInterfaceCreatePayload(
|
|||||||
'weight',
|
'weight',
|
||||||
'weight_type',
|
'weight_type',
|
||||||
'share_id',
|
'share_id',
|
||||||
'ispickup',
|
'ispickup'
|
||||||
'can_use_count'
|
|
||||||
] as const
|
] as const
|
||||||
for (const key of optionalNumbers) {
|
for (const key of optionalNumbers) {
|
||||||
const n = omitOptionalNumber(form[key])
|
const n = omitOptionalNumber(form[key])
|
||||||
@ -740,8 +745,7 @@ export function buildExpressInterfaceCreatePayload(
|
|||||||
key === 'is_hide_goods' ||
|
key === 'is_hide_goods' ||
|
||||||
key === 'weight' ||
|
key === 'weight' ||
|
||||||
key === 'weight_type' ||
|
key === 'weight_type' ||
|
||||||
key === 'ispickup' ||
|
key === 'ispickup'
|
||||||
key === 'can_use_count'
|
|
||||||
? Math.round(n)
|
? Math.round(n)
|
||||||
: n
|
: n
|
||||||
payload[key] = rounded
|
payload[key] = rounded
|
||||||
|
|||||||
@ -412,6 +412,11 @@
|
|||||||
<el-input v-model="formData.product_type" placeholder="请输入产品编码" />
|
<el-input v-model="formData.product_type" placeholder="请输入产品编码" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12" v-if="formData.can_use_count !== undefined">
|
||||||
|
<el-form-item label="可用单量">
|
||||||
|
<el-input :model-value="String(formData.can_use_count)" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="打印模板">
|
<el-form-item label="打印模板">
|
||||||
<el-select
|
<el-select
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user