mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-22 07:04:24 +00:00
fix(CRUD):修复字段类型为char(1)时,生成的单选框无字典数据
This commit is contained in:
parent
08b1aa0eef
commit
16cba0daeb
@ -1525,19 +1525,15 @@ class Crud extends Command
|
||||
/**
|
||||
* 列替换数据
|
||||
*/
|
||||
public function getColumnReplaceData(&$column, $fieldName, $inputType)
|
||||
public function getColumnReplaceData($column, $fieldName, $inputType)
|
||||
{
|
||||
$columnData = [];
|
||||
if (in_array($column['DATA_TYPE'], ['enum', 'set', 'tinyint'])) {
|
||||
if (in_array($column['DATA_TYPE'], ['enum', 'set', 'tinyint', 'char'])) {
|
||||
if ($column['DATA_TYPE'] !== 'tinyint') {
|
||||
$columnData = substr($column['COLUMN_TYPE'], strlen($column['DATA_TYPE']) + 1, -1);
|
||||
$columnData = explode(',', str_replace("'", '', $columnData));
|
||||
}
|
||||
$columnData = $this->getItemArray($columnData, $fieldName, $column['COLUMN_COMMENT']);
|
||||
// 如果类型为tinyint且有使用备注数据
|
||||
if ($columnData && $column['DATA_TYPE'] == 'tinyint') {
|
||||
$column['DATA_TYPE'] = 'enum';
|
||||
}
|
||||
}
|
||||
if (!$columnData && in_array($inputType, ['select', 'selects'])) {
|
||||
$columnData = $this->getItemArray($columnData, $fieldName, $column['COLUMN_COMMENT']);
|
||||
|
Loading…
Reference in New Issue
Block a user