|
|
|
@ -94,9 +94,9 @@ export default { |
|
|
|
fzList: [],//分装列表 |
|
|
|
// 错误状态字段 |
|
|
|
formErrors: { |
|
|
|
mybh: false, |
|
|
|
fzsl: false, |
|
|
|
dw: false, |
|
|
|
mfbzl: false, |
|
|
|
}, |
|
|
|
fzListErrors: [], // 分装列表错误状态 |
|
|
|
uuid:"",//事件id |
|
|
|
@ -105,7 +105,6 @@ export default { |
|
|
|
watch: { |
|
|
|
subData:{ |
|
|
|
handler(newVal) { |
|
|
|
console.log(newVal,"fff"); |
|
|
|
if(newVal.formData){ |
|
|
|
this.formData = newVal.formData; |
|
|
|
} |
|
|
|
@ -157,46 +156,65 @@ export default { |
|
|
|
validateFormData() { |
|
|
|
let isValid = true; |
|
|
|
|
|
|
|
// 验证母液编号 |
|
|
|
if (!this.formData.mybh) { |
|
|
|
this.formErrors.mybh = true; |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
// 验证分装数量 |
|
|
|
if (!this.formData.fzsl) { |
|
|
|
this.formErrors.fzsl = true; |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
// 定义需要验证的基础字段配置 |
|
|
|
const baseFieldConfigs = [ |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'fzsl', |
|
|
|
errorField: 'fzsl', |
|
|
|
itemConfig: this.integerInputNumberItem |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'dw', |
|
|
|
errorField: 'dw', |
|
|
|
itemConfig: this.unitItem |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'mfbzl', |
|
|
|
errorField: 'mfbzl', |
|
|
|
itemConfig: this.inputNumberItem |
|
|
|
} |
|
|
|
]; |
|
|
|
|
|
|
|
// 验证单位 |
|
|
|
if (!this.formData.dw) { |
|
|
|
this.formErrors.dw = true; |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
// 验证基础字段 |
|
|
|
baseFieldConfigs.forEach(config => { |
|
|
|
if (config.itemConfig.fillType === this.templateFillType) { |
|
|
|
if (!this.formData[config.field]) { |
|
|
|
this.formErrors[config.errorField] = true; |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// 验证分装列表中的数值 |
|
|
|
// 验证分装列表中的数值 - 根据字段的fillType和当前templateFillType比较 |
|
|
|
if (this.fzList && this.fzList.length > 0) { |
|
|
|
for (let i = 0; i < this.fzList.length; i++) { |
|
|
|
if (isValueEmpty(this.fzList[i].prenum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: i, |
|
|
|
field: "prenum", |
|
|
|
error: "请输入预填分装数量", |
|
|
|
}) |
|
|
|
isValid = false; |
|
|
|
// 验证预填分装数量 |
|
|
|
if (this.preInputNumberItem.fillType === this.templateFillType) { |
|
|
|
if (isValueEmpty(this.fzList[i].prenum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: i, |
|
|
|
field: "prenum", |
|
|
|
error: "请输入预填分装数量", |
|
|
|
}) |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (isValueEmpty(this.fzList[i].actnum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: i, |
|
|
|
field: "actnum", |
|
|
|
error: "请输入实际分装数量", |
|
|
|
}) |
|
|
|
isValid = false; |
|
|
|
|
|
|
|
// 验证实际分装数量 |
|
|
|
if (this.inputNumberItem.fillType === this.templateFillType) { |
|
|
|
if (isValueEmpty(this.fzList[i].actnum)) { |
|
|
|
this.fzListErrors.push({ |
|
|
|
rowIndex: i, |
|
|
|
field: "actnum", |
|
|
|
error: "请输入实际分装数量", |
|
|
|
}) |
|
|
|
isValid = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return isValid; |
|
|
|
return {valid: isValid,error:""}; |
|
|
|
}, |
|
|
|
resetErrors() { |
|
|
|
// 重置表单错误状态 |
|
|
|
|