|
|
@ -760,21 +760,10 @@ export default { |
|
|
batchChangeWdr(requestData).then(({ data }) => { |
|
|
batchChangeWdr(requestData).then(({ data }) => { |
|
|
if (data && data.code == 0) { |
|
|
if (data && data.code == 0) { |
|
|
const result = data.row |
|
|
const result = data.row |
|
|
if (result.failCount === 0) { |
|
|
|
|
|
this.$message.success(`W/D/R修改成功,共处理${result.successCount}个标签`) |
|
|
|
|
|
} else { |
|
|
|
|
|
// 部分失败,显示详细信息 - rqrq |
|
|
|
|
|
this.$alert( |
|
|
|
|
|
`成功:${result.successCount}个标签<br/>失败:${result.failCount}个标签<br/><br/>失败标签:${result.failedUnitIds ? result.failedUnitIds.join(', ') : '无'}`, |
|
|
|
|
|
'W/D/R修改结果', |
|
|
|
|
|
{ |
|
|
|
|
|
dangerouslyUseHTMLString: true, |
|
|
|
|
|
confirmButtonText: '确定' |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.showChangeResult(result, 'W/D/R修改', () => { |
|
|
this.closeWdrDialog() |
|
|
this.closeWdrDialog() |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
|
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
this.$alert(data.msg || 'W/D/R修改失败', '错误') |
|
|
this.$alert(data.msg || 'W/D/R修改失败', '错误') |
|
|
} |
|
|
} |
|
|
@ -854,36 +843,10 @@ export default { |
|
|
batchChangeExpiryDate(requestData).then(({ data }) => { |
|
|
batchChangeExpiryDate(requestData).then(({ data }) => { |
|
|
if (data && data.code == 0) { |
|
|
if (data && data.code == 0) { |
|
|
const result = data.row |
|
|
const result = data.row |
|
|
|
|
|
|
|
|
if (result.allSuccess) { |
|
|
|
|
|
// 全部成功 - rqrq |
|
|
|
|
|
this.$message.success(`失效日期修改成功,共更新 ${result.successCount} 行ERP库存`) |
|
|
|
|
|
this.closeExpDateDialog() |
|
|
|
|
|
} else { |
|
|
|
|
|
// 部分失败,弹窗显示失败的标签 - rqrq |
|
|
|
|
|
let failedMsg = `成功:${result.successCount} 行,失败:${result.failCount} 行\n\n` |
|
|
|
|
|
failedMsg += `以下标签更新失败:\n` |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < result.failedUnitIds.length; i++) { |
|
|
|
|
|
failedMsg += `- ${result.failedUnitIds[i]}` |
|
|
|
|
|
if (result.failedReasons && result.failedReasons[i]) { |
|
|
|
|
|
failedMsg += `(${result.failedReasons[i]})` |
|
|
|
|
|
} |
|
|
|
|
|
failedMsg += '\n' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.$alert(failedMsg, '部分更新失败', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
callback: () => { |
|
|
|
|
|
|
|
|
this.showChangeResult(result, '失效日期修改', () => { |
|
|
this.closeExpDateDialog() |
|
|
this.closeExpDateDialog() |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getDataList() |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.$alert(data.msg || '修改失败', '提示', { type: 'error' }) |
|
|
this.$alert(data.msg || '修改失败', '提示', { type: 'error' }) |
|
|
} |
|
|
} |
|
|
@ -1032,36 +995,10 @@ export default { |
|
|
batchChangeAvailabilityControlId(requestData).then(({ data }) => { |
|
|
batchChangeAvailabilityControlId(requestData).then(({ data }) => { |
|
|
if (data && data.code == 0) { |
|
|
if (data && data.code == 0) { |
|
|
const result = data.row |
|
|
const result = data.row |
|
|
|
|
|
|
|
|
if (result.allSuccess) { |
|
|
|
|
|
// 全部成功 - rqrq |
|
|
|
|
|
this.$message.success(`Availability Control ID修改成功,共更新 ${result.successCount} 行ERP库存`) |
|
|
|
|
|
this.closeAvailDialog() |
|
|
|
|
|
} else { |
|
|
|
|
|
// 部分失败,弹窗显示失败的标签 - rqrq |
|
|
|
|
|
let failedMsg = `成功:${result.successCount} 行,失败:${result.failCount} 行\n\n` |
|
|
|
|
|
failedMsg += `以下标签更新失败:\n` |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < result.failedUnitIds.length; i++) { |
|
|
|
|
|
failedMsg += `- ${result.failedUnitIds[i]}` |
|
|
|
|
|
if (result.failedReasons && result.failedReasons[i]) { |
|
|
|
|
|
failedMsg += `(${result.failedReasons[i]})` |
|
|
|
|
|
} |
|
|
|
|
|
failedMsg += '\n' |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.$alert(failedMsg, '部分更新失败', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
callback: () => { |
|
|
|
|
|
|
|
|
this.showChangeResult(result, 'Availability Control ID修改', () => { |
|
|
this.closeAvailDialog() |
|
|
this.closeAvailDialog() |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getDataList() |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.$alert(data.msg || '修改失败', '提示', { type: 'error' }) |
|
|
this.$alert(data.msg || '修改失败', '提示', { type: 'error' }) |
|
|
} |
|
|
} |
|
|
@ -1070,6 +1007,49 @@ export default { |
|
|
}).finally(() => { |
|
|
}).finally(() => { |
|
|
this.availSaveLoading = false |
|
|
this.availSaveLoading = false |
|
|
}) |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// ==================== 通用结果显示方法 - rqrq ==================== |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 显示修改结果弹窗 - rqrq |
|
|
|
|
|
* @param result 后端返回的结果对象 |
|
|
|
|
|
* @param title 操作标题 |
|
|
|
|
|
* @param callback 弹窗关闭后的回调 |
|
|
|
|
|
*/ |
|
|
|
|
|
showChangeResult(result, title, callback) { |
|
|
|
|
|
const successCount = result.successCount || 0 |
|
|
|
|
|
const failCount = result.failCount || 0 |
|
|
|
|
|
const failedUnitIds = result.failedUnitIds || [] |
|
|
|
|
|
const failedReasons = result.failedReasons || [] |
|
|
|
|
|
|
|
|
|
|
|
// 构建弹窗内容 - rqrq |
|
|
|
|
|
let htmlContent = `<div style="line-height: 1.8;">` |
|
|
|
|
|
htmlContent += `<p><b>成功数量:</b>${successCount}</p>` |
|
|
|
|
|
htmlContent += `<p><b>失败数量:</b>${failCount}</p>` |
|
|
|
|
|
|
|
|
|
|
|
if (failCount > 0 && failedUnitIds.length > 0) { |
|
|
|
|
|
// 失败序列号(用逗号分隔)- rqrq |
|
|
|
|
|
htmlContent += `<p><b>失败序列号:</b>${failedUnitIds.join(', ')}</p>` |
|
|
|
|
|
|
|
|
|
|
|
// 失败报错(只显示第一个)- rqrq |
|
|
|
|
|
const firstError = failedReasons.length > 0 ? failedReasons[0] : '未知错误' |
|
|
|
|
|
htmlContent += `<p><b>失败报错:</b>${firstError}</p>` |
|
|
|
|
|
} |
|
|
|
|
|
htmlContent += `</div>` |
|
|
|
|
|
|
|
|
|
|
|
// 根据是否有失败决定弹窗类型 - rqrq |
|
|
|
|
|
const dialogType = failCount > 0 ? 'warning' : 'success' |
|
|
|
|
|
const dialogTitle = failCount > 0 ? `${title}结果(部分失败)` : `${title}结果` |
|
|
|
|
|
|
|
|
|
|
|
this.$alert(htmlContent, dialogTitle, { |
|
|
|
|
|
dangerouslyUseHTMLString: true, |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
type: dialogType, |
|
|
|
|
|
callback: () => { |
|
|
|
|
|
if (callback) callback() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|