切换导航条
此项目
正在载入...
登录
何书鹏
/
salarycalculator
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
5 years ago
提交
13da01a48c218c300a1232d50fcb1c168e00502d
1 个父辈
84a181be
新增跨页记忆已选中的行
新增多个扁平化样式按钮 优化表格高亮颜色
隐藏空白字符变更
内嵌
并排对比
正在显示
11 个修改的文件
包含
351 行增加
和
77 行删除
application/admin/lang/zh-cn.php
public/assets/css/backend.css
public/assets/css/backend.min.css
public/assets/css/fastadmin.css
public/assets/css/frontend.min.css
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-table.js
public/assets/less/backend.less
public/assets/less/fastadmin/buttons.less
application/admin/lang/zh-cn.php
查看文件 @
13da01a
...
...
@@ -163,6 +163,8 @@ return [
'File is too big (%sMiB), Max filesize: %sMiB'
=>
'当前上传(%sM),最大允许上传文件大小:%sM'
,
'An unexpected error occurred'
=>
'发生了一个意外错误,程序猿正在紧急处理中'
,
'This page will be re-directed in %s seconds'
=>
'页面将在 %s 秒后自动跳转'
,
'Click to uncheck all'
=>
'点击取消全部'
,
'Multiple selection mode: %s checked'
=>
'跨页选择模式,已选 %s 项'
,
//菜单
'Dashboard'
=>
'控制台'
,
'General'
=>
'常规管理'
,
...
...
public/assets/css/backend.css
查看文件 @
13da01a
...
...
@@ -637,6 +637,9 @@ form.form-horizontal .control-label {
.fixed-table-container
{
border
:
none
!important
;
}
.fixed-table-container
tbody
.selected
td
{
background-color
:
rgba
(
216
,
224
,
230
,
0.5
);
}
/*修复nice-validator新版下的一处BUG*/
.nice-validator
input
,
.nice-validator
select
,
...
...
public/assets/css/backend.min.css
查看文件 @
13da01a
此 diff 太大无法显示。
public/assets/css/fastadmin.css
查看文件 @
13da01a
...
...
@@ -2378,6 +2378,70 @@ select.form-control {
.btn-default.hover
{
background-color
:
#e7e7e7
;
}
.btn-primary-light
{
background-color
:
#E2E5E8
;
border-color
:
#D0D4D8
;
color
:
#85878A
;
}
.btn-primary-light
:hover
,
.btn-primary-light
:active
,
.btn-primary-light.hover
{
background-color
:
#d4d8dd
;
border-color
:
#c6ccd1
;
color
:
#85878A
;
}
.btn-success-light
{
background-color
:
#dff0d8
;
border-color
:
#d1eac8
;
color
:
#468847
;
}
.btn-success-light
:hover
,
.btn-success-light
:active
,
.btn-success-light.hover
{
background-color
:
#d0e9c6
;
border-color
:
#c1e2b3
;
color
:
#468847
;
}
.btn-danger-light
,
.btn-error-light
{
background-color
:
#f2dede
;
border-color
:
#ebcdcd
;
color
:
#b94a48
;
}
.btn-danger-light
:hover
,
.btn-error-light
:hover
,
.btn-danger-light
:active
,
.btn-error-light
:active
,
.btn-danger-light.hover
,
.btn-error-light.hover
{
background-color
:
#ebcccc
;
border-color
:
#e4b9b9
;
color
:
#b94a48
;
}
.btn-warning-light
{
background-color
:
#fcf8e3
;
border-color
:
#faf3cd
;
color
:
#c09853
;
}
.btn-warning-light
:hover
,
.btn-warning-light
:active
,
.btn-warning-light.hover
{
background-color
:
#faf2cc
;
border-color
:
#f7ecb5
;
color
:
#c09853
;
}
.btn-info-light
{
background-color
:
#d9edf7
;
border-color
:
#c6e4f3
;
color
:
#3a87ad
;
}
.btn-info-light
:hover
,
.btn-info-light
:active
,
.btn-info-light.hover
{
background-color
:
#c4e3f3
;
border-color
:
#afd9ee
;
color
:
#3a87ad
;
}
.btn-outline
{
border
:
1px
solid
#fff
;
background
:
transparent
;
...
...
public/assets/css/frontend.min.css
查看文件 @
13da01a
此 diff 太大无法显示。
public/assets/js/backend/general/attachment.js
查看文件 @
13da01a
...
...
@@ -72,6 +72,8 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
}
});
var
urlArr
=
[];
var
multiple
=
Backend
.
api
.
query
(
'multiple'
);
multiple
=
multiple
==
'true'
?
true
:
false
;
var
table
=
$
(
"#table"
);
...
...
@@ -101,7 +103,7 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
showExport
:
false
,
columns
:
[
[
{
field
:
'state'
,
checkbox
:
tru
e
},
{
field
:
'state'
,
checkbox
:
multiple
,
visible
:
multipl
e
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'admin_id'
,
title
:
__
(
'Admin_id'
),
formatter
:
Table
.
api
.
formatter
.
search
,
visible
:
false
},
{
field
:
'user_id'
,
title
:
__
(
'User_id'
),
formatter
:
Table
.
api
.
formatter
.
search
,
visible
:
false
},
...
...
@@ -119,8 +121,6 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
events
:
{
'click .btn-chooseone'
:
function
(
e
,
value
,
row
,
index
)
{
var
multiple
=
Backend
.
api
.
query
(
'multiple'
);
multiple
=
multiple
==
'true'
?
true
:
false
;
Fast
.
api
.
close
({
url
:
row
.
url
,
multiple
:
multiple
});
},
},
formatter
:
function
()
{
...
...
@@ -133,12 +133,6 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefin
// 选中多个
$
(
document
).
on
(
"click"
,
".btn-choose-multi"
,
function
()
{
// var urlArr = [];
// $.each(table.bootstrapTable("getAllSelections"), function (i, j) {
// urlArr.push(j.url);
// });
var
multiple
=
Backend
.
api
.
query
(
'multiple'
);
multiple
=
multiple
==
'true'
?
true
:
false
;
Fast
.
api
.
close
({
url
:
urlArr
.
join
(
","
),
multiple
:
multiple
});
});
...
...
public/assets/js/bootstrap-table-commonsearch.js
查看文件 @
13da01a
...
...
@@ -295,6 +295,7 @@
$
(
this
).
css
(
"min-width"
,
column
[
'width'
]);
}
});
this
.
options
.
stateField
=
this
.
header
.
stateField
;
};
BootstrapTable
.
prototype
.
initToolbar
=
function
()
{
_initToolbar
.
apply
(
this
,
Array
.
prototype
.
slice
.
apply
(
arguments
));
...
...
public/assets/js/require-backend.min.js
查看文件 @
13da01a
...
...
@@ -10808,6 +10808,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
$
(
this
).
css
(
"min-width"
,
column
[
'width'
]);
}
});
this
.
options
.
stateField
=
this
.
header
.
stateField
;
};
BootstrapTable
.
prototype
.
initToolbar
=
function
()
{
_initToolbar
.
apply
(
this
,
Array
.
prototype
.
slice
.
apply
(
arguments
));
...
...
@@ -11097,6 +11098,8 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
cardView
:
false
,
//卡片视图
checkOnInit
:
true
,
//是否在初始化时判断
escape
:
true
,
//是否对内容进行转义
selectedIds
:
[],
selectedData
:
[],
extend
:
{
index_url
:
''
,
add_url
:
''
,
...
...
@@ -11113,7 +11116,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
valign
:
'middle'
,
},
config
:
{
first
td
:
'tbody>tr>td.bs-checkbox'
,
checkbox
td
:
'tbody>tr>td.bs-checkbox'
,
toolbar
:
'.toolbar'
,
refreshbtn
:
'.btn-refresh'
,
addbtn
:
'.btn-add'
,
...
...
@@ -11161,6 +11164,9 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
if
(
navigator
.
userAgent
.
match
(
/
(
iPod|iPhone|iPad
)
/
))
{
Table
.
defaults
.
cardView
=
true
;
}
$
.
fn
.
bootstrapTable
.
Constructor
.
prototype
.
getSelectItem
=
function
()
{
return
this
.
$selectItem
;
};
// 写入bootstrap-table默认配置
$
.
extend
(
true
,
$
.
fn
.
bootstrapTable
.
defaults
,
Table
.
defaults
,
defaults
);
// 写入bootstrap-table column配置
...
...
@@ -11198,7 +11204,24 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
//Bootstrap操作区
var
toolbar
=
$
(
options
.
toolbar
,
parenttable
);
//跨页提示按钮
var
tipsBtn
=
$
(
".btn-selected-tips"
,
parenttable
);
if
(
tipsBtn
.
size
()
===
0
)
{
tipsBtn
=
$
(
'<a href="javascript:" class="btn btn-warning-light btn-selected-tips hide" data-animation="false" data-toggle="tooltip" data-title="'
+
__
(
"Click to uncheck all"
)
+
'"><i class="fa fa-info-circle"></i> '
+
__
(
"Multiple selection mode: %s checked"
,
"<b>0</b>"
)
+
'</a>'
).
appendTo
(
toolbar
);
}
//点击提示按钮
tipsBtn
.
off
(
"click"
).
on
(
"click"
,
function
(
e
)
{
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
"refresh"
);
});
//当刷新表格时
table
.
on
(
'uncheckbox'
,
function
(
status
,
res
,
e
)
{
options
.
selectedIds
=
[];
options
.
selectedData
=
[];
tipsBtn
.
tooltip
(
'hide'
);
tipsBtn
.
addClass
(
'hide'
);
});
//表格加载出错时
table
.
on
(
'load-error.bs.table'
,
function
(
status
,
res
,
e
)
{
if
(
e
.
status
===
0
)
{
return
;
...
...
@@ -11215,21 +11238,30 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
table
.
on
(
'refresh.bs.table'
,
function
(
e
,
settings
,
data
)
{
$
(
Table
.
config
.
refreshbtn
,
toolbar
).
find
(
".fa"
).
addClass
(
"fa-spin"
);
});
//当执行搜索时
table
.
on
(
'search.bs.table common-search.bs.table'
,
function
(
e
,
settings
,
data
)
{
table
.
trigger
(
"uncheckbox"
);
});
if
(
options
.
dblClickToEdit
)
{
//当双击单元格时
table
.
on
(
'dbl-click-row.bs.table'
,
function
(
e
,
row
,
element
,
field
)
{
$
(
Table
.
config
.
editonebtn
,
element
).
trigger
(
"click"
);
});
}
//渲染内容前
table
.
on
(
'pre-body.bs.table'
,
function
(
e
,
data
)
{
$
.
each
(
data
,
function
(
i
,
row
)
{
row
[
options
.
stateField
]
=
$
.
inArray
(
row
[
options
.
pk
],
options
.
selectedIds
)
>
-
1
;
});
});
//当内容渲染完成后
table
.
on
(
'post-body.bs.table'
,
function
(
e
,
settings
,
json
,
xhr
)
{
$
(
Table
.
config
.
refreshbtn
,
toolbar
).
find
(
".fa"
).
removeClass
(
"fa-spin"
);
$
(
Table
.
config
.
disabledbtn
,
toolbar
).
toggleClass
(
'disabled'
,
true
);
if
(
$
(
Table
.
config
.
firsttd
+
":first"
,
table
).
find
(
"input[type='checkbox'][data-index]"
).
size
()
>
0
)
{
if
(
$
(
Table
.
config
.
checkboxtd
+
":first"
,
table
).
find
(
"input[type='checkbox'][data-index]"
).
size
()
>
0
)
{
// 拖拽选择,需要重新绑定事件
require
([
'drag'
,
'drop'
],
function
()
{
var
firsttd
=
$
(
Table
.
config
.
firsttd
,
table
);
firsttd
.
drag
(
"start"
,
function
(
ev
,
dd
)
{
var
checkboxtd
=
$
(
Table
.
config
.
checkboxtd
,
table
);
checkboxtd
.
drag
(
"start"
,
function
(
ev
,
dd
)
{
return
$
(
'<div class="selection" />'
).
css
(
'opacity'
,
.
65
).
appendTo
(
document
.
body
);
}).
drag
(
function
(
ev
,
dd
)
{
$
(
dd
.
proxy
).
css
({
...
...
@@ -11241,7 +11273,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
}).
drag
(
"end"
,
function
(
ev
,
dd
)
{
$
(
dd
.
proxy
).
remove
();
});
first
td
.
drop
(
"start"
,
function
()
{
checkbox
td
.
drop
(
"start"
,
function
()
{
Table
.
api
.
toggleattr
(
this
);
}).
drop
(
function
()
{
Table
.
api
.
toggleattr
(
this
);
...
...
@@ -11255,9 +11287,32 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
}
});
// 处理选中筛选框后按钮的状态统一变更
table
.
on
(
'check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table'
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
$
(
Table
.
config
.
disabledbtn
,
toolbar
).
toggleClass
(
'disabled'
,
!
ids
.
length
);
table
.
on
(
'check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table'
,
function
(
e
)
{
var
allIds
=
table
.
bootstrapTable
(
"getData"
).
map
(
function
(
item
)
{
return
item
[
options
.
pk
];
});
var
selectedIds
=
Table
.
api
.
selectedids
(
table
,
true
),
selectedData
=
Table
.
api
.
selecteddata
(
table
,
true
);
//开启分页checkbox分页记忆
if
(
options
.
maintainSelected
)
{
options
.
selectedIds
=
options
.
selectedIds
.
filter
(
function
(
element
,
index
,
self
)
{
return
$
.
inArray
(
element
,
allIds
)
===
-
1
;
}).
concat
(
selectedIds
);
options
.
selectedData
=
options
.
selectedData
.
filter
(
function
(
element
,
index
,
self
)
{
return
$
.
inArray
(
element
[
options
.
pk
],
allIds
)
===
-
1
;
}).
concat
(
selectedData
);
if
(
options
.
selectedIds
.
length
>
selectedIds
.
length
)
{
$
(
"b"
,
tipsBtn
).
text
(
options
.
selectedIds
.
length
);
tipsBtn
.
removeClass
(
'hide'
);
}
else
{
tipsBtn
.
addClass
(
'hide'
);
}
}
else
{
options
.
selectedIds
=
selectedIds
;
options
.
selectedData
=
selectedData
;
}
$
(
Table
.
config
.
disabledbtn
,
toolbar
).
toggleClass
(
'disabled'
,
!
options
.
selectedIds
.
length
);
});
// 绑定TAB事件
$
(
'.panel-heading [data-field] a[data-toggle="tab"]'
).
on
(
'shown.bs.tab'
,
function
(
e
)
{
...
...
@@ -11269,15 +11324,16 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
}
else
{
object
.
val
(
value
);
}
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
,
{
pageNumber
:
1
});
return
false
;
});
// 刷新按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
refreshbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
refreshbtn
,
function
()
{
table
.
bootstrapTable
(
'refresh'
);
});
// 添加按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
addbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
addbtn
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
var
url
=
options
.
extend
.
add_url
;
if
(
url
.
indexOf
(
"{ids}"
)
!==
-
1
)
{
...
...
@@ -11293,19 +11349,24 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
url
:
options
.
extend
.
import_url
,
data
:
{
file
:
data
.
url
},
},
function
(
data
,
ret
)
{
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
);
});
});
});
}
// 批量编辑按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
editbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
editbtn
,
function
()
{
var
that
=
this
;
var
ids
=
Table
.
api
.
selectedids
(
table
);
if
(
ids
.
length
>
10
)
{
return
;
}
//循环弹出多个编辑框
$
.
each
(
table
.
bootstrapTable
(
'getSelections'
),
function
(
index
,
row
)
{
$
.
each
(
Table
.
api
.
selecteddata
(
table
),
function
(
index
,
row
)
{
var
url
=
options
.
extend
.
edit_url
;
row
=
$
.
extend
({},
row
?
row
:
{},
{
ids
:
row
[
options
.
pk
]});
var
url
=
Table
.
api
.
replaceurl
(
url
,
row
,
table
);
url
=
Table
.
api
.
replaceurl
(
url
,
row
,
table
);
Fast
.
api
.
open
(
url
,
__
(
'Edit'
),
$
(
that
).
data
()
||
{});
});
});
...
...
@@ -11316,6 +11377,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
var
url
=
$
(
that
).
data
(
"url"
)
?
$
(
that
).
data
(
"url"
)
:
$
(
that
).
attr
(
"href"
);
Fast
.
api
.
ajax
(
url
,
function
()
{
Layer
.
closeAll
();
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
);
},
function
()
{
Layer
.
closeAll
();
...
...
@@ -11328,17 +11390,18 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
var
that
=
this
;
var
url
=
$
(
that
).
data
(
"url"
)
?
$
(
that
).
data
(
"url"
)
:
$
(
that
).
attr
(
"href"
);
Fast
.
api
.
ajax
(
url
,
function
()
{
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
);
});
return
false
;
});
// 批量操作按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
multibtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
multibtn
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
Table
.
api
.
multi
(
$
(
this
).
data
(
"action"
),
ids
,
table
,
this
);
});
// 批量删除按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
delbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
delbtn
,
function
()
{
var
that
=
this
;
var
ids
=
Table
.
api
.
selectedids
(
table
);
Layer
.
confirm
(
...
...
@@ -11400,16 +11463,15 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
placeHolderTemplate
:
""
});
});
$
(
table
)
.
on
(
"click"
,
"input[data-id][name='checkbox']"
,
function
(
e
)
{
table
.
on
(
"click"
,
"input[data-id][name='checkbox']"
,
function
(
e
)
{
var
ids
=
$
(
this
).
data
(
"id"
);
var
row
=
Table
.
api
.
getrowbyid
(
table
,
ids
);
table
.
trigger
(
'check.bs.table'
,
[
row
,
this
]);
table
.
bootstrapTable
(
$
(
this
).
prop
(
"checked"
)
?
'checkBy'
:
'uncheckBy'
,
{
field
:
options
.
pk
,
values
:
[
ids
]});
});
$
(
table
)
.
on
(
"click"
,
"[data-id].btn-change"
,
function
(
e
)
{
table
.
on
(
"click"
,
"[data-id].btn-change"
,
function
(
e
)
{
e
.
preventDefault
();
Table
.
api
.
multi
(
$
(
this
).
data
(
"action"
)
?
$
(
this
).
data
(
"action"
)
:
''
,
[
$
(
this
).
data
(
"id"
)],
table
,
this
);
});
$
(
table
)
.
on
(
"click"
,
"[data-id].btn-edit"
,
function
(
e
)
{
table
.
on
(
"click"
,
"[data-id].btn-edit"
,
function
(
e
)
{
e
.
preventDefault
();
var
ids
=
$
(
this
).
data
(
"id"
);
var
row
=
Table
.
api
.
getrowbyid
(
table
,
ids
);
...
...
@@ -11417,7 +11479,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
var
url
=
Table
.
api
.
replaceurl
(
options
.
extend
.
edit_url
,
row
,
table
);
Fast
.
api
.
open
(
url
,
__
(
'Edit'
),
$
(
this
).
data
()
||
{});
});
$
(
table
)
.
on
(
"click"
,
"[data-id].btn-del"
,
function
(
e
)
{
table
.
on
(
"click"
,
"[data-id].btn-del"
,
function
(
e
)
{
e
.
preventDefault
();
var
id
=
$
(
this
).
data
(
"id"
);
var
that
=
this
;
...
...
@@ -11438,11 +11500,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
multi
:
function
(
action
,
ids
,
table
,
element
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
var
data
=
element
?
$
(
element
).
data
()
:
{};
var
ids
=
(
$
.
isArray
(
ids
)
?
ids
.
join
(
","
)
:
ids
);
ids
=
(
$
.
isArray
(
ids
)
?
ids
.
join
(
","
)
:
ids
);
var
url
=
typeof
data
.
url
!==
"undefined"
?
Table
.
api
.
replaceurl
(
data
.
url
,
{
ids
:
ids
},
table
)
:
(
action
==
"del"
?
options
.
extend
.
del_url
:
options
.
extend
.
multi_url
);
var
params
=
typeof
data
.
params
!==
"undefined"
?
(
typeof
data
.
params
==
'object'
?
$
.
param
(
data
.
params
)
:
data
.
params
)
:
''
;
var
options
=
{
url
:
url
,
data
:
{
action
:
action
,
ids
:
ids
,
params
:
params
}};
options
=
{
url
:
url
,
data
:
{
action
:
action
,
ids
:
ids
,
params
:
params
}};
Fast
.
api
.
ajax
(
options
,
function
(
data
,
ret
)
{
table
.
trigger
(
"uncheckbox"
);
var
success
=
$
(
element
).
data
(
"success"
)
||
$
.
noop
;
if
(
typeof
success
===
'function'
)
{
if
(
false
===
success
.
call
(
element
,
data
,
ret
))
{
...
...
@@ -11777,17 +11840,24 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
return
url
;
},
// 获取选中的条目ID集合
selectedids
:
function
(
table
)
{
selectedids
:
function
(
table
,
current
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
if
(
options
.
templateView
)
{
return
$
.
map
(
$
(
"input[data-id][name='checkbox']:checked"
),
function
(
dom
)
{
return
$
(
dom
).
data
(
"id"
);
});
}
else
{
return
$
.
map
(
table
.
bootstrapTable
(
'getSelections'
),
function
(
row
)
{
return
row
[
options
.
pk
];
});
//如果有设置翻页记忆模式
if
(
!
current
&&
options
.
maintainSelected
)
{
return
options
.
selectedIds
;
}
return
$
.
map
(
table
.
bootstrapTable
(
'getSelections'
),
function
(
row
)
{
return
row
[
options
.
pk
];
});
},
//获取选中的数据
selecteddata
:
function
(
table
,
current
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
//如果有设置翻页记忆模式
if
(
!
current
&&
options
.
maintainSelected
)
{
return
options
.
selectedData
;
}
return
table
.
bootstrapTable
(
'getSelections'
);
},
// 切换复选框状态
toggleattr
:
function
(
table
)
{
...
...
@@ -11807,7 +11877,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
getrowbyid
:
function
(
table
,
id
)
{
var
row
=
{};
var
options
=
table
.
bootstrapTable
(
"getOptions"
);
$
.
each
(
table
.
bootstrapTable
(
'getData'
),
function
(
i
,
j
)
{
$
.
each
(
Table
.
api
.
selecteddata
(
table
),
function
(
i
,
j
)
{
if
(
j
[
options
.
pk
]
==
id
)
{
row
=
j
;
return
false
;
...
...
public/assets/js/require-table.js
查看文件 @
13da01a
...
...
@@ -41,6 +41,8 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
cardView
:
false
,
//卡片视图
checkOnInit
:
true
,
//是否在初始化时判断
escape
:
true
,
//是否对内容进行转义
selectedIds
:
[],
selectedData
:
[],
extend
:
{
index_url
:
''
,
add_url
:
''
,
...
...
@@ -57,7 +59,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
valign
:
'middle'
,
},
config
:
{
first
td
:
'tbody>tr>td.bs-checkbox'
,
checkbox
td
:
'tbody>tr>td.bs-checkbox'
,
toolbar
:
'.toolbar'
,
refreshbtn
:
'.btn-refresh'
,
addbtn
:
'.btn-add'
,
...
...
@@ -105,6 +107,9 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
if
(
navigator
.
userAgent
.
match
(
/
(
iPod|iPhone|iPad
)
/
))
{
Table
.
defaults
.
cardView
=
true
;
}
$
.
fn
.
bootstrapTable
.
Constructor
.
prototype
.
getSelectItem
=
function
()
{
return
this
.
$selectItem
;
};
// 写入bootstrap-table默认配置
$
.
extend
(
true
,
$
.
fn
.
bootstrapTable
.
defaults
,
Table
.
defaults
,
defaults
);
// 写入bootstrap-table column配置
...
...
@@ -142,7 +147,24 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
//Bootstrap操作区
var
toolbar
=
$
(
options
.
toolbar
,
parenttable
);
//跨页提示按钮
var
tipsBtn
=
$
(
".btn-selected-tips"
,
parenttable
);
if
(
tipsBtn
.
size
()
===
0
)
{
tipsBtn
=
$
(
'<a href="javascript:" class="btn btn-warning-light btn-selected-tips hide" data-animation="false" data-toggle="tooltip" data-title="'
+
__
(
"Click to uncheck all"
)
+
'"><i class="fa fa-info-circle"></i> '
+
__
(
"Multiple selection mode: %s checked"
,
"<b>0</b>"
)
+
'</a>'
).
appendTo
(
toolbar
);
}
//点击提示按钮
tipsBtn
.
off
(
"click"
).
on
(
"click"
,
function
(
e
)
{
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
"refresh"
);
});
//当刷新表格时
table
.
on
(
'uncheckbox'
,
function
(
status
,
res
,
e
)
{
options
.
selectedIds
=
[];
options
.
selectedData
=
[];
tipsBtn
.
tooltip
(
'hide'
);
tipsBtn
.
addClass
(
'hide'
);
});
//表格加载出错时
table
.
on
(
'load-error.bs.table'
,
function
(
status
,
res
,
e
)
{
if
(
e
.
status
===
0
)
{
return
;
...
...
@@ -159,21 +181,30 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
table
.
on
(
'refresh.bs.table'
,
function
(
e
,
settings
,
data
)
{
$
(
Table
.
config
.
refreshbtn
,
toolbar
).
find
(
".fa"
).
addClass
(
"fa-spin"
);
});
//当执行搜索时
table
.
on
(
'search.bs.table common-search.bs.table'
,
function
(
e
,
settings
,
data
)
{
table
.
trigger
(
"uncheckbox"
);
});
if
(
options
.
dblClickToEdit
)
{
//当双击单元格时
table
.
on
(
'dbl-click-row.bs.table'
,
function
(
e
,
row
,
element
,
field
)
{
$
(
Table
.
config
.
editonebtn
,
element
).
trigger
(
"click"
);
});
}
//渲染内容前
table
.
on
(
'pre-body.bs.table'
,
function
(
e
,
data
)
{
$
.
each
(
data
,
function
(
i
,
row
)
{
row
[
options
.
stateField
]
=
$
.
inArray
(
row
[
options
.
pk
],
options
.
selectedIds
)
>
-
1
;
});
});
//当内容渲染完成后
table
.
on
(
'post-body.bs.table'
,
function
(
e
,
settings
,
json
,
xhr
)
{
$
(
Table
.
config
.
refreshbtn
,
toolbar
).
find
(
".fa"
).
removeClass
(
"fa-spin"
);
$
(
Table
.
config
.
disabledbtn
,
toolbar
).
toggleClass
(
'disabled'
,
true
);
if
(
$
(
Table
.
config
.
firsttd
+
":first"
,
table
).
find
(
"input[type='checkbox'][data-index]"
).
size
()
>
0
)
{
if
(
$
(
Table
.
config
.
checkboxtd
+
":first"
,
table
).
find
(
"input[type='checkbox'][data-index]"
).
size
()
>
0
)
{
// 拖拽选择,需要重新绑定事件
require
([
'drag'
,
'drop'
],
function
()
{
var
firsttd
=
$
(
Table
.
config
.
firsttd
,
table
);
firsttd
.
drag
(
"start"
,
function
(
ev
,
dd
)
{
var
checkboxtd
=
$
(
Table
.
config
.
checkboxtd
,
table
);
checkboxtd
.
drag
(
"start"
,
function
(
ev
,
dd
)
{
return
$
(
'<div class="selection" />'
).
css
(
'opacity'
,
.
65
).
appendTo
(
document
.
body
);
}).
drag
(
function
(
ev
,
dd
)
{
$
(
dd
.
proxy
).
css
({
...
...
@@ -185,7 +216,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
}).
drag
(
"end"
,
function
(
ev
,
dd
)
{
$
(
dd
.
proxy
).
remove
();
});
first
td
.
drop
(
"start"
,
function
()
{
checkbox
td
.
drop
(
"start"
,
function
()
{
Table
.
api
.
toggleattr
(
this
);
}).
drop
(
function
()
{
Table
.
api
.
toggleattr
(
this
);
...
...
@@ -199,9 +230,32 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
}
});
// 处理选中筛选框后按钮的状态统一变更
table
.
on
(
'check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table'
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
$
(
Table
.
config
.
disabledbtn
,
toolbar
).
toggleClass
(
'disabled'
,
!
ids
.
length
);
table
.
on
(
'check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table'
,
function
(
e
)
{
var
allIds
=
table
.
bootstrapTable
(
"getData"
).
map
(
function
(
item
)
{
return
item
[
options
.
pk
];
});
var
selectedIds
=
Table
.
api
.
selectedids
(
table
,
true
),
selectedData
=
Table
.
api
.
selecteddata
(
table
,
true
);
//开启分页checkbox分页记忆
if
(
options
.
maintainSelected
)
{
options
.
selectedIds
=
options
.
selectedIds
.
filter
(
function
(
element
,
index
,
self
)
{
return
$
.
inArray
(
element
,
allIds
)
===
-
1
;
}).
concat
(
selectedIds
);
options
.
selectedData
=
options
.
selectedData
.
filter
(
function
(
element
,
index
,
self
)
{
return
$
.
inArray
(
element
[
options
.
pk
],
allIds
)
===
-
1
;
}).
concat
(
selectedData
);
if
(
options
.
selectedIds
.
length
>
selectedIds
.
length
)
{
$
(
"b"
,
tipsBtn
).
text
(
options
.
selectedIds
.
length
);
tipsBtn
.
removeClass
(
'hide'
);
}
else
{
tipsBtn
.
addClass
(
'hide'
);
}
}
else
{
options
.
selectedIds
=
selectedIds
;
options
.
selectedData
=
selectedData
;
}
$
(
Table
.
config
.
disabledbtn
,
toolbar
).
toggleClass
(
'disabled'
,
!
options
.
selectedIds
.
length
);
});
// 绑定TAB事件
$
(
'.panel-heading [data-field] a[data-toggle="tab"]'
).
on
(
'shown.bs.tab'
,
function
(
e
)
{
...
...
@@ -213,15 +267,16 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
}
else
{
object
.
val
(
value
);
}
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
,
{
pageNumber
:
1
});
return
false
;
});
// 刷新按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
refreshbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
refreshbtn
,
function
()
{
table
.
bootstrapTable
(
'refresh'
);
});
// 添加按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
addbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
addbtn
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
var
url
=
options
.
extend
.
add_url
;
if
(
url
.
indexOf
(
"{ids}"
)
!==
-
1
)
{
...
...
@@ -237,19 +292,24 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
url
:
options
.
extend
.
import_url
,
data
:
{
file
:
data
.
url
},
},
function
(
data
,
ret
)
{
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
);
});
});
});
}
// 批量编辑按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
editbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
editbtn
,
function
()
{
var
that
=
this
;
var
ids
=
Table
.
api
.
selectedids
(
table
);
if
(
ids
.
length
>
10
)
{
return
;
}
//循环弹出多个编辑框
$
.
each
(
table
.
bootstrapTable
(
'getSelections'
),
function
(
index
,
row
)
{
$
.
each
(
Table
.
api
.
selecteddata
(
table
),
function
(
index
,
row
)
{
var
url
=
options
.
extend
.
edit_url
;
row
=
$
.
extend
({},
row
?
row
:
{},
{
ids
:
row
[
options
.
pk
]});
var
url
=
Table
.
api
.
replaceurl
(
url
,
row
,
table
);
url
=
Table
.
api
.
replaceurl
(
url
,
row
,
table
);
Fast
.
api
.
open
(
url
,
__
(
'Edit'
),
$
(
that
).
data
()
||
{});
});
});
...
...
@@ -260,6 +320,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
var
url
=
$
(
that
).
data
(
"url"
)
?
$
(
that
).
data
(
"url"
)
:
$
(
that
).
attr
(
"href"
);
Fast
.
api
.
ajax
(
url
,
function
()
{
Layer
.
closeAll
();
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
);
},
function
()
{
Layer
.
closeAll
();
...
...
@@ -272,17 +333,18 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
var
that
=
this
;
var
url
=
$
(
that
).
data
(
"url"
)
?
$
(
that
).
data
(
"url"
)
:
$
(
that
).
attr
(
"href"
);
Fast
.
api
.
ajax
(
url
,
function
()
{
table
.
trigger
(
"uncheckbox"
);
table
.
bootstrapTable
(
'refresh'
);
});
return
false
;
});
// 批量操作按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
multibtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
multibtn
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
Table
.
api
.
multi
(
$
(
this
).
data
(
"action"
),
ids
,
table
,
this
);
});
// 批量删除按钮事件
$
(
toolbar
)
.
on
(
'click'
,
Table
.
config
.
delbtn
,
function
()
{
toolbar
.
on
(
'click'
,
Table
.
config
.
delbtn
,
function
()
{
var
that
=
this
;
var
ids
=
Table
.
api
.
selectedids
(
table
);
Layer
.
confirm
(
...
...
@@ -344,16 +406,15 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
placeHolderTemplate
:
""
});
});
$
(
table
)
.
on
(
"click"
,
"input[data-id][name='checkbox']"
,
function
(
e
)
{
table
.
on
(
"click"
,
"input[data-id][name='checkbox']"
,
function
(
e
)
{
var
ids
=
$
(
this
).
data
(
"id"
);
var
row
=
Table
.
api
.
getrowbyid
(
table
,
ids
);
table
.
trigger
(
'check.bs.table'
,
[
row
,
this
]);
table
.
bootstrapTable
(
$
(
this
).
prop
(
"checked"
)
?
'checkBy'
:
'uncheckBy'
,
{
field
:
options
.
pk
,
values
:
[
ids
]});
});
$
(
table
)
.
on
(
"click"
,
"[data-id].btn-change"
,
function
(
e
)
{
table
.
on
(
"click"
,
"[data-id].btn-change"
,
function
(
e
)
{
e
.
preventDefault
();
Table
.
api
.
multi
(
$
(
this
).
data
(
"action"
)
?
$
(
this
).
data
(
"action"
)
:
''
,
[
$
(
this
).
data
(
"id"
)],
table
,
this
);
});
$
(
table
)
.
on
(
"click"
,
"[data-id].btn-edit"
,
function
(
e
)
{
table
.
on
(
"click"
,
"[data-id].btn-edit"
,
function
(
e
)
{
e
.
preventDefault
();
var
ids
=
$
(
this
).
data
(
"id"
);
var
row
=
Table
.
api
.
getrowbyid
(
table
,
ids
);
...
...
@@ -361,7 +422,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
var
url
=
Table
.
api
.
replaceurl
(
options
.
extend
.
edit_url
,
row
,
table
);
Fast
.
api
.
open
(
url
,
__
(
'Edit'
),
$
(
this
).
data
()
||
{});
});
$
(
table
)
.
on
(
"click"
,
"[data-id].btn-del"
,
function
(
e
)
{
table
.
on
(
"click"
,
"[data-id].btn-del"
,
function
(
e
)
{
e
.
preventDefault
();
var
id
=
$
(
this
).
data
(
"id"
);
var
that
=
this
;
...
...
@@ -382,11 +443,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
multi
:
function
(
action
,
ids
,
table
,
element
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
var
data
=
element
?
$
(
element
).
data
()
:
{};
var
ids
=
(
$
.
isArray
(
ids
)
?
ids
.
join
(
","
)
:
ids
);
ids
=
(
$
.
isArray
(
ids
)
?
ids
.
join
(
","
)
:
ids
);
var
url
=
typeof
data
.
url
!==
"undefined"
?
Table
.
api
.
replaceurl
(
data
.
url
,
{
ids
:
ids
},
table
)
:
(
action
==
"del"
?
options
.
extend
.
del_url
:
options
.
extend
.
multi_url
);
var
params
=
typeof
data
.
params
!==
"undefined"
?
(
typeof
data
.
params
==
'object'
?
$
.
param
(
data
.
params
)
:
data
.
params
)
:
''
;
var
options
=
{
url
:
url
,
data
:
{
action
:
action
,
ids
:
ids
,
params
:
params
}};
options
=
{
url
:
url
,
data
:
{
action
:
action
,
ids
:
ids
,
params
:
params
}};
Fast
.
api
.
ajax
(
options
,
function
(
data
,
ret
)
{
table
.
trigger
(
"uncheckbox"
);
var
success
=
$
(
element
).
data
(
"success"
)
||
$
.
noop
;
if
(
typeof
success
===
'function'
)
{
if
(
false
===
success
.
call
(
element
,
data
,
ret
))
{
...
...
@@ -721,17 +783,24 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
return
url
;
},
// 获取选中的条目ID集合
selectedids
:
function
(
table
)
{
selectedids
:
function
(
table
,
current
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
if
(
options
.
templateView
)
{
return
$
.
map
(
$
(
"input[data-id][name='checkbox']:checked"
),
function
(
dom
)
{
return
$
(
dom
).
data
(
"id"
);
});
}
else
{
return
$
.
map
(
table
.
bootstrapTable
(
'getSelections'
),
function
(
row
)
{
return
row
[
options
.
pk
];
});
//如果有设置翻页记忆模式
if
(
!
current
&&
options
.
maintainSelected
)
{
return
options
.
selectedIds
;
}
return
$
.
map
(
table
.
bootstrapTable
(
'getSelections'
),
function
(
row
)
{
return
row
[
options
.
pk
];
});
},
//获取选中的数据
selecteddata
:
function
(
table
,
current
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
//如果有设置翻页记忆模式
if
(
!
current
&&
options
.
maintainSelected
)
{
return
options
.
selectedData
;
}
return
table
.
bootstrapTable
(
'getSelections'
);
},
// 切换复选框状态
toggleattr
:
function
(
table
)
{
...
...
@@ -751,7 +820,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
getrowbyid
:
function
(
table
,
id
)
{
var
row
=
{};
var
options
=
table
.
bootstrapTable
(
"getOptions"
);
$
.
each
(
table
.
bootstrapTable
(
'getData'
),
function
(
i
,
j
)
{
$
.
each
(
Table
.
api
.
selecteddata
(
table
),
function
(
i
,
j
)
{
if
(
j
[
options
.
pk
]
==
id
)
{
row
=
j
;
return
false
;
...
...
public/assets/less/backend.less
查看文件 @
13da01a
...
...
@@ -777,6 +777,10 @@ form.form-horizontal .control-label {
/*去除bootstrap-table的边框*/
.fixed-table-container {
border: none !important;
tbody .selected td {
background-color: rgba(216, 224, 230, .5);
}
}
/*修复nice-validator新版下的一处BUG*/
...
...
public/assets/less/fastadmin/buttons.less
查看文件 @
13da01a
...
...
@@ -65,6 +65,73 @@
}
}
.btn-primary-light {
background-color: @primary-light-bg;
border-color: @primary-light-border;
color: @primary-light-text;
&:hover,
&:active,
&.hover {
background-color: darken(@primary-light-bg, 5%);
border-color: darken(@primary-light-bg, 10%);
color: @primary-light-text;
}
}
.btn-success-light {
background-color: @success-light-bg;
border-color: @success-light-border;
color: @success-light-text;
&:hover,
&:active,
&.hover {
background-color: darken(@success-light-bg, 5%);
border-color: darken(@success-light-bg, 10%);
color: @success-light-text;
}
}
.btn-danger-light,
.btn-error-light {
background-color: @danger-light-bg;
border-color: @danger-light-border;
color: @danger-light-text;
&:hover,
&:active,
&.hover {
background-color: darken(@danger-light-bg, 5%);
border-color: darken(@danger-light-bg, 10%);
color: @danger-light-text;
}
}
.btn-warning-light {
background-color: @warning-light-bg;
border-color: @warning-light-border;
color: @warning-light-text;
&:hover,
&:active,
&.hover {
background-color: darken(@warning-light-bg, 5%);
border-color: darken(@warning-light-bg, 10%);
color: @warning-light-text;
}
}
.btn-info-light {
background-color: @info-light-bg;
border-color: @info-light-border;
color: @info-light-text;
&:hover,
&:active,
&.hover {
background-color: darken(@info-light-bg, 5%);
border-color: darken(@info-light-bg, 10%);
color: @info-light-text;
}
}
.btn-outline {
border: 1px solid #fff;
background: transparent;
...
...
请
注册
或
登录
后发表评论