fix(wms): 修复合同ID为空时添加合同关系的错误
在合并、分条和批量分条操作中,当合同ID为空时不再尝试添加合同关系 同时优化批量分条时的合同关系添加逻辑,先过滤掉空合同ID
This commit is contained in:
@@ -766,10 +766,12 @@ export default {
|
||||
|
||||
const coilId = response.data;
|
||||
|
||||
addCoilContractRel({
|
||||
coilId: coilId,
|
||||
contractId: this.targetCoil.contractId,
|
||||
})
|
||||
if (this.targetCoil.contractId) {
|
||||
addCoilContractRel({
|
||||
coilId: coilId,
|
||||
contractId: this.targetCoil.contractId,
|
||||
})
|
||||
}
|
||||
this.$message.success('合卷保存成功');
|
||||
|
||||
// 延迟返回,让用户看到成功提示
|
||||
|
||||
@@ -675,10 +675,12 @@ export default {
|
||||
// 新增分条:调用创建接口
|
||||
res = await createSpecialChild(this.coilId, this.actionId, splitData)
|
||||
// 新增分条后,需要添加分条的合同关系
|
||||
addCoilContractRel({
|
||||
coilId: res.data.coilId,
|
||||
contractId: this.splitForm.contractId,
|
||||
})
|
||||
if (this.splitForm.contractId) {
|
||||
addCoilContractRel({
|
||||
coilId: res.data.coilId,
|
||||
contractId: this.splitForm.contractId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.$message.success(this.splitForm.coilId ? '编辑分条成功' : '新增分条成功')
|
||||
|
||||
@@ -684,12 +684,15 @@ export default {
|
||||
|
||||
// 拿到多个子卷的coilId
|
||||
const newCoilIds = response.msg.split(',');
|
||||
// 先构建所有的请求体,并移除合同为空为空的项
|
||||
const requests = newCoilIds.map((coilId, index) => ({
|
||||
coilId,
|
||||
contractId: this.splitList[index].contractId
|
||||
}))
|
||||
.filter(req => req.contractId);
|
||||
// 为每个子卷添加合同关联
|
||||
Promise.all(newCoilIds.map(async (coilId, index) => {
|
||||
addCoilContractRel({
|
||||
coilId,
|
||||
contractId: this.splitList[index].contractId
|
||||
});
|
||||
Promise.all(requests.map(async (req, index) => {
|
||||
addCoilContractRel(req);
|
||||
}));
|
||||
|
||||
// 如果是从待操作列表进来的,标记操作为完成
|
||||
|
||||
Reference in New Issue
Block a user