flx:修复校验问题

This commit is contained in:
X_Rian 2024-06-19 14:56:32 +08:00
parent fc8b5eec7c
commit 4e5b52c825
2 changed files with 15 additions and 7 deletions

View File

@ -122,12 +122,14 @@
}, },
validate(call) { validate(call) {
this.$refs['wflowForm'].validate().then(res => { this.$refs['wflowForm'].validate().then(res => {
const dataList = Object.values(this.modelValue);
const result = dataList[0][dataList[0].length - 1];
// console.log(4444444, JSON.stringify(this.modelValue)) // console.log(4444444, JSON.stringify(this.modelValue))
const dataList = Object.values(this.modelValue);
const result = dataList[0] instanceof Array ? dataList[0][dataList[0].length - 1] : dataList;
// console.log(JSON.stringify(dataList[0]))
// console.log(4444444, JSON.stringify(this.formFields[this.formFields.length - 1].props.columns))
const flag = this.formFields[this.formFields.length - 1].props.columns ? this.formFields[this.formFields.length - 1].props.columns.every((v, i)=> { const flag = this.formFields[this.formFields.length - 1].props.columns ? this.formFields[this.formFields.length - 1].props.columns.every((v, i)=> {
if((i == this.formFields[this.formFields.length - 1].props.columns.length - 1) && result[v.id]){ if((i == this.formFields[this.formFields.length - 1].props.columns.length - 1) && result[v.id]){
// console.log(result[v.id]) // console.log(5555555, JSON.stringify(result[v.id]))
if(result[v.id][0].id){ if(result[v.id][0].id){
return true return true
} else { } else {
@ -139,9 +141,14 @@
} }
return return
} }
if(result instanceof Array){
// console.log(22222, v.props.required, JSON.stringify(result[result.length - 1]), v.id)
return v.props.required == false || (v.props.required == true && result[result.length - 1][0][v.id] != null && result[result.length - 1][0][v.id] != "")
}
// console.log(22222, v.props.required, JSON.stringify(result), v.id)
return v.props.required == false || (v.props.required == true && result[v.id] != null); return v.props.required == false || (v.props.required == true && result[v.id] != null);
}) : true; }) : true;
console.log(3333333, flag) // console.log(3333333, flag)
call(flag) call(flag)
console.log('表单数据信息:', JSON.stringify(res)); console.log('表单数据信息:', JSON.stringify(res));
}).catch(err => { }).catch(err => {

View File

@ -328,15 +328,16 @@
} }
</script> </script>
<style> <style>
/deep/ .uni-picker-custom { /* :deep(.uni-picker-custom), .uni-picker-custom {
height: 480rpx; height: 480rpx;
} } */
</style> </style>
<style scoped> <style scoped>
.search { .search {
position: fixed; position: fixed;
/* bottom: 465rpx; */ /* bottom: 465rpx; */
bottom: 400rpx; bottom: 242px;
/* bottom: 400rpx; */
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 9999; z-index: 9999;