Browse Source

小程序流程重复表验证修改

ouyj 3 days ago
parent
commit
f8bee77f64
2 changed files with 5 additions and 3 deletions
  1. 3 2
      pages/process/detail/index.vue
  2. 2 1
      pages/work/edit/index.vue

+ 3 - 2
pages/process/detail/index.vue

@@ -1181,8 +1181,9 @@
         const fieldElement = repeatingForm.value.elementItem[j]
         const fieldName = fieldElement.tableField || fieldElement.name
         const fieldValue = item[fieldName]
-        
-        if (fieldValue == '' || fieldValue === undefined || fieldValue === null) {
+
+        // 只有当 noNull 等于 '1' 时才进行非空验证
+        if (fieldElement.noNull == '1' && (fieldValue == '' || fieldValue === undefined || fieldValue === null)) {
           const name = fieldElement.elementName.slice(3)
           $modal.msgError(`详情表${name}不能为空`)
           return false

+ 2 - 1
pages/work/edit/index.vue

@@ -792,7 +792,8 @@ function validateRepeatingForm2() {
 			const fieldName = fieldElement.tableField || fieldElement.name
 			const fieldValue = item[fieldName]
 			
-			if (fieldValue == '' || fieldValue === undefined || fieldValue === null) {
+			// 只有当 noNull 等于 '1' 时才进行非空验证
+			if (fieldElement.noNull == '1' && (fieldValue == '' || fieldValue === undefined || fieldValue === null)) {
 				const name = fieldElement.elementName.slice(3)
 				$modal.msgError(`详情表${name}不能为空`)
 				return false