[update] 修改扩展表格校验
This commit is contained in:
@@ -237,14 +237,23 @@ export default {
|
||||
if (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
|
||||
let isHaveRequired = false
|
||||
for (const item in currRowExtraFormRules) {
|
||||
if (currRowExtraFormRules[item].required === true) {
|
||||
// 有任意一个字段有必填
|
||||
for (const item of currRowExtraFormFormArr) {
|
||||
if (currRowExtraFormRules[item.dbFieldName].required === true && !this.dataSource[i][item.dbFieldName]) {
|
||||
// 有必填但没有填内容
|
||||
isHaveRequired = true
|
||||
}
|
||||
}
|
||||
// for (const item in currRowExtraFormRules) {
|
||||
// if (currRowExtraFormRules[item].required === true) {
|
||||
// // 有任意一个字段有必填,但没有内容
|
||||
// isHaveRequired = true
|
||||
// }
|
||||
// }
|
||||
if (isHaveRequired) {
|
||||
// 任意一个字段有必填,她又没展开过,校验不通过
|
||||
arr[i] = false
|
||||
@@ -258,12 +267,18 @@ export default {
|
||||
} else {
|
||||
// 没有依赖的字段
|
||||
let isHaveRequired = false
|
||||
for (const item in this.extraForm.rules) {
|
||||
if (this.extraForm.rules[item].required === true) {
|
||||
// 有任意一个字段有必填
|
||||
for (const item of this.extraForm.formArr) {
|
||||
if (this.extraForm.rules[item.dbFieldName].required === true && !this.dataSource[i][item.dbFieldName]) {
|
||||
// 有字段有必填,但没有内容
|
||||
isHaveRequired = true
|
||||
}
|
||||
}
|
||||
// for (const item in this.extraForm.rules) {
|
||||
// if (this.extraForm.rules[item].required === true) {
|
||||
// // 有任意一个字段有必填
|
||||
// isHaveRequired = true
|
||||
// }
|
||||
// }
|
||||
if (isHaveRequired) {
|
||||
// 任意一个字段有必填,她又没展开过,校验不通过
|
||||
arr[i] = false
|
||||
|
||||
Reference in New Issue
Block a user