作者 Karson

优化列表导出功能

修复导出全部BUG
优化移动端列表展示
优化iOS移动端展示
... ... @@ -262,7 +262,7 @@ class Backend extends Controller
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id');
$order = $this->request->get("order", "DESC");
$offset = $this->request->get("offset/d", 0);
$limit = $this->request->get("limit/d", 10);
$limit = $this->request->get("limit/d", 999999);
//新增自动计算页码
$page = $limit ? intval($offset / $limit) + 1 : 1;
if ($this->request->has("page")) {
... ... @@ -390,7 +390,7 @@ class Backend extends Controller
$relation = Loader::parseName($tableArr[0], 1, false);
$this->model->alias([$this->model->$relation()->getTable() => $tableArr[0]]);
}
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' time', $arr];
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' TIME', $arr];
break;
case 'NULL':
case 'IS NULL':
... ... @@ -471,7 +471,7 @@ class Backend extends Controller
$ishtml = $this->request->request("isHtml", 0);
if ($istree) {
$word = [];
$pagesize = 99999;
$pagesize = 999999;
}
$order = [];
foreach ($orderby as $k => $v) {
... ... @@ -482,7 +482,7 @@ class Backend extends Controller
//如果有primaryvalue,说明当前是初始化传值
if ($primaryvalue !== null) {
$where = [$primarykey => ['in', $primaryvalue]];
$pagesize = 99999;
$pagesize = 999999;
} else {
$where = function ($query) use ($word, $andor, $field, $searchfield, $custom) {
$logic = $andor == 'AND' ? '&' : '|';
... ...
... ... @@ -244,6 +244,7 @@ class User extends Frontend
];
$msg = [
'renewpassword.confirm' => __('Password and confirm password don\'t match')
];
$data = [
'oldpassword' => $oldpassword,
... ...
<?php
return [
'User center' => '会员中心',
'Register' => '注册',
'Login' => '登录',
'Account' => '账号',
'Mobile' => '手机号',
'Email' => '邮箱',
'Captcha' => '验证码',
'Lv' => 'Lv',
'Score' => '积分',
'Day' => '天',
'Intro' => '个人介绍',
'Successions' => '连续登录',
'Maxsuccessions' => '最长连续登录',
'Logintime' => '登录时间',
'Prevtime' => '最后登录',
'Change' => '修改',
'Click to edit' => '点击编辑',
'Email/Mobile/Username' => '邮箱/手机/用户名',
'Sign up successful' => '注册成功',
'Email active successful' => '邮箱激活成功',
'Username can not be empty' => '用户名不能为空',
'Username must be 3 to 30 characters' => '用户名必须3-30个字符',
'Account must be 3 to 50 characters' => '账户必须3-50个字符',
'Password can not be empty' => '密码不能为空',
'Password must be 6 to 30 characters' => '密码必须6-30个字符',
'Email is incorrect' => '邮箱格式不正确',
'Mobile is incorrect' => '手机格式不正确',
'Username already exist' => '用户名已经存在',
'Nickname already exist' => '昵称已经存在',
'Email already exist' => '邮箱已经存在',
'Mobile already exist' => '手机号已经存在',
'Username is incorrect' => '用户名不正确',
'Reset password' => '修改密码',
'Reset password by email' => '通过邮箱',
'Reset password by mobile' => '通过手机重置',
'Reset password successful' => '修改密码成功',
'Account is locked' => '账户已经被锁定',
'Password is incorrect' => '密码不正确',
'Account is incorrect' => '账户不正确',
'Account not exist' => '账户不存在',
'Account can not be empty' => '账户不能为空',
'Username or password is incorrect' => '用户名或密码不正确',
'You are not logged in' => '你当前还未登录',
'You\'ve logged in, do not login again' => '你已经登录,请不要重复登录',
'This guy hasn\'t written anything yet' => '这个人很懒,啥也没写',
'Profile' => '个人资料',
'Old password' => '旧密码',
'New password' => '新密码',
'Renew password' => '确认新密码',
'Change password' => '修改密码',
'New email' => '新邮箱',
'New mobile' => '新手机号',
'Change password successful' => '修改密码成功',
'Captcha is incorrect' => '验证码不正确',
'Logged in successful' => '登录成功',
'Logout successful' => '退出成功',
'User center already closed' => '会员中心已经关闭',
'Operation failed' => '操作失败',
'Invalid parameters' => '参数不正确',
'Change password failure' => '修改密码失败',
'All' => '全部',
'Url' => '物理路径',
'Imagewidth' => '宽度',
'Imageheight' => '高度',
'Imagetype' => '图片类型',
'Imageframes' => '图片帧数',
'Preview' => '预览',
'Filename' => '文件名',
'Filesize' => '文件大小',
'Mimetype' => 'Mime类型',
'Image' => '图片',
'Audio' => '音频',
'Video' => '视频',
'Text' => '文档',
'Application' => '应用',
'Zip' => '压缩包',
'Extparam' => '透传数据',
'Createtime' => '创建日期',
'Uploadtime' => '上传时间',
'Storage' => '存储引擎',
'User center' => '会员中心',
'Register' => '注册',
'Login' => '登录',
'Account' => '账号',
'Mobile' => '手机号',
'Email' => '邮箱',
'Captcha' => '验证码',
'Lv' => 'Lv',
'Score' => '积分',
'Day' => '天',
'Intro' => '个人介绍',
'Successions' => '连续登录',
'Maxsuccessions' => '最长连续登录',
'Logintime' => '登录时间',
'Prevtime' => '最后登录',
'Change' => '修改',
'Click to edit' => '点击编辑',
'Email/Mobile/Username' => '邮箱/手机/用户名',
'Sign up successful' => '注册成功',
'Email active successful' => '邮箱激活成功',
'Username can not be empty' => '用户名不能为空',
'Username must be 3 to 30 characters' => '用户名必须3-30个字符',
'Account must be 3 to 50 characters' => '账户必须3-50个字符',
'Password can not be empty' => '密码不能为空',
'Password must be 6 to 30 characters' => '密码必须6-30个字符',
'Email is incorrect' => '邮箱格式不正确',
'Mobile is incorrect' => '手机格式不正确',
'Username already exist' => '用户名已经存在',
'Nickname already exist' => '昵称已经存在',
'Email already exist' => '邮箱已经存在',
'Mobile already exist' => '手机号已经存在',
'Username is incorrect' => '用户名不正确',
'Reset password' => '修改密码',
'Reset password by email' => '通过邮箱',
'Reset password by mobile' => '通过手机重置',
'Reset password successful' => '修改密码成功',
'Account is locked' => '账户已经被锁定',
'Password is incorrect' => '密码不正确',
'Account is incorrect' => '账户不正确',
'Account not exist' => '账户不存在',
'Account can not be empty' => '账户不能为空',
'Username or password is incorrect' => '用户名或密码不正确',
'You are not logged in' => '你当前还未登录',
'You\'ve logged in, do not login again' => '你已经登录,请不要重复登录',
'This guy hasn\'t written anything yet' => '这个人很懒,啥也没写',
'Profile' => '个人资料',
'Old password' => '旧密码',
'New password' => '新密码',
'Renew password' => '确认新密码',
'Change password' => '修改密码',
'New email' => '新邮箱',
'New mobile' => '新手机号',
'Change password successful' => '修改密码成功',
'Password and confirm password don\'t match' => '两次输入的密码不一致',
'Captcha is incorrect' => '验证码不正确',
'Logged in successful' => '登录成功',
'Logout successful' => '退出成功',
'User center already closed' => '会员中心已经关闭',
'Operation failed' => '操作失败',
'Invalid parameters' => '参数不正确',
'Change password failure' => '修改密码失败',
'All' => '全部',
'Url' => '物理路径',
'Imagewidth' => '宽度',
'Imageheight' => '高度',
'Imagetype' => '图片类型',
'Imageframes' => '图片帧数',
'Preview' => '预览',
'Filename' => '文件名',
'Filesize' => '文件大小',
'Mimetype' => 'Mime类型',
'Image' => '图片',
'Audio' => '音频',
'Video' => '视频',
'Text' => '文档',
'Application' => '应用',
'Zip' => '压缩包',
'Extparam' => '透传数据',
'Createtime' => '创建日期',
'Uploadtime' => '上传时间',
'Storage' => '存储引擎',
];
... ...
... ... @@ -9,7 +9,7 @@
"jquery": "^2.1.4",
"bootstrap": "^3.3.7",
"font-awesome": "^4.6.1",
"bootstrap-table": "fastadmin-bootstraptable#~1.11.3",
"bootstrap-table": "fastadmin-bootstraptable#~1.11.5",
"jstree": "~3.3.2",
"moment": "^2.20.1",
"toastr": "~2.1.3",
... ...
... ... @@ -42,6 +42,13 @@ html.ios-fix body {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
html.ios-fix .wrapper,
html.ios-fix body .wrapper,
html.ios-fix .tab-pane,
html.ios-fix body .tab-pane {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.wrapper {
height: 100%;
}
... ... @@ -973,8 +980,32 @@ table.table-nowrap thead > tr > th {
#firstnav .navbar-nav > .user-menu .user-image {
margin-top: -3px;
}
.fixed-table-toolbar .columns-right.btn-group {
display: none;
.fixed-table-toolbar > .bs-bars {
float: none !important;
}
.fixed-table-toolbar .toolbar a.btn-refresh,
.fixed-table-toolbar .toolbar a.btn-del,
.fixed-table-toolbar .toolbar a.btn-add,
.fixed-table-toolbar .toolbar a.btn-edit,
.fixed-table-toolbar .toolbar a.btn-import,
.fixed-table-toolbar .toolbar a.btn-more,
.fixed-table-toolbar .toolbar a.btn-recyclebin,
.fixed-table-toolbar .toolbar a.btn-mini-xs {
font-size: 0;
}
.fixed-table-toolbar .toolbar a.btn-refresh .fa,
.fixed-table-toolbar .toolbar a.btn-del .fa,
.fixed-table-toolbar .toolbar a.btn-add .fa,
.fixed-table-toolbar .toolbar a.btn-edit .fa,
.fixed-table-toolbar .toolbar a.btn-import .fa,
.fixed-table-toolbar .toolbar a.btn-more .fa,
.fixed-table-toolbar .toolbar a.btn-recyclebin .fa,
.fixed-table-toolbar .toolbar a.btn-mini-xs .fa {
font-size: initial;
}
.fixed-table-toolbar .search {
max-width: 110px;
float: left !important;
}
.fixed .content-wrapper,
.fixed .right-side {
... ... @@ -1085,7 +1116,7 @@ table.table-nowrap thead > tr > th {
min-height: 41px;
background-color: #fff;
box-sizing: border-box;
z-index: 1;
z-index: 2;
box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.08);
}
.fixed-columns .fixed-table-body,
... ...
... ... @@ -14,10 +14,16 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
idTable: 'commonTable',
showExport: true,
exportDataType: "all",
exportDataType: "auto",
exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
exportOptions: {
fileName: 'export_' + Moment().format("YYYY-MM-DD"),
preventInjection: false,
mso: {
onMsoNumberFormat: function (cell, row, col) {
return !isNaN($(cell).text()) ? '\\@' : '';
},
},
ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
},
pageSize: localStorage.getItem("pagesize") || 10,
... ... @@ -39,6 +45,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
paginationNextText: __("Next"),
paginationLastText: __("Last"),
cardView: false, //卡片视图
iosCardView: true, //ios卡片视图
checkOnInit: true, //是否在初始化时判断
escape: true, //是否对内容进行转义
selectedIds: [],
... ... @@ -103,10 +110,6 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
defaults = defaults ? defaults : {};
columnDefaults = columnDefaults ? columnDefaults : {};
locales = locales ? locales : {};
// 如果是iOS设备则启用卡片视图
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
Table.defaults.cardView = true;
}
$.fn.bootstrapTable.Constructor.prototype.getSelectItem = function () {
return this.$selectItem;
};
... ... @@ -135,6 +138,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
return __('Go');
}
}, locales);
// 如果是iOS设备则判断是否启用卡片视图
if ($.fn.bootstrapTable.defaults.iosCardView && navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
Table.defaults.cardView = true;
$.fn.bootstrapTable.defaults.cardView = true;
}
if (typeof defaults.exportTypes != 'undefined') {
$.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
}
... ... @@ -227,9 +235,14 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
checkboxtd.drop("start", function () {
Table.api.toggleattr(this);
}).drop(function () {
Table.api.toggleattr(this);
}).drop("end", function () {
Table.api.toggleattr(this);
// Table.api.toggleattr(this);
}).drop("end", function (e) {
var that = this;
setTimeout(function () {
if (e.type === 'mousemove') {
Table.api.toggleattr(that);
}
}, 0);
});
$.drop({
multi: true
... ... @@ -237,6 +250,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
});
}
});
var exportDataType = options.exportDataType;
// 处理选中筛选框后按钮的状态统一变更
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) {
... ... @@ -262,8 +276,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
options.selectedIds = selectedIds;
options.selectedData = selectedData;
}
//如果导出类型为auto时则自动判断
if (exportDataType === 'auto') {
options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
}
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
});
// 绑定TAB事件
$('.panel-heading [data-field] a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
... ...
... ... @@ -59,6 +59,11 @@ html.ios-fix, html.ios-fix body {
height: 100%;
overflow: auto;
-webkit-overflow-scrolling: touch;
.wrapper, .tab-pane {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
}
.wrapper {
... ... @@ -1205,8 +1210,23 @@ table.table-nowrap {
}
.fixed-table-toolbar {
.columns-right.btn-group {
display: none;
> .bs-bars {
float: none !important;
}
.toolbar {
a.btn-refresh, a.btn-del, a.btn-add, a.btn-edit, a.btn-import, a.btn-more, a.btn-recyclebin, a.btn-mini-xs {
font-size: 0;
.fa {
font-size: initial;
}
}
}
.search {
max-width: 110px;
float: left !important;
}
}
... ... @@ -1349,7 +1369,7 @@ table.table-nowrap {
min-height: 41px;
background-color: #fff;
box-sizing: border-box;
z-index: 1;
z-index: 2;
box-shadow: 0 -1px 8px rgba(0, 0, 0, .08);
.fixed-table-body {
... ... @@ -1390,3 +1410,4 @@ table.table-nowrap {
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}
... ...