From 92f294d24dedc9e51b45da6f59104a65bd1026ed Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 14 Jan 2026 10:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BC=80=E5=85=B3=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=9C=AA=E7=9F=A5=E7=8A=B6=E6=80=81=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 2 +- .../admin/command/Crud/stubs/html/switch-edit.stub | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 application/admin/command/Crud/stubs/html/switch-edit.stub diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index c2ee128c..dc55d91e 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -884,7 +884,7 @@ EOD; } $stateNoClass = 'fa-flip-horizontal text-gray'; $formAddElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => $defaultValue, 'fieldSwitchClass' => $defaultValue == $yes ? '' : $stateNoClass]); - $formEditElement = $this->getReplacedStub('html/' . $inputType, ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{neq name=\"\$row.{$field}\" value=\"{$yes}\"}fa-flip-horizontal text-gray{/neq}"]); + $formEditElement = $this->getReplacedStub('html/' . $inputType . '-edit', ['field' => $field, 'fieldName' => $fieldName, 'fieldYes' => $yes, 'fieldNo' => $no, 'attrStr' => Form::attributes($attrArr), 'fieldValue' => "{\$row.{$field}}", 'fieldSwitchClass' => "{neq name=\"\$row.{$field}\" value=\"{$yes}\"}fa-flip-horizontal text-gray{/neq}"]); } elseif ($inputType == 'citypicker') { $attrArr['class'] = implode(' ', $cssClassArr); $attrArr['data-toggle'] = "city-picker"; diff --git a/application/admin/command/Crud/stubs/html/switch-edit.stub b/application/admin/command/Crud/stubs/html/switch-edit.stub new file mode 100644 index 00000000..8e109181 --- /dev/null +++ b/application/admin/command/Crud/stubs/html/switch-edit.stub @@ -0,0 +1,9 @@ + + + + {if in_array($row.{%field%}, ['{%fieldYes%}', '{%fieldNo%}'])} + + {else/} + + {/if} +