[update] 修改扩展表格校验
This commit is contained in:
@@ -237,14 +237,23 @@ export default {
|
|||||||
if (this.formIsDepend) {
|
if (this.formIsDepend) {
|
||||||
if (this.dataSource[i][this.formIsDepend]) {
|
if (this.dataSource[i][this.formIsDepend]) {
|
||||||
// 需要依赖某个字段,获取当前行该字段时,扩展表单是否有必填项
|
// 需要依赖某个字段,获取当前行该字段时,扩展表单是否有必填项
|
||||||
|
// console.log(this.dataSource[i])
|
||||||
|
// console.log(this.extraForm[this.dataSource[i][this.formIsDepend]])
|
||||||
|
const currRowExtraFormFormArr = this.extraForm[this.dataSource[i][this.formIsDepend]].formArr
|
||||||
const currRowExtraFormRules = this.extraForm[this.dataSource[i][this.formIsDepend]].rules
|
const currRowExtraFormRules = this.extraForm[this.dataSource[i][this.formIsDepend]].rules
|
||||||
let isHaveRequired = false
|
let isHaveRequired = false
|
||||||
for (const item in currRowExtraFormRules) {
|
for (const item of currRowExtraFormFormArr) {
|
||||||
if (currRowExtraFormRules[item].required === true) {
|
if (currRowExtraFormRules[item.dbFieldName].required === true && !this.dataSource[i][item.dbFieldName]) {
|
||||||
// 有任意一个字段有必填
|
// 有必填但没有填内容
|
||||||
isHaveRequired = true
|
isHaveRequired = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// for (const item in currRowExtraFormRules) {
|
||||||
|
// if (currRowExtraFormRules[item].required === true) {
|
||||||
|
// // 有任意一个字段有必填,但没有内容
|
||||||
|
// isHaveRequired = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
if (isHaveRequired) {
|
if (isHaveRequired) {
|
||||||
// 任意一个字段有必填,她又没展开过,校验不通过
|
// 任意一个字段有必填,她又没展开过,校验不通过
|
||||||
arr[i] = false
|
arr[i] = false
|
||||||
@@ -258,12 +267,18 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
// 没有依赖的字段
|
// 没有依赖的字段
|
||||||
let isHaveRequired = false
|
let isHaveRequired = false
|
||||||
for (const item in this.extraForm.rules) {
|
for (const item of this.extraForm.formArr) {
|
||||||
if (this.extraForm.rules[item].required === true) {
|
if (this.extraForm.rules[item.dbFieldName].required === true && !this.dataSource[i][item.dbFieldName]) {
|
||||||
// 有任意一个字段有必填
|
// 有字段有必填,但没有内容
|
||||||
isHaveRequired = true
|
isHaveRequired = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// for (const item in this.extraForm.rules) {
|
||||||
|
// if (this.extraForm.rules[item].required === true) {
|
||||||
|
// // 有任意一个字段有必填
|
||||||
|
// isHaveRequired = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
if (isHaveRequired) {
|
if (isHaveRequired) {
|
||||||
// 任意一个字段有必填,她又没展开过,校验不通过
|
// 任意一个字段有必填,她又没展开过,校验不通过
|
||||||
arr[i] = false
|
arr[i] = false
|
||||||
|
|||||||
Reference in New Issue
Block a user