切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
8 years ago
提交
14b67d6be1b0b454f77631e1cc00ec70c90bc1c8
1 个父辈
4fbc2c8e
新增普通搜索的onCommonSearch事件和onPostCommonSearch事件
优化普通搜索显示 优化菜单双击事件 优化后台插件安装提示 优化普通搜索操作符,Between支持单边搜索
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
174 行增加
和
123 行删除
application/admin/controller/Addon.php
application/admin/lang/zh-cn/addon.php
application/admin/view/addon/index.html
application/common/controller/Backend.php
public/assets/js/backend/addon.js
public/assets/js/backend/index.js
public/assets/js/bootstrap-table-commonsearch.js
public/assets/js/require-backend.min.js
application/admin/controller/Addon.php
查看文件 @
14b67d6
...
...
@@ -259,7 +259,7 @@ class Addon extends Backend
Service
::
importsql
(
$name
);
$info
[
'config'
]
=
get_addon_config
(
$name
)
?
1
:
0
;
$this
->
success
(
__
(
'
I
nstalled tips'
),
null
,
[
'addon'
=>
$info
]);
$this
->
success
(
__
(
'
Offline i
nstalled tips'
),
null
,
[
'addon'
=>
$info
]);
}
catch
(
Exception
$e
)
{
...
...
application/admin/lang/zh-cn/addon.php
查看文件 @
14b67d6
...
...
@@ -7,6 +7,7 @@ return [
'Array key'
=>
'键'
,
'Array value'
=>
'值'
,
'File'
=>
'文件'
,
'Donate'
=>
'打赏作者'
,
'Warmtips'
=>
'温馨提示'
,
'Offline install'
=>
'离线安装'
,
'Refresh addon cache'
=>
'刷新插件缓存'
,
...
...
@@ -21,7 +22,11 @@ return [
'Pay click tips'
=>
'请点击这里在新窗口中进行支付!'
,
'Pay new window tips'
=>
'请在新弹出的窗口中进行支付,支付完成后再重新点击安装按钮进行安装!'
,
'Uninstall tips'
=>
'确认卸载插件?<p class="text-danger">卸载将会删除所有插件文件且不可找回!!! 插件如果有创建数据库表请手动删除!!!</p>如有重要数据请备份后再操作!'
,
'Installed tips'
=>
'插件安装成功,你需要手动启用该插件,使之生效'
,
'Offline installed tips'
=>
'插件安装成功!你需要手动启用该插件,并清除缓存使之生效'
,
'Online installed tips'
=>
'插件安装成功!清除插件缓存和框架缓存后生效!'
,
'Not login tips'
=>
'你当前未登录FastAdmin,登录后将同步已购买的记录,下载时无需二次付费!'
,
'Login now'
=>
'立即登录'
,
'Continue install'
=>
'不登录,继续安装'
,
'Recommend'
=>
'推荐'
,
'Hot'
=>
'热门'
,
'New'
=>
'新'
,
...
...
application/admin/view/addon/index.html
查看文件 @
14b67d6
...
...
@@ -2,16 +2,13 @@
.item-addon
{
margin-left
:
15px
;
margin-bottom
:
15px
;}
.item-addon
img
.img-responsive
,
.item-addon
.noimage
{
width
:
300px
;
height
:
200px
;}
.noimage
{
line-height
:
200px
;
text-align
:
center
;
background
:
#18bc9c
;
color
:
#fff
;}
.addon
{
position
:
relative
;
}
.addon
>
span
{
position
:
absolute
;
left
:
15px
;
top
:
15px
;
}
.layui-layer-pay
.layui-layer-content
{
padding
:
0
;
height
:
600px
!important
;
}
.addon
{
position
:
relative
;}
.addon
>
span
{
position
:
absolute
;
left
:
15px
;
top
:
15px
;}
.layui-layer-pay
.layui-layer-content
{
padding
:
0
;
height
:
600px
!important
;}
.layui-layer-pay
{
border
:
none
;}
.payimg
{
position
:
relative
;
width
:
800px
;
height
:
600px
;}
.payimg
.alipaycode
{
position
:
absolute
;
left
:
265px
;
top
:
442px
;}
.payimg
.wechatcode
{
position
:
absolute
;
left
:
660px
;
top
:
442px
;}
</style>
<div
id=
"warmtips"
class=
"alert alert-dismissable alert-danger hide"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
>
×
</button>
...
...
@@ -79,13 +76,15 @@
<
/div
>
</script>
<script
id=
"paytpl"
type=
"text/html"
>
<
div
style
=
"position:relative;width:800px;height:600px;background:url('<%=payimg%>') 0 0 no-repeat;"
>
<
div
style
=
"position:absolute;left:265px;top:442px;"
>
<
div
class
=
"payimg"
style
=
"background:url('<%=payimg%>') 0 0 no-repeat;background-size:cover;"
>
<%
if
(
paycode
){
%>
<
div
class
=
"alipaycode"
>
<%=
paycode
%>
<
/div
>
<
div
style
=
"position:absolute;left:660px;top:442px;
"
>
<
div
class
=
"wechatcode
"
>
<%=
paycode
%>
<
/div
>
<%
}
%>
<
/div
>
</script>
<script
id=
"conflicttpl"
type=
"text/html"
>
...
...
@@ -146,7 +145,7 @@
<
p
class
=
"text-muted"
>
{:
__
(
'Createtime'
)}
:
<%=
Moment
(
item
.
createtime
*
1000
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
%><
/p
>
<
p
class
=
"operate"
data
-
id
=
"<%=item.id%>"
data
-
name
=
"<%=item.name%>"
>
<%
if
(
!
addon
){
%>
<
a
href
=
"javascript:;"
class
=
"btn btn-primary btn-success btn-install"
data
-
type
=
"<%=item.price<=0?'free':'price';%>"
><
i
class
=
"fa fa-cloud-download"
><
/i> {:__
(
'Install'
)
}</
a
>
<
a
href
=
"javascript:;"
class
=
"btn btn-primary btn-success btn-install"
data
-
type
=
"<%=item.price<=0?'free':'price';%>"
data
-
donateimage
=
"<%=item.donateimage%>"
><
i
class
=
"fa fa-cloud-download"
><
/i> {:__
(
'Install'
)
}</
a
>
<%
if
(
item
.
demourl
){
%>
<
a
href
=
"<%=item.demourl%>"
class
=
"btn btn-primary btn-info btn-demo"
target
=
"_blank"
><
i
class
=
"fa fa-flash"
><
/i> {:__
(
'Demo'
)
}</
a
>
<%
}
%>
...
...
application/common/controller/Backend.php
查看文件 @
14b67d6
...
...
@@ -262,7 +262,21 @@ class Backend extends Controller
break
;
case
'BETWEEN'
:
case
'NOT BETWEEN'
:
$where
[]
=
[
$k
,
$sym
,
array_slice
(
explode
(
','
,
$v
),
0
,
2
)];
$arr
=
array_slice
(
explode
(
','
,
$v
),
0
,
2
);
if
(
stripos
(
$v
,
','
)
===
false
||
!
array_filter
(
$arr
))
continue
;
//当出现一边为空时改变操作符
if
(
$arr
[
0
]
===
''
)
{
$sym
=
$sym
==
'BETWEEN'
?
'<='
:
'>'
;
$arr
=
$arr
[
1
];
}
else
if
(
$arr
[
1
]
===
''
)
{
$sym
=
$sym
==
'BETWEEN'
?
'>='
:
'<'
;
$arr
=
$arr
[
0
];
}
$where
[]
=
[
$k
,
$sym
,
$arr
];
break
;
case
'LIKE'
:
case
'LIKE %...%'
:
...
...
public/assets/js/backend/addon.js
查看文件 @
14b67d6
...
...
@@ -120,6 +120,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
// 点击安装
$
(
document
).
on
(
"click"
,
".btn-install"
,
function
()
{
var
that
=
this
;
var
name
=
$
(
this
).
closest
(
".operate"
).
data
(
"name"
);
var
userinfo
=
Controller
.
api
.
userinfo
.
get
();
var
uid
=
userinfo
?
userinfo
.
id
:
0
;
...
...
@@ -131,6 +132,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
},
function
(
data
,
ret
)
{
Layer
.
closeAll
();
Config
[
'addons'
][
data
.
addon
.
name
]
=
ret
.
data
.
addon
;
Layer
.
alert
(
__
(
'Online installed tips'
),
{
btn
:
[
__
(
'OK'
),
__
(
'Donate'
)],
title
:
__
(
'Warning'
),
icon
:
1
,
btn2
:
function
()
{
//打赏
Layer
.
open
({
content
:
Template
(
"paytpl"
,
{
payimg
:
$
(
that
).
data
(
"donateimage"
)}),
shade
:
0.8
,
area
:
[
'800px'
,
'600px'
],
skin
:
'layui-layer-msg layui-layer-pay'
,
title
:
false
,
closeBtn
:
true
,
btn
:
false
,
resize
:
false
,
});
}
});
$
(
'.btn-refresh'
).
trigger
(
'click'
);
},
function
(
data
,
ret
)
{
//如果是需要购买的插件则弹出二维码提示
...
...
@@ -183,6 +202,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
return
false
;
});
};
if
(
$
(
that
).
data
(
"type"
)
!==
'free'
)
{
if
(
parseInt
(
uid
)
===
0
)
{
return
Layer
.
alert
(
__
(
'Not login tips'
),
{
title
:
__
(
'Warning'
),
btn
:
[
__
(
'Login now'
),
__
(
'Continue install'
)],
yes
:
function
(
index
,
layero
)
{
$
(
".btn-userinfo"
).
trigger
(
"click"
);
},
btn2
:
function
()
{
install
(
name
,
false
);
}
});
}
}
install
(
name
,
false
);
});
...
...
public/assets/js/backend/index.js
查看文件 @
14b67d6
...
...
@@ -8,7 +8,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
//双击重新加载页面
$
(
document
).
on
(
"dblclick"
,
".sidebar-menu li > a"
,
function
(
e
)
{
$
(
"#
tab
_"
+
$
(
this
).
attr
(
"addtabs"
)
+
" iframe"
).
attr
(
'src'
,
function
(
i
,
val
)
{
$
(
"#
con
_"
+
$
(
this
).
attr
(
"addtabs"
)
+
" iframe"
).
attr
(
'src'
,
function
(
i
,
val
)
{
return
val
;
});
e
.
stopPropagation
();
...
...
public/assets/js/bootstrap-table-commonsearch.js
查看文件 @
14b67d6
...
...
@@ -3,6 +3,7 @@
* @version: v0.0.1
*
* @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
* @update 2017-09-03 <http://git.oschina.net/karson/fastadmin>
*/
!
function
(
$
)
{
...
...
@@ -19,8 +20,8 @@
vModal
+=
vFormCommon
.
join
(
''
);
vModal
+=
"</div>"
;
that
.
$container
.
prepend
(
$
(
vModal
));
var
form
=
$
(
"form.form-commonsearch"
,
that
.
$container
);
that
.
$commonsearch
=
$
(
".commonsearch-table"
,
that
.
$container
);
var
form
=
$
(
"form.form-commonsearch"
,
that
.
$commonsearch
);
//绑定日期时间元素事件
if
(
$
(
".datetimepicker"
,
form
).
size
()
>
0
)
{
...
...
@@ -49,25 +50,26 @@
// 表单提交
form
.
on
(
"submit"
,
function
(
event
)
{
event
.
preventDefault
();
that
.
onCo
lumnCo
mmonSearch
();
that
.
onCommonSearch
();
return
false
;
});
// 重置搜索
form
.
on
(
"click"
,
"button[type=reset]"
,
function
(
event
)
{
form
[
0
].
reset
();
that
.
onCo
lumnCo
mmonSearch
();
that
.
onCommonSearch
();
});
};
var
createFormCommon
=
function
(
pColumns
,
that
)
{
var
htmlForm
=
[];
var
opList
=
[
'='
,
'>'
,
'>='
,
'<'
,
'<='
,
'!='
,
'LIKE'
,
'LIKE %...%'
,
'NOT LIKE'
,
'IN(...)'
,
'NOT IN(...)'
,
'BETWEEN'
,
'NOT BETWEEN'
,
'IS NULL'
,
'IS NOT NULL'
];
htmlForm
.
push
(
sprintf
(
'<form class="form-inline form-commonsearch" action="%s" >'
,
that
.
options
.
actionForm
));
var
opList
=
[
'='
,
'>'
,
'>='
,
'<'
,
'<='
,
'!='
,
'LIKE'
,
'LIKE %...%'
,
'NOT LIKE'
,
'IN'
,
'NOT IN'
,
'IN(...)'
,
'NOT IN(...)'
,
'BETWEEN'
,
'NOT BETWEEN'
,
'IS NULL'
,
'IS NOT NULL'
];
htmlForm
.
push
(
sprintf
(
'<form class="form-horizontal form-commonsearch" action="%s" >'
,
that
.
options
.
actionForm
));
htmlForm
.
push
(
'<fieldset>'
);
if
(
that
.
options
.
titleForm
.
length
>
0
)
htmlForm
.
push
(
sprintf
(
"<legend>%s</legend>"
,
that
.
options
.
titleForm
));
htmlForm
.
push
(
'<div class="row">'
);
for
(
var
i
in
pColumns
)
{
var
vObjCol
=
pColumns
[
i
];
if
(
!
vObjCol
.
checkbox
&&
vObjCol
.
field
!==
'operate'
&&
vObjCol
.
searchable
&&
vObjCol
.
operate
!==
false
)
{
...
...
@@ -75,8 +77,11 @@
query
=
query
?
query
:
''
;
vObjCol
.
defaultValue
=
that
.
options
.
renderDefault
&&
query
!=
''
?
query
:
(
typeof
vObjCol
.
defaultValue
===
'undefined'
?
''
:
vObjCol
.
defaultValue
);
ColumnsForSearch
.
push
(
vObjCol
);
htmlForm
.
push
(
'<div class="form-group" style="margin:5px">'
);
htmlForm
.
push
(
sprintf
(
'<label for="%s" class="control-label" style="padding:0 10px">%s</label>'
,
vObjCol
.
field
,
vObjCol
.
title
));
htmlForm
.
push
(
'<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'
);
htmlForm
.
push
(
sprintf
(
'<label for="%s" class="control-label col-xs-4">%s</label>'
,
vObjCol
.
field
,
vObjCol
.
title
));
htmlForm
.
push
(
'<div class="col-xs-8">'
);
vObjCol
.
operate
=
(
typeof
vObjCol
.
operate
===
'undefined'
||
$
.
inArray
(
vObjCol
.
operate
,
opList
)
===
-
1
)
?
'='
:
vObjCol
.
operate
;
htmlForm
.
push
(
sprintf
(
'<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>'
,
vObjCol
.
field
,
vObjCol
.
field
,
vObjCol
.
operate
));
...
...
@@ -86,7 +91,7 @@
htmlForm
.
push
(
sprintf
(
'<select class="form-control" name="%s" %s>%s</select>'
,
vObjCol
.
field
,
style
,
sprintf
(
'<option value="">%s</option>'
,
that
.
options
.
formatCommonChoose
())));
(
function
(
vObjCol
,
that
)
{
$
.
when
(
vObjCol
.
searchList
).
done
(
function
(
ret
)
{
var
isArray
=
false
;
if
(
ret
.
data
&&
ret
.
data
.
searchlist
&&
$
.
isArray
(
ret
.
data
.
searchlist
))
{
var
resultlist
=
{};
...
...
@@ -126,17 +131,26 @@
if
(
/BETWEEN$/
.
test
(
vObjCol
.
operate
))
{
var
defaultValueArr
=
/^.+|.+$/
.
test
(
defaultValue
)
?
defaultValue
.
split
(
'|'
)
:
[
''
,
''
];
htmlForm
.
push
(
sprintf
(
'<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValueArr
[
0
],
placeholder
,
vObjCol
.
field
,
style
,
data
));
htmlForm
.
push
(
sprintf
(
' - <input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValueArr
[
1
],
placeholder
,
vObjCol
.
field
,
style
,
data
));
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'
);
htmlForm
.
push
(
sprintf
(
'<label for="%s" class="control-label col-xs-4">%s</label>'
,
vObjCol
.
field
,
"-"
));
htmlForm
.
push
(
'<div class="col-xs-8">'
);
htmlForm
.
push
(
sprintf
(
'<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValueArr
[
1
],
placeholder
,
vObjCol
.
field
,
style
,
data
));
}
else
{
htmlForm
.
push
(
sprintf
(
'<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValue
,
placeholder
,
vObjCol
.
field
,
style
,
data
));
}
}
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</div>'
);
}
}
htmlForm
.
push
(
'<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'
);
htmlForm
.
push
(
createFormBtn
(
that
).
join
(
''
));
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</fieldset>'
);
htmlForm
.
push
(
'</form>'
);
...
...
@@ -147,12 +161,10 @@
var
htmlBtn
=
[];
var
searchSubmit
=
that
.
options
.
formatCommonSubmitButton
();
var
searchReset
=
that
.
options
.
formatCommonResetButton
();
htmlBtn
.
push
(
'<div class="form-group" style="margin:5px">'
);
htmlBtn
.
push
(
'<div class="col-sm-12 text-center">'
);
htmlBtn
.
push
(
'<div class="col-sm-8 col-xs-offset-4">'
);
htmlBtn
.
push
(
sprintf
(
'<button type="submit" class="btn btn-success" >%s</button> '
,
searchSubmit
));
htmlBtn
.
push
(
sprintf
(
'<button type="reset" class="btn btn-default" >%s</button> '
,
searchReset
));
htmlBtn
.
push
(
'</div>'
);
htmlBtn
.
push
(
'</div>'
);
return
htmlBtn
;
};
...
...
@@ -179,7 +191,7 @@
if
(
obj
.
size
()
>
1
)
{
if
(
/BETWEEN$/
.
test
(
sym
))
{
var
value_begin
=
$
.
trim
(
$
(
"[name='"
+
name
+
"']:first"
).
val
()),
value_end
=
$
.
trim
(
$
(
"[name='"
+
name
+
"']:last"
).
val
());
if
(
!
value_begin
.
length
||
!
value_end
.
length
)
{
if
(
!
value_begin
.
length
&&
!
value_end
.
length
)
{
return
true
;
}
if
(
typeof
vObjCol
.
process
===
'function'
)
{
...
...
@@ -187,8 +199,8 @@
value_end
=
vObjCol
.
process
(
value_end
,
'end'
);
}
else
if
(
$
(
"[name='"
+
name
+
"']:first"
).
attr
(
'type'
)
===
'datetime'
)
{
//datetime类型字段转换成时间戳
var
Hms
=
Moment
(
value_begin
).
format
(
"HH:mm:ss"
);
value_begin
=
parseInt
(
Moment
(
value_begin
)
/
1000
);
value_end
=
parseInt
(
Moment
(
value_end
)
/
1000
);
value_begin
=
value_begin
?
parseInt
(
Moment
(
value_begin
)
/
1000
)
:
''
;
value_end
=
value_end
?
parseInt
(
Moment
(
value_end
)
/
1000
)
:
''
;
if
(
value_begin
===
value_end
&&
'00:00:00'
===
Hms
)
{
value_end
+=
86399
;
}
...
...
@@ -217,7 +229,10 @@
searchFormVisible
:
true
,
searchClass
:
'searchit'
,
renderDefault
:
true
,
onColumnCommonSearch
:
function
(
field
,
text
)
{
onCommonSearch
:
function
(
field
,
text
)
{
return
false
;
},
onPostCommonSearch
:
function
(
table
)
{
return
false
;
}
});
...
...
@@ -227,7 +242,8 @@
});
$
.
extend
(
$
.
fn
.
bootstrapTable
.
Constructor
.
EVENTS
,
{
'column-common-search.bs.table'
:
'onColumnCommonSearch'
'common-search.bs.table'
:
'onCommonSearch'
,
'post-common-search.bs.table'
:
'onPostCommonSearch'
});
$
.
extend
(
$
.
fn
.
bootstrapTable
.
locales
[
$
.
fn
.
bootstrapTable
.
defaults
.
locale
],
{
...
...
@@ -297,6 +313,7 @@
params
.
op
=
JSON
.
stringify
(
$
.
extend
(
params
.
op
||
{},
searchQuery
.
op
));
return
params
;
};
this
.
trigger
(
'post-common-search'
,
that
);
};
...
...
@@ -335,40 +352,23 @@
})
:
this
.
data
;
};
BootstrapTable
.
prototype
.
onColumnCommonSearch
=
function
(
event
)
{
if
(
typeof
event
===
'undefined'
)
{
var
searchquery
=
getSearchQuery
(
this
);
// 追加查询关键字
this
.
options
.
pageNumber
=
1
;
this
.
options
.
queryParams
=
function
(
params
)
{
return
{
search
:
params
.
search
,
sort
:
params
.
sort
,
order
:
params
.
order
,
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
),
offset
:
params
.
offset
,
limit
:
params
.
limit
,
};
BootstrapTable
.
prototype
.
onCommonSearch
=
function
()
{
var
searchquery
=
getSearchQuery
(
this
);
this
.
trigger
(
'common-search'
,
this
,
searchquery
);
// 追加查询关键字
this
.
options
.
pageNumber
=
1
;
this
.
options
.
queryParams
=
function
(
params
)
{
return
{
search
:
params
.
search
,
sort
:
params
.
sort
,
order
:
params
.
order
,
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
),
offset
:
params
.
offset
,
limit
:
params
.
limit
,
};
this
.
refresh
({
query
:
{
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
)}});
}
else
{
var
text
=
$
.
trim
(
$
(
event
.
currentTarget
).
val
());
var
$field
=
$
(
event
.
currentTarget
)[
0
].
id
;
if
(
$
.
isEmptyObject
(
this
.
filterColumnsPartial
))
{
this
.
filterColumnsPartial
=
{};
}
if
(
text
)
{
this
.
filterColumnsPartial
[
$field
]
=
text
;
}
else
{
delete
this
.
filterColumnsPartial
[
$field
];
}
this
.
options
.
pageNumber
=
1
;
this
.
onSearch
(
event
);
// this.updatePagination();
this
.
trigger
(
'column-common-search'
,
$field
,
text
);
}
};
this
.
refresh
({
query
:
{
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
)}});
};
}(
jQuery
);
...
...
public/assets/js/require-backend.min.js
查看文件 @
14b67d6
...
...
@@ -7283,6 +7283,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
* @version: v0.0.1
*
* @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
* @update 2017-09-03 <http://git.oschina.net/karson/fastadmin>
*/
!
function
(
$
)
{
...
...
@@ -7299,8 +7300,8 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
vModal
+=
vFormCommon
.
join
(
''
);
vModal
+=
"</div>"
;
that
.
$container
.
prepend
(
$
(
vModal
));
var
form
=
$
(
"form.form-commonsearch"
,
that
.
$container
);
that
.
$commonsearch
=
$
(
".commonsearch-table"
,
that
.
$container
);
var
form
=
$
(
"form.form-commonsearch"
,
that
.
$commonsearch
);
//绑定日期时间元素事件
if
(
$
(
".datetimepicker"
,
form
).
size
()
>
0
)
{
...
...
@@ -7329,25 +7330,26 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
// 表单提交
form
.
on
(
"submit"
,
function
(
event
)
{
event
.
preventDefault
();
that
.
onCo
lumnCo
mmonSearch
();
that
.
onCommonSearch
();
return
false
;
});
// 重置搜索
form
.
on
(
"click"
,
"button[type=reset]"
,
function
(
event
)
{
form
[
0
].
reset
();
that
.
onCo
lumnCo
mmonSearch
();
that
.
onCommonSearch
();
});
};
var
createFormCommon
=
function
(
pColumns
,
that
)
{
var
htmlForm
=
[];
var
opList
=
[
'='
,
'>'
,
'>='
,
'<'
,
'<='
,
'!='
,
'LIKE'
,
'LIKE %...%'
,
'NOT LIKE'
,
'IN(...)'
,
'NOT IN(...)'
,
'BETWEEN'
,
'NOT BETWEEN'
,
'IS NULL'
,
'IS NOT NULL'
];
htmlForm
.
push
(
sprintf
(
'<form class="form-inline form-commonsearch" action="%s" >'
,
that
.
options
.
actionForm
));
var
opList
=
[
'='
,
'>'
,
'>='
,
'<'
,
'<='
,
'!='
,
'LIKE'
,
'LIKE %...%'
,
'NOT LIKE'
,
'IN'
,
'NOT IN'
,
'IN(...)'
,
'NOT IN(...)'
,
'BETWEEN'
,
'NOT BETWEEN'
,
'IS NULL'
,
'IS NOT NULL'
];
htmlForm
.
push
(
sprintf
(
'<form class="form-horizontal form-commonsearch" action="%s" >'
,
that
.
options
.
actionForm
));
htmlForm
.
push
(
'<fieldset>'
);
if
(
that
.
options
.
titleForm
.
length
>
0
)
htmlForm
.
push
(
sprintf
(
"<legend>%s</legend>"
,
that
.
options
.
titleForm
));
htmlForm
.
push
(
'<div class="row">'
);
for
(
var
i
in
pColumns
)
{
var
vObjCol
=
pColumns
[
i
];
if
(
!
vObjCol
.
checkbox
&&
vObjCol
.
field
!==
'operate'
&&
vObjCol
.
searchable
&&
vObjCol
.
operate
!==
false
)
{
...
...
@@ -7355,8 +7357,11 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
query
=
query
?
query
:
''
;
vObjCol
.
defaultValue
=
that
.
options
.
renderDefault
&&
query
!=
''
?
query
:
(
typeof
vObjCol
.
defaultValue
===
'undefined'
?
''
:
vObjCol
.
defaultValue
);
ColumnsForSearch
.
push
(
vObjCol
);
htmlForm
.
push
(
'<div class="form-group" style="margin:5px">'
);
htmlForm
.
push
(
sprintf
(
'<label for="%s" class="control-label" style="padding:0 10px">%s</label>'
,
vObjCol
.
field
,
vObjCol
.
title
));
htmlForm
.
push
(
'<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'
);
htmlForm
.
push
(
sprintf
(
'<label for="%s" class="control-label col-xs-4">%s</label>'
,
vObjCol
.
field
,
vObjCol
.
title
));
htmlForm
.
push
(
'<div class="col-xs-8">'
);
vObjCol
.
operate
=
(
typeof
vObjCol
.
operate
===
'undefined'
||
$
.
inArray
(
vObjCol
.
operate
,
opList
)
===
-
1
)
?
'='
:
vObjCol
.
operate
;
htmlForm
.
push
(
sprintf
(
'<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>'
,
vObjCol
.
field
,
vObjCol
.
field
,
vObjCol
.
operate
));
...
...
@@ -7366,7 +7371,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
htmlForm
.
push
(
sprintf
(
'<select class="form-control" name="%s" %s>%s</select>'
,
vObjCol
.
field
,
style
,
sprintf
(
'<option value="">%s</option>'
,
that
.
options
.
formatCommonChoose
())));
(
function
(
vObjCol
,
that
)
{
$
.
when
(
vObjCol
.
searchList
).
done
(
function
(
ret
)
{
var
isArray
=
false
;
if
(
ret
.
data
&&
ret
.
data
.
searchlist
&&
$
.
isArray
(
ret
.
data
.
searchlist
))
{
var
resultlist
=
{};
...
...
@@ -7406,17 +7411,26 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
if
(
/BETWEEN$/
.
test
(
vObjCol
.
operate
))
{
var
defaultValueArr
=
/^.+|.+$/
.
test
(
defaultValue
)
?
defaultValue
.
split
(
'|'
)
:
[
''
,
''
];
htmlForm
.
push
(
sprintf
(
'<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValueArr
[
0
],
placeholder
,
vObjCol
.
field
,
style
,
data
));
htmlForm
.
push
(
sprintf
(
' - <input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValueArr
[
1
],
placeholder
,
vObjCol
.
field
,
style
,
data
));
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'
);
htmlForm
.
push
(
sprintf
(
'<label for="%s" class="control-label col-xs-4">%s</label>'
,
vObjCol
.
field
,
"-"
));
htmlForm
.
push
(
'<div class="col-xs-8">'
);
htmlForm
.
push
(
sprintf
(
'<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValueArr
[
1
],
placeholder
,
vObjCol
.
field
,
style
,
data
));
}
else
{
htmlForm
.
push
(
sprintf
(
'<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>'
,
type
,
addclass
,
vObjCol
.
field
,
defaultValue
,
placeholder
,
vObjCol
.
field
,
style
,
data
));
}
}
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</div>'
);
}
}
htmlForm
.
push
(
'<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'
);
htmlForm
.
push
(
createFormBtn
(
that
).
join
(
''
));
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</div>'
);
htmlForm
.
push
(
'</fieldset>'
);
htmlForm
.
push
(
'</form>'
);
...
...
@@ -7427,12 +7441,10 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
var
htmlBtn
=
[];
var
searchSubmit
=
that
.
options
.
formatCommonSubmitButton
();
var
searchReset
=
that
.
options
.
formatCommonResetButton
();
htmlBtn
.
push
(
'<div class="form-group" style="margin:5px">'
);
htmlBtn
.
push
(
'<div class="col-sm-12 text-center">'
);
htmlBtn
.
push
(
'<div class="col-sm-8 col-xs-offset-4">'
);
htmlBtn
.
push
(
sprintf
(
'<button type="submit" class="btn btn-success" >%s</button> '
,
searchSubmit
));
htmlBtn
.
push
(
sprintf
(
'<button type="reset" class="btn btn-default" >%s</button> '
,
searchReset
));
htmlBtn
.
push
(
'</div>'
);
htmlBtn
.
push
(
'</div>'
);
return
htmlBtn
;
};
...
...
@@ -7459,7 +7471,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
if
(
obj
.
size
()
>
1
)
{
if
(
/BETWEEN$/
.
test
(
sym
))
{
var
value_begin
=
$
.
trim
(
$
(
"[name='"
+
name
+
"']:first"
).
val
()),
value_end
=
$
.
trim
(
$
(
"[name='"
+
name
+
"']:last"
).
val
());
if
(
!
value_begin
.
length
||
!
value_end
.
length
)
{
if
(
!
value_begin
.
length
&&
!
value_end
.
length
)
{
return
true
;
}
if
(
typeof
vObjCol
.
process
===
'function'
)
{
...
...
@@ -7467,8 +7479,8 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
value_end
=
vObjCol
.
process
(
value_end
,
'end'
);
}
else
if
(
$
(
"[name='"
+
name
+
"']:first"
).
attr
(
'type'
)
===
'datetime'
)
{
//datetime类型字段转换成时间戳
var
Hms
=
Moment
(
value_begin
).
format
(
"HH:mm:ss"
);
value_begin
=
parseInt
(
Moment
(
value_begin
)
/
1000
);
value_end
=
parseInt
(
Moment
(
value_end
)
/
1000
);
value_begin
=
value_begin
?
parseInt
(
Moment
(
value_begin
)
/
1000
)
:
''
;
value_end
=
value_end
?
parseInt
(
Moment
(
value_end
)
/
1000
)
:
''
;
if
(
value_begin
===
value_end
&&
'00:00:00'
===
Hms
)
{
value_end
+=
86399
;
}
...
...
@@ -7497,7 +7509,10 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
searchFormVisible
:
true
,
searchClass
:
'searchit'
,
renderDefault
:
true
,
onColumnCommonSearch
:
function
(
field
,
text
)
{
onCommonSearch
:
function
(
field
,
text
)
{
return
false
;
},
onPostCommonSearch
:
function
(
table
)
{
return
false
;
}
});
...
...
@@ -7507,7 +7522,8 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
});
$
.
extend
(
$
.
fn
.
bootstrapTable
.
Constructor
.
EVENTS
,
{
'column-common-search.bs.table'
:
'onColumnCommonSearch'
'common-search.bs.table'
:
'onCommonSearch'
,
'post-common-search.bs.table'
:
'onPostCommonSearch'
});
$
.
extend
(
$
.
fn
.
bootstrapTable
.
locales
[
$
.
fn
.
bootstrapTable
.
defaults
.
locale
],
{
...
...
@@ -7577,6 +7593,7 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
params
.
op
=
JSON
.
stringify
(
$
.
extend
(
params
.
op
||
{},
searchQuery
.
op
));
return
params
;
};
this
.
trigger
(
'post-common-search'
,
that
);
};
...
...
@@ -7615,41 +7632,24 @@ return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)
})
:
this
.
data
;
};
BootstrapTable
.
prototype
.
onColumnCommonSearch
=
function
(
event
)
{
if
(
typeof
event
===
'undefined'
)
{
var
searchquery
=
getSearchQuery
(
this
);
// 追加查询关键字
this
.
options
.
pageNumber
=
1
;
this
.
options
.
queryParams
=
function
(
params
)
{
return
{
search
:
params
.
search
,
sort
:
params
.
sort
,
order
:
params
.
order
,
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
),
offset
:
params
.
offset
,
limit
:
params
.
limit
,
};
BootstrapTable
.
prototype
.
onCommonSearch
=
function
()
{
var
searchquery
=
getSearchQuery
(
this
);
this
.
trigger
(
'common-search'
,
this
,
searchquery
);
// 追加查询关键字
this
.
options
.
pageNumber
=
1
;
this
.
options
.
queryParams
=
function
(
params
)
{
return
{
search
:
params
.
search
,
sort
:
params
.
sort
,
order
:
params
.
order
,
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
),
offset
:
params
.
offset
,
limit
:
params
.
limit
,
};
this
.
refresh
({
query
:
{
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
)}});
}
else
{
var
text
=
$
.
trim
(
$
(
event
.
currentTarget
).
val
());
var
$field
=
$
(
event
.
currentTarget
)[
0
].
id
;
if
(
$
.
isEmptyObject
(
this
.
filterColumnsPartial
))
{
this
.
filterColumnsPartial
=
{};
}
if
(
text
)
{
this
.
filterColumnsPartial
[
$field
]
=
text
;
}
else
{
delete
this
.
filterColumnsPartial
[
$field
];
}
this
.
options
.
pageNumber
=
1
;
this
.
onSearch
(
event
);
// this.updatePagination();
this
.
trigger
(
'column-common-search'
,
$field
,
text
);
}
};
this
.
refresh
({
query
:
{
filter
:
JSON
.
stringify
(
searchquery
.
filter
),
op
:
JSON
.
stringify
(
searchquery
.
op
)}});
};
}(
jQuery
);
...
...
请
注册
或
登录
后发表评论