|
|
|
@ -263,6 +263,75 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
verifyFzListError(index, field) { |
|
|
|
// 如果index和field都为空,就全匹配 |
|
|
|
if (index === undefined && field === undefined) { |
|
|
|
if (this.fzList && this.fzList.length > 0) { |
|
|
|
// 清空现有错误信息 |
|
|
|
this.fzListErrors = []; |
|
|
|
|
|
|
|
// 遍历fzList,没有值的就放到fzListErrors里面 |
|
|
|
for (let i = 0; i < this.fzList.length; i++) { |
|
|
|
const item = this.fzList[i]; |
|
|
|
if (isValueEmpty(item.prenum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: i, |
|
|
|
field: "prenum", |
|
|
|
error: "请输入预填分装数量" |
|
|
|
}); |
|
|
|
} |
|
|
|
if (isValueEmpty(item.actnum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: i, |
|
|
|
field: "actnum", |
|
|
|
error: "请输入实际分装数量" |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (index !== undefined) { |
|
|
|
// 如果index不为空,检查指定索引的项 |
|
|
|
if (this.fzList[index]) { |
|
|
|
const item = this.fzList[index]; |
|
|
|
|
|
|
|
if (field === undefined) { |
|
|
|
// 如果field为空,检查prenum和actnum |
|
|
|
// 先移除该索引的所有错误信息 |
|
|
|
this.fzListErrors = this.fzListErrors.filter(err => err.rowIndex !== index); |
|
|
|
|
|
|
|
// 没有值的就放到fzListErrors里面 |
|
|
|
if (isValueEmpty(item.prenum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: index, |
|
|
|
field: "prenum", |
|
|
|
error: "请输入预填分装数量" |
|
|
|
}); |
|
|
|
} |
|
|
|
if (isValueEmpty(item.actnum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: index, |
|
|
|
field: "actnum", |
|
|
|
error: "请输入实际分装数量" |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 如果field不为空,检查指定字段 |
|
|
|
// 先移除该索引和字段的错误信息 |
|
|
|
this.fzListErrors = this.fzListErrors.filter(err => !(err.rowIndex === index && err.field === field)); |
|
|
|
|
|
|
|
// 没有值的就放到fzListErrors里面 |
|
|
|
if (isValueEmpty(item[field])) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: index, |
|
|
|
field: field, |
|
|
|
error: field === "prenum" ? "请输入预填分装数量" : "请输入实际分装数量" |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
hasError(index, field) { |
|
|
|
const o = this.fzListErrors.find((item)=>{ |
|
|
|
return item.rowIndex === index && item.field === field; |
|
|
|
|