Pre Merge pull request !422 from lifankohome/develop

pull/422/MERGE
lifankohome 2025-06-26 09:09:02 +00:00 committed by Gitee
commit 50ee59c526
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 9 additions and 0 deletions

View File

@ -755,6 +755,15 @@ class Crud extends Command
$cssClassArr = ['form-control'];
$fieldName = "row[{$field}]";
$defaultValue = $v['COLUMN_DEFAULT'];
// 从数据库中获取表字段信息(mysql 10.4.25-MariaDB)中的默认数据两端会加上两个单引号,两个单引号需要清除掉,否则
// 在生成add.html时默认数据全部多单引号并且js无法解析正确的默认值导致单选框、多选框勾选错误。
if (is_string($defaultValue) && strlen($defaultValue) >= 2) {
if (substr($defaultValue, 0, 1) === "'" && substr($defaultValue, -1) === "'") {
$defaultValue = substr($defaultValue, 1, -1);
}
}
$editValue = "{\$row.{$field}|htmlentities}";
// 如果默认值非null,则是一个必选项
if ($v['IS_NULLABLE'] == 'NO') {