Commit 37de2abf by chenwq

优化模版表单数据验证逻辑,增加对特定条件的支持

1 parent 64bea8c7
...@@ -106,13 +106,23 @@ Page({ ...@@ -106,13 +106,23 @@ Page({
let { let {
attr attr
} = e.detail } = e.detail
let { tmlpFormData, tmlpObj, trainTmlpSuffix } = this.data let { tmlpFormData, tmlpObj, trainTmlpSuffix, tmlpCode } = this.data
tmlpObj['organizeTraining' + trainTmlpSuffix]?.forEach(item => { tmlpObj['organizeTraining' + trainTmlpSuffix]?.forEach(item => {
if (!item.name.includes('isTrainingOrganized')) { if (!item.name.includes('isTrainingOrganized')) {
item.isHide = tmlpFormData[attr] == '否' ? true : false item.isHide = tmlpFormData[attr] == '否' ? true : false
} }
}) })
if (allRuleObj[pAttr] && pAttr == ('organizeTraining' + trainTmlpSuffix)) {
let keyList = Object.keys(allRuleObj[pAttr])
keyList.forEach(item => {
if (item != ('isTrainingOrganized' + trainTmlpSuffix) && allRuleObj[pAttr][item]) {
allRuleObj[pAttr][item][0].required = tmlpFormData[attr] == '否' ? false : true
}
})
}
const pAttrList = Object.keys(allRuleObj) const pAttrList = Object.keys(allRuleObj)
console.log(tmlpCode, 'pAttrList---')
if (tmlpCode == 'uuid-temp-001') {
pAttrList.forEach(pAttrItem => { pAttrList.forEach(pAttrItem => {
tmlpObj[pAttrItem].forEach(item => { tmlpObj[pAttrItem].forEach(item => {
if (!item.name.includes('dayOffStatus')) { if (!item.name.includes('dayOffStatus')) {
...@@ -126,6 +136,7 @@ Page({ ...@@ -126,6 +136,7 @@ Page({
} }
}) })
}) })
}
console.log(tmlpObj, attr) console.log(tmlpObj, attr)
this.setData({ this.setData({
tmlpObj tmlpObj
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!