切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
8 years ago
提交
98060d5128c41c5eedd1ef1a05d66be561f5c2cf
1 个父辈
311f1d76
修复CRUD时使用带前缀表时的BUG
修复安卓下快捷搜索菜单的BUG
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
16 行增加
和
14 行删除
application/admin/command/Crud.php
public/assets/js/backend/index.js
application/admin/command/Crud.php
查看文件 @
98060d5
...
...
@@ -201,7 +201,8 @@ class Crud extends Command
$prefix
=
Config
::
get
(
'database.prefix'
);
//检查主表
$tableName
=
$table
;
$table
=
stripos
(
$table
,
$prefix
)
===
0
?
substr
(
$table
,
strlen
(
$prefix
))
:
$table
;
$modelTableName
=
$tableName
=
$table
;
$modelTableType
=
'table'
;
$tableInfo
=
Db
::
query
(
"SHOW TABLE STATUS LIKE '
{
$tableName
}
'"
,
[],
TRUE
);
if
(
!
$tableInfo
)
...
...
@@ -214,21 +215,19 @@ class Crud extends Command
throw
new
Exception
(
"table not found"
);
}
}
else
{
$table
=
stripos
(
$table
,
$prefix
)
===
0
?
substr
(
$table
,
strlen
(
$prefix
))
:
$table
;
}
$tableInfo
=
$tableInfo
[
0
];
$relationModelTableName
=
$relationTableName
=
$relation
;
$relationModelTableType
=
'table'
;
//检查关联表
if
(
$relation
)
{
$relationTableName
=
$prefix
.
$relation
;
$relation
=
stripos
(
$relation
,
$prefix
)
===
0
?
substr
(
$relation
,
strlen
(
$prefix
))
:
$relation
;
$relationModelTableName
=
$relationTableName
=
$relation
;
$relationTableInfo
=
Db
::
query
(
"SHOW TABLE STATUS LIKE '
{
$relationTableName
}
'"
,
[],
TRUE
);
if
(
!
$relationTableInfo
)
{
$relationTableName
=
$relation
;
$relationTableName
=
$
prefix
.
$
relation
;
$relationModelTableType
=
'name'
;
$relationTableInfo
=
Db
::
query
(
"SHOW TABLE STATUS LIKE '
{
$relationTableName
}
'"
,
[],
TRUE
);
if
(
!
$relationTableInfo
)
...
...
@@ -236,10 +235,6 @@ class Crud extends Command
throw
new
Exception
(
"relation table not found"
);
}
}
else
{
$relation
=
stripos
(
$relation
,
$prefix
)
===
0
?
substr
(
$relation
,
strlen
(
$prefix
))
:
$relation
;
}
}
//根据表名匹配对应的Fontawesome图标
...
...
@@ -247,6 +242,7 @@ class Crud extends Command
$iconName
=
is_file
(
$iconPath
)
&&
stripos
(
file_get_contents
(
$iconPath
),
'@fa-var-'
.
$table
.
':'
)
?
$table
:
'fa fa-circle-o'
;
//控制器默认以表名进行处理,以下划线进行分隔,如果需要自定义则需要传入controller,格式为目录层级
$controller
=
str_replace
(
'_'
,
''
,
$controller
);
$controllerArr
=
!
$controller
?
explode
(
'_'
,
strtolower
(
$table
))
:
explode
(
'/'
,
strtolower
(
$controller
));
$controllerUrl
=
implode
(
'/'
,
$controllerArr
);
$controllerName
=
ucfirst
(
array_pop
(
$controllerArr
));
...
...
@@ -670,7 +666,6 @@ class Crud extends Command
}
}
//JS最后一列加上操作列
$javascriptList
[] = str_repeat("
", 24) . "
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
";
$addList
= implode("
\n
", array_filter(
$addList
));
...
...
@@ -718,9 +713,9 @@ class Crud extends Command
'modelAutoWriteTimestamp' => in_array('createtime',
$fieldArr
) || in_array('updatetime',
$fieldArr
) ? "
'int'
" : 'false',
'createTime' => in_array('createtime',
$fieldArr
) ? "
'createtime'
" : 'false',
'updateTime' => in_array('updatetime',
$fieldArr
) ? "
'updatetime'
" : 'false',
'modelTableName' =>
$
tabl
e
,
'modelTableName' =>
$
modelTableNam
e
,
'modelTableType' =>
$modelTableType
,
'relationModelTableName' =>
$relation
,
'relationModelTableName' =>
$relation
ModelTableName
,
'relationModelTableType' =>
$relationModelTableType
,
'relationModelName' =>
$relationModelName
,
'relationWith' => '',
...
...
public/assets/js/backend/index.js
查看文件 @
98060d5
...
...
@@ -16,10 +16,17 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
//快捷搜索
$
(
".menuresult"
).
width
(
$
(
"form.sidebar-form > .input-group"
).
width
());
var
isAndroid
=
/
(
android
)
/i
.
test
(
navigator
.
userAgent
);
var
searchResult
=
$
(
".menuresult"
);
$
(
"form.sidebar-form"
).
on
(
"blur"
,
"input[name=q]"
,
function
()
{
searchResult
.
addClass
(
"hide"
);
if
(
isAndroid
)
{
$
.
AdminLTE
.
options
.
sidebarSlimScroll
=
true
;
}
}).
on
(
"focus"
,
"input[name=q]"
,
function
()
{
if
(
isAndroid
)
{
$
.
AdminLTE
.
options
.
sidebarSlimScroll
=
false
;
}
if
(
$
(
"a"
,
searchResult
).
size
()
>
0
)
{
searchResult
.
removeClass
(
"hide"
);
}
...
...
请
注册
或
登录
后发表评论