作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

导出功能优化

@@ -27,9 +27,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -27,9 +27,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
27 }; 27 };
28 $(document).on("click", ".btn-export", function () { 28 $(document).on("click", ".btn-export", function () {
29 var ids = Table.api.selectedids(table); 29 var ids = Table.api.selectedids(table);
  30 + var page = table.bootstrapTable('getData');
  31 + var all = table.bootstrapTable('getOptions').totalRows;
30 Layer.confirm("选择导出的选项<form action='" + Fast.api.fixurl("registers/export") + "' method='post'><input type='hidden' name='ids' value=''/></form>", { 32 Layer.confirm("选择导出的选项<form action='" + Fast.api.fixurl("registers/export") + "' method='post'><input type='hidden' name='ids' value=''/></form>", {
31 title: '导出数据', 33 title: '导出数据',
32 - btn: ["选中项(" + ids.length + "条)"], 34 + btn: ["选中项(" + ids.length + "条)", "本页(" + page.length + "条)", "全部(" + all + "条)"],
33 success: function (layero, index) { 35 success: function (layero, index) {
34 $(".layui-layer-btn a", layero).addClass("layui-layer-btn0"); 36 $(".layui-layer-btn a", layero).addClass("layui-layer-btn0");
35 }, yes: function (index, layero) { 37 }, yes: function (index, layero) {
@@ -50,9 +52,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -50,9 +52,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
50 }; 52 };
51 $(document).on("click", ".btn-export1", function () { 53 $(document).on("click", ".btn-export1", function () {
52 var ids = Table.api.selectedids(table); 54 var ids = Table.api.selectedids(table);
  55 + var page = table.bootstrapTable('getData');
  56 + var all = table.bootstrapTable('getOptions').totalRows;
53 Layer.confirm("选择导出的选项<form action='" + Fast.api.fixurl("registers/export1") + "' method='post' id='form1'><input type='hidden' name='s_ids' value=''/></form>", { 57 Layer.confirm("选择导出的选项<form action='" + Fast.api.fixurl("registers/export1") + "' method='post' id='form1'><input type='hidden' name='s_ids' value=''/></form>", {
54 title: '导出数据', 58 title: '导出数据',
55 - btn: ["选中项(" + ids.length + "条)"], 59 + btn: ["选中项(" + ids.length + "条)", "本页(" + page.length + "条)", "全部(" + all + "条)"],
56 success: function (layero, index) { 60 success: function (layero, index) {
57 $(".layui-layer-btn a", layero).addClass("layui-layer-btn0"); 61 $(".layui-layer-btn a", layero).addClass("layui-layer-btn0");
58 }, yes: function (index, layero) { 62 }, yes: function (index, layero) {