From 5dc827af40229ecdc98b6357d99bcda3fbb6a3a5 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Thu, 20 Jan 2022 19:02:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=95=B0=E6=8D=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=A4=84=E7=90=86=E6=A8=A1=E5=9D=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/module/FormHandleModule.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/module/FormHandleModule.php b/app/module/FormHandleModule.php index e4454d1b7..61b5e476c 100644 --- a/app/module/FormHandleModule.php +++ b/app/module/FormHandleModule.php @@ -236,13 +236,27 @@ class FormHandleModule // 根据用户选择顺序追加数据 $temp_form = array_column($this->form_data['form'], null, 'label'); - foreach($this->user_fields as $v) + foreach($this->user_fields as $k=>$v) { + // 字段不存在数据中则移除 if(array_key_exists($v['label'], $temp_form)) { $temp = $temp_form[$v['label']]; - $temp['is_list'] = $v['checked']; + + // 是否存在设置不展示列表、则移除字段 + if(isset($temp['is_list']) && $temp['is_list'] == 0) + { + unset($this->user_fields[$k]); + } + + // 避免已定义了列表是否显示字段、导致覆盖成为展示 + if(!isset($temp['is_list'])) + { + $temp['is_list'] = $v['checked']; + } $data[] = $temp; + } else { + unset($this->user_fields[$k]); } }