fix(wms): 修复分条操作中的表单验证和超时问题
修复分条操作中的表单验证逻辑,将验证提前到try块外以避免潜在错误。同时为特殊分条完成接口增加超时设置,并添加加载状态提示以改善用户体验。调整了未知状态标签的缩进格式。
This commit is contained in:
@@ -281,6 +281,7 @@ export function completeSpecialSplit(pendingActionId) {
|
|||||||
return request({
|
return request({
|
||||||
url: '/wms/materialCoil/specialSplit/complete',
|
url: '/wms/materialCoil/specialSplit/complete',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
timeout: 100000,
|
||||||
params: {
|
params: {
|
||||||
pendingActionId
|
pendingActionId
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
<div v-else-if="scope.row.dataType == 0">
|
<div v-else-if="scope.row.dataType == 0">
|
||||||
<el-tag type="warning">历史卷</el-tag>
|
<el-tag type="warning">历史卷</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-tag type="danger">未知状态</el-tag>
|
<el-tag type="danger">未知状态</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -458,12 +458,13 @@ export default {
|
|||||||
|
|
||||||
// 新增/编辑分条
|
// 新增/编辑分条
|
||||||
async addSplit() {
|
async addSplit() {
|
||||||
|
// 表单验证
|
||||||
|
const valid = await this.$refs.splitFormRef.validate()
|
||||||
|
console.log('valid', valid)
|
||||||
|
if (!valid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// 表单验证
|
|
||||||
const valid = await this.$refs.splitFormRef.validate()
|
|
||||||
if (!valid) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 区分新增/编辑:有coilId则为编辑,否则为新增
|
// 区分新增/编辑:有coilId则为编辑,否则为新增
|
||||||
let res
|
let res
|
||||||
this.buttonLoading = true
|
this.buttonLoading = true
|
||||||
@@ -483,6 +484,7 @@ export default {
|
|||||||
this.getSplitList()
|
this.getSplitList()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 表单验证失败时的提示
|
// 表单验证失败时的提示
|
||||||
|
console.log('error', error)
|
||||||
if (error.name !== 'ValidationError') {
|
if (error.name !== 'ValidationError') {
|
||||||
this.$message.error((this.splitForm.coilId ? '编辑' : '新增') + '分条异常:' + error.message)
|
this.$message.error((this.splitForm.coilId ? '编辑' : '新增') + '分条异常:' + error.message)
|
||||||
}
|
}
|
||||||
@@ -498,9 +500,13 @@ export default {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: '正在记录分条操作...',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
|
})
|
||||||
try {
|
try {
|
||||||
this.buttonLoading = true
|
this.buttonLoading = true
|
||||||
|
|
||||||
// 1. 完成分条主流程
|
// 1. 完成分条主流程
|
||||||
const splitRes = await completeSpecialSplit(this.actionId)
|
const splitRes = await completeSpecialSplit(this.actionId)
|
||||||
if (splitRes.code !== 200) {
|
if (splitRes.code !== 200) {
|
||||||
@@ -523,6 +529,8 @@ export default {
|
|||||||
if (error.message !== 'cancel') { // 排除取消确认的情况
|
if (error.message !== 'cancel') { // 排除取消确认的情况
|
||||||
this.$message.error('完成分条异常:' + error.message)
|
this.$message.error('完成分条异常:' + error.message)
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
loading.close()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user