同步更新升级

This commit is contained in:
邹景立 2023-05-09 13:29:37 +08:00
parent a731e3e45b
commit 07bd186995
3 changed files with 51 additions and 4 deletions

View File

@ -827,6 +827,7 @@ CREATE TABLE `system_file` (
`mime` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '文件类型',
`size` bigint(20) NULL DEFAULT 0 COMMENT '文件大小',
`uuid` bigint(20) NULL DEFAULT 0 COMMENT '用户编号',
`unid` bigint(20) NULL DEFAULT 0 COMMENT '会员编号',
`isfast` tinyint(1) NULL DEFAULT 0 COMMENT '是否秒传',
`issafe` tinyint(1) NULL DEFAULT 0 COMMENT '安全模式',
`status` tinyint(1) NULL DEFAULT 1 COMMENT '上传状态(1悬空,2落地)',
@ -836,6 +837,7 @@ CREATE TABLE `system_file` (
INDEX `idx_system_file_type`(`type`) USING BTREE,
INDEX `idx_system_file_hash`(`hash`) USING BTREE,
INDEX `idx_system_file_uuid`(`uuid`) USING BTREE,
INDEX `idx_system_file_unid`(`unid`) USING BTREE,
INDEX `idx_system_file_xext`(`xext`) USING BTREE,
INDEX `idx_system_file_status`(`status`) USING BTREE,
INDEX `idx_system_file_issafe`(`issafe`) USING BTREE,

View File

@ -678,7 +678,7 @@ $(function () {
// 实例并绑定事件
$table.data('this', layui.table.render(bindData(option)));
$table.bind('reload render reloadData', function (evt, opts) {
if (option.page === false) opts.page = false;
if (option.page === false) (opts || {}).page = false;
data = $.extend({}, data, (opts || {}).where || {});
opts = bindData($.extend({}, opts || {}, {loading: true}));
if (evt.type.indexOf('reload') > -1) {

View File

@ -41,8 +41,8 @@ define(function () {
if (sortField.length > 0 && sortType.length > 0) {
location += (location.indexOf('?') > -1 ? '&' : '?') + '_order_=' + sortType + '&_field_=' + sortField;
}
that.load(location, form.serialize(), method).then(function (ret) {
that.export(done.call(that, ret, []), name);
that.load(location, form.serialize(), method).then(function (data) {
that.export(done.call(that, data, []), name);
}).fail(function (ret) {
$.msg.tips(ret || '文件导出失败');
});
@ -52,7 +52,7 @@ define(function () {
/*! 加载导出的文档 */
Excel.prototype.load = function (url, data, method) {
return (function (defer, lists, loaded) {
loaded = $.msg.loading("正在加载 <span data-upload-count>0.00</span>%");
loaded = $.msg.loading('正在加载 <span data-upload-count>0.00</span>%');
return (lists = []), LoadNextPage(1, 1), defer;
function LoadNextPage(curPage, maxPage, urlParams) {
@ -73,6 +73,51 @@ define(function () {
})($.Deferred());
};
/**
* 设置表格导出样式
*/
Excel.prototype.withStyle = function (data, colsWidth, defaultWidth, defaultHeight) {
// 自动计算列序
var idx, colN = 0, defaC = {}, lastCol;
for (idx in data[0]) defaC[lastCol = layui.excel.numToTitle(++colN)] = defaultWidth || 99;
defaC[lastCol] = 160;
// 设置表头样式
layui.excel.setExportCellStyle(data, 'A1:' + lastCol + '1', {
s: {
font: {sz: 12, bold: true, color: {rgb: "FFFFFF"}, name: '微软雅黑', shadow: true},
fill: {bgColor: {indexed: 64}, fgColor: {rgb: '5FB878'}},
alignment: {vertical: 'center', horizontal: 'center'}
}
});
// 设置内容样式
(function (style1, style2) {
layui.excel.setExportCellStyle(data, 'A2:' + lastCol + data.length, {s: style1}, function (rawCell, newCell, row, config, curRow) {
typeof rawCell !== 'object' && (rawCell = {v: rawCell});
rawCell.s = Object.assign({}, style2, rawCell.s || {});
return (curRow % 2 === 0) ? newCell : rawCell;
});
})({
font: {sz: 10, shadow: true, name: '微软雅黑'},
fill: {bgColor: {indexed: 64}, fgColor: {rgb: "EAEAEA"}},
alignment: {vertical: 'center', horizontal: 'center'}
}, {
font: {sz: 10, shadow: true, name: '微软雅黑'},
fill: {bgColor: {indexed: 64}, fgColor: {rgb: "FFFFFF"}},
alignment: {vertical: 'center', horizontal: 'center'}
});
// 设置表格行宽高,需要设置最后的行或列宽高,否则部分不生效
var rowsC = {1: 33}, colsC = Object.assign({}, defaC, {A: 60}, colsWidth || {});
rowsC[data.length] = defaultHeight || 28, this.options.extend = {
'!cols': layui.excel.makeColConfig(colsC, defaultWidth || 99),
'!rows': layui.excel.makeRowConfig(rowsC, defaultHeight || 28),
};
return data;
}
/*! 直接推送表格内容 */
Excel.prototype.push = function (url, sheet, cols, filter) {
var loaded, $input;