切换导航条
此项目
正在载入...
登录
何书鹏
/
anttest
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
5 years ago
提交
c8085a406ed6b47ccc725e5a19671cd812433c6b
1 个父辈
b4185e2d
新增列表搜索autocomplete配置
优化关联搜索 优化附件列表缩略图显示
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
53 行增加
和
25 行删除
application/common/controller/Backend.php
application/common/model/Attachment.php
public/assets/js/backend/general/attachment.js
public/assets/js/bootstrap-table-commonsearch.js
public/assets/js/require-backend.min.js
public/assets/js/require-frontend.min.js
application/common/controller/Backend.php
查看文件 @
c8085a4
...
...
@@ -273,39 +273,41 @@ class Backend extends Controller
$op
=
(
array
)
json_decode
(
$op
,
true
);
$filter
=
$filter
?
$filter
:
[];
$where
=
[];
$alias
=
[];
$bind
=
[];
$name
=
''
;
$tableName
=
''
;
if
(
$relationSearch
)
{
if
(
!
empty
(
$this
->
model
))
{
$name
=
$this
->
model
->
getTable
();
$tableName
=
$name
.
'.'
;
}
$sortArr
=
explode
(
','
,
$sort
);
foreach
(
$sortArr
as
$index
=>
&
$item
)
{
$item
=
stripos
(
$item
,
"."
)
===
false
?
$tableName
.
trim
(
$item
)
:
$item
;
}
unset
(
$item
);
$sort
=
implode
(
','
,
$sortArr
);
$aliasName
=
''
;
if
(
!
empty
(
$this
->
model
))
{
$name
=
$this
->
model
->
getTable
();
$alias
[
$name
]
=
Loader
::
parseName
(
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
))));
$aliasName
=
$alias
[
$name
]
.
'.'
;
}
$sortArr
=
explode
(
','
,
$sort
);
foreach
(
$sortArr
as
$index
=>
&
$item
)
{
$item
=
stripos
(
$item
,
"."
)
===
false
?
$aliasName
.
trim
(
$item
)
:
$item
;
}
unset
(
$item
);
$sort
=
implode
(
','
,
$sortArr
);
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$where
[]
=
[
$
table
Name
.
$this
->
dataLimitField
,
'in'
,
$adminIds
];
$where
[]
=
[
$
alias
Name
.
$this
->
dataLimitField
,
'in'
,
$adminIds
];
}
if
(
$search
)
{
$searcharr
=
is_array
(
$searchfields
)
?
$searchfields
:
explode
(
','
,
$searchfields
);
foreach
(
$searcharr
as
$k
=>
&
$v
)
{
$v
=
stripos
(
$v
,
"."
)
===
false
?
$
table
Name
.
$v
:
$v
;
$v
=
stripos
(
$v
,
"."
)
===
false
?
$
alias
Name
.
$v
:
$v
;
}
unset
(
$v
);
$where
[]
=
[
implode
(
"|"
,
$searcharr
),
"LIKE"
,
"%
{
$search
}
%"
];
}
$index
=
0
;
foreach
(
$filter
as
$k
=>
$v
)
{
if
(
!
preg_match
(
'/^[a-zA-Z0-9_\-\.]+$/'
,
$k
))
{
continue
;
}
$sym
=
isset
(
$op
[
$k
])
?
$op
[
$k
]
:
'='
;
if
(
stripos
(
$k
,
"."
)
===
false
)
{
$k
=
$
table
Name
.
$k
;
$k
=
$
alias
Name
.
$k
;
}
$v
=
!
is_array
(
$v
)
?
trim
(
$v
)
:
$v
;
$sym
=
strtoupper
(
isset
(
$op
[
$k
])
?
$op
[
$k
]
:
$sym
);
...
...
@@ -341,10 +343,11 @@ class Backend extends Controller
case
'FINDINSET'
:
case
'FIND_IN_SET'
:
$v
=
is_array
(
$v
)
?
$v
:
explode
(
','
,
str_replace
(
' '
,
','
,
$v
));
foreach
(
$v
as
$index
=>
$item
)
{
$item
=
str_replace
([
' '
,
','
,
"'"
],
''
,
$item
);
$item
=
addslashes
(
htmlentities
(
strip_tags
(
$item
)));
$where
[]
=
"FIND_IN_SET('
{
$item
}
', `"
.
(
$relationSearch
?
str_replace
(
'.'
,
'`.`'
,
$k
)
:
$k
)
.
"`)"
;
$findArr
=
array_values
(
$v
);
foreach
(
$findArr
as
$idx
=>
$item
)
{
$bindName
=
"item_"
.
$index
.
"_"
.
$idx
;
$bind
[
$bindName
]
=
$item
;
$where
[]
=
"FIND_IN_SET(:
{
$bindName
}
, `"
.
str_replace
(
'.'
,
'`.`'
,
$k
)
.
"`)"
;
}
break
;
case
'IN'
:
...
...
@@ -385,10 +388,10 @@ class Backend extends Controller
$arr
=
$arr
[
0
];
}
$tableArr
=
explode
(
'.'
,
$k
);
if
(
count
(
$tableArr
)
>
1
&&
$tableArr
[
0
]
!=
$name
)
{
if
(
count
(
$tableArr
)
>
1
&&
$tableArr
[
0
]
!=
$name
&&
!
in_array
(
$tableArr
[
0
],
$alias
)
)
{
//修复关联模型下时间无法搜索的BUG
$relation
=
Loader
::
parseName
(
$tableArr
[
0
],
1
,
false
);
$
this
->
model
->
alias
([
$this
->
model
->
$relation
()
->
getTable
()
=>
$tableArr
[
0
]])
;
$
alias
[
$this
->
model
->
$relation
()
->
getTable
()]
=
$tableArr
[
0
]
;
}
$where
[]
=
[
$k
,
str_replace
(
'RANGE'
,
'BETWEEN'
,
$sym
)
.
' TIME'
,
$arr
];
break
;
...
...
@@ -401,8 +404,14 @@ class Backend extends Controller
default
:
break
;
}
$index
++
;
}
$where
=
function
(
$query
)
use
(
$where
)
{
$this
->
model
->
alias
(
$alias
);
$model
=
$this
->
model
;
$where
=
function
(
$query
)
use
(
$where
,
$alias
,
$bind
,
&
$model
)
{
$model
->
alias
(
$alias
);
$model
->
bind
(
$bind
);
foreach
(
$where
as
$k
=>
$v
)
{
if
(
is_array
(
$v
))
{
call_user_func_array
([
$query
,
'where'
],
$v
);
...
...
@@ -411,7 +420,7 @@ class Backend extends Controller
}
}
};
return
[
$where
,
$sort
,
$order
,
$offset
,
$limit
,
$page
];
return
[
$where
,
$sort
,
$order
,
$offset
,
$limit
,
$page
,
$alias
,
$bind
];
}
/**
...
...
application/common/model/Attachment.php
查看文件 @
c8085a4
...
...
@@ -15,12 +15,31 @@ class Attachment extends Model
// 定义字段类型
protected
$type
=
[
];
protected
$append
=
[
'thumb_style'
];
public
function
setUploadtimeAttr
(
$value
)
{
return
is_numeric
(
$value
)
?
$value
:
strtotime
(
$value
);
}
/**
* 获取云储存的缩略图样式字符
*/
public
function
getThumbStyleAttr
(
$value
,
$data
)
{
if
(
!
isset
(
$data
[
'storage'
])
||
$data
[
'storage'
]
==
'local'
)
{
return
''
;
}
else
{
$config
=
get_addon_config
(
$data
[
'storage'
]);
if
(
$config
&&
isset
(
$config
[
'thumbstyle'
]))
{
return
$config
[
'thumbstyle'
];
}
}
return
''
;
}
public
static
function
getMimetypeList
()
{
$data
=
[
...
...
public/assets/js/backend/general/attachment.js
查看文件 @
c8085a4
...
...
@@ -162,8 +162,7 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
formatter
:
{
thumb
:
function
(
value
,
row
,
index
)
{
if
(
row
.
mimetype
.
indexOf
(
"image"
)
>
-
1
)
{
var
style
=
row
.
storage
===
'upyun'
?
'!/fwfh/120x90'
:
''
;
return
'<a href="'
+
row
.
fullurl
+
'" target="_blank"><img src="'
+
row
.
fullurl
+
style
+
'" alt="" style="max-height:90px;max-width:120px"></a>'
;
return
'<a href="'
+
row
.
fullurl
+
'" target="_blank"><img src="'
+
row
.
fullurl
+
row
.
thumb_style
+
'" alt="" style="max-height:90px;max-width:120px"></a>'
;
}
else
{
return
'<a href="'
+
row
.
fullurl
+
'" target="_blank"><img src="'
+
Fast
.
api
.
fixurl
(
"ajax/icon"
)
+
"?suffix="
+
row
.
imagetype
+
'" alt="" style="max-height:90px;max-width:120px"></a>'
;
}
...
...
public/assets/js/bootstrap-table-commonsearch.js
查看文件 @
c8085a4
...
...
@@ -80,6 +80,7 @@
var
extend
=
typeof
vObjCol
.
extend
===
'undefined'
?
''
:
vObjCol
.
extend
;
var
style
=
typeof
vObjCol
.
style
===
'undefined'
?
''
:
sprintf
(
'style="%s"'
,
vObjCol
.
style
);
extend
=
typeof
vObjCol
.
data
!==
'undefined'
&&
extend
==
''
?
vObjCol
.
data
:
extend
;
extend
=
typeof
vObjCol
.
autocomplete
!==
'undefined'
?
extend
+
' autocomplete="'
+
(
vObjCol
.
autocomplete
===
false
||
vObjCol
.
autocomplete
===
'off'
?
'off'
:
'on'
)
+
'"'
:
extend
;
if
(
vObjCol
.
searchList
)
{
if
(
typeof
vObjCol
.
searchList
===
'function'
)
{
htmlForm
.
push
(
vObjCol
.
searchList
.
call
(
this
,
vObjCol
));
...
...
public/assets/js/require-backend.min.js
查看文件 @
c8085a4
此 diff 太大无法显示。
public/assets/js/require-frontend.min.js
查看文件 @
c8085a4
此 diff 太大无法显示。
请
注册
或
登录
后发表评论