diff --git a/src/views/modules/haianAutoWarehouse/haianPalletAssembly.vue b/src/views/modules/haianAutoWarehouse/haianPalletAssembly.vue
index 83b48a6..50cd49f 100644
--- a/src/views/modules/haianAutoWarehouse/haianPalletAssembly.vue
+++ b/src/views/modules/haianAutoWarehouse/haianPalletAssembly.vue
@@ -82,12 +82,13 @@
- 是否强制整托出库
+ 是否强制整托出库
@@ -362,6 +363,8 @@ export default {
savedManualRemark: '',
manualRemarkSaving: false,
forceFullPalletOut: false,
+ // 取消未确认的勾选时重建控件,避免原生checkbox短暂显示未保存的新状态。- rqrq
+ forceFullPalletOutRenderKey: 0,
palletTypeDisabled: false,
autoSortDisabled: false,
currentWcsAutoSort: '',
@@ -677,8 +680,32 @@ export default {
handleAutoSortChange() {
this.savePalletTypeConfig()
},
- handleForceFullPalletOutChange() {
- this.savePalletTypeConfig()
+ // 勾选变化先保持原值;操作员确认后才更新强制整托标记并保存,取消时不触发接口。- rqrq
+ handleForceFullPalletOutChange (nextValue) {
+ this.forceFullPalletOutRenderKey += 1
+ this.$nextTick(() => {
+ this.$confirm('是否修改强制整托出库标记', '提示', {
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ type: 'warning',
+ closeOnClickModal: false
+ }).then(() => {
+ const previousForceFullPalletOut = this.forceFullPalletOut
+ const previousAutoSort = this.currentAutoSort
+ this.forceFullPalletOut = nextValue
+ this.updateAutoSortControl()
+ // 确认后保存;接口拒绝或网络失败时恢复原勾选和自动分拣状态,避免页面值与海安托盘配置不一致。- rqrq
+ this.savePalletTypeConfig().then((saved) => {
+ if (!saved) {
+ this.forceFullPalletOut = previousForceFullPalletOut
+ this.currentAutoSort = previousAutoSort
+ this.updateAutoSortControl()
+ }
+ })
+ }).catch(() => {
+ // 取消或关闭弹框时受控勾选框保持原值,不修改托盘配置。- rqrq
+ })
+ })
},
// A0206失焦才保存手工备注;内容和上次成功值相同则不请求,失败保留输入供再次离开重试 - rqrq
handleManualRemarkBlur() {
@@ -720,12 +747,13 @@ export default {
}
this.autoSortDisabled = this.detailList.length > 0 || this.interfaceBusy
},
- savePalletTypeConfig() {
+ // 保存海安托盘配置并返回是否成功;失败由页面提示,勾选确认调用方据此恢复原状态。- rqrq
+ savePalletTypeConfig () {
if (this.interfaceBusy) {
- return
+ return Promise.resolve(false)
}
this.palletConfigLoading = true
- updatePalletTypeAndAutoSort({
+ return updatePalletTypeAndAutoSort({
site: this.site,
palletId: this.palletCode,
palletType: this.currentPalletType,
@@ -736,11 +764,14 @@ export default {
this.palletInfo.palletType = this.currentPalletType
this.palletInfo.autoSort = this.currentAutoSort
this.$message.success('托盘配置已更新')
+ return true
} else {
this.$alert((data && data.msg) || '托盘配置更新失败', '错误', { confirmButtonText: '确定' })
+ return false
}
}).catch((error) => {
- this.$alert(error.message || '托盘配置更新失败', '错误', { confirmButtonText: '确定' })
+ this.$message.error(error.message || '托盘配置更新失败')
+ return false
}).finally(() => {
this.palletConfigLoading = false
})
@@ -1138,6 +1169,11 @@ export default {