diff --git a/src/components/Template/Step.vue b/src/components/Template/Step.vue index 5743dd1..7343586 100644 --- a/src/components/Template/Step.vue +++ b/src/components/Template/Step.vue @@ -114,7 +114,7 @@ const stepTypes = [ { label: '灭菌', value: 'mj' }, { label: '复苏', value: 'fs' }, { label: '封板', value: 'fb' }, - { label: '质量分装', value: 'zlfz' }, + // { label: '质量分装', value: 'zlfz' }, ]; diff --git a/src/components/Template/StepComponents/ZLSubPackage.vue b/src/components/Template/StepComponents/ZLSubPackage.vue index f633709..4d9f4cd 100644 --- a/src/components/Template/StepComponents/ZLSubPackage.vue +++ b/src/components/Template/StepComponents/ZLSubPackage.vue @@ -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; diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js index 4a88533..ff5bf8e 100644 --- a/src/components/Template/mixins/formPackageMixins.js +++ b/src/components/Template/mixins/formPackageMixins.js @@ -411,7 +411,9 @@ export default { getFormData() { // 同时执行数据校验和子组件校验 const validateResult = this.validateFormData(); - const subComponentValidateResult = this.validateSubComponents(); + // const subComponentValidateResult = this.validateSubComponents(); + const subComponentValidateResult = {valid: true, error: ''}; + console.log(subComponentValidateResult,"subComponentValidateResult") return new Promise((resolve, reject) => { if (validateResult.valid && subComponentValidateResult.valid) {