From ac7dcc0e7b0f90071fc86ccb5499e8d17cd8b3da Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 31 Oct 2024 15:53:34 +0800 Subject: [PATCH] * [refac bug #56645] Add required tag for flow child data. --- lib/zin/wg/flowsubtable/v1.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/zin/wg/flowsubtable/v1.php b/lib/zin/wg/flowsubtable/v1.php index 0b9b806542..dac9f7db01 100644 --- a/lib/zin/wg/flowsubtable/v1.php +++ b/lib/zin/wg/flowsubtable/v1.php @@ -37,13 +37,14 @@ class flowSubTable extends wg $field = (object)$field; if(!$field->show) continue; - $items[] = [ + $required = ($notEmptyRule && (strpos(",{$field->layoutRules},", ",{$notEmptyRule->id},") !== false) || strpos(",{$field->rules},", ",{$notEmptyRule->id},") !== false) || !empty($field->required); + $items[] = [ 'name' => "children[sub_{$module}][{$field->field}]", // 子表的字段可以重名,所以需要加上 module 'label' => $field->name, 'control' => $common->flow->buildFormControl($field, 'batch'), 'items' => array_filter($field->options), 'width' => $field->width == 'auto' ? '160px' : $field->width, - 'required' => $notEmptyRule && strpos(",{$field->layoutRules},", ",{$notEmptyRule->id},") !== false, + 'required' => $required, 'ditto' => in_array($field->control, $dittoControl), 'defaultDitto' => $dataList ? 'off' : 'on' ];