fix(wms): 修复合同ID为空时添加合同关系的错误

在合并、分条和批量分条操作中,当合同ID为空时不再尝试添加合同关系
同时优化批量分条时的合同关系添加逻辑,先过滤掉空合同ID
This commit is contained in:
2026-04-20 11:04:14 +08:00
parent af002b84d3
commit 4fefc68bbc
4 changed files with 22 additions and 15 deletions

View File

@@ -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('合卷保存成功');
// 延迟返回,让用户看到成功提示

View File

@@ -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 ? '编辑分条成功' : '新增分条成功')

View File

@@ -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);
}));
// 如果是从待操作列表进来的,标记操作为完成

View File

@@ -26,10 +26,10 @@
<!-- 自定义日期选择器 -->
<span v-if="viewType === 'custom'" style="margin-left: 10px;">
<el-date-picker style="width: 200px;" v-model="queryParams.byCreateTimeStart"
type="date" value-format="yyyy-MM-dd" placeholder="选择开始日期"></el-date-picker>
type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择开始日期"></el-date-picker>
<el-date-picker style="width: 200px;" v-model="queryParams.byCreateTimeEnd"
type="date" value-format="yyyy-MM-dd" placeholder="选择结束日期"></el-date-picker>
type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择结束日期"></el-date-picker>
</span>
</div>
<el-row>