Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yaru
fgqyxxlr
Commits
32ab3189
Commit
32ab3189
authored
Aug 27, 2018
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
弹层外区域关闭
parent
c6d3e823
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
src/main/resources/static/ruoyi/js/ry-ui.js
+5
-2
src/main/resources/static/ruoyi/js/ry-ui.min.js
+2
-2
No files found.
src/main/resources/static/ruoyi/js/ry-ui.js
View file @
32ab3189
...
...
@@ -302,7 +302,8 @@
shade
:
0.3
,
title
:
title
,
content
:
url
,
shadeClose
:
true
// fix,点击阴影部分关闭窗口,常用.
// 弹层外区域关闭
shadeClose
:
true
});
},
// 弹出层全屏
...
...
@@ -332,7 +333,9 @@
maxmin
:
true
,
shade
:
0.3
,
title
:
title
,
content
:
url
content
:
url
,
// 弹层外区域关闭
shadeClose
:
true
});
layer
.
full
(
index
);
},
...
...
src/main/resources/static/ruoyi/js/ry-ui.min.js
View file @
32ab3189
...
...
@@ -2,4 +2,4 @@
* ruoyi.js
* Author: Ruoyi
*/
(
function
(
$
){
$
.
extend
({
table
:{
_option
:{},
_params
:{},
init
:
function
(
options
){
$
.
table
.
_option
=
options
;
$
.
table
.
_params
=
$
.
common
.
isEmpty
(
options
.
queryParams
)?
$
.
table
.
queryParams
:
options
.
queryParams
;
_sortOrder
=
$
.
common
.
isEmpty
(
options
.
sortOrder
)?
"asc"
:
options
.
sortOrder
;
_sortName
=
$
.
common
.
isEmpty
(
options
.
sortName
)?
""
:
options
.
sortName
;
$
(
"#bootstrap-table"
).
bootstrapTable
({
url
:
options
.
url
,
contentType
:
"application/x-www-form-urlencoded"
,
method
:
"post"
,
cache
:
false
,
sortable
:
true
,
sortStable
:
true
,
sortName
:
_sortName
,
sortOrder
:
_sortOrder
,
pagination
:
$
.
common
.
visible
(
options
.
pagination
),
pageNumber
:
1
,
pageSize
:
10
,
pageList
:[
10
,
25
,
50
],
iconSize
:
"outline"
,
toolbar
:
"#toolbar"
,
sidePagination
:
"server"
,
search
:
$
.
common
.
visible
(
options
.
search
),
showRefresh
:
$
.
common
.
visible
(
options
.
showRefresh
),
showColumns
:
$
.
common
.
visible
(
options
.
showColumns
),
showToggle
:
$
.
common
.
visible
(
options
.
showToggle
),
showExport
:
$
.
common
.
visible
(
options
.
showExport
),
queryParams
:
$
.
table
.
_params
,
columns
:
options
.
columns
,
responseHandler
:
$
.
table
.
responseHandler
})},
queryParams
:
function
(
params
){
return
{
pageSize
:
params
.
limit
,
pageNum
:
params
.
offset
/
params
.
limit
+
1
,
searchValue
:
params
.
search
,
orderByColumn
:
params
.
sort
,
isAsc
:
params
.
order
}},
responseHandler
:
function
(
res
){
if
(
res
.
code
==
0
){
return
{
rows
:
res
.
rows
,
total
:
res
.
total
}}
else
{
$
.
modal
.
alertWarning
(
res
.
msg
);
return
{
rows
:[],
total
:
0
}}},
search
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
var
params
=
$
(
"#bootstrap-table"
).
bootstrapTable
(
"getOptions"
);
params
.
queryParams
=
function
(
params
){
var
search
=
{};
$
.
each
(
$
(
"#"
+
currentId
).
serializeArray
(),
function
(
i
,
field
){
search
[
field
.
name
]
=
field
.
value
});
search
.
pageSize
=
params
.
limit
;
search
.
pageNum
=
params
.
offset
/
params
.
limit
+
1
;
search
.
searchValue
=
params
.
search
;
search
.
orderByColumn
=
params
.
sort
;
search
.
isAsc
=
params
.
order
;
return
search
};
$
(
"#bootstrap-table"
).
bootstrapTable
(
"refresh"
,
params
)},
exportExcel
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
$
.
modal
.
loading
(
"正在导出数据,请稍后..."
);
$
.
post
(
$
.
table
.
_option
.
exportUrl
,
$
(
"#"
+
currentId
).
serializeArray
(),
function
(
result
){
if
(
result
.
code
==
web_status
.
SUCCESS
){
window
.
location
.
href
=
ctx
+
"common/download?fileName="
+
result
.
msg
+
"&delete="
+
true
}
else
{
$
.
modal
.
alertError
(
result
.
msg
)}
$
.
modal
.
closeLoading
()})},
refresh
:
function
(){
$
(
"#bootstrap-table"
).
bootstrapTable
(
"refresh"
,{
url
:
$
.
table
.
_option
.
url
,
silent
:
true
})},
selectColumns
:
function
(
column
){
return
$
.
map
(
$
(
"#bootstrap-table"
).
bootstrapTable
(
"getSelections"
),
function
(
row
){
return
row
[
column
]})},
selectFirstColumns
:
function
(){
return
$
.
map
(
$
(
"#bootstrap-table"
).
bootstrapTable
(
"getSelections"
),
function
(
row
){
return
row
[
$
.
table
.
_option
.
columns
[
1
].
field
]})},
selectDictLabel
:
function
(
_datas
,
_value
){
var
actions
=
[];
$
.
each
(
_datas
,
function
(
index
,
dict
){
if
(
dict
.
dictValue
==
_value
){
actions
.
push
(
"<span class='badge badge-"
+
dict
.
listClass
+
"'>"
+
dict
.
dictLabel
+
"</span>"
);
return
false
}});
return
actions
.
join
(
""
)}},
treeTable
:{
_option
:{},
_treeTable
:{},
init
:
function
(
options
){
$
.
table
.
_option
=
options
;
var
treeTable
=
$
(
"#bootstrap-table"
).
bootstrapTreeTable
({
code
:
options
.
id
,
parentCode
:
options
.
parentId
,
type
:
"get"
,
url
:
options
.
url
,
ajaxParams
:{},
expandColumn
:
"0"
,
striped
:
false
,
bordered
:
true
,
expandAll
:
$
.
common
.
visible
(
options
.
expandAll
),
columns
:
options
.
columns
});
$
.
treeTable
.
_treeTable
=
treeTable
},
search
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
var
params
=
{};
$
.
each
(
$
(
"#"
+
currentId
).
serializeArray
(),
function
(
i
,
field
){
params
[
field
.
name
]
=
field
.
value
});
$
.
treeTable
.
_treeTable
.
bootstrapTreeTable
(
"refresh"
,
params
)},
refresh
:
function
(){
$
.
treeTable
.
_treeTable
.
bootstrapTreeTable
(
"refresh"
)},},
form
:{
reset
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
$
(
"#"
+
currentId
)[
0
].
reset
()},
selectCheckeds
:
function
(
name
){
var
checkeds
=
""
;
$
(
'input:checkbox[name="'
+
name
+
'"]:checked'
).
each
(
function
(
i
){
if
(
0
==
i
){
checkeds
=
$
(
this
).
val
()}
else
{
checkeds
+=
(
","
+
$
(
this
).
val
())}});
return
checkeds
},
selectSelects
:
function
(
name
){
var
selects
=
""
;
$
(
"#"
+
name
+
" option:selected"
).
each
(
function
(
i
){
if
(
0
==
i
){
selects
=
$
(
this
).
val
()}
else
{
selects
+=
(
","
+
$
(
this
).
val
())}});
return
selects
}},
modal
:{
icon
:
function
(
type
){
var
icon
=
""
;
if
(
type
==
modal_status
.
WARNING
){
icon
=
0
}
else
{
if
(
type
==
modal_status
.
SUCCESS
){
icon
=
1
}
else
{
if
(
type
==
modal_status
.
FAIL
){
icon
=
2
}
else
{
icon
=
3
}}}
return
icon
},
msg
:
function
(
content
,
type
){
if
(
type
!=
undefined
){
layer
.
msg
(
content
,{
icon
:
$
.
modal
.
icon
(
type
),
time
:
1000
,
shift
:
5
})}
else
{
layer
.
msg
(
content
)}},
msgError
:
function
(
content
){
$
.
modal
.
msg
(
content
,
modal_status
.
FAIL
)},
msgSuccess
:
function
(
content
){
$
.
modal
.
msg
(
content
,
modal_status
.
SUCCESS
)},
msgWarning
:
function
(
content
){
$
.
modal
.
msg
(
content
,
modal_status
.
WARNING
)},
alert
:
function
(
content
,
type
){
layer
.
alert
(
content
,{
icon
:
$
.
modal
.
icon
(
type
),
title
:
"系统提示"
,
btn
:[
"确认"
],
btnclass
:[
"btn btn-primary"
],})},
msgReload
:
function
(
msg
,
type
){
layer
.
msg
(
msg
,{
icon
:
$
.
modal
.
icon
(
type
),
time
:
500
,
shade
:[
0.1
,
"#8F8F8F"
]},
function
(){
$
.
modal
.
reload
()})},
alertError
:
function
(
content
){
$
.
modal
.
alert
(
content
,
modal_status
.
FAIL
)},
alertSuccess
:
function
(
content
){
$
.
modal
.
alert
(
content
,
modal_status
.
SUCCESS
)},
alertWarning
:
function
(
content
){
$
.
modal
.
alert
(
content
,
modal_status
.
WARNING
)},
close
:
function
(){
var
index
=
parent
.
layer
.
getFrameIndex
(
window
.
name
);
parent
.
layer
.
close
(
index
)},
confirm
:
function
(
content
,
callBack
){
layer
.
confirm
(
content
,{
icon
:
3
,
title
:
"系统提示"
,
btn
:[
"确认"
,
"取消"
],
btnclass
:[
"btn btn-primary"
,
"btn btn-danger"
],},
function
(
index
){
layer
.
close
(
index
);
callBack
(
true
)})},
open
:
function
(
title
,
url
,
width
,
height
){
if
(
navigator
.
userAgent
.
match
(
/
(
iPhone|iPod|Android|ios
)
/i
)){
width
=
"auto"
;
height
=
"auto"
}
if
(
$
.
common
.
isEmpty
(
title
)){
title
=
false
}
if
(
$
.
common
.
isEmpty
(
url
)){
url
=
"404.html"
}
if
(
$
.
common
.
isEmpty
(
width
)){
width
=
800
}
if
(
$
.
common
.
isEmpty
(
height
)){
height
=
(
$
(
window
).
height
()
-
50
)}
layer
.
open
({
type
:
2
,
area
:[
width
+
"px"
,
height
+
"px"
],
fix
:
false
,
maxmin
:
true
,
shade
:
0.3
,
title
:
title
,
content
:
url
})},
openFull
:
function
(
title
,
url
,
width
,
height
){
if
(
navigator
.
userAgent
.
match
(
/
(
iPhone|iPod|Android|ios
)
/i
)){
width
=
"auto"
;
height
=
"auto"
}
if
(
$
.
common
.
isEmpty
(
title
)){
title
=
false
}
if
(
$
.
common
.
isEmpty
(
url
)){
url
=
"404.html"
}
if
(
$
.
common
.
isEmpty
(
width
)){
width
=
800
}
if
(
$
.
common
.
isEmpty
(
height
)){
height
=
(
$
(
window
).
height
()
-
50
)}
var
index
=
layer
.
open
({
type
:
2
,
area
:[
width
+
"px"
,
height
+
"px"
],
fix
:
false
,
maxmin
:
true
,
shade
:
0.3
,
title
:
title
,
content
:
url
});
layer
.
full
(
index
)},
loading
:
function
(
message
){
$
.
blockUI
({
message
:
'<div class="loaderbox"><div class="loading-activity"></div> '
+
message
+
"</div>"
})},
closeLoading
:
function
(){
setTimeout
(
function
(){
$
.
unblockUI
()},
50
)},
reload
:
function
(){
parent
.
location
.
reload
()}},
operate
:{
submit
:
function
(
url
,
type
,
dataType
,
data
){
$
.
modal
.
loading
(
"正在处理中,请稍后..."
);
var
config
=
{
url
:
url
,
type
:
type
,
dataType
:
dataType
,
data
:
data
,
success
:
function
(
result
){
$
.
operate
.
ajaxSuccess
(
result
)}};
$
.
ajax
(
config
)},
post
:
function
(
url
,
data
){
$
.
operate
.
submit
(
url
,
"post"
,
"json"
,
data
)},
remove
:
function
(
id
){
$
.
modal
.
confirm
(
"确定删除该条"
+
$
.
table
.
_option
.
modalName
+
"信息吗?"
,
function
(){
var
url
=
$
.
common
.
isEmpty
(
id
)?
$
.
table
.
_option
.
removeUrl
:
$
.
table
.
_option
.
removeUrl
.
replace
(
"{id}"
,
id
);
var
data
=
{
"ids"
:
id
};
$
.
operate
.
submit
(
url
,
"post"
,
"json"
,
data
)})},
removeAll
:
function
(){
var
rows
=
$
.
common
.
isEmpty
(
$
.
table
.
_option
.
id
)?
$
.
table
.
selectFirstColumns
():
$
.
table
.
selectColumns
(
$
.
table
.
_option
.
id
);
if
(
rows
.
length
==
0
){
$
.
modal
.
alertWarning
(
"请至少选择一条记录"
);
return
}
$
.
modal
.
confirm
(
"确认要删除选中的"
+
rows
.
length
+
"条数据吗?"
,
function
(){
var
url
=
$
.
table
.
_option
.
removeUrl
;
var
data
=
{
"ids"
:
rows
.
join
()};
$
.
operate
.
submit
(
url
,
"post"
,
"json"
,
data
)})},
add
:
function
(
id
){
var
url
=
$
.
common
.
isEmpty
(
id
)?
$
.
table
.
_option
.
createUrl
:
$
.
table
.
_option
.
createUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
open
(
"添加"
+
$
.
table
.
_option
.
modalName
,
url
)},
edit
:
function
(
id
){
var
url
=
$
.
table
.
_option
.
updateUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
open
(
"修改"
+
$
.
table
.
_option
.
modalName
,
url
)},
addFull
:
function
(
id
){
var
url
=
$
.
common
.
isEmpty
(
id
)?
$
.
table
.
_option
.
createUrl
:
$
.
table
.
_option
.
createUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
openFull
(
"添加"
+
$
.
table
.
_option
.
modalName
,
url
)},
editFull
:
function
(
id
){
var
url
=
$
.
table
.
_option
.
updateUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
openFull
(
"修改"
+
$
.
table
.
_option
.
modalName
,
url
)},
save
:
function
(
url
,
data
){
$
.
modal
.
loading
(
"正在处理中,请稍后..."
);
var
config
=
{
url
:
url
,
type
:
"post"
,
dataType
:
"json"
,
data
:
data
,
success
:
function
(
result
){
$
.
operate
.
saveSuccess
(
result
)}};
$
.
ajax
(
config
)},
ajaxSuccess
:
function
(
result
){
if
(
result
.
code
==
web_status
.
SUCCESS
){
$
.
modal
.
msgSuccess
(
result
.
msg
);
$
.
table
.
refresh
()}
else
{
$
.
modal
.
alertError
(
result
.
msg
)}
$
.
modal
.
closeLoading
()},
saveSuccess
:
function
(
result
){
if
(
result
.
code
==
web_status
.
SUCCESS
){
$
.
modal
.
msgReload
(
"保存成功,正在刷新数据请稍后……"
,
modal_status
.
SUCCESS
)}
else
{
$
.
modal
.
alertError
(
result
.
msg
)}
$
.
modal
.
closeLoading
()}},
validate
:{
unique
:
function
(
value
){
if
(
value
==
"0"
){
return
true
}
return
false
}},
common
:{
isEmpty
:
function
(
value
){
if
(
value
==
null
||
this
.
trim
(
value
)
==
""
){
return
true
}
return
false
},
visible
:
function
(
value
){
if
(
$
.
common
.
isEmpty
(
value
)
||
value
==
true
){
return
true
}
return
false
},
trim
:
function
(
value
){
if
(
value
==
null
){
return
""
}
return
value
.
toString
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
|
\r
|
\n
/g
,
""
)},
random
:
function
(
min
,
max
){
return
Math
.
floor
((
Math
.
random
()
*
max
)
+
min
)}}})})(
jQuery
);
web_status
=
{
SUCCESS
:
0
,
FAIL
:
500
};
modal_status
=
{
SUCCESS
:
"success"
,
FAIL
:
"error"
,
WARNING
:
"warning"
};
\ No newline at end of file
(
function
(
$
){
$
.
extend
({
table
:{
_option
:{},
_params
:{},
init
:
function
(
options
){
$
.
table
.
_option
=
options
;
$
.
table
.
_params
=
$
.
common
.
isEmpty
(
options
.
queryParams
)?
$
.
table
.
queryParams
:
options
.
queryParams
;
_sortOrder
=
$
.
common
.
isEmpty
(
options
.
sortOrder
)?
"asc"
:
options
.
sortOrder
;
_sortName
=
$
.
common
.
isEmpty
(
options
.
sortName
)?
""
:
options
.
sortName
;
$
(
"#bootstrap-table"
).
bootstrapTable
({
url
:
options
.
url
,
contentType
:
"application/x-www-form-urlencoded"
,
method
:
"post"
,
cache
:
false
,
sortable
:
true
,
sortStable
:
true
,
sortName
:
_sortName
,
sortOrder
:
_sortOrder
,
pagination
:
$
.
common
.
visible
(
options
.
pagination
),
pageNumber
:
1
,
pageSize
:
10
,
pageList
:[
10
,
25
,
50
],
iconSize
:
"outline"
,
toolbar
:
"#toolbar"
,
sidePagination
:
"server"
,
search
:
$
.
common
.
visible
(
options
.
search
),
showRefresh
:
$
.
common
.
visible
(
options
.
showRefresh
),
showColumns
:
$
.
common
.
visible
(
options
.
showColumns
),
showToggle
:
$
.
common
.
visible
(
options
.
showToggle
),
showExport
:
$
.
common
.
visible
(
options
.
showExport
),
queryParams
:
$
.
table
.
_params
,
columns
:
options
.
columns
,
responseHandler
:
$
.
table
.
responseHandler
})},
queryParams
:
function
(
params
){
return
{
pageSize
:
params
.
limit
,
pageNum
:
params
.
offset
/
params
.
limit
+
1
,
searchValue
:
params
.
search
,
orderByColumn
:
params
.
sort
,
isAsc
:
params
.
order
}},
responseHandler
:
function
(
res
){
if
(
res
.
code
==
0
){
return
{
rows
:
res
.
rows
,
total
:
res
.
total
}}
else
{
$
.
modal
.
alertWarning
(
res
.
msg
);
return
{
rows
:[],
total
:
0
}}},
search
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
var
params
=
$
(
"#bootstrap-table"
).
bootstrapTable
(
"getOptions"
);
params
.
queryParams
=
function
(
params
){
var
search
=
{};
$
.
each
(
$
(
"#"
+
currentId
).
serializeArray
(),
function
(
i
,
field
){
search
[
field
.
name
]
=
field
.
value
});
search
.
pageSize
=
params
.
limit
;
search
.
pageNum
=
params
.
offset
/
params
.
limit
+
1
;
search
.
searchValue
=
params
.
search
;
search
.
orderByColumn
=
params
.
sort
;
search
.
isAsc
=
params
.
order
;
return
search
};
$
(
"#bootstrap-table"
).
bootstrapTable
(
"refresh"
,
params
)},
exportExcel
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
$
.
modal
.
loading
(
"正在导出数据,请稍后..."
);
$
.
post
(
$
.
table
.
_option
.
exportUrl
,
$
(
"#"
+
currentId
).
serializeArray
(),
function
(
result
){
if
(
result
.
code
==
web_status
.
SUCCESS
){
window
.
location
.
href
=
ctx
+
"common/download?fileName="
+
result
.
msg
+
"&delete="
+
true
}
else
{
$
.
modal
.
alertError
(
result
.
msg
)}
$
.
modal
.
closeLoading
()})},
refresh
:
function
(){
$
(
"#bootstrap-table"
).
bootstrapTable
(
"refresh"
,{
url
:
$
.
table
.
_option
.
url
,
silent
:
true
})},
selectColumns
:
function
(
column
){
return
$
.
map
(
$
(
"#bootstrap-table"
).
bootstrapTable
(
"getSelections"
),
function
(
row
){
return
row
[
column
]})},
selectFirstColumns
:
function
(){
return
$
.
map
(
$
(
"#bootstrap-table"
).
bootstrapTable
(
"getSelections"
),
function
(
row
){
return
row
[
$
.
table
.
_option
.
columns
[
1
].
field
]})},
selectDictLabel
:
function
(
_datas
,
_value
){
var
actions
=
[];
$
.
each
(
_datas
,
function
(
index
,
dict
){
if
(
dict
.
dictValue
==
_value
){
actions
.
push
(
"<span class='badge badge-"
+
dict
.
listClass
+
"'>"
+
dict
.
dictLabel
+
"</span>"
);
return
false
}});
return
actions
.
join
(
""
)}},
treeTable
:{
_option
:{},
_treeTable
:{},
init
:
function
(
options
){
$
.
table
.
_option
=
options
;
var
treeTable
=
$
(
"#bootstrap-table"
).
bootstrapTreeTable
({
code
:
options
.
id
,
parentCode
:
options
.
parentId
,
type
:
"get"
,
url
:
options
.
url
,
ajaxParams
:{},
expandColumn
:
"0"
,
striped
:
false
,
bordered
:
true
,
expandAll
:
$
.
common
.
visible
(
options
.
expandAll
),
columns
:
options
.
columns
});
$
.
treeTable
.
_treeTable
=
treeTable
},
search
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
var
params
=
{};
$
.
each
(
$
(
"#"
+
currentId
).
serializeArray
(),
function
(
i
,
field
){
params
[
field
.
name
]
=
field
.
value
});
$
.
treeTable
.
_treeTable
.
bootstrapTreeTable
(
"refresh"
,
params
)},
refresh
:
function
(){
$
.
treeTable
.
_treeTable
.
bootstrapTreeTable
(
"refresh"
)},},
form
:{
reset
:
function
(
formId
){
var
currentId
=
$
.
common
.
isEmpty
(
formId
)?
$
(
"form"
).
attr
(
"id"
):
formId
;
$
(
"#"
+
currentId
)[
0
].
reset
()},
selectCheckeds
:
function
(
name
){
var
checkeds
=
""
;
$
(
'input:checkbox[name="'
+
name
+
'"]:checked'
).
each
(
function
(
i
){
if
(
0
==
i
){
checkeds
=
$
(
this
).
val
()}
else
{
checkeds
+=
(
","
+
$
(
this
).
val
())}});
return
checkeds
},
selectSelects
:
function
(
name
){
var
selects
=
""
;
$
(
"#"
+
name
+
" option:selected"
).
each
(
function
(
i
){
if
(
0
==
i
){
selects
=
$
(
this
).
val
()}
else
{
selects
+=
(
","
+
$
(
this
).
val
())}});
return
selects
}},
modal
:{
icon
:
function
(
type
){
var
icon
=
""
;
if
(
type
==
modal_status
.
WARNING
){
icon
=
0
}
else
{
if
(
type
==
modal_status
.
SUCCESS
){
icon
=
1
}
else
{
if
(
type
==
modal_status
.
FAIL
){
icon
=
2
}
else
{
icon
=
3
}}}
return
icon
},
msg
:
function
(
content
,
type
){
if
(
type
!=
undefined
){
layer
.
msg
(
content
,{
icon
:
$
.
modal
.
icon
(
type
),
time
:
1000
,
shift
:
5
})}
else
{
layer
.
msg
(
content
)}},
msgError
:
function
(
content
){
$
.
modal
.
msg
(
content
,
modal_status
.
FAIL
)},
msgSuccess
:
function
(
content
){
$
.
modal
.
msg
(
content
,
modal_status
.
SUCCESS
)},
msgWarning
:
function
(
content
){
$
.
modal
.
msg
(
content
,
modal_status
.
WARNING
)},
alert
:
function
(
content
,
type
){
layer
.
alert
(
content
,{
icon
:
$
.
modal
.
icon
(
type
),
title
:
"系统提示"
,
btn
:[
"确认"
],
btnclass
:[
"btn btn-primary"
],})},
msgReload
:
function
(
msg
,
type
){
layer
.
msg
(
msg
,{
icon
:
$
.
modal
.
icon
(
type
),
time
:
500
,
shade
:[
0.1
,
"#8F8F8F"
]},
function
(){
$
.
modal
.
reload
()})},
alertError
:
function
(
content
){
$
.
modal
.
alert
(
content
,
modal_status
.
FAIL
)},
alertSuccess
:
function
(
content
){
$
.
modal
.
alert
(
content
,
modal_status
.
SUCCESS
)},
alertWarning
:
function
(
content
){
$
.
modal
.
alert
(
content
,
modal_status
.
WARNING
)},
close
:
function
(){
var
index
=
parent
.
layer
.
getFrameIndex
(
window
.
name
);
parent
.
layer
.
close
(
index
)},
confirm
:
function
(
content
,
callBack
){
layer
.
confirm
(
content
,{
icon
:
3
,
title
:
"系统提示"
,
btn
:[
"确认"
,
"取消"
],
btnclass
:[
"btn btn-primary"
,
"btn btn-danger"
],},
function
(
index
){
layer
.
close
(
index
);
callBack
(
true
)})},
open
:
function
(
title
,
url
,
width
,
height
){
if
(
navigator
.
userAgent
.
match
(
/
(
iPhone|iPod|Android|ios
)
/i
)){
width
=
"auto"
;
height
=
"auto"
}
if
(
$
.
common
.
isEmpty
(
title
)){
title
=
false
}
if
(
$
.
common
.
isEmpty
(
url
)){
url
=
"404.html"
}
if
(
$
.
common
.
isEmpty
(
width
)){
width
=
800
}
if
(
$
.
common
.
isEmpty
(
height
)){
height
=
(
$
(
window
).
height
()
-
50
)}
layer
.
open
({
type
:
2
,
area
:[
width
+
"px"
,
height
+
"px"
],
fix
:
false
,
maxmin
:
true
,
shade
:
0.3
,
title
:
title
,
content
:
url
,
shadeClose
:
true
})},
openFull
:
function
(
title
,
url
,
width
,
height
){
if
(
navigator
.
userAgent
.
match
(
/
(
iPhone|iPod|Android|ios
)
/i
)){
width
=
"auto"
;
height
=
"auto"
}
if
(
$
.
common
.
isEmpty
(
title
)){
title
=
false
}
if
(
$
.
common
.
isEmpty
(
url
)){
url
=
"404.html"
}
if
(
$
.
common
.
isEmpty
(
width
)){
width
=
800
}
if
(
$
.
common
.
isEmpty
(
height
)){
height
=
(
$
(
window
).
height
()
-
50
)}
var
index
=
layer
.
open
({
type
:
2
,
area
:[
width
+
"px"
,
height
+
"px"
],
fix
:
false
,
maxmin
:
true
,
shade
:
0.3
,
title
:
title
,
content
:
url
,
shadeClose
:
true
});
layer
.
full
(
index
)},
loading
:
function
(
message
){
$
.
blockUI
({
message
:
'<div class="loaderbox"><div class="loading-activity"></div> '
+
message
+
"</div>"
})},
closeLoading
:
function
(){
setTimeout
(
function
(){
$
.
unblockUI
()},
50
)},
reload
:
function
(){
parent
.
location
.
reload
()}},
operate
:{
submit
:
function
(
url
,
type
,
dataType
,
data
){
$
.
modal
.
loading
(
"正在处理中,请稍后..."
);
var
config
=
{
url
:
url
,
type
:
type
,
dataType
:
dataType
,
data
:
data
,
success
:
function
(
result
){
$
.
operate
.
ajaxSuccess
(
result
)}};
$
.
ajax
(
config
)},
post
:
function
(
url
,
data
){
$
.
operate
.
submit
(
url
,
"post"
,
"json"
,
data
)},
remove
:
function
(
id
){
$
.
modal
.
confirm
(
"确定删除该条"
+
$
.
table
.
_option
.
modalName
+
"信息吗?"
,
function
(){
var
url
=
$
.
common
.
isEmpty
(
id
)?
$
.
table
.
_option
.
removeUrl
:
$
.
table
.
_option
.
removeUrl
.
replace
(
"{id}"
,
id
);
var
data
=
{
"ids"
:
id
};
$
.
operate
.
submit
(
url
,
"post"
,
"json"
,
data
)})},
removeAll
:
function
(){
var
rows
=
$
.
common
.
isEmpty
(
$
.
table
.
_option
.
id
)?
$
.
table
.
selectFirstColumns
():
$
.
table
.
selectColumns
(
$
.
table
.
_option
.
id
);
if
(
rows
.
length
==
0
){
$
.
modal
.
alertWarning
(
"请至少选择一条记录"
);
return
}
$
.
modal
.
confirm
(
"确认要删除选中的"
+
rows
.
length
+
"条数据吗?"
,
function
(){
var
url
=
$
.
table
.
_option
.
removeUrl
;
var
data
=
{
"ids"
:
rows
.
join
()};
$
.
operate
.
submit
(
url
,
"post"
,
"json"
,
data
)})},
add
:
function
(
id
){
var
url
=
$
.
common
.
isEmpty
(
id
)?
$
.
table
.
_option
.
createUrl
:
$
.
table
.
_option
.
createUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
open
(
"添加"
+
$
.
table
.
_option
.
modalName
,
url
)},
edit
:
function
(
id
){
var
url
=
$
.
table
.
_option
.
updateUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
open
(
"修改"
+
$
.
table
.
_option
.
modalName
,
url
)},
addFull
:
function
(
id
){
var
url
=
$
.
common
.
isEmpty
(
id
)?
$
.
table
.
_option
.
createUrl
:
$
.
table
.
_option
.
createUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
openFull
(
"添加"
+
$
.
table
.
_option
.
modalName
,
url
)},
editFull
:
function
(
id
){
var
url
=
$
.
table
.
_option
.
updateUrl
.
replace
(
"{id}"
,
id
);
$
.
modal
.
openFull
(
"修改"
+
$
.
table
.
_option
.
modalName
,
url
)},
save
:
function
(
url
,
data
){
$
.
modal
.
loading
(
"正在处理中,请稍后..."
);
var
config
=
{
url
:
url
,
type
:
"post"
,
dataType
:
"json"
,
data
:
data
,
success
:
function
(
result
){
$
.
operate
.
saveSuccess
(
result
)}};
$
.
ajax
(
config
)},
ajaxSuccess
:
function
(
result
){
if
(
result
.
code
==
web_status
.
SUCCESS
){
$
.
modal
.
msgSuccess
(
result
.
msg
);
$
.
table
.
refresh
()}
else
{
$
.
modal
.
alertError
(
result
.
msg
)}
$
.
modal
.
closeLoading
()},
saveSuccess
:
function
(
result
){
if
(
result
.
code
==
web_status
.
SUCCESS
){
$
.
modal
.
msgReload
(
"保存成功,正在刷新数据请稍后……"
,
modal_status
.
SUCCESS
)}
else
{
$
.
modal
.
alertError
(
result
.
msg
)}
$
.
modal
.
closeLoading
()}},
validate
:{
unique
:
function
(
value
){
if
(
value
==
"0"
){
return
true
}
return
false
}},
common
:{
isEmpty
:
function
(
value
){
if
(
value
==
null
||
this
.
trim
(
value
)
==
""
){
return
true
}
return
false
},
visible
:
function
(
value
){
if
(
$
.
common
.
isEmpty
(
value
)
||
value
==
true
){
return
true
}
return
false
},
trim
:
function
(
value
){
if
(
value
==
null
){
return
""
}
return
value
.
toString
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
|
\r
|
\n
/g
,
""
)},
random
:
function
(
min
,
max
){
return
Math
.
floor
((
Math
.
random
()
*
max
)
+
min
)}}})})(
jQuery
);
web_status
=
{
SUCCESS
:
0
,
FAIL
:
500
};
modal_status
=
{
SUCCESS
:
"success"
,
FAIL
:
"error"
,
WARNING
:
"warning"
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment