From 6a7e45bd8e843a3d4674cb588d0a3302ecdade8d Mon Sep 17 00:00:00 2001 From: augushong Date: Sat, 9 Jul 2022 16:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=B3=E8=81=94=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=BC=96=E8=BE=91=E6=B2=A1=E6=9C=89=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/curd/BuildCurdService.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/admin/service/curd/BuildCurdService.php b/app/admin/service/curd/BuildCurdService.php index d8ca245..fc927a6 100644 --- a/app/admin/service/curd/BuildCurdService.php +++ b/app/admin/service/curd/BuildCurdService.php @@ -1264,6 +1264,8 @@ class BuildCurdService } elseif (in_array($field, ['remark']) || $val['formType'] == 'textarea') { $templateFile = "view{$this->DS}module{$this->DS}textarea"; } elseif ($val['formType'] == 'relation') { + + // 使用select生成 $templateFile = "view{$this->DS}module{$this->DS}select"; if (isset($val['bindRelation'])) { @@ -1353,6 +1355,16 @@ class BuildCurdService } elseif (in_array($field, ['remark']) || $val['formType'] == 'textarea') { $templateFile = "view{$this->DS}module{$this->DS}textarea"; $value = '{$row.' . $field . '|raw|default=\'\'}'; + } elseif ($val['formType'] == 'relation') { + + + // 使用select生成 + $templateFile = "view{$this->DS}module{$this->DS}select"; + if (isset($val['bindRelation'])) { + $define = $this->buildOptionView($val['bindRelation'], '{in name="k" value="$row.' . $field . '"}selected=""{/in}'); + } elseif (isset($val['define']) && !empty($val['define'])) { + $define = $this->buildOptionView($field, '{in name="k" value="$row.' . $field . '"}selected=""{/in}'); + } } elseif ($val['formType'] == 'table') { $templateFile = "view{$this->DS}module{$this->DS}table"; $define = $this->buildTableView($field, $val, $value);