Browse Source

标签特殊修改

master
常熟吴彦祖 3 months ago
parent
commit
9dc6a7c82a
  1. 126
      src/views/modules/warehouse/changeHUSpecialItem.vue

126
src/views/modules/warehouse/changeHUSpecialItem.vue

@ -760,21 +760,10 @@ export default {
batchChangeWdr(requestData).then(({ data }) => {
if (data && data.code == 0) {
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.closeWdrDialog()
this.getDataList()
this.showChangeResult(result, 'W/D/R修改', () => {
this.closeWdrDialog()
this.getDataList()
})
} else {
this.$alert(data.msg || 'W/D/R修改失败', '错误')
}
@ -854,36 +843,10 @@ export default {
batchChangeExpiryDate(requestData).then(({ data }) => {
if (data && data.code == 0) {
const result = data.row
if (result.allSuccess) {
// - rqrq
this.$message.success(`失效日期修改成功,共更新 ${result.successCount} 行ERP库存`)
this.showChangeResult(result, '失效日期修改', () => {
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.closeExpDateDialog()
this.getDataList()
}
})
return
}
this.getDataList()
this.getDataList()
})
} else {
this.$alert(data.msg || '修改失败', '提示', { type: 'error' })
}
@ -1032,36 +995,10 @@ export default {
batchChangeAvailabilityControlId(requestData).then(({ data }) => {
if (data && data.code == 0) {
const result = data.row
if (result.allSuccess) {
// - rqrq
this.$message.success(`Availability Control ID修改成功,共更新 ${result.successCount} 行ERP库存`)
this.showChangeResult(result, 'Availability Control ID修改', () => {
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.closeAvailDialog()
this.getDataList()
}
})
return
}
this.getDataList()
this.getDataList()
})
} else {
this.$alert(data.msg || '修改失败', '提示', { type: 'error' })
}
@ -1070,6 +1007,49 @@ export default {
}).finally(() => {
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()
}
})
}
}
}

Loading…
Cancel
Save