mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
refactor(CRUD):多数据库支持兼容旧记录时默认值将显示为空
This commit is contained in:
parent
16c2185f67
commit
b033c06d26
@ -307,12 +307,9 @@ class Crud extends Backend
|
|||||||
if (!$info) {
|
if (!$info) {
|
||||||
$this->error(__('Record not found'));
|
$this->error(__('Record not found'));
|
||||||
}
|
}
|
||||||
// 需要兼容旧纪录
|
|
||||||
if(!isset($info['table']['databaseConnection'])) {
|
|
||||||
$info['table']['databaseConnection'] = config('database.default');
|
|
||||||
}
|
|
||||||
// 数据表是否有数据
|
// 数据表是否有数据
|
||||||
$connection = TableManager::getConnection($info['table']['databaseConnection']);
|
$connection = TableManager::getConnection($info['table']['databaseConnection'] ?? '');
|
||||||
$tableName = TableManager::tableName($info['table']['name'], false, $connection);
|
$tableName = TableManager::tableName($info['table']['name'], false, $connection);
|
||||||
$adapter = TableManager::phinxAdapter(true, $connection);
|
$adapter = TableManager::phinxAdapter(true, $connection);
|
||||||
if ($adapter->hasTable($tableName)) {
|
if ($adapter->hasTable($tableName)) {
|
||||||
|
@ -1136,6 +1136,7 @@ const loadData = () => {
|
|||||||
state.table.rebuild = 'Yes'
|
state.table.rebuild = 'Yes'
|
||||||
}
|
}
|
||||||
state.table.isCommonModel = parseInt(res.data.table.isCommonModel)
|
state.table.isCommonModel = parseInt(res.data.table.isCommonModel)
|
||||||
|
state.table.databaseConnection = res.data.table.databaseConnection ? res.data.table.databaseConnection : ''
|
||||||
const fields = res.data.fields
|
const fields = res.data.fields
|
||||||
for (const key in fields) {
|
for (const key in fields) {
|
||||||
const field = handleFieldAttr(cloneDeep(fields[key]))
|
const field = handleFieldAttr(cloneDeep(fields[key]))
|
||||||
|
Loading…
Reference in New Issue
Block a user