fix(wms): 修复分条操作中的表单验证和超时问题

修复分条操作中的表单验证逻辑,将验证提前到try块外以避免潜在错误。同时为特殊分条完成接口增加超时设置,并添加加载状态提示以改善用户体验。调整了未知状态标签的缩进格式。
This commit is contained in:
砂糖
2026-01-26 09:51:50 +08:00
parent 06b783c6a4
commit e8a1c61729
2 changed files with 16 additions and 7 deletions

View File

@@ -281,6 +281,7 @@ export function completeSpecialSplit(pendingActionId) {
return request({
url: '/wms/materialCoil/specialSplit/complete',
method: 'post',
timeout: 100000,
params: {
pendingActionId
}

View File

@@ -49,7 +49,7 @@
<div v-else-if="scope.row.dataType == 0">
<el-tag type="warning">历史卷</el-tag>
</div>
<div v-else>
<div v-else>
<el-tag type="danger">未知状态</el-tag>
</div>
</template>
@@ -458,12 +458,13 @@ export default {
// 新增/编辑分条
async addSplit() {
// 表单验证
const valid = await this.$refs.splitFormRef.validate()
console.log('valid', valid)
if (!valid) {
return
}
try {
// 表单验证
const valid = await this.$refs.splitFormRef.validate()
if (!valid) {
return
}
// 区分新增/编辑有coilId则为编辑否则为新增
let res
this.buttonLoading = true
@@ -483,6 +484,7 @@ export default {
this.getSplitList()
} catch (error) {
// 表单验证失败时的提示
console.log('error', error)
if (error.name !== 'ValidationError') {
this.$message.error((this.splitForm.coilId ? '编辑' : '新增') + '分条异常:' + error.message)
}
@@ -498,9 +500,13 @@ export default {
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
const loading = this.$loading({
lock: true,
text: '正在记录分条操作...',
background: 'rgba(0, 0, 0, 0.7)',
})
try {
this.buttonLoading = true
// 1. 完成分条主流程
const splitRes = await completeSpecialSplit(this.actionId)
if (splitRes.code !== 200) {
@@ -523,6 +529,8 @@ export default {
if (error.message !== 'cancel') { // 排除取消确认的情况
this.$message.error('完成分条异常:' + error.message)
}
} finally {
loading.close()
}
})
},