5 changed files with 66 additions and 8 deletions
-
54src/utils/haianWcsPushResult.js
-
5src/views/modules/haianWarehouse/noOrderIssue/noOrderNotification54.vue
-
5src/views/modules/haianWarehouse/poOrder/searchPoIssureNotify54.vue
-
5src/views/modules/haianWarehouse/shipment/shipmentNotification54.vue
-
5src/views/modules/haianWarehouse/shopOrderIssueNotify/searchIssureNotify54.vue
@ -0,0 +1,54 @@ |
|||
/** |
|||
* 展示海安四类申请单的 WCS 确认推送结果:保留后端摘要,并逐订单展示失败和跳过原因。- rqrq |
|||
* @param vm 当前 Vue 页面实例,用于创建安全文本节点和打开必须确认的弹框。- rqrq |
|||
* @param data WCS 推送接口的成功响应,优先读取 row,兼容顶层结果字段。- rqrq |
|||
* @returns Element UI 弹框 Promise;缺少逐单原因时明确提示核查,避免把部分成功误报为全部成功。- rqrq |
|||
*/ |
|||
export function showHaianWcsPushResult (vm, data) { |
|||
const result = data.row || data |
|||
const failedMessages = Array.isArray(result.failedOrderMessages) ? result.failedOrderMessages : [] |
|||
const skippedMessages = Array.isArray(result.skippedOrderNos) ? result.skippedOrderNos : [] |
|||
const pushedCount = Number(result.pushedOrderCount) || 0 |
|||
const failedCount = Number(result.failedOrderCount) || 0 |
|||
const skippedCount = Number(result.skippedOrderCount) || 0 |
|||
const hasUnpushedOrders = failedCount > 0 || skippedCount > 0 || failedMessages.length > 0 || skippedMessages.length > 0 |
|||
const h = vm.$createElement |
|||
const children = [ |
|||
h('div', {style: {fontWeight: 'bold', marginBottom: '8px'}}, |
|||
`本次成功 ${pushedCount} 单,失败 ${failedCount} 单,跳过 ${skippedCount} 单`), |
|||
h('div', {style: {marginBottom: '12px', whiteSpace: 'normal', wordBreak: 'break-all'}}, |
|||
result.message || data.msg || 'WCS推送处理完成') |
|||
] |
|||
|
|||
// 后端每条 failedOrderMessages 含订单号和具体错误,逐行渲染为文本节点,避免将错误内容当 HTML 执行。- rqrq
|
|||
if (failedCount > 0 || failedMessages.length > 0) { |
|||
children.push(h('div', {style: {fontWeight: 'bold', color: '#F56C6C'}}, '推送失败原因:')) |
|||
children.push(h('ol', {style: {margin: '6px 0 12px', paddingLeft: '22px'}}, |
|||
failedMessages.map(message => h('li', {style: {marginBottom: '6px', wordBreak: 'break-all'}}, String(message))))) |
|||
if (failedMessages.length < failedCount) { |
|||
children.push(h('div', {style: {color: '#F56C6C', marginBottom: '12px'}}, |
|||
`还有 ${failedCount - failedMessages.length} 单未返回逐单原因,请按申请单号核查服务端日志。`)) |
|||
} |
|||
} |
|||
|
|||
// 未满足库存或区域条件的订单属于跳过,单独列出后端原因,避免与外呼失败混淆。- rqrq
|
|||
if (skippedCount > 0 || skippedMessages.length > 0) { |
|||
children.push(h('div', {style: {fontWeight: 'bold', color: '#E6A23C'}}, '本次未推送原因:')) |
|||
children.push(h('ol', {style: {margin: '6px 0 0', paddingLeft: '22px'}}, |
|||
skippedMessages.map(message => h('li', {style: {marginBottom: '6px', wordBreak: 'break-all'}}, String(message))))) |
|||
if (skippedMessages.length < skippedCount) { |
|||
children.push(h('div', {style: {color: '#E6A23C'}}, |
|||
`还有 ${skippedCount - skippedMessages.length} 单未返回逐单原因,请重新预览申请单。`)) |
|||
} |
|||
} |
|||
|
|||
// 限制内容高度并保留滚动条,批量失败时所有原因仍可查看;只能点击确认按钮关闭。- rqrq
|
|||
return vm.$alert(h('div', {style: {maxHeight: '55vh', overflowY: 'auto', textAlign: 'left'}}, children), |
|||
'WCS推送结果', { |
|||
type: hasUnpushedOrders ? 'warning' : 'success', |
|||
confirmButtonText: '确定', |
|||
showClose: false, |
|||
closeOnClickModal: false, |
|||
closeOnPressEscape: false |
|||
}) |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue